3

I am trying to create my first book using book-class. I have successfully included chapters and the reference pages of each chapter are shown flawlessly. However, for some reason my citations in the main text don't work - for example, instead Sims (2003), I get author ?. I have tried numerous things but can't figure out, why is this happening - would appreciate a lot, if someone could help.

Here is a piece of code that I find relevant:

The main thesis.tex file that includes chapters:

    \documentclass[a4paper,12pt]{book}
    \usepackage{amsfonts}
    \usepackage{amssymb}
    \usepackage[numbers,sectionbib]{natbib}
    \usepackage{chapterbib}
    \usepackage[onehalfspacing]{setspace}
    \usepackage{graphicx}
    \usepackage{verbatim}
    \usepackage{amsmath}
    \usepackage{amsthm}
    \usepackage{color}
    \usepackage[utf8]{inputenc}
    \usepackage{fullpage}
    \usepackage{epigraph}
    \usepackage{xr}

    \setcounter{MaxMatrixCols}{10}
    %\addtolength{\oddsidemargin}{-0.5in}
    %\addtolength{\evensidemargin}{-0.5in}
    %\addtolength{\textwidth}{1.0in}
    %\addtolength{\topmargin}{-0.5in}
    %\addtolength{\textheight}{1.0in}

    \setlength{\epigraphwidth}{0.7\textwidth}
    \usepackage[titletoc]{appendix}

    %\bibliographystyle{plainnat}
    \begin{document}
    \frontmatter  
    %\pagenumbering{roman} 
    \tableofcontents
    \mainmatter 
    %\pagenumbering{arabic} 
    \include{tex/chapter1}\newpage\cleardoublepage
    %\input{tex/chapter2}\newpage\cleardoublepage
    %\input{tex/chapter3}\newpage\cleardoublepage
    %\input{tex/chapter4}\newpage\cleardoublepage
    %\input{tex/chapter5}\newpage\cleardoublepage

    \end{document}

Inside chapters I call references page by:

    \renewcommand\bibname{{REFERENCES}}
    \bibliographystyle{plainnat} 
    \bibliography{tex/references} 

Inside chapter texts I cite in the following way:

    \citet{Weibull2007}

While the corresponding entry in the bib file references looks like:

    @ARTICLE{Weibull2007,
      author = {Jorgen W. Weibull and Lars-Goran Mattsson and Mark                 Voorneveld},
      title = {Better May be Worse: Some Monotonicity Results and Paradoxes in Discrete Choice Under Uncertainty},
      journal = {Theory and Decision},
      year = {2007},
      volume = {63},
      month = {September},
       timestamp = {2016.06.26}
    }

As an output of this citation I get: (author?) [54] study

More information on the chapter setups:

\chapter[Content title ]{}
\title{Title}

\begin{center}
\huge{Title}
\footnote{text}

\large{author\footnote{
text}}

\vspace*{2cm}
    \end{center}

\begin{center}
    \textmd{Abstract}
\end{center}
text



\newpage

\section{Introduction}
 text. cite{author1} text.\citep{author2} text. \ref{Sec: Model1} text.
 \section{Section two}
  text. \citeauthor{author3}.
\section{Conclusion}
text

\renewcommand\bibname{{REFERENCES}} 
\bibliographystyle{plainnat}

\bibliography{tex/Citation}  
\begin{appendices}
    \appendixpage
    \noappendicestocpagenum
    \addappheadtotoc
\section{one}
text
\section{two}
text
\end{appendices}

Does anybody see the problem? Any help would be much appreciated.

Best,

Mark

  • 1
  • 1
    Did you run the cycle (pdf)latex -> bibtex -> (pdf)latex (twice)? – Bernard Jun 26 '16 at 18:18
  • 1
    use \bibliographystyle{plainnat}. \citet and \citep depends upon style. – Runar Jun 26 '16 at 18:27
  • I see a lot of inaccessible \input{....} statements -- this is not a compilable document! – user31729 Jun 26 '16 at 18:29
  • Off-topic: All \newpage\cleardoublepage statements are probably unnecessary. – Mico Jun 26 '16 at 19:35
3

Since you're using the natbib citation management package, you should (a) use the plainnat bibliography style instead of the plain bibliography style and (b) load the natbib package with the option numbers. That way, you can produce author-number style citation call-outs via \citet and purely numeric-style citation call-outs via \citep.

