Problem with latex output

227 views
Skip to first unread message

Lukashevichus Ksenia

unread,
Oct 27, 2013, 3:25:05 PM10/27/13
to sphinx...@googlegroups.com
Hello everyone!
I'm trying to get latex and HTML documentation using Sphinx 1.2b2, and while HTML result seems to be quite OK, latex output I get gives huge number of "undefined control sequence" errors when running PDFLatex, and I can't even find a problem in lines it points. RST sources, conf.py and the resulting latex file are attached. 
The second question:
Is it possible to use png pictures for HTML and eps for latex? 

Ksenia Lukashevichus.
latex output.zip
conf.py
chap_acknowledge.rst
chap_reach.rst
chap_ellcalc.rst
chap_examples.rst
chap_func.rst
chap_install.rst
chap_implement.rst
chap_intro.rst
chap_summary.rst
main_manual.rst

shirou

unread,
Oct 30, 2013, 9:15:34 PM10/30/13
to sphinx...@googlegroups.com
HI Ksenia,

For the second question.

When you use an asterisk for the image extension like this,

.. image:: gnu.*

Sphinx searches all images matching the pettern. and each builder
(HTML, LaTeX etc...) have prefer image type.
so it possible to use png for HTML and PDF for LaTeX.
See <http://sphinx-doc.org/latest/rest.html#images>

However, it seems Sphinx can not understand ".eps" extension for the image type,
and also, Sphinx use imghdr
<http://docs.python.org/2.7/library/imghdr.html> library to detect an
image type. but it does not support eps image type.


After all, currently I think it is not possible to use png and eps
(Just look at a code. I may made mistakes)
But you can make a PullRequest which makes determine the eps file from
the extension. it may change around here.
https://bitbucket.org/birkenfeld/sphinx/src/e55c174b5dc5885dc2acc9aa8089e324ffc47b63/sphinx/environment.py?at=default#cl-769
or make a issue which requests this feature.

Thank you,
WAKAYAMA Shirou


2013/10/28 Lukashevichus Ksenia <lukashe...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sphinx-users...@googlegroups.com.
> To post to this group, send email to sphinx...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/groups/opt_out.

Lukashevichus Ksenia

unread,
Nov 2, 2013, 2:38:01 PM11/2/13
to sphinx...@googlegroups.com, shiro...@gmail.com
Thank you for your answer!

I have some more questions.
1) Is it possible to use math symbols in titles of sections? When in LaTeX, there is "\texorpdfstring" but when I produce HTML using Sphinx, it's not processed.
2) In math directive I use some symbols from amssymb package for latex, but when LaTeX is produced, there is no "usepackage" for amssymb and of course I get the mistakes. What's wrong?
3) Is there something wrong with this code:
.. math::
   :label: valign2
   &&S = \begin{pmatrix}
        c & s\\
        -s & c
       \end{pmatrix},\quad c = \langle\hat{v_1},\ \hat{v_2}\rangle,\ \quad s = \sqrt{1 - c^2},\ \quad \hat{v_i} = \dfrac{v_i}{\|v_i\|}\\ 

?
Because when I make latexpdf, these lines look like:

\phantomsection\label{some_rst:equation-valign2}\begin{gather}
\begin{split}&&S = \begin{pmatrix}
c & s\\
-s & c
\end{pmatrix},\quad c = \langle\hat{v_1},\ \hat{v_2}\rangle,\ \quad s = \sqrt{1 - c^2},\ \quad \hat{v_i} = \dfrac{v_i}{\|v_i\|}\\\end{split}\label{some_rst-valign2}
\end{gather}

and trying to compile it with PDFLaTeX I get:
! Extra alignment tab has been changed to \cr. 


Hope for any help, thank you!

четверг, 31 октября 2013 г., 5:15:34 UTC+4 пользователь shirou написал:

Guenter Milde

unread,
Nov 4, 2013, 3:25:56 AM11/4/13
to sphinx...@googlegroups.com
On 2013-11-02, Lukashevichus Ksenia wrote:

> 2) In math directive I use some symbols from amssymb package for latex, but
> when LaTeX is produced, there is no "usepackage" for amssymb and of course
> I get the mistakes. What's wrong?

While the Docutils LaTeX writer always inserts a "usepackage{amsmath} if
there is "math" in the document, this may be not the case with the Sphinx
LaTeX writer. You may need to add this to your configuration setup
(latex_preamble in conf.py).

> 3) Is there something wrong with this code:
> .. math::
> :label: valign2
> &&S = \begin{pmatrix}
> c & s\\
> -s & c
> \end{pmatrix},\quad c = \langle\hat{v_1},\ \hat{v_2}\rangle,\ \quad
> s = \sqrt{1 - c^2},\ \quad \hat{v_i} = \dfrac{v_i}{\|v_i\|}\\

Why do you start with && and end with \\?

> Because when I make latexpdf, these lines look like:

However, running through Docutils and then pdflatex, the code works.

In my view, the result of \hat{v_1} looks not as good as \hat{v}_1, though
(with Latin Modern and standard mathematical CM fonts).

Günter

Lukashevichus Ksenia

unread,
Nov 8, 2013, 2:47:47 PM11/8/13
to sphinx...@googlegroups.com, mi...@users.sf.net
Thank you, I finally managed to get PDF. 
There are some more questions: 
1) I'm using pngmath for HTML, is it possible to increase a resolution of equation images? 
2) How to change color of internal references in Latex? Now it is a bit faint. 
3) I have several source files, but I need to refer equation and titles from one chapter in another one. I tried to put all the source rst to one file, but it's not good. Is there a way to keep chapters separate?

понедельник, 4 ноября 2013 г., 12:25:56 UTC+4 пользователь Guenter Milde написал:

Lukashevichus Ksenia

unread,
Nov 9, 2013, 6:43:17 AM11/9/13
to sphinx...@googlegroups.com, mi...@users.sf.net
I found an answer to the 3rd question, but the 1) - 2) are still interesting!

пятница, 8 ноября 2013 г., 23:47:47 UTC+4 пользователь Lukashevichus Ksenia написал:

Guenter Milde

unread,
Nov 11, 2013, 8:23:02 AM11/11/13
to sphinx...@googlegroups.com
On 2013-11-08, Lukashevichus Ksenia wrote:

> Thank you, I finally managed to get PDF.
> There are some more questions:
> 1) I'm using pngmath for HTML, is it possible to increase a resolution of
> equation images?

I don't know. However, I recommend using skaling equations with,
e.g., mathjax.

> 2) How to change color of internal references in Latex? Now it is a bit
> faint.

Have a look at the generated LaTeX preamble and the documentation of the
"hyperref" LaTeX package. I suppose you can change settings using the
\hypersetup command in the "latex_preamble" variable in conf.py.

Günter

Reply all
Reply to author
Forward
0 new messages