每章有不同的参考书目,并有共享的参考资料

每章有不同的参考书目,并有共享的参考资料

我尝试查看已发布的解决方案,但找不到适合我的情况的解决方案。我正在编写一篇包含章节的博士论文,其中包含一个主文件。格式如下

\documentclass[12pt, twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage[pagestyles]{titlesec}
\titleformat{\chapter}[display]{\normalfont\bfseries}{}{0pt}{\Huge}
\newpagestyle{mystyle}
{\sethead[\thepage][][\chaptertitle]{}{}{\thepage}}
\pagestyle{mystyle}
\usepackage[semicolon,round,sort&compress]{natbib}
\usepackage[sectionbib]{chapterbib}
\usepackage{hyperref}
\usepackage{epstopdf}
\usepackage{rotating}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{calc}
\usepackage{float}
\usepackage{indentfirst}
\usepackage{chronology}
\usepackage[toc,page]{appendix}
\usepackage{graphics}
\usepackage{color,soul}
\usepackage{tablefootnote}
\usepackage{epsfig}         
\usepackage{subfigure}
\usepackage{grffile}        
\usepackage{soul}
\usepackage{longtable}
\usepackage{lscape}
\usepackage{url}
\usepackage{epsfig} 
\graphicspath{ {images/} }
\usepackage{caption}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm

\begin{document}
\input{chapters/titlepage}

\mainmatter
\tableofcontents
\listoffigures
\listoftables

\chapter{Introduction}
\input{chapters/chap0}

\chapter{chap1}
\input{chapters/chap1}

\chapter{chap2}
\input{chapters/chap2}

\end{document}

每章末尾都有各自的参考书目,如下

\bibliographystyle{apalike}
\bibliography{chapters/bib0}

在第 0 章的情况下。请注意,由于每个章节都以 开头\section{},并且没有 ,因此无法单独编译\begin{document}。但是,只有第一个 (即第 0 章)才能正常工作\input{ }。从第 1 章开始,我得到的只是重复的第 0 章的参考书目。因此,我在文本中得到了 ?? 作为新参考的输出。警告说 ref'x' 被多次定义,后来又说 refx未定义。我该如何修复它?

Bibtek文件如下:

bib0

@article{acemoglu2000,
title={The colonial origins of comparative development: An empirical investigation},
author={Acemoglu, Daron and Johnson, Simon and Robinson, James A},
year={2000},
institution={National bureau of economic research}
}

@book{acemoglu2012,
title={Why nations fail: the origins of power, prosperity and poverty},
author={Acemoglu, Daron and Robinson, James A and Woren, Dan},
volume={4},
year={2012},
publisher={SciELO Chile}
}

围兜1

@article{acemoglu2000,
title={The colonial origins of comparative development: An empirical investigation},
author={Acemoglu, Daron and Johnson, Simon and Robinson, James A},
year={2000},
institution={National bureau of economic research}
}
@article{ackerberg2006,
title={Structural identification of production functions},
author={Ackerberg, Daniel and Caves, Kevin and Frazer, Garth},
year={2006}
}

编译过程如下:pdflatek -> biblatek -> pdflatek(x2)。看起来这是唯一有效的编译解决方案

答案1

\chapterbib由于with的使用不正确,引用不会按要求生成natbib。正确的用法是:

\usepackage[sectionbib]{natbib}
\usepackage{chapterbib}  

当不作为引文管理器使用时,每章末尾的参考文献natbib的用法为:\chapterbib

\usepackage[sectionbib]{chapterbib}

这是根据上传的代码生成每章末尾参考文献列表的完整文件。为方便起见,原始文件中的几个命令被隐藏。为了避免出现孤立的章节标题,我将命令移到了包含的文件中。为了简单起见,我还删除了和文件\chapter的路径。includedbib

PDFLaTeX记得在主文件上运行编译器 ( ),它将aux为每个包含的文件生成辅助文件 ( )。然后打开每个辅助文件并bibtex在每个文件上运行。这bbl将为每个章节生成文件。然后返回主文件并重新运行编译器两次。

\documentclass[12pt, twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage[pagestyles]{titlesec}
\titleformat{\chapter}[display]{\normalfont\bfseries}{}{0pt}{\Huge}
%\newpagestyle{mystyle}
%{\sethead[\thepage][][\chaptertitle]{}{}{\thepage}}
%\pagestyle{mystyle}\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Don't use this                                               %
%\usepackage[semicolon,round,sort&compress,sectionbib]{natbib} %
%\usepackage[sectionbib]{chapterbib}                           %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Replacement                                                  %
\usepackage[semicolon,round,sort&compress,sectionbib]{natbib}  %
\usepackage{chapterbib}                                        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{hyperref}
\usepackage{epstopdf}
\usepackage{rotating}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{calc}
\usepackage{float}
\usepackage{indentfirst}
\usepackage{chronology}
\usepackage[toc,page]{appendix}
\usepackage{graphics}
\usepackage{color,soul}
\usepackage{tablefootnote}
\usepackage{epsfig}         
\usepackage{subfigure}
\usepackage{grffile}        
\usepackage{soul}
\usepackage{longtable}
\usepackage{lscape}
\usepackage{url}
\usepackage{epsfig} 
\graphicspath{ {images/} }
\usepackage{caption}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry} % this was incomplete
\usepackage{filecontents}
% Create bib file for Introduction chapter
\begin{filecontents*}{bib0.bib}
@article{acemoglu2000,
    title={The colonial origins of comparative development: An empirical investigation},
    author={Acemoglu, Daron and Johnson, Simon and Robinson, James A},
    year={2000},
    institution={National bureau of economic research}
}
@book{acemoglu2012,
    title={Why nations fail: the origins of power, prosperity and poverty},
    author={Acemoglu, Daron and Robinson, James A and Woren, Dan},
    volume={4},
    year={2012},
    publisher={SciELO Chile}
}
\end{filecontents*}
%
% Create bib file for chapter 1. Note that it is not a requirement to have different bib files for each chapter.
\begin{filecontents*}{bib1.bib}
@article{acemoglu2000,
    title={The colonial origins of comparative development: An empirical investigation},
    author={Acemoglu, Daron and Johnson, Simon and Robinson, James A},
    year={2000},
    institution={National bureau of economic research}
}
@article{ackerberg2006,
    title={Structural identification of production functions},
    author={Ackerberg, Daniel and Caves, Kevin and Frazer, Garth},
    year={2006}
}
%
%Create Introduction
\end{filecontents*}
\begin{filecontents*}{chap0.tex}
    \chapter{Introduction}
    This is Chapter ``Introduction'' from included file chap0.tex. \\
    This is a citation for \cite{acemoglu2000} from bib0. \\
    \citep{acemoglu2012} is a citation for the second reference. \\
    The Reference list for introductory chapter appears next. \\
    \bibliographystyle{apalike}
    \bibliography{bib0}
\end{filecontents*}
%
% Create Chapter 1
\begin{filecontents*}{chap1.tex}
    \chapter{chap1}
    This is Chapter 1 from included file chap1.tex. \\
    This is a citation for \cite{acemoglu2000} from bib1. \\
    \citep{ackerberg2006} is a citation for the second reference. \\
    The Reference list for the chapter appears next. \\
    \bibliographystyle{apalike}
    \bibliography{bib1}
\end{filecontents*}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Suppress content not required for this solution %  
%\include{chapters/titlepage}                    %
%                                                %
%\mainmatter                                     %
%\tableofcontents                                %
%\listoffigures                                  %
%\listoftables                                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\include{chap0}
\include{chap1}
\end{document}

这是章节简介的输出

这是第 1 章的输出

答案2

对于那些使用biblatex而不是natbib只将章节放入refsection环境的人来说。这是一个使用与 Ross 相同的代码的示例。

\documentclass[12pt, twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
%Declaring the way I use Biblatex. You should change the params depending on %your styles
\usepackage[style=abnt,uniquename=init,giveninits]{biblatex}
\addbibresource{bib0.bib}
\addbibresource{bib1.bib}
\usepackage{filecontents}
% Create bib file for Introduction chapter
\begin{filecontents*}{bib0.bib}
@article{acemoglu2000,
    title={The colonial origins of comparative development: An empirical investigation},
    author={Acemoglu, Daron and Johnson, Simon and Robinson, James A},
    year={2000},
    institution={National bureau of economic research}
}
@book{acemoglu2012,
    title={Why nations fail: the origins of power, prosperity and poverty},
    author={Acemoglu, Daron and Robinson, James A and Woren, Dan},
    volume={4},
    year={2012},
    publisher={SciELO Chile}
}
\end{filecontents*}
%
% Create bib file for chapter 1. Note that it is not a requirement to have different bib files for each chapter.
\begin{filecontents*}{bib1.bib}
@article{acemoglu2000,
    title={The colonial origins of comparative development: An empirical investigation},
    author={Acemoglu, Daron and Johnson, Simon and Robinson, James A},
    year={2000},
    institution={National bureau of economic research}
}
@article{ackerberg2006,
    title={Structural identification of production functions},
    author={Ackerberg, Daniel and Caves, Kevin and Frazer, Garth},
    year={2006}
}
%
%Create Introduction
\end{filecontents*}
\begin{filecontents*}{chap0.tex}
%This is how you'd go if you use Biblatex
\begin{refsection}
    \chapter{Introduction}
    This is Chapter ``Introduction'' from included file chap0.tex. \\
    This is a citation for \cite{acemoglu2000} from bib0. \\
    \citep{acemoglu2012} is a citation for the second reference. \\
    The Reference list for introductory chapter appears next. \\
    \printbibliography
    \end{refsection}
\end{filecontents*}
%
% Create Chapter 1
\begin{filecontents*}{chap1.tex}
    \begin{refsection}
    \chapter{chap1}
    This is Chapter 1 from included file chap1.tex. \\
    This is a citation for \cite{acemoglu2000} from bib1. \\
    \citep{ackerberg2006} is a citation for the second reference. \\
    The Reference list for the chapter appears next. \\
    \printbibliography
    \end{refsection}
\end{filecontents*}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Suppress content not required for this solution %  
%\include{chapters/titlepage}                    %
%                                                %
%\mainmatter                                     %
%\tableofcontents                                %
%\listoffigures                                  %
%\listoftables                                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\include{chap0}
\include{chap1}
\end{document}

答案3

用 LaTeX 命令 \include 替换 TeX 原始输入。然后,您可以使用 LaTeX 命令 \includeonly{chapters/chap0} 选择要编译的部分。LaTeX 包含机制会自动处理交叉引用。

您将需要稍微重新组织一下您的输入,因为 \include 会强制分页(而您又不希望在章节标题之后立即分页)。

相关内容