It seems I should not have overlooked the reST documentation so easily. The `raw` directive is exactly what I was looking for.
For anyone else that is interested in knowing how to render the ToC in a different part of the document other than the beginning, they should create a hidden ToC entry to a document that contains: .. The LaTeX ToC is rendered here. .. only:: latex .. raw:: latex \tableofcontents On Jul 3, 1:26 pm, Filip Dupanović <[email protected]> wrote: > Hi everyone! > > I'm trying to write a thesis paper using Sphinx. One of the rare > difficulties I have in doing so is that my ToC has to follow my > preface (title, cover, (c), ack, abstract), because the latex builder > puts the call to `\tableofcontents` at the beginning of the document. > > I have immediately dropped the idea that I would redefine the > `latex_elements['tableofcontents']` with my whole preface hardcoded > out of hygienic reasons. I was going along the lines of doing > something in my master document: > > .. This is the master document. > > It's content does not appear in the latex output. > > Contents > ======= > > .. toctree:: > :hidden: > > copyright > abstract > contents > > .. toctree:: > :maxdepth: 2 > > preface > introduction > > And in the contents.rst to put: > > .. The LaTeX ToC is rendered here. > > .. only:: latex > > \tableofcontents > > But the backslash gets reformatted and does not appear in .tex output. > I guess this is a good indicator that I shouldn't be trying to put > latex markup into rst. > > Is there any clean way to provide a custom position of the ToC in the > document? -- You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.
