[Tex/LaTex] Book class does not recognise the references in the bib file

author-numbercitingnatbib

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

Best Answer

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}
Related Question