3

I've searched this site as well as other resources, and I understand it that this is a common problem, however, no single place can explain what exactly are the steps for debugging or troubleshooting. Here's my setup:

#+LATEX_HEADER: \hypersetup{urlcolor=blue}
#+LATEX_HEADER: \hypersetup{colorlinks,urlcolor=blue}
#+LATEX_HEADER: \bibliographystyle{plain}
#+LATEX_HEADER: \bibliography{gg}

#+BEGIN_SRC sh :exports none
  BIBINPUTS=./gg.bib:$BIBINPUTS
  export BIBINPUTS
#+END_SRC

Here's the TEX file produced from Org mode:

\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{amssymb}
\usepackage{hyperref}
\tolerance=1000
\hypersetup{urlcolor=blue}
\hypersetup{colorlinks,urlcolor=blue}
\bibliographystyle{plain}
\bibliography{gg}
\author{me}
\date{2014-08-24}
\title{unimportant}
\hypersetup{
 pdfkeywords={unimportant},
  pdfsubject={unimportant},
  pdfcreator={Emacs 24.3.1 (Org mode 8.2.6)}}
\begin{document}

\maketitle
\tableofcontents

\cite{Wilkinson}
...
\end{document}

Log produced by Bibtex:

This is BibTeX, Version 0.99d (TeX Live 2013)
Capacity: max_strings=35307, hash_size=35307, hash_prime=30011
The top-level auxiliary file: test.aux
The style file: plain.bst
I found no \bibdata command---while reading file test.aux
Warning--I didn't find a database entry for "Wilkinson"
[...] 

Contents of gg.bib file:

@book{Wilkinson,
 author = {Wilkinson, Leland},
 title = {The Grammar of Graphics (Statistics and Computing)},
 year = {2005},
 isbn = {0387245448},
 publisher = {Springer-Verlag New York, Inc.},
 address = {Secaucus, NJ, USA},
}

This is the .bbl file produced:

\begin{thebibliography}{}

\end{thebibliography}

Note that this is already wrong: content is missing.

Org mode log:

compiling test.tex...
test.bbl:1: Missing \begin{document}.
test.bbl:1: leading text: \begin{thebibliography}{}

Well, this is nonsense, why should there be \begin{document} here?

Anyways, in the end, the PDF is generated, but no bibliography and the citations look like [?].

I've tried all of these programs to generate the output:

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

;; (setq org-latex-to-pdf-process
;;       '("xelatex %f && bibtex %f && xelatex %f && xelatex %f"))

;; (setq org-latex-to-pdf-process
;;      '("pdflatex -interaction nonstopmode %b"
;;        "bibtex %b"
;;        "pdflatex -interaction nonstopmode %b"
;;        "pdflatex -interaction nonstopmode %b"))

;; (setq org-latex-pdf-process '("rubber -d --into %o %f"))

;; (setq org-latex-pdf-process
;;       '("texi2dvi --pdf --clean --verbose --batch %f"
;;         "bibtex %b" "texi2dvi --pdf --clean --verbose --batch %f"
;;         "texi2dvi --pdf --clean --verbose --batch %f"))

They give more or less the same results. Depending on the phase of the moon and whether Venus can be found in the constellation of Libra, the error messages can vary, but most of them don't even resemble the actual state of affairs in the document they are supposed to relate to. I will post error messages upon demand, because I don't want to clutter this already long post.

I will be enormously grateful if instead of / in addition to trying to fix my setup, you could provide a complete example which uses .org and .bib files.


I'm almost there:

#+LATEX_HEADER: \usepackage[backend=bibtex, style=numeric]{biblatex}
#+LATEX_HEADER: \hypersetup{urlcolor=blue}
#+LATEX_HEADER: \hypersetup{colorlinks,urlcolor=blue}
#+LATEX_HEADER: \addbibresource{gg.bib}

With these modifications and rubber as the compiler I can generate the proper citation, but the bibliography list isn't generated.


Oh, I made it! :) I was missing \printbibliography - this instructs the processor to place the bibliography in the specified place.

I'll wait for an answer though before I post one myself. I can't say that I understand why does it work the way it does, so probably someone who knows better could explain it.

  • 1
    I have no idea what "org mode" is, but the \bibliography{gg} must go behind \begin{document} as it is not only the command that declares the bib but also the command that prints the bibliography. – Ulrike Fischer Aug 24 '14 at 15:10
  • @UlrikeFischer in terms of document layout, which direction is behind: is it before or after the \begin{document}? It doesn't seem to make any difference wherever in the document I put it. – wvxvw Aug 24 '14 at 15:15
  • 1
    @wvxvw For 'classical' BibTeX \bibliography is a command in the document not the preamble: \begin{document} ... \bibliography{gg}. – Joseph Wright Aug 24 '14 at 15:33
  • 1
    \bibliography{gg} belongs after \begin{document}- – Ulrike Fischer Aug 24 '14 at 15:33
  • 1
    Well without log-files it is difficult to say what you are doing wrong. I suggest that you stop with all this org-mode and first try to compile a normal document step-by-step (pdflatex, bibtex or biber, pdflatex) until you understand what happens. – Ulrike Fischer Aug 24 '14 at 16:30
2

This is one reason why it is can be helpful to start with a minimal WORKING example, if you can find one :-)

#+LaTeX_HEADER: \usepackage{mathptmx}
#+LaTeX_HEADER: \usepackage{pifont}
#+LaTeX_HEADER: \usepackage[margin=0.7in]{geometry}
#+LaTeX_HEADER: \usepackage[backend=bibtex,sorting=none]{biblatex}
#+LaTeX_HEADER: \addbibresource{gg.bib}  %% point at your bib file
#+LaTeX_HEADER: \newcommand{\point}[1]{\noindent \textbf{#1}}
#+LaTeX_HEADER: \usepackage{hyperref}
#+LaTeX_HEADER: \usepackage{csquotes}
#+LaTeX_HEADER: \usepackage[mla]{ellipsis}
#+LaTeX_HEADER: \parindent = 0em
#+LaTeX_HEADER: \setlength\parskip{.5\baselineskip}
#+STARTUP: content

#+TITLE: The problem with computers
#+AUTHOR: Joseph Corneli
#+DATE: \today \\ (DRAFT)

It's not what you think! \cite{Wilkinson}. % change to a ref from your bib file

#+BEGIN_COMMENT
References
#+END_COMMENT

\printbibliography

My org mode config is here: https://gist.github.com/holtzermann17/6953779 The key bit is:

(setq org-latex-pdf-process
  '("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f"))
  • I don't know why, but it doesn't work for me :( I'm getting no error messages, but instead of \bibliography there's an empty space, and the references in the document are shown as [Ref], (the first time it succeeded they showed [#], where # was a clickable digit, linked to the reference. – wvxvw Aug 24 '14 at 16:21
  • I've added comments on lines you'll have to change on your local setup... – Joe Corneli Aug 24 '14 at 16:24
  • better yet, I made the changes to match the file names and bib stuff above. If that doesn't work I'll be a bit surprised... It could be that you need to change your emacs vars. – Joe Corneli Aug 24 '14 at 16:27
  • gist.github.com/holtzermann17/… is how I define org-latex-pdf-process. – Joe Corneli Aug 24 '14 at 16:29
  • 1
    Oh, with rubber replaced by pdflatex it now produces bibliography. Dear lord, why does it have to be so... alright, I'll shut up :) – wvxvw Aug 24 '14 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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