emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: Table of contents for just one section?
Date: Sun, 11 Jan 2015 23:37:47 +0100	[thread overview]
Message-ID: <87387h9c5g.fsf@gmx.us> (raw)
In-Reply-To: 87y4p9dm2r.fsf@nicolasgoaziou.fr

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

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

  reply	other threads:[~2015-01-11 22:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16  3:50 Table of contents for just one section? D. C. Toedt
2014-10-20 13:41 ` Nicolas Goaziou
2014-10-20 14:06   ` D. C. Toedt
2014-10-26  8:15     ` Nicolas Goaziou
2014-10-26 11:03       ` D. C. Toedt
2015-03-16 22:35         ` D. C. Toedt
2015-03-16 22:47           ` Rasmus
2015-03-16 23:13           ` Thomas S. Dye
2014-10-26 11:32       ` Rasmus
2014-10-26 13:01         ` Nicolas Goaziou
2014-10-26 15:01           ` Rasmus
2014-10-26 15:10             ` Rasmus
2015-01-11 21:49             ` Nicolas Goaziou
2015-01-11 22:37               ` Rasmus [this message]
2015-01-12  8:38                 ` Nicolas Goaziou
2015-01-12 10:45                   ` Rasmus
2015-01-12 23:12                     ` Nicolas Goaziou
2015-01-13  1:23                       ` Rasmus
2015-01-13  9:30                         ` Nicolas Goaziou
2015-01-13 10:21                           ` Rasmus
2015-01-13 10:43                             ` Nicolas Goaziou
2015-01-13 11:56                               ` Rasmus
2015-01-13 15:36                                 ` Nicolas Goaziou
2014-10-26 10:53   ` Rasmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87387h9c5g.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).