1

I'm having a problem with printing the bibliography at end of a book. The main .tex file is

\documentclass[a4paper,12pt]{book}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{url}
\usepackage[algoruled,vlined]{algorithm2e}
\usepackage{graphicx,subfigure}
\usepackage{booktabs}
\usepackage[usenames,dvipsnames]{color}

\usepackage[font=small,format=plain,labelfont=bf,up,textfont=it,up]{caption}

% fancy headers and footers
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.1pt} % for upper line
\renewcommand{\footrulewidth}{0.1pt} % for lower line
 \fancyhead[LE,RO]{\itshape \nouppercase \rightmark}\fancyhead[LO,RE]           {\itshape \nouppercase \leftmark}
\fancyfoot[C]{\thepage}

 \usepackage[semicolon]{natbib}

\usepackage{fancybox}

\usepackage{xcolor}
\usepackage{framed}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\newenvironment{myfancybox}{%
\def\FrameCommand{\fboxsep=\FrameSep \fcolorbox{black}}%
\color{black}\MakeFramed {\FrameRestore}}%
{\endMakeFramed}


\usepackage{rotating}


\usepackage{sectsty}
\allsectionsfont{\itshape}

\setlength{\headheight}{15pt}

\parskip1ex
\begin{document}

\include{forTest}
\bibliographystyle{plainnat}
\bibliography{refs}
\end{document}

In a document forTest.tex put

\chapter{abs}
\label{ch:grid}

\section{asdf }
As stated in \citep{ads}.

and the content of the refs.bib file that is in the same folder as the other files:

@inproceedings{ads,
author = "adfsdf, k.",
title = "adf",
booktitle = "sdaf",
series = "adsf",
pages = "19",
publisher = "sda",
year = 2008
}

After I hit pdflatex, citation adf is undefined. Note that the bib file is very large, and I should not adapt that file. I wonder if there is some other way to include it.

2
  • 4
    have you run bibtex? you need pdflatex bibtex pdflatex to sort out all the references Commented Jun 11, 2012 at 14:48
  • Many thanks. Note that by pdflatex only I managed to do some shorter documents, but that's different story, I guess.
    – boy
    Commented Jun 11, 2012 at 14:55

1 Answer 1

7

On the first run of latex you would always expect cross references to be undefined.

If using bibtex you need to run (pdf)latex once (to write the list of needed citations to the aux file) then you need to run bibtex (to generate the bbl file that contains the LaTeX code for the bibliography) Then you need to run (pdf)latex twice more to resolve all the cross references to the generated bibliography.

1
  • Yes, thanks. Now it works perfectly. I still have some questions related to referencing, but that will not be posted here.
    – boy
    Commented Jun 11, 2012 at 15:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .