Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In my document I want to create a separate bibliography for each chapter. This works fine by using the chapterbib package. However, \bibentry does not work anymore in included files when invoking the chapterbib package. The MWE shows that the full cite is present in the main document, but does not show in the chapter.

\begin{filecontents}{mytestbib.bib}
@Article{einstein1911,
 author        = "Albert Einstein",
 title         = "On The influence of gravitation on the propagation of light",
 journal       = "Annalen Phys.",
 volume        = "35",
 pages         = "898-908",
 year          = "1911"}
\end{filecontents}

\begin{filecontents}{testchap.tex}
\chapter{light}
A full in-text cite of \bibentry{einstein1911}.\\
A regular citation: \citep{einstein1911}.
\bibliographystyle{apalike}
\bibliography{mytestbib}
\end{filecontents}

\documentclass{scrbook}
\usepackage{filecontents}
\usepackage{natbib}
\usepackage{bibentry}
\usepackage[sectionbib]{chapterbib}
\nobibliography*

\begin{document}
A full in-text cite of \bibentry{einstein1911}.\\
A regular citation: \citep{einstein1911}.

\include{testchap}

\bibliographystyle{apalike}
\bibliography{mytestbib}
\end{document} 
share|improve this question
    
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Jubobs Mar 5 at 21:04

1 Answer 1

up vote 2 down vote accepted

The subfiles need to have a \nobibliography* command included so that \bibentry works. In addition, you should really put the \bibliographystyle of the main file before any file inclusions. In your case it is not too important, but if you had different styles in the subfiles it would give a problem - each of the aux files for of the included files is read by bibtex and so it meets multiple \bibstyle commands, only the first one takes effect, hence the need of ordering the main file correctly.

This all works fine for the standard book class, however with scrbook you can not use the sectionbib option of chapterbib. EDTI See below for how to work around this

book.cls

Main part

Sample main part

Included chapter

Sample included chapter

\begin{filecontents}{mytestbib.bib}
@Article{einstein1911,
 author        = "Albert Einstein",
 title         = "On The influence of gravitation on the propagation of light",
 journal       = "Annalen Phys.",
 volume        = "35",
 pages         = "898-908",
 year          = "1911"}
\end{filecontents}

\begin{filecontents}{testchap.tex}
\nobibliography*

\chapter{Light}
A full in-text cite of \bibentry{einstein1911}.\\
A regular citation: \citep{einstein1911}.
\bibliographystyle{apalike}
\bibliography{mytestbib}
\end{filecontents}

\documentclass{book}
\usepackage{filecontents}
\usepackage{bibentry}
\usepackage{natbib}
\usepackage[sectionbib]{chapterbib}
\nobibliography*

\begin{document}
\bibliographystyle{apalike}

A full in-text cite of \bibentry{einstein1911}.\\
A regular citation: \citep{einstein1911}.

\include{testchap}

\bibliography{mytestbib}
\end{document} 

scrbook.cls

For scrbook class the above will work fine, unless you pass the sectionbib option to chapterbib. This is because the sectionbib option attempts to patch the definition of thebibliography, but scrbook changes the standard definition. However, the effect of the sectionbib option may be optianed by issuing

\KOMAoption{bibliography}{leveldown}

in the preamble, which switches bibliogrpahies to be sections, and then \bib@leveldownfalse, appropriately escaped, before the main bibliography to make this a chapter.

\begin{filecontents}{mytestbib.bib}
@Article{einstein1911,
 author        = "Albert Einstein",
 title         = "On The influence of gravitation on the propagation of light",
 journal       = "Annalen Phys.",
 volume        = "35",
 pages         = "898-908",
 year          = "1911"}
\end{filecontents}

\begin{filecontents}{testchap.tex}
\nobibliography*

\chapter{Light}
A full in-text cite of \bibentry{einstein1911}.\\
A regular citation: \citep{einstein1911}.
\bibliographystyle{apalike}
\bibliography{mytestbib}
\end{filecontents}

\documentclass{scrbook}
\usepackage{filecontents}
\usepackage{bibentry}
\usepackage{natbib}
\usepackage{chapterbib}
\nobibliography*

\KOMAoption{bibliography}{leveldown}

\begin{document}
\bibliographystyle{apalike}

A full in-text cite of \bibentry{einstein1911}.\\
A regular citation: \citep{einstein1911}.

\include{testchap}

\makeatletter
\bib@leveldownfalse
\makeatother
\bibliography{mytestbib}
\end{document} 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.