
事實上我是 LaTeX 的新手。我想列印每一章的參考書目。我嘗試過但失敗了。我的文件結構如下:
該資料夾中texfiles
有一個名為 的子資料夾chapters
和兩個文件,一個.tex
名為主文件main.tex
,另一個.bib
文件名為bibliography.bib
file。
該子資料夾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 作業系統中使用“Texstudio”編譯器。請幫助我做到這一點。提前致謝。
答案1
透過選項refsegment=chapter
,biblatex
您可以獲得您想要的。
然後你可以寫
\printbibliography[segment=\therefsegment,title=first bib]
和選項segment=\therefsegment
為您提供當前片段中僅引用的參考文獻條目的參考書目。
請看下面的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}
以及由此產生的兩個參考書目:
和