From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: table of contents and numbers Date: Wed, 11 Apr 2012 13:12:25 -0400 Message-ID: <4735.1334164345@alphaville> References: <4F85ADBE.6000602@hafro.is> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:51223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SI15w-0007RR-Fp for emacs-orgmode@gnu.org; Wed, 11 Apr 2012 13:12:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SI15q-0000T9-3B for emacs-orgmode@gnu.org; Wed, 11 Apr 2012 13:12:36 -0400 Received: from g1t0028.austin.hp.com ([15.216.28.35]:29464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SI15p-0000Sp-Tx for emacs-orgmode@gnu.org; Wed, 11 Apr 2012 13:12:30 -0400 In-Reply-To: Message from Julian Burgos of "Wed, 11 Apr 2012 16:13:50 -0000." <4F85ADBE.6000602@hafro.is> 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: Julian Burgos Cc: Org Mode Mailing List Julian Burgos wrote: > Dear list, > > My apologies for another very basic question. I'm wondering why I do > not get a table of contents when exporting the following file as pdf > > ---start org file ----------- > #+TITLE: Test > #+OPTIONS: toc: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: ,---- | ... | ;; table of contents | (when (and org-export-with-toc | (plist-get opt-plist :section-numbers)) | (funcall org-export-latex-format-toc-function | ...)) `---- The HTML exporter does this "by hand", so to speak, so it is not as constrained and can do the "right" thing. Nick