從 .bib 檔案取得子目錄中單獨章節的引用

從 .bib 檔案取得子目錄中單獨章節的引用

事實上我是 LaTeX 的新手。我想列印每一章的參考書目。我嘗試過但失敗了。我的文件結構如下:

該資料夾中texfiles有一個名為 的子資料夾chapters和兩個文件,一個.tex名為主文件main.tex,另一個.bib文件名為bibliography.bibfile。

該子資料夾chapters包含兩個.tex文件,它們是chapter01.texchapter02.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=chapterbiblatex您可以獲得您想要的。

然後你可以寫

\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}

以及由此產生的兩個參考書目:

第一書目

第二參考書目

相關內容