使用 chapterbib 和子目录进行编译过程

使用 chapterbib 和子目录进行编译过程

让我们考虑以下目录结构:

.
├── contents
│   ├── backmatter
│   │   ├── appendix.bib
│   │   └── appendix.tex
│   ├── frontmatter
│   │   ├── preface.bib
│   │   └── preface.tex
│   └── mainmatter
│       ├── chapter1.bib
│       ├── chapter1.tex
│       ├── chapter2.bib
│       └── chapter2.tex
└── main.tex

以及以下主文件:

% main.tex
\documentclass[oneside, 10pt]{book}

\usepackage[T1]{fontenc}
\usepackage[sf = false, tt = false]{libertine}
\usepackage{lipsum}
\usepackage[sectionbib]{chapterbib}
\usepackage{hyperref}

\begin{document}
\frontmatter
\include{contents/frontmatter/preface}
\mainmatter
\include{contents/mainmatter/chapter1}
\include{contents/mainmatter/chapter2}
\backmatter
\include{contents/backmatter/appendix}
\end{document}

问题:如何使用chapterbib包并编译整个内容,以便在每章末尾为每个章节生成一个参考书目部分?(我想要解释 没有 natbib如果这有任何改变)


前言:

% preface.tex
\chapter{Preface}

\section{Preface first section}
\lipsum[1]\cite{preface:ref1}

\section{Preface second section}
\lipsum[1]\cite{preface:ref2}

\section{Preface third section}
\lipsum[1]\cite{preface:ref3}

\bibliographystyle{alpha}
\bibliography{preface} 

和:

% preface.bib
@article{preface:ref1,
    author  = {Someone}, 
    title   = {Preface1},
    journal = {Journal},
    year    = 2000,
}

@article{preface:ref2,
    author  = {Someone}, 
    title   = {Preface2},
    journal = {Journal},
    year    = 2000,
}

@article{preface:ref3,
    author  = {Someone}, 
    title   = {Preface3},
    journal = {Journal},
    year    = 2000,
}

第一章:

% chapter1.tex
\chapter{First chapter}

\section{First chapter first section}
\lipsum[1]\cite{chapter1:ref1}

\section{First chapter second section}
\lipsum[1]\cite{chapter1:ref2}

\section{First chapter third section}
\lipsum[1]\cite{chapter1:ref3}

\bibliographystyle{alpha}
\bibliography{chapter1} 

和:

% chapter1.bib
@article{chapter1:ref1,
    author  = {Someone}, 
    title   = {FirstChapter1},
    journal = {Journal},
    year    = 2000,
}

@article{chapter1:ref2,
    author  = {Someone}, 
    title   = {FirstChapter2},
    journal = {Journal},
    year    = 2000,
}

@article{chapter1:ref3,
    author  = {Someone}, 
    title   = {FirstChapter3},
    journal = {Journal},
    year    = 2000,
}

第二章:

% chapter2.tex
\chapter{Second chapter}

\section{Second chapter first section}
\lipsum[1]\cite{chapter2:ref1}

\section{Second chapter second section}
\lipsum[1]\cite{chapter2:ref2}

\section{Second chapter third section}
\lipsum[1]\cite{chapter2:ref3}

\bibliographystyle{alpha}
\bibliography{chapter2} 

和:

% chapter2.bib
@article{chapter2:ref1,
    author  = {Someone}, 
    title   = {SecondChapter1},
    journal = {Journal},
    year    = 2000,
}

@article{chapter2:ref2,
    author  = {Someone}, 
    title   = {SecondChapter2},
    journal = {Journal},
    year    = 2000,
}

@article{chapter2:ref3,
    author  = {Someone}, 
    title   = {SecondChapter3},
    journal = {Journal},
    year    = 2000,
}

附录:

% appendix.tex
\chapter*{Appendix}

\section*{Appendix first section}
\lipsum[1]\cite{appendix:ref1}

\section*{Appendix second section}
\lipsum[1]\cite{appendix:ref2}

\section*{Appendix third section}
\lipsum[1]\cite{appendix:ref3}

\bibliographystyle{alpha}
\bibliography{appendix} 

和:

% appendix.bib
@article{appendix:ref1,
    author  = {Someone}, 
    title   = {Appendix1},
    journal = {Journal},
    year    = 2000,
}

@article{appendix:ref2,
    author  = {Someone}, 
    title   = {Appendix2},
    journal = {Journal},
    year    = 2000,
}

@article{appendix:ref3,
    author  = {Someone}, 
    title   = {Appendix3},
    journal = {Journal},
    year    = 2000,
}

相关内容