Nicolas Goaziou <m...@nicolasgoaziou.fr> writes: > Hello, > > Rasmus <ras...@gmx.us> writes: > >> Ah, it's much easier to use \stopcontents[level-i] to end contents >> collection. Revising the example: >> >> \documentclass{book} >> \usepackage{titletoc} >> \begin{document} >> \part{p1} >> \startcontents[level-0] >> \printcontents[level-0]{}{0}{\setcounter{tocdepth}{2}} >> \chapter{c1} >> \startcontents[level-1] >> \printcontents[level-1]{}{1}{\setcounter{tocdepth}{1}} >> \section{s1} \subsection{s2} >> \stopcontents[level-1] >> \chapter{c2} >> \section{s3} >> \stopcontents[level-0] >> \part{p2}\chapter{c3} >> \end{document} >> >> Note that the contents is determined by the .pcf file. Maybe that's >> easier to to understand than my babeling. Also, "pcf" should be >> added >> to `org-latex-logfiles-extensions'. > > Done.
That looks cool! Thanks! One more thing. For LaTeX, *we must load titletoc before hyperref*. E.g. cf. here: http://tex.stackexchange.com/questions/79547/weird-behavior-of-partial-toc-with-titletoc Or just try this document: #+LATEX_HEADER: \usepackage{titletoc} * section 1 #+TOC: headlines 1 local ** sub 1 Which produces (in LaTeX): [full-TOC] 1. SECTION 1 section.1 ← artifact from loading after hyperref [sub-toc] 1.1 SUB 1 * Solutions 1. We could use org-latex-packages-alist but that's another forced dependency; ugh! 2. Alternatively, we could ensure that hyperref is always loaded last which is the almost-always safe rule of thumb rule anyway¹. Since we already have org-latex-hyperref-template we could drop hyperref from org-latex-packages-alist and make its presence implicit based on that variable. 3. Or we can add to the manual this deficit and advice how to solve it "manually". 4. It's also possible to solve it on the LaTeX side with something like \BeforePackage from KOMA-Script. Again, more dependencies. 5. We could provide placement mechanisms to #+LATEX_HEADER-keywords Of these I think 2. or 1. are the acceptable solutions. 1. is easier, but as adds more dependencies which sucks. So I prefer 2. WDYT? —Rasmus Footnotes: ¹ Exceptions, including some notable ones (it's a mess): http://tex.stackexchange.com/questions/1863/which-packages-should-be-loaded-after-hyperref-instead-of-before -- A page of history is worth a volume of logic