6

I'm trying to write my thesis in org-mode, and so far it feels amazing. The integration with my todo system, the easy markup language, integration with latex. Wow.

But recently (since I upgraded to the latest latex version on my Arch system, and installed biber from the separate package) the export to pdf cannot find my references anymore.

If I export to .tex first and then run latexmk -f -pdf minimal.tex from the command line everything does work correctly. Here are the relevant settings in my init file:

(setq org-latex-pdf-process
      (list "latexmk -f -pdf %f"))

Because it uses so many files, I made a small git repo with all the files.

  • minimal.org is the source file. note that some of the lines start with # +, and are thus comments.
  • minimal.bib is a tiny bibliography file.
  • minimal.tex is the auto-generated .tex file.
  • fromlatexmk.pdf is the pdf file generated from the command line with the .tex file as input.
  • fromorgmode.pdf is the pdf generated from org's C-c C-e l p (or o), with the failed references.

I hope somebody can help me solve this mystery!

4
  • I would recommend org-ref. Commented Dec 29, 2016 at 11:21
  • Shouldn't you add a -bibtex flag to latexmk? Commented Feb 28, 2017 at 0:36
  • @JohnKitchin latexmk was working correctly, but the command from emacs wasn't. In the end I made a small shells cript that calls the correct latexmk command and also performs some sed commands for cleanup.
    – Japhir
    Commented Mar 1, 2017 at 12:04
  • That doesn't make sense to me. I have used this before and it worked fine. I need the shell-escape because of the minted package that is default for me. (setq org-latex-pdf-process (list "latexmk -shell-escape -bibtex -f -pdf %f")) Commented Apr 29, 2017 at 12:16

2 Answers 2

2

So a rather unsatisfying answer that works out, is to run the commands in from the command line to generate all the required auto files with latexmk. From then on the export commands from emacs work correctly.

1

This took me a very long time to figure out. I had the same issue.

Specifically in macOS the emacs shell does not properly inherit the PATH. In my situation, this meant that biber was not in path, but latexmk was. latexmk just builds the pdf anyway, with no viewable error message anywhere except ‘empty bibliography’ or ‘unknown citation’. There are many better solutions in the linked post, but here is my janky one solution:

  (setq org-latex-pdf-process
    '("export PATH=\"/Library/TeX/texbin/:$PATH\";latexmk -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f"))
1
  • Hmm at present for me (on Arch Linux) the $PATH from my zsh config and from my emacs shell are the same (probably because I compiled emacs with nativecomp myself?). But your analysis may have spot on for what happened on my system at the time, when I hadn't switched to sway/wayland yet! :O
    – Japhir
    Commented Jul 22 at 12:11

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.