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: Nicolas Goaziou
Subject: Re: [O] Table of contents for just one section?
Date: Sun, 26 Oct 2014 14:01:50 +0100

Hello,

Rasmus <address@hidden> writes:

> I think we can do it with titletoc.  I have used other functionality
> of titletoc, and it 'doesn't sucks'ᵀᴹ.  Below is an example.  The
> output is more inline with normal tocs, but you can also style it
> [I've used this for making paragraph-TOCs in the past].
>
> So ox-latex needs to insert at least the following to initialize a
> local TOC
>
>    \startcontents[ID-level] % need not be unique and might not be neceasary
>    \printcontents[ID-level]{}{(1+ level)}{TOC OPTIONS}
>
> And, importantly — and mildely annoyingly — \startcontents[ID] *after*
> the next heading of the same level.

I don't quite get this part. Does that string need to be inserted only
after the second sibling (i.e., not after the third, too)? What happens
if there is no other sibling?

> There are some preamble options, but since we are doing it
> programically, it might be safer to insert it into the body.

The patch will not insert "\usepackage{titletoc}" for the user, however,
à la `org-latex-listings'.

> It seems it need not be same unique ID.
>
> An 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}
>     \chapter{c2}
>     \startcontents[level-1]
>     \section{s3}
>     \part{p2}
>     \startcontents[level-0]
>     \chapter{c3}
>     \end{document}
>
> The only "challenge" is to insert \startcontents[ID] in the next
> headline of same level.  The brute force method would be very bad.

What do you call the "brute force"?

> Maybe doing it like section numbers are determined?

What do you mean?

> Let me know what you think and whether you will do it.

I can try to implement it.

I also note that these tocs do not have any title. Would it make sense
to remove title from local tocs in other back-ends too?

Thanks for your feedback.


Regards,

-- 
Nicolas Goaziou



reply via email to

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