从 .bib 文件中获取子目录中单独章节的引用

从 .bib 文件中获取子目录中单独章节的引用

其实我是 LaTeX 新手。我想打印每章的参考书目。我试过但失败了。我的文件结构如下:

该文件夹中texfiles有一个名为的子文件夹chapters和两个文件,一个.tex名为的主文件main.tex,另一个.bib名为的bibliography.bib文件。

该子文件夹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 OS 中使用“Texstudio”编译器。请帮我完成此操作。提前致谢。

答案1

通过选择refsegment=chapterbiblatex您可以得到您想要的。

然后你可以写

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

以及由此产生的两个参考书目:

第一书目

第二份书目

相关内容