Separately, since you're using the chapterbib package to create per-chapter bibliographies while employing section-level rather than chapter-level per-chapter bibliographies, you should (a) load natbib with the option sectionbib (in addition to the option numbers -- see above) and (b) \include rather than \input the chapterx.tex files. (See page 4 of the user guide of the chapterbib package.) Provide \bibliographystyle instructions in each chapterx.tex file. After the initial LaTeX run, there will be separate chapterx.aux files (in addition to the \jobname.aux file.) Run BibTeX separately on each of the chapter aux files, by typing bibtex chapter1, bibtex chapter2, etc -- one per chapter. You may have to open a command window and run bibtex manually. Then, run LaTeX twice more to fully propagate all changes.

enter image description here

TWo additional suggestions/observations:

  • As you're using the book document class, do use high-level commands such as \frontmatter and \mainmatter instead of low-level instructions such as \pagenumbering{roman} and \pagenumbering{arabic}.

  • Do make sure that all information in your bib entries is correct and complete. E.g., in the Weibull2007 entry, two fields (number and pages) were missing and the first names of two of the authors were missing diacritics.


\RequirePackage{filecontents}

\begin{filecontents}{references.bib}
@ARTICLE{Weibull2007,
  author = {J{\"o}rgen W. Weibull and Lars-G{\"o}ran 
            Mattsson and Mark Voorneveld},
  title  = {Better May be Worse: {Some} Monotonicity 
            Results and Paradoxes in Discrete Choice 
            Under Uncertainty},
  journal= {Theory and Decision},
  year   = {2007},
  volume = {63},
  number = {2},
  month  = {September},
  pages  = {121-151},
  timestamp = {2016.06.26}
}    
\end{filecontents}

\begin{filecontents}{chapter1.tex}
\renewcommand\bibname{REFERENCES}
\chapter{Introduction}
\citet{Weibull2007}, \citep{Weibull2007}
\bibliographystyle{plainnat}
\bibliography{references}
\end{filecontents}

\begin{filecontents}{chapter2.tex}
\renewcommand\bibname{REFERENCES}
\chapter{Conclusion}
\citep{Weibull2007}, \citet{Weibull2007}
\bibliographystyle{plainnat}
\bibliography{references}
\end{filecontents}


\documentclass[a4paper,12pt]{book}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[numbers,sectionbib]{natbib}  %% <-- note this change
\usepackage{chapterbib}
\usepackage[onehalfspacing]{setspace}
\usepackage{graphicx}
\usepackage{verbatim}
%%%\usepackage{amssymb} %% don't load packages more than once!
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{color}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage{epigraph}
\usepackage{setspace}   %% again: don't load packages more than once!
\usepackage{xr}         %% are you sure you need this package?!

\setcounter{MaxMatrixCols}{10}
%    \addtolength{\oddsidemargin}{-0.5in}
%    \addtolength{\evensidemargin}{-0.5in}
%    \addtolength{\textwidth}{1.0in}
%    \addtolength{\topmargin}{-0.5in}
%    \addtolength{\textheight}{1.0in}

\setlength{\epigraphwidth}{0.7\textwidth}
\usepackage[titletoc]{appendix}

 %% <-- note this change
\begin{document}
\frontmatter
%%%\pagenumbering{roman} 
\tableofcontents
\mainmatter
%%%\pagenumbering{arabic} 
\include{chapter1}
\include{chapter2}
\end{document}
  • Hi Mico. Thanks a lot, I've incorporated your changes and it solved some problems but not all. I have almost the same situation as your example, but the difference is that I have more chapters. It seems as, when I am compiling bibliography, it only compiles the first bib file. Therefore, the first chapter compiles nicely with all the references being correct. The other chapters have (author?) or just ? for every reference that was not defined in the first chapter. Is there a way to tell tex to consider every chapter's bibliography separately? Tnx a lot! @Bernard Yes I did, see above – Mark Jun 26 '16 at 21:57
  • 1
    @Mark - Did you follow the instructions on p. 4 of the user guide of the chapterbib package? (Type texdoc chapterbib at a command prompt to launch the user guide in a pdf viewer.) – Mico Jun 26 '16 at 22:16
  • 1
    @Mark - In addition, you need to run BibTeX not on \jobname but separately (probably manually) on chapter1, chapter2, etc -- one per \included file. Then, run LaTeX twice more on \jobname. I'll update my example to highlight this requirement. – Mico Jun 27 '16 at 4:40
  • 1
    When using Chapterbib with Natbib, the correct setup is \usepackage[sectionbib]{natbib} \usepackage{chapterbib} See tex.stackexchange.com/questions/229846/… – Ross Jun 27 '16 at 5:14
  • 2
    @Ross - Thanks, I've updated the code. (Incidentally, my initial code works just fine too, but it's probably prudent to follow the instructions in sections 2.15 and 2.15.1 of the user guide of the natbib package...) – Mico Jun 27 '16 at 5:35

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.