# How to cite properly?

I have one bibliography at the end of each chapter.

I have a main file with:

    \documentclass[b5paper,8pt,twoside,parskip=half,numbers=noenddot,bibliography=tot ocnumbered,listof=totoc]{scrbook}
\input{formatAndDefs}
\input{mycommands}
\usepackage[utf8]{inputenc}

\usepackage{natbib}
\usepackage{chapterbib}
\sectionbib{\section}{section}

\DeclareUnicodeCharacter{00A0}{ }

\begin{document}
\pagenumbering{roman}
\input{TitlePage}
\frontmatter
\dominitoc
\input{Preface}
\input{AppendedPapers}
\tableofcontents
\listoffigures
\mainmatter

\input{chapter1}
\include{biblio1}
\input{chapter2}
\include{biblio2}
\input{chapter3}
\include{biblio3}

\end{document}


Each biblio1, biblio2, biblio3 file have the lines:

biblio1.tex: \nocite{*} \bibliographystyle{plain} \bibliography{1}

biblio2.tex: \nocite{*} \bibliographystyle{plain} \bibliography{2}

biblio3.tex: \nocite{*} \bibliographystyle{plain} \bibliography{3}

And finally, I have three .bib files: 1.bib, 2.bib, and 3.bib

For example, the file 3.bib contains:

@article{3clock,
author    = "S. Knappe; P. Schwindt; V. Gerginov; V. Shah; L. Liew; J. Moreland; H. Robinson; L. Hollberg; J. Kitching",
title     = "Microfabricated atomic clocks and magnetometers",
journal   = "Journal of Optics A",
volume ="8",
number= "7",
year      = "2006"
}
@article{3sel,
author    = "S. Seltzer; D. Rampulla; S. Rivillon-Amy; Y. Chabal; S.   Bernasek; M. Romalis",
title     = "Testing the effect of surface coatings on alkali atom polarization lifetimes",
journal   = "Journal of Applied Physics",
year      = "2008"
}

@article{3anderson,
author    = "L. Anderson; F. Pipkin; J. Baird",
title     = "Hyperfine structure of hydrogen, deuterium, and tritium",
journal   = "Physical Review",
volume ="120",
number= "4",
year      = "1960"
}


Finally, in chapter3.tex I have:

Posteriormente, en 1957, H. Dehmelt\cite{3anderson} introdujo la posibilidad de determinar un campo magnético mediante la medición de la frecuencia de precesión de Larmor de los spin atómicos que habían sido previamente polarizados. Esta idea fue exitosamente llevada a cabo de manera experimental por W. Bell y A. Bloom\cite{3sel}.


I want the complete bibliography at the end of each chapter and the corresponding numbering in the place where I cite in the chapter. Instead, i get a question mark.

I compiled in this way:

pdflatex thesis.tex bibtex biblio1.aux bibtex biblio2.aux bibtex biblio3.aux pdflatex thesis.tex pdflatex thesis.tex

Here is an image of the question marks:

• If you want a bibliography at each chapter you can use chapterbib package. If it's what you want I can make a proper answer Oct 6 '15 at 19:25

   \documentclass[b5paper,8pt,twoside,parskip=half,numbers=noenddot,bibliography=tot ocnumbered,listof=totoc]{scrbook}
\input{formatAndDefs}
\input{mycommands}
\usepackage[utf8]{inputenc}

\usepackage[sectionbib]{natbib} %sectionbib add as option to natbib
\usepackage{chapterbib}
\sectionbib{\section}{section}

\DeclareUnicodeCharacter{00A0}{ }

\begin{document}
\pagenumbering{roman}
\input{TitlePage}
\frontmatter
\dominitoc
\input{Preface}
\input{AppendedPapers}
\tableofcontents
\listoffigures
\mainmatter

\input{chapter1}
\include{biblio1}
\input{chapter2}
\include{biblio2}
\input{chapter3}

\include{biblio3}

\end{document}


You can keep all your file as you want. To compile the compilation is:

pdflatex thesis.tex
bibtex biblio1
bibtex biblio2
bibtex biblio3
pdflatex thesis.tex
pdflatex thesis.tex


By the way the \nocite{*} is not a good way to cite. Every entry of each bibliography will be cite and anyone could forgot to remove an entry.

• If I do what you suggest I get the question marks again in the places where I need the citation. In other hand, like now the bibliography is numbered, I get a new problem with that. I included the \nocite{*} because I want the complete bibliography at the end of the chapter. Oct 6 '15 at 19:48
• @Lau can you provide a screenshot of the question marks? Oct 6 '15 at 19:50
• @Lau I've seen your update. What's going when you remove the \nocite{*}? Oct 6 '15 at 20:01
• when I remove the \nocite{*} the question marks are still there. The only difference is that the bibliography does not appear at the end of the chapter, because i have no citations now Oct 6 '15 at 20:09
• @Lau at the enf of chapter 3 you should have a bibliography since you use \cite{foo} in a paragraph Oct 6 '15 at 20:14

I have found a solution:

The problem is that the chapters are add with an \input command instead of an \include command. Because of that, when you compile the first time

pdflatex thesis.tex


you does not generate any chapter.aux file, where you have the \cite{} commands. Then you can't compile the chapter with bibtex, and you get the question marks instead the citing number.

One solution is:

\documentclass[b5paper,8pt,twoside,parskip=half,numbers=noenddot,bibliography=tot ocnumbered,listof=totoc]{scrbook}
\input{formatAndDefs}
\input{mycommands}
\usepackage[utf8]{inputenc}

\usepackage{natbib}
\usepackage{chapterbib}
\sectionbib{\section}{section}

\DeclareUnicodeCharacter{00A0}{ }

\begin{document}
\pagenumbering{roman}
\input{TitlePage}
\frontmatter
\dominitoc
\input{Preface}
\input{AppendedPapers}
\tableofcontents
\listoffigures
\mainmatter

\include{chapter1}
%\include{biblio1} %copy the content of that file at the end of chapter1
\include{chapter2}
%\include{biblio2} %copy the content of that file at the end of chapter2
\include{chapter3}
%\include{biblio3} %copy the content of that file at the end of chapter3

\end{document}


Then you get the number of the cite correctly

And also the complete bibliography at the end of the chapter because of the \cite{*} command.

To compile the order is:

pdflatex thesis.tex
bibtex chapter1.aux
bibtex chapter2.aux
bibtex chapter3.aux
pdflatex thesis.tex
pdflatex thesis.tex