emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Include TOC in PDF export?
@ 2012-03-02 22:32 Michael Hannon
  2012-03-02 23:21 ` Nick Dokos
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Hannon @ 2012-03-02 22:32 UTC (permalink / raw)
  To: Org-Mode List

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.


I'm running:

    Org-mode version 7.8.03 (release_7.8.03.324.gc4b233)

in Fedora 16, 64-bit.

What am I missing?

Thanks,

-- Mike



#+TITLE:
#+OPTIONS: num:nil ^:{} toc:t

* Tale of Two Cities

*It was the best of times, it was the worst of times*

It was the best of times, it was the worst of times, it was the age of
wisdom, it was the age of foolishness, it was the epoch of belief, it
was the epoch of incredulity, it was the season of Light, it was the
season of Darkness, it was the spring of hope, it was the winter of
despair, we had everything before us, we had nothing before us, we
were all going direct to heaven, we were all going direct the other
way - in short, the period was so far like the present period, that
some of its noisiest authorities insisted on its being received, for
good or for evil, in the superlative degree of comparison only.

* David Copperfield

*Barkis is willin*

As he repudiated this suggestion, however, with a jerk of his head,
and once more confirmed his previous request by saying, with profound
gravity, 'Barkis is willin'. That's the message,' I readily undertook
its transmission. While I was waiting for the coach in the hotel at
Yarmouth that very afternoon, I procured a sheet of paper and an
inkstand, and wrote a note to Peggotty, which ran thus: 'My dear
Peggotty. I have come here safe. Barkis is willing. My love to
mama. Yours affectionately. P.S. He says he particularly wants you to
know - BARKIS IS WILLING.'

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Include TOC in PDF export?
  2012-03-02 22:32 Include TOC in PDF export? Michael Hannon
@ 2012-03-02 23:21 ` Nick Dokos
  2012-03-02 23:39   ` Nick Dokos
  2012-03-02 23:44   ` Michael Hannon
  0 siblings, 2 replies; 5+ messages in thread
From: Nick Dokos @ 2012-03-02 23:21 UTC (permalink / raw)
  To: Michael Hannon; +Cc: nicholas.dokos, Org-Mode List

Michael Hannon <jm_hannon@yahoo.com> 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.

Nick

> 
> I'm running:
> 
>     Org-mode version 7.8.03 (release_7.8.03.324.gc4b233)
> 
> in Fedora 16, 64-bit.
> 
> What am I missing?
> 
> Thanks,
> 
> -- Mike
> 
> 
> 
> #+TITLE:
> #+OPTIONS: num:nil ^:{} toc:t
> 
> * Tale of Two Cities
> 
> *It was the best of times, it was the worst of times*
> 
> It was the best of times, it was the worst of times, it was the age of
> wisdom, it was the age of foolishness, it was the epoch of belief, it
> was the epoch of incredulity, it was the season of Light, it was the
> season of Darkness, it was the spring of hope, it was the winter of
> despair, we had everything before us, we had nothing before us, we
> were all going direct to heaven, we were all going direct the other
> way - in short, the period was so far like the present period, that
> some of its noisiest authorities insisted on its being received, for
> good or for evil, in the superlative degree of comparison only.
> 
> * David Copperfield
> 
> *Barkis is willin*
> 
> As he repudiated this suggestion, however, with a jerk of his head,
> and once more confirmed his previous request by saying, with profound
> gravity, 'Barkis is willin'. That's the message,' I readily undertook
> its transmission. While I was waiting for the coach in the hotel at
> Yarmouth that very afternoon, I procured a sheet of paper and an
> inkstand, and wrote a note to Peggotty, which ran thus: 'My dear
> Peggotty. I have come here safe. Barkis is willing. My love to
> mama. Yours affectionately. P.S. He says he particularly wants you to
> know - BARKIS IS WILLING.'
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Include TOC in PDF export?
  2012-03-02 23:21 ` Nick Dokos
@ 2012-03-02 23:39   ` Nick Dokos
  2012-03-02 23:44   ` Michael Hannon
  1 sibling, 0 replies; 5+ messages in thread
From: Nick Dokos @ 2012-03-02 23:39 UTC (permalink / raw)
  To: Michael Hannon, Org-Mode List; +Cc: nicholas.dokos

Nick Dokos <nicholas.dokos@hp.com> wrote:

> Michael Hannon <jm_hannon@yahoo.com> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Include TOC in PDF export?
  2012-03-02 23:21 ` Nick Dokos
  2012-03-02 23:39   ` Nick Dokos
@ 2012-03-02 23:44   ` Michael Hannon
  2012-03-03  0:23     ` suvayu ali
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Hannon @ 2012-03-02 23:44 UTC (permalink / raw)
  To: nicholas.dokos@hp.com; +Cc: Org-Mode List

> From: Nick Dokos <nicholas.dokos@hp.com>
>> 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.

Thanks, Nick.  I think I'll learn to love the current arrangement.

-- Mike

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Include TOC in PDF export?
  2012-03-02 23:44   ` Michael Hannon
@ 2012-03-03  0:23     ` suvayu ali
  0 siblings, 0 replies; 5+ messages in thread
From: suvayu ali @ 2012-03-03  0:23 UTC (permalink / raw)
  To: Michael Hannon; +Cc: nicholas.dokos@hp.com, Org-Mode List

On Sat, Mar 3, 2012 at 00:44, Michael Hannon <jm_hannon@yahoo.com> wrote:
>> 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.
>
> Thanks, Nick.  I think I'll learn to love the current arrangement.

There is a slightly hacky solution. With "num:nil", you can put a line
like the following line after every heading you want to see in the
TOC.

\addcontentsline{toc}{subsection}{\nameref{<subsection latex label>}}

Hope this helps.

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-03  0:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-02 22:32 Include TOC in PDF export? Michael Hannon
2012-03-02 23:21 ` Nick Dokos
2012-03-02 23:39   ` Nick Dokos
2012-03-02 23:44   ` Michael Hannon
2012-03-03  0:23     ` suvayu ali

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).