Hi,

Le 15/08/2020 à 18:06, bradley...@gmail.com a écrit :

When generating html files, the information in the current section comes before 
the information for each of its child sections; i.e., the document is designed 
to be read from any node down the tree.

If I put my toctree commands directly after the title for a section, latexpdf 
puts the information for the children before the information for the parent.

background for this is that LaTeX document is a linear structure ; LaTeX itself 
does not build a tree of its contents. A toctree directive will trigger 
inclusion at this spot of the latex translation of children


If I put my toctree commands at the end of a section, latexpdf's table of 
contents puts the children for the current section below the last heading for 
the current section, instead of directly below the title for the current 
section.

again, due to linear structure and the table of contents is built-up linearly

via raw latex directives of a somewhat hacky nature it could be possible to 
silence the table of contents build-up from title of section to inclusion of 
children,

to permute the info would be even more hacky at latex level as it would require 
a whole apparatus for that (if working only at latex level)


How do I get latexpdf to generate output like the children are at the end of 
each section and table of contents like the children are under the title for 
each section ?


- for first question, I am currently not knowledgeable enough on Sphinx toctree 
handling to answer,

- for second question, as hinted above it is possible to make sectional units 
between title and children invisible to LaTeX table of contents ; if you want 
to keep the info, then I guess you are asking necessarily for a tree-like 
rendering of the LaTeX table of contents in PDF output which however is a 
single linear document. This basically means a LaTeX package dedicated to tree 
like rendering of table of contents.

To make things invisible to the pdf table of contents

.. raw:: latex

   \addtocontents{toc}{\protect\setcounter{tocdepth}{-2}}

at start of material to be skipped (the contents will still be in text of pdf, 
only table of contents entry are made invisible)


and

.. raw:: latex

   \addtocontents{toc}{\protect\setcounter{tocdepth}{1}}


at end (assuming "manual", for "howto", use {2} in place of {1})

with some LaTeX guru having time it could be possible to do things like

.. raw:: latex

   \addtocontents{toc}{" start storing the upcoming TOC data but do not display it 
yet "}

and

.. raw:: latex

   \addtocontents{toc}{" deliver now the stored TOC data (hoping hyperlinks will 
work by the way) "}



To achieve more, i.e. tree-like storage and rendering basically means a whole 
LaTeX package I think,

Jean-François


--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/rhdas2%2411ae%241%40ciao.gmane.io.

Reply via email to