I am try to set up TeXworks on Windows to write my thesis, but have hit a problem with creating a shared bibliography in a two-tier document hierarchy.
I have a main thesis.tex
file which sets up the packages and then includes chapters, and finally a bibliography. The collection.bib
file is in the folder above thesis.tex
, and chapters are in subfolders.
\documentclass[11pt,a4paper]{../uolthesis}
%\usepackage{alltt,float}
%\usepackage{lgrind}
\usepackage{url} % for better handling of URL
\usepackage{lscape}
\usepackage{subfigure}
\usepackage{mathrsfs}
\usepackage{graphicx}
%\usepackage{caption2}
\usepackage{epstopdf}
\usepackage{sidecap}
\usepackage{../draft_doc}
\graphicspath{{ch1/}{ch2/}}
% correct bad hyphenation here
\hyphenation{op-tical}
% use less hyphenation
\lesshyphenation
% or totally stop it
%\nohyphenation
% speed up compilation
%\includeonly{ch1/ch1}
\begin{document}
\chapter*{thesis title}
\cite{Santner2010,Kalal2011} % This works
\include{ch1/ch1} % \cite{} in here produces [?]
\include{ch2/ch2} % \cite{} in here produces [?]
\clearpage
\markboth{References}{References}
\bibliographystyle{ieeetr}
{\bibliography{../collection}}
\end{document}
The problem is that \cite{}
from within thesis.tex
work correctly, but the same citations in the chapter tex files produce [?]
. The bibliography produced correctly contains all cited papers, so the problem is only in getting the numeric references are the citation point.
The log file is, predictably, full of lines like
Package natbib Warning: Citation `Santner2010' on page 9 undefined on input line 61.
I am compiling with pdfLatex+MakeIndex+BibTeX
. I've tried compiling multiple times without success.
What am I doing wrong, please?
Best Answer
This seems to be a problem with the two custom elements included in your MWE - the
\documentclass[11pt,a4paper]{../uolthesis}
documentclass and whatever is in your\usepackage{../draft_doc}
package.Using the standardWith thereport
class and commenting the mentioned usepackage line (as well as getting rid of the stuff relating to hyphenation) yields the following which behaves perfectly fine:uolthesis
class (from OP's comment) I can reproduce the error with the following minimal example:and commenting the line:
solves the problem.
Refer to the documentation of
chapterbib
as to why this behaviour would occur and how to use the package if separate bibliographies are needed.