[Tex/LaTex] Problems with .bbl in org-mode

bibtexemacsorg-mode

I use Emacs's org-mode to draft papers. I also use the tufte-latex package.

Currently my .emacs looks like this:

(setq org-latex-to-pdf-process
     '("xelatex -interaction nonstopmode %f"
       "xelatex -interaction nonstopmode %f")
)
(require 'org-latex)
(add-hook 'org-mode-hook (lambda () (org-indent-mode 1)))
(unless (boundp 'org-export-latex-classes)
(setq org-export-latex-classes nil))

(add-to-list 'org-export-latex-classes
  '("tufte-handout" 
"\\documentclass[justified]{tufte-handout}
\\usepackage[T1]{fontenc}
\\usepackage{fontspec}
\\usepackage{graphicx} 
\\defaultfontfeatures{Mapping=tex-text}
\\usepackage{geometry}
\\usepackage{multicol}
\\pagestyle{empty}
\\title{}
      [NO-DEFAULT-PACKAGES]
      [NO-PACKAGES]"
("\\section{%s}" . "\\section*{%s}")
     ("\\subsection{%s}" . "\\subsection*{%s}")
     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
     ("\\subsubsubsection{%s}" . "\\subsubsubsection*{%s}")
     ("\\paragraph{%s}" . "\\paragraph*{%s}")
     ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

Now I am trying to export file called tnc.org. There is a tnc.bib file in the same directory. I include it in the .org file thus:

\bibliography{tnc}
\bibliographystyle{plainnat}

However, when I try to export using org-mode, I get the following warning:

No file tnc.bbl.
Package natbib Warning: There were undefined citations.

The paper renders otherwise ok, except there are no sidenotes or bibliography.

What do I do?

Best Answer

Rather than hard coding a build sequence you can let latexmk take care of the build process. This will make a more flexible solution that works for other document types than the one you specified. To have Org-mode export to pdf by latexmk you can add the following line to your .emacs:

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