emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* table of contents and numbers
@ 2012-04-11 16:13 ` Julian Burgos
  2012-04-11 17:12   ` Nick Dokos
  0 siblings, 1 reply; 7+ messages in thread
From: Julian Burgos @ 2012-04-11 16:13 UTC (permalink / raw)
  To: Org Mode Mailing List

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.

Many thanks,

Julian

-- 
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: julian@hafro.is

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

* Re: table of contents and numbers
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2012-04-11 17:12 UTC (permalink / raw)
  To: Julian Burgos; +Cc: Org Mode Mailing List

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

The HTML exporter does this "by hand", so to speak, so it is not as
constrained and can do the "right" thing.

Nick

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

* Re: table of contents and numbers
  2012-04-11 17:12   ` Nick Dokos
@ 2012-04-11 19:00     ` John Hendy
  2012-04-12 10:00       ` Julian Burgos
  0 siblings, 1 reply; 7+ messages in thread
From: John Hendy @ 2012-04-11 19:00 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Julian Burgos, Org Mode Mailing List

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

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

* Re: table of contents and numbers
  2012-04-11 19:00     ` John Hendy
@ 2012-04-12 10:00       ` Julian Burgos
  2012-04-12 14:30         ` Nick Dokos
                           ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Julian Burgos @ 2012-04-12 10:00 UTC (permalink / raw)
  To: John Hendy; +Cc: nicholas.dokos, Org Mode Mailing List

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


-- 
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: julian@hafro.is

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

* Re: table of contents and numbers
  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
  2 siblings, 0 replies; 7+ messages in thread
From: Nick Dokos @ 2012-04-12 14:30 UTC (permalink / raw)
  To: Julian Burgos; +Cc: Org Mode Mailing List

Julian Burgos <julian@hafro.is> wrote:

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

You could do that, but you could also use John's idea below to add
\addcontentsline after each heading in the org file.

Nick

> On mið 11.apr 2012 19:00, John Hendy wrote:
> > 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
> >>
> >>
> >>
> 
> 
> -- 
> 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: julian@hafro.is
> 
> 

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

* Re: table of contents and numbers
  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
  2 siblings, 0 replies; 7+ messages in thread
From: Jonas Hörsch @ 2012-04-12 16:52 UTC (permalink / raw)
  To: emacs-orgmode


On Thu, Apr 12 2012, Julian Burgos wrote:

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

Hi there,

another option might be to remove the num:nil org option and instead
tell latex not to number any sections by setting secnumdepth to 0.

so for instance

---start org file -----------
#+TITLE: Test
#+OPTIONS:  toc:t
#+LATEX_HEADER: \setcounter{secnumdepth}{0}

* Part 1
Some text

* Part 2
Some more text
---end org file -----------

should do the trick.

the only drawback is that one still needs the num:nil option for the
other export formats.

perhaps this could become another way to implement num:nil for the latex
export in general. though i don't think it would work reliably for just a
subtree then.

Greets,
Jonas

> On mið 11.apr 2012 19:00, John Hendy wrote:
>> 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
>>>
>>>
>>>

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

* Re: table of contents and numbers
  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
  2 siblings, 0 replies; 7+ messages in thread
From: Jonas Hörsch @ 2012-04-12 16:59 UTC (permalink / raw)
  To: Julian Burgos; +Cc: Org Mode Mailing List

On Thu, Apr 12 2012, Julian Burgos wrote:

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

Hi there,

another option might be to remove the num:nil org option and instead
tell latex not to number any sections by setting secnumdepth to 0.

so for instance

---start org file -----------
#+TITLE: Test
#+OPTIONS:  toc:t
#+LATEX_HEADER: \setcounter{secnumdepth}{0}

* Part 1
Some text

* Part 2
Some more text
---end org file -----------

should do the trick.

the only drawback is that one still needs the num:nil option for the
other export formats.

perhaps this could become another way to implement num:nil for the latex
export in general. though i don't think it would work reliably for just a
subtree then.

Greets,
Jonas

P.S.: sorry to those fellow newsgroup-reading people, who now got this
answer twice, but i just realized, this is originally a mailing list.

> On mið 11.apr 2012 19:00, John Hendy wrote:
>> 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
>>>
>>>
>>>

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

end of thread, other threads:[~2012-04-12 16:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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
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

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