I just spend hours trying to figure out why bibtex citations don't work. Turns out it's because \bibliography{testbib}
needs to come after begin{document}
.
This is my test.org
:
#+LATEX_HEADER: \usepackage{natbib}
#+LATEX_HEADER: \bibliographystyle{plainnat}
* Test
This is a test. \citep{Nobody06}
#+LATEX_HEADER: \bibliography{testbib}
This is the generated test.tex
(only the relevant parts):
% Created 2018-11-01 Thu 13:28
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
[ ... ]
\usepackage{natbib}
\bibliographystyle{plainnat}
\bibliography{testbib}
[ ... ]
\section{Test}
\label{sec:orgfb2727b}
This is a test. \citep{Nobody06}
\end{document}
Manually changing the file to this:
% Created 2018-11-01 Thu 13:28
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
[ ... ]
\usepackage{natbib}
\bibliographystyle{plainnat}
[ ... ]
\section{Test}
\label{sec:orgfb2727b}
This is a test. \citep{Nobody06}
\bibliography{testbib}
\end{document}
Fixes the issue so that I can run the pdflatex
and bibtex
commands to generate the references in the final pdf file.
Is there some way I can force the line \bibliography{testbib}
to be inserted in the right spot from within Emacs? I.e. so that I can just run C-c C-e l p
to export a pdf without having to manually run pdflatex
and bibtex
?