sphinx 1.3.4 latex gives no toc

475 views
Skip to first unread message

repriville

unread,
Jan 20, 2016, 6:17:39 PM1/20/16
to sphinx-users

I upgraded to sphinx 1.3.4 in a python 2.7.8 virtual environment. 

The document I've been working on now doesn't generate a table of contents in the latexpdf (and it used to).  After much poking about the past several days, I believe that 'make latex' is adding
\setcounter{tocdepth}{-2}

where it should be a positive number.

So, in a simplified test doc, that just has one file listed in the vanilla index.rst and that file has one header, I get in the .tex file
\title{Dummy Doc Documentation}
\date{January 20, 2016}
\release{3.1}
\author{Bleeding Edge}
\newcommand{\sphinxlogo}{}
\renewcommand{\releasename}{Release}
\setcounter{tocdepth}{-2}
\makeindex


If I try to set the tocdepth in the latex preamble in conf.py, the value is set before the "\title" and is overwritten here. So the result is where the table of contents entries are, I get a page that says "Contents" at the top, but no values.

If I manually edit the generated .tex file, change the -2 to a positive number, then manually run pdflatex on the .tex file, the generated pdf file has the correct toc entries.

Ideas? Work arounds?

Thanks for any help.

Komiya Takeshi

unread,
Jan 21, 2016, 12:21:00 AM1/21/16
to sphinx-users
Hi,

Sorry for inconvinience.
It's bug of 1.3.4 And will fixed at 1.3.5.

Please use 1.3.3 until next version is released (may be this weekend).

Thank you for reporting

Takeshi KOMIYA

2016年1月21日木曜日 8時17分39秒 UTC+9 repriville:

Kevin Dunn

unread,
Jan 21, 2016, 2:50:20 AM1/21/16
to sphinx...@googlegroups.com
I had the same unexpected experience a few days ago. My work around, other than downgrading, was to modify my conf.py as follows:

TABLE_OF_CONTENTS = r"""
% Sphinx 1.3.4 has decided to set this to "-2" in one of the newer versions.
% Set it "1", which is what we are looking for
\setcounter{tocdepth}{1}
\tableofcontents
"""

latex_elements = {
     ...
     'tableofcontents': TABLE_OF_CONTENTS,
     ...
}

I'm looking to the new 1.3.5 version Takeshi.

repriville

unread,
Jan 22, 2016, 10:06:48 AM1/22/16
to sphinx-users
Thanks all. (For some reason, my posts to this group are very slow appearing..)

I used to know latex back in the day, but have forgotten most of it. So tips like this are useful to get me back in the swing of things.

I just used 'sed -i' on the .tex file, then ran pdflatex once by hand. Worked well enough till I found out what was going on.

Cheers. Looking forward to 1.3.5!

Franck Lefebure

unread,
Jan 31, 2017, 9:48:18 AM1/31/17
to sphinx-users
Hi,

I'm very newbie with Sphinx and evaluating it for the documentation of a large java/gradle project.

I faced the same problem of TOC missing in pdf export
but my versions are not the same : Windows10 / Python 2.7.13 / sphinx 1.5.2

K Dunn workaround did the trick

Franck

Komiya Takeshi

unread,
Jan 31, 2017, 10:01:16 AM1/31/17
to sphinx...@googlegroups.com
Hi Franck,

I'd like to know how did you lost TOC.
If it's also a bug, I will fix it in nearly release.
Could you show me your project or small producible example?

Thanks,
Takeshi KOMIYA
> --
> 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 https://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/d/optout.

Franck Lefebure

unread,
Jan 31, 2017, 6:45:56 PM1/31/17
to sphinx-users
Hi Takeshi,

Sure,
You have a simplified config (extensions disabled if conf.py) as attachment
What I do with theses file is :

>sphinx-build src/main/sphinx/test build/site/test -blatex
>cd build\site\test
>pdflatex softbridge

With the workaround (line 29 in conf.py) I have the TOC, If workaround is commented I don't have it.

Franck
conf.py
index.rst
architecture.rst

Komiya Takeshi

unread,
Jan 31, 2017, 10:54:58 PM1/31/17
to sphinx...@googlegroups.com
Hi,

I reproduced your case.
This problem is caused by usage of LaTeX.
Some LaTeX macros expects to compile several times to build PDF.
TOC is one of them.

Please run pdflatex twice or three times.
(The Makefile generated by Sphinx runs pdflatex 5 times!)
Then you'll see TOC in your PDF.

refs:
http://tex.stackexchange.com/questions/53235/why-does-latex-bibtex-need-three-passes-to-clear-up-all-warnings

Thanks,

Franck Lefebure

unread,
Feb 1, 2017, 9:21:20 AM2/1/17
to sphinx-users

I followed your link and felt on the command "latexmk -pdf softbridge" which automates the process you describe.

Thanks for your analysis 
Franck
Reply all
Reply to author
Forward
0 new messages