Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

By default Org-mode exports to numbered LaTeX headings. For example, the following

#+title: Test

* Introduction
* Heading
* Heading
* References

exports to

\section{Introduction}
\label{sec-1}
\section{Heading}
\label{sec-2}
\section{Heading}
\label{sec-3}
\section{References}
\label{sec-4}

It is possible to disable numbering for all LaTeX headings by adding #+options: num:nil as in

#+title: Test
#+options: num:nil

* Introduction
* Heading
* Heading
* References

which exports to

\section*{Introduction}
\label{sec-1}
\section*{Heading}
\label{sec-2}
\section*{Heading}
\label{sec-3}
\section*{References}
\label{sec-4}

Note that \section* is a LaTeX macro for unnumbered section.

Is it possible to tell Org-mode to not number particular headings, i.e. via editing the properties of headings? For example, is it possible to get the following LaTeX exported from Org-mode:

\section*{Introduction}
\label{sec-1}
\section{Heading}
\label{sec-2}
\section{Heading}
\label{sec-3}
\section*{References}
\label{sec-4}

I am running Org-mode 7.6 in Emacs 23.3.1.

share|improve this question

migrated from stackoverflow.com Apr 18 '12 at 19:57

This question came from our site for professional and enthusiast programmers.

    
It is a common misperception that all and everything you can do with LaTeX should be possible by using Org-mode and exporting to LaTeX. No! Write your document in LaTeX and link into it from your Org-mode file. –  Keks Dose May 2 '12 at 11:45
1  
@KeksDose I do not expect to do everything in Org-mode that I can do with LaTeX. I do however expect to do some basic and useful things in Org-mode that are also possible with LaTeX. This issue is one of them and it is something that can be handy also when exporting from Org-mode to other formats such as html. Also, I do not think it is effective to write directly in LaTeX. I prefer to draft in Org-mode. –  N.N. May 2 '12 at 11:52
1  
There are gazillions of things which are considered as basic and usefull, depends on whom you ask. Go and draft your document in Org-mode, I admit to do so as well, but in LaTeX you will have to give some finishing touches to the *.tex-file. I'm impressed about the features of Org-mode as well, it even can calculate (have you noticed the radiotables? Incredible!), but what you and many other people ask, seems the direct highway to hell for Org-mode. Besides that: All those features would destroy the clean outline of Org-mode files. –  Keks Dose May 2 '12 at 12:00
1  
@KeksDose As said, controlling heading numbering for particular headers is useful not only for LaTeX. Also, it would not interfere with the clean outline of Org file because it can be implemented via properties which are already in Org-mode. Org-mode already does something similar with properties to handle beamer export. –  N.N. May 2 '12 at 12:08
    
I searched through stackoverflow and found some of your questions related to exporting. Would you mind to give a résumé on all your specific solutions you found? Maybe you can share a link here at tex.stackexchange. Probably many people would find that usefull! –  Keks Dose May 2 '12 at 12:49
show 3 more comments

2 Answers

Selective numbering is not supported at the moment (even in Org-mode master). However you can choose to not number headings beyond a certain depth by specifying something like this:

#+OPTIONS: H:3 num:2

* Introduction

* Heading
** Something 1
*** Something 2

* Heading
** Something 1
*** Something 2

* References

The above will export up to 3 levels of headlines but will number only up to level 2.

\section{Introduction}
\label{sec-1}

\section{Heading}
\label{sec-2}
\subsection{Something 1}
\label{sec-2-1}
\subsubsection*{Something 2}
\label{sec-2-1-1}

\section{Heading}
\label{sec-3}
\subsection{Something 1}
\label{sec-3-1}
\subsubsection*{Something 2}
\label{sec-3-1-1}
\section{References}
\label{sec-4}

PS: I don't see how this is more appropriate in tex rather than stackoverflow.

share|improve this answer
    
Indeed, this is not exactly what I want. I want to be able to have numbered and unnumbered headings of the same level. Strange way of supporting numbering depth. A more elegant solution for Org-mode would be to add \setcounter{secnumdepth}{2} to the preamble when #+OPTIONS: H:3 num:2 rather than adding \section*s. I have flagged for migration back to SO. Do not understand why it got migrated here in the first place. –  N.N. Apr 19 '12 at 19:03
    
@N.N. I think it's done this way because Org-mode tries to be export backend agnostic. So every time you enter a latex snippet, the disparity between exported files with different backends increase. That said, I believe it could be more configurable after the new export engine is in place. –  suvayu Apr 20 '12 at 11:21
add comment

I think there is still not an option in org-mode. One work around I used recently to use ignoreheading for required node and give latex command explicitly for unnumbered section.

* Abstract                                                   :ignoreheading:
\section*{Abstract}
blah 

ofcourse you should have a filter defined in your init.el for ignoreheading to work.

;;; Nicolas Goaziou, http://article.gmane.org/gmane.emacs.orgmode/67692
(defun org-latex-ignore-heading-filter-headline (headline backend info)
  "Strip headline from HEADLINE. Ignore BACKEND and INFO."
  (when (and (org-export-derived-backend-p backend 'latex)
             (string-match "\\`.*ignoreheading.*\n" headline))
    (replace-match "" nil nil headline)))
(add-to-list 'org-export-filter-headline-functions
             'org-latex-ignore-heading-filter-headline)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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