From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Hendy Subject: Re: table of contents and numbers Date: Wed, 11 Apr 2012 14:00:52 -0500 Message-ID: References: <4F85ADBE.6000602@hafro.is> <4735.1334164345@alphaville> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:53258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SI2mr-0002p1-UQ for emacs-orgmode@gnu.org; Wed, 11 Apr 2012 15:01:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SI2ml-0000Sp-Fu for emacs-orgmode@gnu.org; Wed, 11 Apr 2012 15:01:01 -0400 Received: from mail-bk0-f41.google.com ([209.85.214.41]:63238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SI2ml-0000S3-6M for emacs-orgmode@gnu.org; Wed, 11 Apr 2012 15:00:55 -0400 Received: by bkwq16 with SMTP id q16so1183226bkw.0 for ; Wed, 11 Apr 2012 12:00:52 -0700 (PDT) In-Reply-To: <4735.1334164345@alphaville> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com Cc: Julian Burgos , Org Mode Mailing List On Wed, Apr 11, 2012 at 12:12 PM, Nick Dokos wrote: > Julian Burgos wrote: > >> Dear list, >> >> My apologies for another very basic question. =C2=A0I'm wondering why I = do >> not get a table of contents when exporting the following file as pdf >> >> ---start org file ----------- >> #+TITLE: Test >> #+OPTIONS: =C2=A0toc:t num:nil >> >> * Part 1 >> Some text >> >> * Part 2 >> Some more text >> ---end org file ----------- >> >> I do get the TOC when exporting as hmtl, though. >> > > I believe it's because of a rather technical latex limitation: latex > writes TOC entries into a .toc file, which is then read back in when the > \tableofcontents macro is expanded. When you specify num:nil asking for > unnumbered sections, the latex exporter produces \section* markers, > instead of the standard \section markers. But when latex processes > those, it does not add anything to the .toc file. If org added a > \tableofcontents, you would get just the title and an empty TOC. In > order to prevent that, the latex exporter requires that both toc and num > be non-nil - see l.1487 ff in lisp/org-latex.el: > > ,---- > | =C2=A0 =C2=A0 =C2=A0... > | =C2=A0 =C2=A0 =C2=A0;; table of contents > | =C2=A0 =C2=A0 =C2=A0(when (and org-export-with-toc > | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (plist-get opt-plist := section-numbers)) > | =C2=A0 =C2=A0 =C2=A0 =C2=A0(funcall org-export-latex-format-toc-functio= n > | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ...)) > `---- One can work around this by manually adding sections under each headline. ----- #+options: num:nil toc:t #+text: \tableofcontents * Introduction \addcontentsline{toc}{section}{Introduction} ----- Tedious for long documents, but does work. John > > The HTML exporter does this "by hand", so to speak, so it is not as > constrained and can do the "right" thing. > > Nick > > >