I am using the packages hyperref and chapterbib. The citations kept showing as [?], even though I could find the correct keys back in the aux and bbl files. After excluding packages one-by-one I found that when I remove \usepackage{hyperref} from my packages, I do get the correct reference.

Is there a way to use both of these packages at the same time? Am I missing something in the options of the package that I should add?

Working example:

In main directory, main.tex

% comment out \usepackage{hyperref} to get [1] instead of [?]

in chapters/ directory, chapter1.tex:

test: \cite{albertRoleRegulatoryVariation2015}

in chapters/ directory, chapter1.bib:

  title = {The Role of Regulatory Variation in Complex Traits and Disease},
  author = {Albert, Frank W. and Kruglyak, Leonid},
  year = {2015},
  month = apr,
  volume = {16},
  pages = {197--212},
  issn = {1471-0064},
  doi = {10.1038/nrg3891},
  journal = {Nature Reviews Genetics},

Build with pdflatex main.tex; bibtex chapters/chapter1; pdflatex main.tex; pdflatex main.tex

  • 1
    Have you tried to run bibtex inside the chapters folder? (just as a test)
    – daleif
    Feb 20 '20 at 14:27
  • After your comment I have tried this, but it gives the same result ([?] when including hyperref, [1] when removing hyperref)
    – Niek
    Feb 20 '20 at 14:46
  • 1
    Sigh, first rule of hyperref: hyperref should be loaded last, Second rule of hyperref there are a few exceptions to the first rule, chapterbib is not one of them. Compiles just fine if I change the order of chapterbib and hyperref
    – daleif
    Feb 20 '20 at 15:08
  • I was not aware of this rule. Switching hyperref to the bottom indeed fixes the problem. Can you put this as answer so that I can accept?
    – Niek
    Feb 20 '20 at 15:58

With very few exceptions the hyperref package has to be the last of the packages loaded (as it needs to patch several packages)

In this case loading hyperref after chapterbib solves the problem

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.