5

I have a LaTeX template I created for use with Emacs 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 in the resulting PDF:

  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

  • the article class omits all starred headers from the toc. some other classes (such as amsart; there may be others) include them. since you're not preparing this input directly, it may be to your benefit to try a document class that does include starred headers, or develop a class of your own, starting with a class that otherwise produces your preferred format, and patch in the star-including code from amsart or similar. (none of the toc* packages seem to handle starred sections this way.) – barbara beeton Sep 6 '13 at 19:56
  • I see. Any idea how to do that? – incandescentman Sep 6 '13 at 20:31
  • 1
    Another way to turn off numbering of sections, subsections,... in the article class is to do \setcounter{secnumdepth}{0}. And the sections and subsections will correctly appear in the table of contents. So, perhaps try with \setcounter{secnumdepth}{0} added in the LaTeX file, but without doing num:nil from org-mode – user4686 Sep 6 '13 at 20:51
  • I like that idea. I tried it, but the numbers still appear. Is there somewhere in particular I should put that line? I tried it in a couple places, including right at the beginning: (add-to-list 'org-latex-classes '("ilija" "\\documentclass[12pt]{article} \\setcounter{\\secnumdepth}{0} \\usepackage{float} \\usepackage[breaklinks=true,linktocpage,pdftitle={\\@title},pdfauthor={\\@author},xetex]{hyperref} \\usepackage{algorithm} \\usepackage{amsmath} \\usepackage{ifxetex} – incandescentman Sep 6 '13 at 21:19
3

I had the same problem as you and I tried what @jfbu was suggesting in the comments and this worked with org-mode:

Near the beginning of your file, add

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.