书籍目录

书籍目录

在我的文档中,我想为每一章创建单独的参考书目。使用 chapterbib 包可以很好地完成此操作。但是,调用 chapterbib 包时,\bibentry 在包含的文件中不再起作用。MWE 显示主文档中有完整的引用,但章节中没有显示。

\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} 

答案1

子文件需要\nobibliography*包含命令才能正常\bibentry工作。此外,您确实应该将\bibliographystyle主文件的放在任何文件包含之前。对于您来说,这并不重要,但如果子文件中的样式不同,则会出现问题 - 所包含文件的每个辅助文件都被读取,bibtex因此它会遇到多个\bibstyle命令,只有第一个命令生效,因此需要正确排序主文件。

这对于标准书籍类来说都很好,但是scrbook你不能sectionbib使用chapterbib乙二胺四乙酸请参阅下文了解如何解决此问题

书籍目录

主要部分

样品主体部分

包含章节

样本包含章节

\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类,上述操作将正常工作,除非您将sectionbib选项传递给chapterbib。这是因为该sectionbib选项试图修补 的定义thebibliography,但scrbook会更改标准定义。但是,sectionbib可以通过发出以下命令来选择该选项的效果

\KOMAoption{bibliography}{leveldown}

在序言中,将参考书目切换为章节,然后\bib@leveldownfalse在主要参考书目之前适当转义,使其成为章节。

\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} 

相关内容