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
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}
I'm not aware of a BibTeX style file for PNAS, but the Bibulous project does provide an easy way of customizing styles. For the style suggestions linked to by the OP, it took me only a few minutes to put together a complete style template to follow PNAS' requirements. Using the following main.bib database file
@ARTICLE{Neuhaus,
author = {Jean-Marc Neuhaus and Liliane Sitcher and Meins, Jr, Frederick and Thomas Boller},
year = {1991},
title = {A short C-terminal sequence is necessary and sufficient for the targeting of chitinases to the plant vacuole},
journal = {Proc Natl Acad Sci USA},
volume = {88},
number = {22},
pages = {10362-10366}
}
@INCOLLECTION{Hill,
author = {Adrian V. S. Hill},
year = {1991},
title = {HLA associations with malaria in Africa: some implications for MHC evolution},
booktitle = {Molecular Evolution of the Major Histocompatibility Complex},
editor = {Jan Klein and Dagmar Klein},
publisher = {Springer},
address = {Heidelberg},
pages = {403-420}
}
and the style template file main.bst (the lines below show the complete file)
TEMPLATES:
article = <au> (<year>) <title>. \textit{<journal>} <volume>(<number>): [<startpage>--<endpage>|<startpage>|<eid>|].[ <note>]
incollection = <au> (<year>) <title>. \textit{<booktitle>}[, vol.~<volume>, ][, <edition_ordinal>~ed.][, <null.if_singular(editorlist, edmsg1, edmsg2)>~<ed>][, <series>][, Chap.~<chapter>] (<publisher>, <address>)[, pp~<startpage>--<endpage>|p~<startpage>|<eid>|].[ <note>]
SPECIAL-TEMPLATES:
authorlist = <author.to_namelist()>
editorlist = <editor.to_namelist()>
authorname.n = [<authorlist.n.prefix> ]<authorlist.n.last>[ <authorlist.n.first.initial()>][<authorlist.n.middle.initial().compress()>][, <authorlist.n.suffix>]
au = <authorname.0>, ..., <authorname.9>
editorname.n = [<editorlist.n.prefix> ]<editorlist.n.last>[ <editorlist.n.first.initial()>][<editorlist.n.middle.initial().compress()>][, <editorlist.n.suffix>]
ed = <editorname.0>, ..., <editorname.9>
null = {}
OPTIONS:
edmsg1 = ed
edmsg2 = eds
compiling the main.tex file
\documentclass{article}
\usepackage[paper=letterpaper, text={6.5in,9in},centering]{geometry}
\makeatletter %
\renewcommand{\@biblabel}[1]{#1.}
\makeatother
\begin{document}
\nocite{Neuhaus,Hill}
\bibliography{temp}
\bibliographystyle{temp}
\end{document}
produces the following formatted result:
This provides templates for only journal articles and articles/chapters in books, but the PNAS website provides guidelines for only these two. Templates for other entry types are easily derived from the two shown here. (For example, a book
entry type template can be defined by adding another line
book = <au> (<year>) <title>. ...
in the lines below TEMPLATE:
in the style template file.)
Best Answer
See comments on switching to
biblatex
andbiber
- if you want to keep usingbibtex
, read on.You're missing a
\nobibliography*
command - see the documentation and here for details.But even with the
\nobibliography*
command there is no output of\bibentry
- this seems to be a problem with theagsm
style since switching toplain
style does fix the problem:The problem is indeed with the format of the .bbl file created with the
agsm
style - compare the created .bbl:with the format mentioned in the documentation under '4. Caveats':
they obviously don't fit.