3

I am writing my PhD thesis using TeXmaker.

%---------------------Preamble---------------%
\documentclass[b5paper,twoside,10pt,openany]{book}
\usepackage[margin=1in]{geometry}       
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[bitstream-charter]{mathdesign}
\usepackage{amsmath}
\usepackage{sectsty}
\usepackage{natbib}
\usepackage{chapterbib}
\pagenumbering{gobble}                      
\usepackage{graphicx}                       
\usepackage[normalem]{ulem}     
\providecommand\phantomsection{}
\setcounter{secnumdepth}{3}

%---------------------Document starts here---------------%
\begin{document}

\input{titlepage}
\input{dedication}
\input{abstract}

%---------------------Chapters in the thesis---------------%

\input{chapter1}
\input{chapter2}

%------------------------------------%

\end{document} 

%------------------------------------%

within each chapter: a separate bibliography and bibliography style (unsrt) is defined.

When I do: bibtex chapter1, I get an error:

Process started I couldn't open file name `chapter1.aux' Process exited normally.

Can anyone help?

lockstep
  • 250,273
abhishek
  • 465

2 Answers2

6

Without using \include you have to use the command \cbinput and the environment cbunit in the several input files.

Here is a complete minimal example for chapterbib (load it before babel!) with \include which makes more sense:

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}

\begin{filecontents*}{chap1.tex}
\chapter{Introduction} foo 
 \ldots~\cite{book-full} \ldots
 \bibliographystyle{alpha} \bibliography{xampl}
\end{filecontents*}
\begin{filecontents*}{chap2.tex}
\chapter{Grundlagen} bar
 \ldots~\cite{article-full} 
 \bibliographystyle{plain} \bibliography{xampl}
\end{filecontents*}

\usepackage[sectionbib]{chapterbib}
\usepackage[english]{babel}
% bibtex chap1  bibtex chap2
\begin{document}
\include{chap1}
\include{chap2}
\end{document}

running

pdflatex test.tex
bibtex chap1
bibtex chap2
pdflatex test.tex
pdflatex test.tex

has the output:

enter image description here

The bibfile xampl.bib is part of any TeX distribution.

5

Using biblatex will give you more or less the power and benefits from all specialized packages combined in one, the only drawback is that many journals do not accept biblatex, but in my experience that is also the case for bibtex. For your PhD thesis, you are free to choose, so I would recommend biblatex, because it is powerful and flexible.

Below is a working example, mainly copied form Herberts example.
You just have to run pdflatex-biber-pdflatex to see the output.

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{blindtext}
\usepackage{filecontents}
%
\begin{filecontents*}{chap1.tex}
\chapter{Introduction}  
 \blindtext~\parencite{bertram} 
 \blindtext~\textcite{doody}
 \printbibliography[segment=1,heading=subbibliography]
\end{filecontents*}
%
\begin{filecontents*}{chap2.tex}
\chapter{Grundlagen} 
 \blindtext~\citep{aksin} 
 \blindtext~\citet{glashow}
\printbibliography[segment=2,heading=subbibliography]
\end{filecontents*}

\usepackage[autostyle]{csquotes}
\usepackage[refsegment=chapter,style=numeric,natbib=true]{biblatex}
\addbibresource{biblatex-examples.bib}
\usepackage[]{hyperref}
\hypersetup{colorlinks=true}

\begin{document}
\include{chap1}
\input{chap2}
\end{document}

Some more comments: biblatex does not use the aux file, so you can use include or input as you prefer. biblatex-examples.bibis a file that is included with all major distributions, use a different name for your own .bib file.

If you want to learn more, take a look at these examples or start reading some of the biblatex questions, for example this one or this one.

matth
  • 12,381