From: John Hendy <jw.hendy@gmail.com>
To: nicholas.dokos@hp.com
Cc: Julian Burgos <julian@hafro.is>,
Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: table of contents and numbers
Date: Wed, 11 Apr 2012 14:00:52 -0500 [thread overview]
Message-ID: <CA+M2ft9zZzA_LPHgLh=Jx8o3HWkE+xgOUByzeUeOpAAZTHUOBg@mail.gmail.com> (raw)
In-Reply-To: <4735.1334164345@alphaville>
On Wed, Apr 11, 2012 at 12:12 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> Julian Burgos <julian@hafro.is> 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
>
>
>
next prev parent reply other threads:[~2012-04-11 19:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <julian@hafro.is>
2012-04-11 16:13 ` table of contents and numbers Julian Burgos
2012-04-11 17:12 ` Nick Dokos
2012-04-11 19:00 ` John Hendy [this message]
2012-04-12 10:00 ` Julian Burgos
2012-04-12 14:30 ` Nick Dokos
2012-04-12 16:52 ` Jonas Hörsch
2012-04-12 16:59 ` Jonas Hörsch
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='CA+M2ft9zZzA_LPHgLh=Jx8o3HWkE+xgOUByzeUeOpAAZTHUOBg@mail.gmail.com' \
--to=jw.hendy@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=julian@hafro.is \
--cc=nicholas.dokos@hp.com \
/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).