emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] table of contents and numbers


From: Julian Burgos
Subject: Re: [O] table of contents and numbers
Date: Thu, 12 Apr 2012 10:00:39 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

Thanks for the answer Nick. So to get a TOC without numbers I would need to edit the TEX file directly, right?

On mið 11.apr 2012 19:00, John Hendy wrote:
On Wed, Apr 11, 2012 at 12:12 PM, Nick Dokos<address@hidden>  wrote:
Julian Burgos<address@hidden>  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
|                 ...))
`----
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





--
Julian Mariano Burgos, PhD
Hafrannsóknastofnunin/Marine Research Institute
Skúlagata 4, 121 Reykjavík, Iceland
Sími/Telephone : +354-5752037
Bréfsími/Telefax:  +354-5752001
Netfang/Email: address@hidden




reply via email to

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