5
votes

I used to be able to pass the CUSTOM_ID property as custom \label once exported to LaTeX. A snippet like this:

* Introduction
  :PROPERTIES:
  :CUSTOM_ID: custom_label
  :END:

Would export to:

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

I am using Org-mode version 8.2.7c and that is not the case anymore, the org-mode snippet above exports to:

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

Because of that, I need to add custom labels everywhere, like:

* Introduction
  :PROPERTIES:
  :CUSTOM_ID: custom_label
  :END:
  \label{custom_label}

Is there a better way to pass the CUSTOM_ID property with the new org-latex-export-as-latex way?

Or, more generally, is there a systematic way to pass any PROPERTIES when exporting to LaTeX?

Thank you for any help or pointer I could use.

2
But Go to [[#custom_label]] exports to Go to \ref{sec-1}. Why is not that good enough for you?rvf0068
Hi, thanks for asking. I use org-mode to publish books (via LaTeX). Some books are like a dictionary, where each entry has its own key, dictated by the publisher. I need to be able to access those 'keys' (as labels) so to print them properly (as running titles, or in other places).gsl

2 Answers

4
votes

Just in case you don't notice @nberth 's answer, In current version Org 8.3.2, do the following

(setq org-latex-prefer-user-labels t)
0
votes

The current development branch of org-mode (8.3) allows to use the CUSTOM_ID property for this.

If one must use his own labels in LaTeX export, he could set org-latex-custom-id-as-label to non-nil.

org-latex-custom-id-as-label is part of Org v8.3.

The following code:

(with-temp-buffer
  (let ((org-latex-custom-id-as-label t))
    (insert "* Introduction\n:PROPERTIES:\n:CUSTOM_ID: custom_label\n:END:")
    (org-mode)
    (org-latex-export-as-latex nil nil nil t)))

will produce a buffer with the contents

\section{Introduction}
\label{custom_label}

as desired.