其实我是 LaTeX 新手。我想打印每章的参考书目。我试过但失败了。我的文件结构如下:
该文件夹中texfiles
有一个名为的子文件夹chapters
和两个文件,一个.tex
名为的主文件main.tex
,另一个.bib
名为的bibliography.bib
文件。
该子文件夹chapters
包含两个.tex
文件,它们是chapter01.tex
和chapter02.tex
。
该目录texfiles
包含:
1.
main.tex
:
\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
%\usepackage[sectionbib]{chapterbib}
\usepackage{biblatex}
\usepackage[numbers]{natbib}
\bibliography{bibliography}
\bibliographystyle{ieeetr}
\begin{document}
\author{Author's Name}
\title{Simple Book Example}
\date{January 2017}
\frontmatter
\maketitle
\tableofcontents
\mainmatter
\include{./chapters/chapter01}
\include{./chapters/chapter02}
\backmatter
\end{document}
2.
bibliography.bib
:
@book{id1,
author = {author},
title = {title},
date = {date},
publisher={aaaaaaa},
year={2017}
}
@book{id2,
author = {author},
title = {title},
date = {date},
publisher={sdddddddds},
year={2017}
}
子目录chapters
内容如下:
1.
chapter01.tex
:
\chapter{Title of chapter 1}
some text of chapter 1
\section{Title of section}
some text of section of chapter 1
\cite{id1,id2}
\printbibliography
2.
chapter02.tex
:
\chapter{Title of chapter 2}
some text of chapter 2
\section{Title of section}
some text of section of chapter 2
\cite{id1,id2}
\printbibliography
我在 Linuxmint OS 中使用“Texstudio”编译器。请帮我完成此操作。提前致谢。
答案1
通过选择refsegment=chapter
,biblatex
您可以得到您想要的。
然后你可以写
\printbibliography[segment=\therefsegment,title=first bib]
并且选项segment=\therefsegment
为您提供了当前段中仅引用的 bib 条目的参考书目。
请参阅以下 MWE
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{id1,
author = {author},
title = {title},
date = {date},
publisher={aaaaaaa},
year={2017}
}
@book{id2,
author = {author},
title = {title},
date = {date},
publisher={sdddddddds},
year={2017}
}
\end{filecontents}
\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[%
refsegment=chapter, % <===============================================
natbib
]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
\author{Author's Name}
\title{Simple Book Example}
\date{January 2017}
\frontmatter
\maketitle
\tableofcontents
\mainmatter
\chapter{Title of chapter 1}
some text of chapter 1
\section{Title of section}
some text of section of chapter 1
\cite{id1,id2}
\printbibliography[segment=\therefsegment,title=first bib] % <==========
\chapter{Title of chapter 2}
some text of chapter 2
\cite{id1}
\printbibliography[segment=\therefsegment,title=second bib] % <=========
\backmatter
\end{document}
以及由此产生的两个参考书目:
和