emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* heading numbering in LaTeX export?
@ 2013-09-06 19:43 Peter Salazar
  2013-09-06 20:30 ` John Hendy
  2013-09-07 20:21 ` Richard Lawrence
  0 siblings, 2 replies; 12+ messages in thread
From: Peter Salazar @ 2013-09-06 19:43 UTC (permalink / raw)
  To: org-mode

[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]

I have a LaTeX template I created for use with org-mode, to export to PDF
via LaTeX using xelatex.

I don't edit LaTeX directly, I just generate from org-mode. This works
perfectly for me except for one thing: it only works when I have heading
numbering turned on.

When I turn numbering off in org-mode, by adding this line to my org-mode
file...

    #+OPTIONS:   num:nil

...LaTeX no longer recognizes my headings as headings. This creates two
problems:

1. The Table of Contents is blank.
2. The \leftmark in the heading shows up as "Contents" instead of showing
up as the title of the section.

How do I modify these org-mode preferences such that my I can turn heading
numbering off in org-mode while still correctly generating a Table of
Contents and adding my section title to the header?

I'm sorry, but I don't know enough about LaTeX to make a minimum
representation of this. I have no idea where the problem is.

Here are the org-mode preferences in question:
http://pastebin.com/62Nugpsg

Thanks!

[-- Attachment #2: Type: text/html, Size: 1358 bytes --]

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

* Re: heading numbering in LaTeX export?
  2013-09-06 19:43 heading numbering in LaTeX export? Peter Salazar
@ 2013-09-06 20:30 ` John Hendy
  2013-09-07 22:51   ` Peter Salazar
  2013-09-07 20:21 ` Richard Lawrence
  1 sibling, 1 reply; 12+ messages in thread
From: John Hendy @ 2013-09-06 20:30 UTC (permalink / raw)
  To: Peter Salazar; +Cc: org-mode

On Fri, Sep 6, 2013 at 2:43 PM, Peter Salazar <cycleofsong@gmail.com> wrote:
> I have a LaTeX template I created for use with org-mode, to export to PDF
> via LaTeX using xelatex.
>
> I don't edit LaTeX directly, I just generate from org-mode. This works
> perfectly for me except for one thing: it only works when I have heading
> numbering turned on.
>
> When I turn numbering off in org-mode, by adding this line to my org-mode
> file...
>
>     #+OPTIONS:   num:nil
>
> ...LaTeX no longer recognizes my headings as headings. This creates two
> problems:
>
> 1. The Table of Contents is blank.
> 2. The \leftmark in the heading shows up as "Contents" instead of showing up
> as the title of the section.
>
> How do I modify these org-mode preferences such that my I can turn heading
> numbering off in org-mode while still correctly generating a Table of
> Contents and adding my section title to the header?
>
> I'm sorry, but I don't know enough about LaTeX to make a minimum
> representation of this. I have no idea where the problem is.
>

At the very least, can you provide a minimal org file? This is over my
head with xelatex and all that customization, but I think people are
going to at least need:
- minimal emacs config (reproducible version that produces the
problem, not just the latex stuff)
- a .org file that produces the issue you're experiencing (even with
just a couple headlines and the words "blah blah blah" or what have
you as the text


John

> Here are the org-mode preferences in question:
> http://pastebin.com/62Nugpsg
>
> Thanks!

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

* Re: heading numbering in LaTeX export?
  2013-09-06 19:43 heading numbering in LaTeX export? Peter Salazar
  2013-09-06 20:30 ` John Hendy
@ 2013-09-07 20:21 ` Richard Lawrence
  2013-09-07 20:41   ` Rasmus
  1 sibling, 1 reply; 12+ messages in thread
From: Richard Lawrence @ 2013-09-07 20:21 UTC (permalink / raw)
  To: emacs-orgmode

Hi Peter,

Peter Salazar <cycleofsong@gmail.com> writes:

> I have a LaTeX template I created for use with org-mode, to export to PDF
> via LaTeX using xelatex.
>
> I don't edit LaTeX directly, I just generate from org-mode. This works
> perfectly for me except for one thing: it only works when I have heading
> numbering turned on.
>
> When I turn numbering off in org-mode, by adding this line to my org-mode
> file...
>
>     #+OPTIONS:   num:nil
>
> ...LaTeX no longer recognizes my headings as headings. This creates two
> problems:
>
> 1. The Table of Contents is blank.

This is because, when you set num:nil, Org exports headings to LaTeX
using the \section*{} command, not the usual \section{}.  LaTeX does not
put sections defined with \section* (or \chapter*, \part*, etc.) in the
table of contents. 

Thus, if you still want all sections to show up in your table of
contents, you probably don't want to set num:nil.  If you just want
section numbers not to show up in section titles, there's probably a
simple way to do this in LaTeX by redefining a command, but I can't find
it right now; maybe someone else here knows.  Once you know the LaTeX
command, you can set it on Org via

#+LATEX_HEADER: \renewcommand{...}

or whatever.

See also: https://en.wikibooks.org/wiki/LaTeX/Document_Structure#Sectioning_commands

> 2. The \leftmark in the heading shows up as "Contents" instead of showing
> up as the title of the section.

I'm not sure about this issue.  I would guess that it's also caused
by using \section* rather than \section, but there's no \leftmark
command in the test document I created. 

-- 
Best,
Richard

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

* Re: heading numbering in LaTeX export?
  2013-09-07 20:21 ` Richard Lawrence
@ 2013-09-07 20:41   ` Rasmus
  0 siblings, 0 replies; 12+ messages in thread
From: Rasmus @ 2013-09-07 20:41 UTC (permalink / raw)
  Cc: emacs-orgmode

Richard Lawrence <richard.lawrence@berkeley.edu> writes:

> Hi Peter,
>
> Peter Salazar <cycleofsong@gmail.com> writes:
>
>> I have a LaTeX template I created for use with org-mode, to export to PDF
>> via LaTeX using xelatex.
>>
>> I don't edit LaTeX directly, I just generate from org-mode. This works
>> perfectly for me except for one thing: it only works when I have heading
>> numbering turned on.
>>
>> When I turn numbering off in org-mode, by adding this line to my org-mode
>> file...
>>
>>     #+OPTIONS:   num:nil
>>
>> ...LaTeX no longer recognizes my headings as headings. This creates two
>> problems:
>>
>> 1. The Table of Contents is blank.
>
> This is because, when you set num:nil, Org exports headings to LaTeX
> using the \section*{} command, not the usual \section{}.  LaTeX does not
> put sections defined with \section* (or \chapter*, \part*, etc.) in the
> table of contents. 
>
> Thus, if you still want all sections to show up in your table of
> contents, you probably don't want to set num:nil.  If you just want
> section numbers not to show up in section titles, there's probably a
> simple way to do this in LaTeX by redefining a command, but I can't find
> it right now; maybe someone else here knows.  Once you know the LaTeX
> command, you can set it on Org via

#+LATEX: \setcounter{secnumdepth}{0}

Or just

#+OPTIONS: num:0

–Rasmus

-- 
If you can mix business and politics wonderful things can happen!

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

* Re: heading numbering in LaTeX export?
  2013-09-06 20:30 ` John Hendy
@ 2013-09-07 22:51   ` Peter Salazar
  2013-09-08  4:05     ` Nick Dokos
  2013-09-08 14:26     ` John Hendy
  0 siblings, 2 replies; 12+ messages in thread
From: Peter Salazar @ 2013-09-07 22:51 UTC (permalink / raw)
  To: John Hendy, Richard Lawrence, Rasmus; +Cc: org-mode

[-- Attachment #1: Type: text/plain, Size: 2507 bytes --]

Thanks for the responses!

John: Oh yes, of course. Sorry about that. inimal org file and config files
are here. I had to make the org file long enough to make several pages, so
the header displays. Here you go:
https://github.com/petersalazar/org-troubleshooting

Rasmus: #+OPTIONS: num:0 is what I started from. When I do that, the
resulting PDF has no Table of Contents, and the header displays the section
title as "Contents."

The same thing happens with #+LATEX: \setcounter{secnumdepth}{0}.

Richard: Your idea about
#+LATEX_HEADER: \renewcommand{...}

sounds very promising! I'd love to know what the exact command is!

I don't need section numbers ever, so my desire is to turn off numbering
forever, but still have an intact Table of Contents and header.

Thanks guys!


On Fri, Sep 6, 2013 at 4:30 PM, John Hendy <jw.hendy@gmail.com> wrote:

> On Fri, Sep 6, 2013 at 2:43 PM, Peter Salazar <cycleofsong@gmail.com>
> wrote:
> > I have a LaTeX template I created for use with org-mode, to export to PDF
> > via LaTeX using xelatex.
> >
> > I don't edit LaTeX directly, I just generate from org-mode. This works
> > perfectly for me except for one thing: it only works when I have heading
> > numbering turned on.
> >
> > When I turn numbering off in org-mode, by adding this line to my org-mode
> > file...
> >
> >     #+OPTIONS:   num:nil
> >
> > ...LaTeX no longer recognizes my headings as headings. This creates two
> > problems:
> >
> > 1. The Table of Contents is blank.
> > 2. The \leftmark in the heading shows up as "Contents" instead of
> showing up
> > as the title of the section.
> >
> > How do I modify these org-mode preferences such that my I can turn
> heading
> > numbering off in org-mode while still correctly generating a Table of
> > Contents and adding my section title to the header?
> >
> > I'm sorry, but I don't know enough about LaTeX to make a minimum
> > representation of this. I have no idea where the problem is.
> >
>
> At the very least, can you provide a minimal org file? This is over my
> head with xelatex and all that customization, but I think people are
> going to at least need:
> - minimal emacs config (reproducible version that produces the
> problem, not just the latex stuff)
> - a .org file that produces the issue you're experiencing (even with
> just a couple headlines and the words "blah blah blah" or what have
> you as the text
>
>
> John
>
> > Here are the org-mode preferences in question:
> > http://pastebin.com/62Nugpsg
> >
> > Thanks!
>

[-- Attachment #2: Type: text/html, Size: 3889 bytes --]

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

* Re: heading numbering in LaTeX export?
  2013-09-07 22:51   ` Peter Salazar
@ 2013-09-08  4:05     ` Nick Dokos
  2013-09-08  4:59       ` Peter Salazar
  2013-09-08 14:26     ` John Hendy
  1 sibling, 1 reply; 12+ messages in thread
From: Nick Dokos @ 2013-09-08  4:05 UTC (permalink / raw)
  To: emacs-orgmode

Peter Salazar <cycleofsong@gmail.com> writes:

> Thanks for the responses!
>
> John: Oh yes, of course. Sorry about that. inimal org file and config files are here. I had to make the org file long enough to make several pages, so the header displays. Here you
> go: 
> https://github.com/petersalazar/org-troubleshooting
>
> Rasmus: #+OPTIONS: num:0 is what I started from. When I do that, the resulting PDF has no Table of Contents, and the header displays the section title as "Contents." 
>
> The same thing happens with #+LATEX: \setcounter{secnumdepth}{0}.
>
> Richard: Your idea about 
> #+LATEX_HEADER: \renewcommand{...}
>
> sounds very promising! I'd love to know what the exact command is! 

The quick-and-dirty solution is

--8<---------------cut here---------------start------------->8---
#+LATEX_HEADER: \renewcommand{\thesection}{}
#+LATEX_HEADER: \renewcommand{\thesubsection}{}
#+LATEX_HEADER: \renewcommand{\thesubsubsection}{}
--8<---------------cut here---------------end--------------->8---

That's enough for the default secnumdepth of 3, but if you make that
bigger, you'll have to make it even dirtier:

--8<---------------cut here---------------start------------->8---
#+LATEX_HEADER: \renewcommand{\theparagraph}{}
#+LATEX_HEADER: \renewcommand{\thesubparagraph}{}
--8<---------------cut here---------------end--------------->8---

There is probably a cleaner way, but that would require cleverness
and I don't have any right now.

BTW, this turns off section numbers in the TOC as well, not just in the
body of the document.
--
Nick

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

* Re: heading numbering in LaTeX export?
  2013-09-08  4:05     ` Nick Dokos
@ 2013-09-08  4:59       ` Peter Salazar
  2013-09-08  5:54         ` Nick Dokos
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Salazar @ 2013-09-08  4:59 UTC (permalink / raw)
  To: Nick Dokos; +Cc: org-mode

[-- Attachment #1: Type: text/plain, Size: 2061 bytes --]

Thank you! That solution is very promising indeed.

I see why it's quick and dirty though - it appears to be generation section
numbers, but just making the numbers invisible, so that the headings are
not flush with the left margin:
http://i.imgur.com/G6drpmf.png

Is there a solution to that, or is that just the way it is?

Thanks again.




On Sun, Sep 8, 2013 at 12:05 AM, Nick Dokos <ndokos@gmail.com> wrote:

> Peter Salazar <cycleofsong@gmail.com> writes:
>
> > Thanks for the responses!
> >
> > John: Oh yes, of course. Sorry about that. inimal org file and config
> files are here. I had to make the org file long enough to make several
> pages, so the header displays. Here you
> > go:
> > https://github.com/petersalazar/org-troubleshooting
> >
> > Rasmus: #+OPTIONS: num:0 is what I started from. When I do that, the
> resulting PDF has no Table of Contents, and the header displays the section
> title as "Contents."
> >
> > The same thing happens with #+LATEX: \setcounter{secnumdepth}{0}.
> >
> > Richard: Your idea about
> > #+LATEX_HEADER: \renewcommand{...}
> >
> > sounds very promising! I'd love to know what the exact command is!
>
> The quick-and-dirty solution is
>
> --8<---------------cut here---------------start------------->8---
> #+LATEX_HEADER: \renewcommand{\thesection}{}
> #+LATEX_HEADER: \renewcommand{\thesubsection}{}
> #+LATEX_HEADER: \renewcommand{\thesubsubsection}{}
> --8<---------------cut here---------------end--------------->8---
>
> That's enough for the default secnumdepth of 3, but if you make that
> bigger, you'll have to make it even dirtier:
>
> --8<---------------cut here---------------start------------->8---
> #+LATEX_HEADER: \renewcommand{\theparagraph}{}
> #+LATEX_HEADER: \renewcommand{\thesubparagraph}{}
> --8<---------------cut here---------------end--------------->8---
>
> There is probably a cleaner way, but that would require cleverness
> and I don't have any right now.
>
> BTW, this turns off section numbers in the TOC as well, not just in the
> body of the document.
> --
> Nick
>
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 2913 bytes --]

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

* Re: heading numbering in LaTeX export?
  2013-09-08  4:59       ` Peter Salazar
@ 2013-09-08  5:54         ` Nick Dokos
  2013-09-08  7:43           ` Peter Salazar
  0 siblings, 1 reply; 12+ messages in thread
From: Nick Dokos @ 2013-09-08  5:54 UTC (permalink / raw)
  To: emacs-orgmode

Peter Salazar <cycleofsong@gmail.com> writes:

> Thank you! That solution is very promising indeed. 
>
> I see why it's quick and dirty though - it appears to be generation
> section numbers, but just making the numbers invisible, so that the
> headings are not flush with the left margin:
> http://i.imgur.com/G6drpmf.png
>
> Is there a solution to that, or is that just the way it is? 
>

Here is a cleaner way:

#+LATEX_HEADER: \setcounter{secnumdepth}{0}
#+LATEX_HEADER: \setcounter{tocdepth}{3}

--
Nick

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

* Re: heading numbering in LaTeX export?
  2013-09-08  5:54         ` Nick Dokos
@ 2013-09-08  7:43           ` Peter Salazar
  2013-09-08 11:47             ` Nick Dokos
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Salazar @ 2013-09-08  7:43 UTC (permalink / raw)
  To: Nick Dokos; +Cc: org-mode

[-- Attachment #1: Type: text/plain, Size: 816 bytes --]

That appears to work perfectly. Thank you so much!

If I have 5 levels of heading, should I do it like this?

#+LATEX_HEADER: \setcounter{secnumdepth}{0}
#+LATEX_HEADER: \setcounter{tocdepth}{5}


On Sun, Sep 8, 2013 at 1:54 AM, Nick Dokos <ndokos@gmail.com> wrote:

> Peter Salazar <cycleofsong@gmail.com> writes:
>
> > Thank you! That solution is very promising indeed.
> >
> > I see why it's quick and dirty though - it appears to be generation
> > section numbers, but just making the numbers invisible, so that the
> > headings are not flush with the left margin:
> > http://i.imgur.com/G6drpmf.png
> >
> > Is there a solution to that, or is that just the way it is?
> >
>
> Here is a cleaner way:
>
> #+LATEX_HEADER: \setcounter{secnumdepth}{0}
> #+LATEX_HEADER: \setcounter{tocdepth}{3}
>
> --
> Nick
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 1589 bytes --]

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

* Re: heading numbering in LaTeX export?
  2013-09-08  7:43           ` Peter Salazar
@ 2013-09-08 11:47             ` Nick Dokos
  2013-09-08 16:58               ` Peter Salazar
  0 siblings, 1 reply; 12+ messages in thread
From: Nick Dokos @ 2013-09-08 11:47 UTC (permalink / raw)
  To: emacs-orgmode

Peter Salazar <cycleofsong@gmail.com> writes:

> That appears to work perfectly. Thank you so much! 
>
> If I have 5 levels of heading, should I do it like this? 
>
> #+LATEX_HEADER: \setcounter{secnumdepth}{0}
> #+LATEX_HEADER: \setcounter{tocdepth}{5}
>

Yes, although IMO the TOC will be too busy with that many levels.
But to each his/her own...
-- 
Nick

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

* Re: heading numbering in LaTeX export?
  2013-09-07 22:51   ` Peter Salazar
  2013-09-08  4:05     ` Nick Dokos
@ 2013-09-08 14:26     ` John Hendy
  1 sibling, 0 replies; 12+ messages in thread
From: John Hendy @ 2013-09-08 14:26 UTC (permalink / raw)
  To: Peter Salazar; +Cc: Richard Lawrence, org-mode, Rasmus

On Sat, Sep 7, 2013 at 5:51 PM, Peter Salazar <cycleofsong@gmail.com> wrote:
> Thanks for the responses!
>
> John: Oh yes, of course. Sorry about that. inimal org file and config files
> are here. I had to make the org file long enough to make several pages, so
> the header displays. Here you go:
> https://github.com/petersalazar/org-troubleshooting

Hi Peter,


Actually, I hadn't understood your issue. I thought you weren't
getting headlines exported at all, as in a blank document, which might
require a bit more delving into. Now I get it and it makes sense. When
I use num:nil but want a TOC, I tend to just add the entries manually:

#+begin_example

* Introduction
\addcontentsline{toc}{subsection}{Introduction}

blah blah blah

* Conclusion
\addcontentsline{toc}{subsection}{Conclusion}

blah blah blah

#+end_example


Perhaps a bit manual, and it looks like you've gotten more automated
answers to use via #+latex_header arguments.


Good luck!
John

>
> Rasmus: #+OPTIONS: num:0 is what I started from. When I do that, the
> resulting PDF has no Table of Contents, and the header displays the section
> title as "Contents."
>
> The same thing happens with #+LATEX: \setcounter{secnumdepth}{0}.
>
> Richard: Your idea about
> #+LATEX_HEADER: \renewcommand{...}
>
> sounds very promising! I'd love to know what the exact command is!
>
> I don't need section numbers ever, so my desire is to turn off numbering
> forever, but still have an intact Table of Contents and header.
>
> Thanks guys!
>
>
> On Fri, Sep 6, 2013 at 4:30 PM, John Hendy <jw.hendy@gmail.com> wrote:
>>
>> On Fri, Sep 6, 2013 at 2:43 PM, Peter Salazar <cycleofsong@gmail.com>
>> wrote:
>> > I have a LaTeX template I created for use with org-mode, to export to
>> > PDF
>> > via LaTeX using xelatex.
>> >
>> > I don't edit LaTeX directly, I just generate from org-mode. This works
>> > perfectly for me except for one thing: it only works when I have heading
>> > numbering turned on.
>> >
>> > When I turn numbering off in org-mode, by adding this line to my
>> > org-mode
>> > file...
>> >
>> >     #+OPTIONS:   num:nil
>> >
>> > ...LaTeX no longer recognizes my headings as headings. This creates two
>> > problems:
>> >
>> > 1. The Table of Contents is blank.
>> > 2. The \leftmark in the heading shows up as "Contents" instead of
>> > showing up
>> > as the title of the section.
>> >
>> > How do I modify these org-mode preferences such that my I can turn
>> > heading
>> > numbering off in org-mode while still correctly generating a Table of
>> > Contents and adding my section title to the header?
>> >
>> > I'm sorry, but I don't know enough about LaTeX to make a minimum
>> > representation of this. I have no idea where the problem is.
>> >
>>
>> At the very least, can you provide a minimal org file? This is over my
>> head with xelatex and all that customization, but I think people are
>> going to at least need:
>> - minimal emacs config (reproducible version that produces the
>> problem, not just the latex stuff)
>> - a .org file that produces the issue you're experiencing (even with
>> just a couple headlines and the words "blah blah blah" or what have
>> you as the text
>>
>>
>> John
>>
>> > Here are the org-mode preferences in question:
>> > http://pastebin.com/62Nugpsg
>> >
>> > Thanks!
>
>

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

* Re: heading numbering in LaTeX export?
  2013-09-08 11:47             ` Nick Dokos
@ 2013-09-08 16:58               ` Peter Salazar
  0 siblings, 0 replies; 12+ messages in thread
From: Peter Salazar @ 2013-09-08 16:58 UTC (permalink / raw)
  To: Nick Dokos; +Cc: org-mode

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

Ah, I see. Cool, then I will stick to {tocdepth}{3}. Thanks again!


On Sun, Sep 8, 2013 at 7:47 AM, Nick Dokos <ndokos@gmail.com> wrote:

> Peter Salazar <cycleofsong@gmail.com> writes:
>
> > That appears to work perfectly. Thank you so much!
> >
> > If I have 5 levels of heading, should I do it like this?
> >
> > #+LATEX_HEADER: \setcounter{secnumdepth}{0}
> > #+LATEX_HEADER: \setcounter{tocdepth}{5}
> >
>
> Yes, although IMO the TOC will be too busy with that many levels.
> But to each his/her own...
> --
> Nick
>
>
>

[-- Attachment #2: Type: text/html, Size: 1025 bytes --]

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

end of thread, other threads:[~2013-09-08 16:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-06 19:43 heading numbering in LaTeX export? Peter Salazar
2013-09-06 20:30 ` John Hendy
2013-09-07 22:51   ` Peter Salazar
2013-09-08  4:05     ` Nick Dokos
2013-09-08  4:59       ` Peter Salazar
2013-09-08  5:54         ` Nick Dokos
2013-09-08  7:43           ` Peter Salazar
2013-09-08 11:47             ` Nick Dokos
2013-09-08 16:58               ` Peter Salazar
2013-09-08 14:26     ` John Hendy
2013-09-07 20:21 ` Richard Lawrence
2013-09-07 20:41   ` Rasmus

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