Problem rendering latex matrices

313 views
Skip to first unread message

Jose Gomez-Dans

unread,
Jun 26, 2012, 9:05:46 AM6/26/12
to sphin...@googlegroups.com
Hi,

I have some sphinx documentation that require displaying a matrix in latex notation. The code looks like this

.. math::

   \mathbf{\Delta} = 
    \begin{pmatrix}
    1      & -1     &  0     & \cdots & 0\\
    0      & 1      & -1     & \cdots & 0\\
    \vdots & \vdots & \vdots & \ddots & 0\\
    0      & 0      & 0      & \cdots & -1\\
    \end{pmatrix}

The code works in latex itself, but sphinx complains 

sphinxext/mathmpl.py:56: Warning: Could not render math expression $\mathbf{\Delta} = \begin{pmatrix} 1      & -1     &  0     & \cdots & 0\\ 0      & 1      & -1     & \cdots & 0\\ \vdots & \vdots & \vdots & \ddots & 0\\ 0      & 0      & 0      & \cdots & -1\\ \end{pmatrix}$

Is there something I am missing?

Thanks
Jose


--
RSU ■ Dept. of Geography ■ University College ■ Gower St, London WC1E 6BT UK

Kathy Tolbert

unread,
Jun 26, 2012, 10:46:53 AM6/26/12
to sphin...@googlegroups.com

The .. math:: provided builds fine for me for HTML & latexpdf with no warnings.

 

I noticed that your warning shows a beginning and ending $ that are not showing in your math example. I always remove the beginning & ending $ or \[ markup before adding it to a math directive or role. Does your document have the $ surrounding it?

 

Kathy

Jose Gomez-Dans

unread,
Jun 26, 2012, 11:40:06 AM6/26/12
to sphin...@googlegroups.com
Hi Kathy,

On 26 June 2012 15:46, Kathy Tolbert <ka...@flow3d.com> wrote:

The .. math:: provided builds fine for me for HTML & latexpdf with no warnings.


That's just the code I have in my document, which doesn't work on my system (sphinx 1.1.3)
 

I noticed that your warning shows a beginning and ending $ that are not showing in your math example. I always remove the beginning & ending $ or \[ markup before adding it to a math directive or role. Does your document have the $ surrounding it?


I thought that was added by sphinx automatically. As I said, I don't add it, my ReST code is just 

.. math::

   \mathbf{\Delta} = 
    \begin{pmatrix}
    1      & -1     &  0     & \cdots & 0\\
    0      & 1      & -1     & \cdots & 0\\
    \vdots & \vdots & \vdots & \ddots & 0\\
    0      & 0      & 0      & \cdots & -1\\
    \end{pmatrix}

Unless there's some indentation issue that I'm not aware off?

J

Miroslav ILIAŠ

unread,
Oct 11, 2012, 6:15:28 AM10/11/12
to sphin...@googlegroups.com
Hi,

we have the same problem (Sphinx v1.1.3)

.. math::
 \left(\begin{matrix} 10  \\ 9   \end{matrix}\right)


#/usr/lib/pymodules/python2.7/matplotlib/sphinxext/mathmpl.py:56: Warning: Could not render math expression $\left(\begin{matrix} 10  \\ 9   \end{matrix}\right)$

Any help please ?

Miro

Bernhard Grotz

unread,
Oct 11, 2012, 9:32:58 AM10/11/12
to sphin...@googlegroups.com

Hi,

* Miroslav ILIAŠ <Mirosla...@umb.sk> [11.10.2012 13:24]:
> we have the same problem (Sphinx v1.1.3)
>
> .. math::
> \left(\begin{matrix} 10 \\ 9 \end{matrix}\right)

I tested your example, and no error occured on my system. I'm also using Sphinx
v.1.1.3 with pngmath, so probably a latex package is missing on your system. If
you're using a Debian or Ubuntu based system as well, you can check if the
following packages are installed:

.. code-block:: bash

aptitude install python-numpy python-matplotlib dvipng

.. code-block:: bash

aptitude install texlive-base texlive-common texlive-extra-utils
texlive-latex-base texlive-latex-recommended texlive-latex-extra
texlive-math-extra texlive-science

I do not know exactly which of these packages are really necessary, but if you
have enough freespace on your disk, some additional latex-packages would not be
amiss..

Hope that helps,

Bernhard

P.S.: The other example you posted also works with my sphinx/latex build.
signature.asc
Reply all
Reply to author
Forward
0 new messages