# Multiline equations: misuse in our part or wishlist item for mpl?

Hi all,

in the NIPY documentation, we're heavily taking advantage of mpl's
math support, and for the most part it's working great. But having it
in there, we may have gotten a bit carried away... If you look at this
page:

http://neuroimaging.scipy.org/site/doc/manual/html/users/glm_spec.html

its reST sources here:

http://neuroimaging.scipy.org/site/doc/manual/html/_sources/users/glm_spec.txt

Contain text like:

/begin quote
"""
Typically, the events occur in groups, say odd events are labelled
*a*, even ones *b*. We might rewrite this as

.. math::

E = \delta_{(t_1,a)} + \delta_{(t_2,b)} + \delta_{(t_3,a)} + \dots +
\delta_{t_{10},b}

This type of experiment can be represented by two counting processes
:math:(E_a, E_b) defined as

.. math::

\begin{aligned}
E_a(t) &= \sum_{t_j, \text{$j$ odd}} 1_{\{t_j \leq t\}} \\
E_b(t) &= \sum_{t_j, \text{$j$ even}} 1_{\{t_j \leq t\}}
\end{aligned}

These delta-function responses are effectively events of duration 0
and infinite height.

""" / end quote

In the final PDF
(http://neuroimaging.scipy.org/site/doc/manual/nipy.pdf) that all
renders fine, since it's 'real' latex doing the work. However, the
HTML linked above renders the first equation fine, while the multiline
one doesn't work.

Is this something possible with today's MPL but where we are just not
making the right calls, or is it a missing feature. If the latter, is
it realistic to expect it to be added, or should we rather plan for
avoiding such type of typesetting in our docs or switching math
engines for the html docs? Or is the feature 'almost there' but
slightly buggy?

Any hints much appreciated, I just wasn't sure whether this would be a
bug report, feature request or just seeking advice...

Cheers,

f

Multiline equations are not currently supported by the mathtext engine. It's the alignment stuff that makes it more than just a "throw a vbox together". It's a good feature request -- go ahead and add it to the tracker if you're really interested in it -- but I don't know if I'll have time to do this myself in the near future. I'm happy to help show someone around the code...

Of course, in your case, you could also investigate one of the other math rendering directives included with Sphinx.

Mike

Fernando Perez wrote:

···

Hi all,

in the NIPY documentation, we're heavily taking advantage of mpl's
math support, and for the most part it's working great. But having it
in there, we may have gotten a bit carried away... If you look at this
page:

http://neuroimaging.scipy.org/site/doc/manual/html/users/glm_spec.html

its reST sources here:

http://neuroimaging.scipy.org/site/doc/manual/html/_sources/users/glm_spec.txt

Contain text like:

/begin quote
"""
Typically, the events occur in groups, say odd events are labelled
*a*, even ones *b*. We might rewrite this as

.. math::

E = \delta_{(t_1,a)} + \delta_{(t_2,b)} + \delta_{(t_3,a)} + \dots +
\delta_{t_{10},b}

This type of experiment can be represented by two counting processes
:math:(E_a, E_b) defined as

.. math::

\begin{aligned}
E_a(t) &= \sum_{t_j, \text{$j$ odd}} 1_{\{t_j \leq t\}} \\
E_b(t) &= \sum_{t_j, \text{$j$ even}} 1_{\{t_j \leq t\}}
\end{aligned}

These delta-function responses are effectively events of duration 0
and infinite height.

""" / end quote

In the final PDF
(http://neuroimaging.scipy.org/site/doc/manual/nipy.pdf) that all
renders fine, since it's 'real' latex doing the work. However, the
HTML linked above renders the first equation fine, while the multiline
one doesn't work.

Is this something possible with today's MPL but where we are just not
making the right calls, or is it a missing feature. If the latter, is
it realistic to expect it to be added, or should we rather plan for
avoiding such type of typesetting in our docs or switching math
engines for the html docs? Or is the feature 'almost there' but
slightly buggy?

Any hints much appreciated, I just wasn't sure whether this would be a
bug report, feature request or just seeking advice...

Cheers,

f

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Hi Mike,

Multiline equations are not currently supported by the mathtext engine.
It's the alignment stuff that makes it more than just a "throw a vbox
together". It's a good feature request -- go ahead and add it to the
tracker if you're really interested in it -- but I don't know if I'll have
time to do this myself in the near future. I'm happy to help show someone
around the code...

Many thanks for the info. I did file it here, so you guys can track
it for when someone has a chance to tackle it:

https://sourceforge.net/tracker/?func=detail&aid=2766156&group_id=80706&atid=560723

Of course, in your case, you could also investigate one of the other math
rendering directives included with Sphinx.

For now, that seems the most prudent course of action for us, since I
don't think we can tackle the mpl code right now.

Best,

f

···

On Wed, Apr 15, 2009 at 11:26 AM, Michael Droettboom <mdroe@...31...> wrote: