emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Table of contents for just one section?


From: Rasmus
Subject: Re: [O] Table of contents for just one section?
Date: Sun, 11 Jan 2015 23:37:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Nicolas Goaziou <address@hidden> writes:

> Hello,
>
> Rasmus <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]