[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Include TOC in PDF export?
From: |
Nick Dokos |
Subject: |
Re: [O] Include TOC in PDF export? |
Date: |
Fri, 02 Mar 2012 18:39:57 -0500 |
Nick Dokos <address@hidden> wrote:
> Michael Hannon <address@hidden> wrote:
>
> > Greetings. I'm exporting a document to both HTML and PDF. In the
> > HTML version, I get a table of contents. In the PDF version, I do NOT
> > get a table of contents. The appended text illustrates the problem.
> > I'd like to get the TOC in both.
> >
>
> num:nil causes unnumbered sections in latex (\section*{...}) which are
> not entered into the .toc file (that's a latex limitation, not an
> org-mode one), so the latex exporter wants both num: and toc: to be
> enabled before it produces a table of contents.
>
> I think the only way to get a TOC is to set num:t. You can probably
> rewrite a chunk of latex code so that unnumbered sections etc end up in
> the .toc file, but I think it would be a fairly major undertaking.
>
There is a trick (I found it in the titlesec doc) that allows you
to get unnumbered sections without using the \section* forms:
--8<---------------cut here---------------start------------->8---
#+TITLE:
#+OPTIONS: num:t ^:{} toc:5
#+LaTeX_HEADER: \setcounter{secnumdepth}{0}
--8<---------------cut here---------------end--------------->8---
Since num: is t, the latex exporter will produce a TOC and the \setcounter
will suppress section numbers. Unfortunately, that won't work with HTML
though: the sections will be numbered (unless some other trick can be found
there - maybe some CSS magic, although I wouldn't know where to start with
that).
Nick