比如,加入chapterbib包(\usepackage{chapterbib})具体如何使用,我们选了一个例子:
下面有一个比较完整的例子:
\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}
这里需要注意的是:编译时,先对主文件进行 latex 编译,再分别对各个章节文件进行 bibtex 编译,再对主文件两次latex。即:latex main.tex, bibtex chap0, bibtex chap1.tex, latex main.tex,.. 。这样就可以正常显示了。
选自:https://www.jianshu.com/p/220377fc8d0a https://www.douban.com/note/331370169/
发表评论 取消回复