I am trying to export an .org buffer with the following contents:

#+CAPTION: My subgraph.
#+NAME: fig:subgraph

The following latex output is produced:

% Created 2018-01-30 Tue 09:32
% Intended LaTeX compiler: pdflatex
 pdfcreator={Emacs 24.5.1 (Org mode 9.1.4)}, 


My subgraph.}

The #+NAME: command was ignored. It works properly when I start Emacs with emacs -q. In the search for the guilty line in my configuration, I commented out lines in init.el until nothing remained, but the problem persists. What is going on? What is the difference between -q and empty init file? (I compared the *Messages* buffer after starting Emacs both ways and did not find any difference)

  • 1
    Try again with emacs -Q this also doesn't run the system configuration files for emacs.
    – Tobias
    Commented Jan 30, 2018 at 9:22
  • It works with either emacs -q or emacs -Q. Commented Jan 30, 2018 at 12:52

1 Answer 1


There is a bit of differences between emacs -q and emacs with no init.el. See "Summary: Sequence of Actions at Startup".

Do you happen to have Emacs 25.2.2 with Org mode 8.2.10? Because that's what I have on my Debian System. When you run emacs -q, do you run that older version of org mode? Post the good output if you don't know what you are running.

Org version 8.3 or later introduced org-latex-prefer-user-labels, which is nil as a default. With this variable set to non-nil, you can use your custom ID, which is taken from #+NAME.

C-h v org-latex-prefer-user-labels to see more detail.

Here is the one I got from Org 8.2.10:

\caption{\label{fig:subgraph}My subgraph.}
% Emacs 25.2.2 (Org mode 8.2.10)

And with default Org 9.1.6:

My subgraph.}

And this is Org 9.1.6 with org-latex-prefer-user-labels set to t:

My subgraph.}
  • The output that I posted indicates: Emacs 24.5.1 (Org mode 9.1.4). When Emacs starts, there is no variable org-latex-prefer-user-labels. It appears only after an export. Nonetheless, setting it to t resolves the problem. Thanks! Commented Jan 30, 2018 at 13:08
  • @AlwaysLearning , you said emacs -q works. What is the version of your emacs -q? Plus, please fix the question title, it's not about -q or init.el. Commented Jan 30, 2018 at 14:36
  • emacs -q --version gives GNU Emacs 24.5.1. Now that I am thinking about it: why does it work with -q? Commented Jan 30, 2018 at 20:40
  • 1
    With -q, org-version gives 8.2.10. I guess this explains it! Commented Jan 31, 2018 at 6:50
  • 1
    Thanks, this works. Any idea why they added this variable and set it to nil by default? Seems to only add inconvenience to the users...
    – xji
    Commented Jul 31, 2018 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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