使用 LaTeX,如何在每个部分的末尾提供参考文献列表?

发布于 2024-08-25 22:32:38 字数 1459 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

遮了一弯 2024-09-01 22:32:39

如果您使用 Biblatex,则 引用文章标题,您可以使用它在章节或章节末尾生成参考书目,或者甚至有一个按章/节分隔的组合参考书目。作为一个包,它旨在取代“babelbib、bibtopic、bibunits、chapterbib、cite、inlinebib、mlbib、multibib、splitbib”。

您可以通过以下三种方式之一在每个部分后放置参考书目。首先,将节的文本包装在 \begin{refsection}/\end{refsection} 对中,如下所示

\section{SomeSectionName}
\begin{refsection}
% your text goes here
\printbibliography
\end{refsection}
\section{NextSection}

其次,在每个 \section 语句,您放置一个 \newrefsection 语句,该语句结束上一节并开始新一节。并且,您再次在下一个 \section 之前加上 \printbibliography 语句。最后,有一个 refsection 包选项,可以采用 nonepartchaptersection< /code> 或 subsection 作为参数。要将全局书目中每个部分的书目条目分组,请使用 refsegment 代替,使用 \bibbysegment 按顺序打印所有段。 (\bibbysection 也可以以相同的方式用于参考部分。)

我不知道根据 @Norman 的回答,您需要将文本拆分多少,但是做一点实验你就可以弄清楚。

If you are using Biblatex, as for citing article titles, you can use it to produce bibliographies at the end of sections or chapters, or even have a combined bibliography where they are separated by chapter/section. As a package, it is intended to replace "babelbib, bibtopic, bibunits, chapterbib, cite, inlinebib, mlbib, multibib, splitbib."

You can put a bibliography after each section, in one of three ways. First, wrap the text of your section in a \begin{refsection}/\end{refsection} pair, as such

\section{SomeSectionName}
\begin{refsection}
% your text goes here
\printbibliography
\end{refsection}
\section{NextSection}

Second, after each \section statement you put a \newrefsection statement which ends the previous section and begins the new one. And, you precede the next \section with a \printbibliography statement, again. Finally, there is a refsection package option that takes either none, part, chapter, section, or subsection as an argument. To group your bibliographic entries per section in a global bibliography you use refsegment instead, using \bibbysegment to print all the segments in order. (\bibbysection can be used in the same manner for ref-sections, too.)

I don't know how much you'll have to split up your text, as per @Norman's answer, but with a little experimentation you can figure it out.

青巷忧颜 2024-09-01 22:32:39

此外,

\usepackage[sectionbib]{natbib}
\usepackage{chapterbib}

您还必须将每个部分放入单独的 .tex 文件中,然后\include。您必须分别对每个 .tex 文件运行 bibtex

注意:使用 \input 而不是 \include 可以避免不必要的分页符,但它不会创建 BibTeX 完成其工作所需的 .aux 文件。我查看了 \include 的定义,除了完全禁用 \clearpage 之外,我不知道如何禁用分页功能。您可以

\let\originalclearpage=\clearpage
\def\clearpage{\relax}

\begin{document} 之后尝试,但您可能必须手动放入一些 \originalclearpage

In addition to

\usepackage[sectionbib]{natbib}
\usepackage{chapterbib}

You will have to put each section in a separate .tex file which you then \include. You will have to run bibtex on each .tex file separately.

N.B. Using \input rather than \include avoids unwanted page breaks, but it will not create the .aux file that BibTeX needs to do its work. I looked at the definition of \include, and I don't see how to disable the page-breaking function except by disabling \clearpage entirely. You could try

\let\originalclearpage=\clearpage
\def\clearpage{\relax}

right after your \begin{document}, but you may have to put some \originalclearpage in by hand.

墨离汐 2024-09-01 22:32:39

@celenius - 如果你真的想摆脱那个分页符,这里有一个非常脏技巧来做到这一点......

\makeatletter
\let\O@@input@\@input@
\def\@noclearpage{\@ifnextchar\clearpage\@gobble\relax}
\def\@input@#1{\O@@input@{#1}\@noclearpage}
\let\O@@include\@include
\def\@include{\expandafter\@noclearpage\O@@include}
\let\O@include\include
\def\include{\expandafter\@noclearpage\O@include}
\makeatother

基本上我们对 \include 宏进行手术以获得摆脱所有 \clearpage 实例,但最干净的方法,如您所见,仍然真的很脏。这是非常脆弱的,并且可能只适用于 article 类,因此如果您使用不同的 \documentclass ,那么您就不走运了。我基本上是通过启用 \tracingcommands=1\tracingmacros=1 并 grep .log 文件来获取 \clearpage 以便我可以破解在其之前调用的任何内容以插入 \@noclearpage

我不推荐这个解决方案 - 最好研究一下 chapterbib 的工作原理并以正确的方式修复它,而不依赖于 \include 和单独的 >.aux 它生成的文件...但我确信这将是一项非常困难的任务。我想另一种解决方法是编写一个命令来模拟 \include.aux 文件的分解,而不实际执行包含...


EDIT: okay, here's a quickie

\makeatletter
\newenvironment{auxfile}[1]{\relax
  \ifnum\@auxout=\@partaux
    \@latex@error{auxfile environments cannot be nested or \string\include d}
    \@eha
  \else\@changeaux{#1}\fi
}{\immediate\closeout\@partaux\let\@auxout\@mainaux}
\def\@changeaux#1{%
  \immediate\write\@mainaux{\string\@input{#1.aux}}%
  \let\@auxout\@partaux
  \immediate\openout\@partaux#1.aux%
  \immediate\write\@partaux{\relax}}
\makeatother

然后您只需插入 \begin{auxfile}{foo}...\end{auxfile} ,它将使用 foo.aux 而不是正常的 。 aux 文件。这与chapterbib完全兼容。我认为 CTAN 没有这样的东西,所以也许我会将其作为迷你包提交。

@celenius - if you really want to get rid of that pagebreak, here's a very dirty trick to do it...

\makeatletter
\let\O@@input@\@input@
\def\@noclearpage{\@ifnextchar\clearpage\@gobble\relax}
\def\@input@#1{\O@@input@{#1}\@noclearpage}
\let\O@@include\@include
\def\@include{\expandafter\@noclearpage\O@@include}
\let\O@include\include
\def\include{\expandafter\@noclearpage\O@include}
\makeatother

Basically we perform surgery on the \include macro to get rid of all the \clearpage instances, but the cleanest way to do this, as you can see, is still really dirty. This is horribly brittle and will likely only work for the article class, so if you're using a different \documentclass, you're out of luck. I basically derived this by enabling \tracingcommands=1 and \tracingmacros=1 and grepping the .log file for \clearpage so that I could hack whatever gets called before it to insert a \@noclearpage.

I don't recommend this solution - it would be much better to look into how chapterbib works and fix it the right way, without depending on \include and the separate .aux files it generates... but I'm positive that would be a pretty difficult task. I guess another workaround would be to write a command to emulate \include's breaking up of .aux files, without actually doing the includes...


EDIT: okay, here's a quickie

\makeatletter
\newenvironment{auxfile}[1]{\relax
  \ifnum\@auxout=\@partaux
    \@latex@error{auxfile environments cannot be nested or \string\include d}
    \@eha
  \else\@changeaux{#1}\fi
}{\immediate\closeout\@partaux\let\@auxout\@mainaux}
\def\@changeaux#1{%
  \immediate\write\@mainaux{\string\@input{#1.aux}}%
  \let\@auxout\@partaux
  \immediate\openout\@partaux#1.aux%
  \immediate\write\@partaux{\relax}}
\makeatother

Then you can just insert \begin{auxfile}{foo}...\end{auxfile} and it will use foo.aux instead of the normal .aux file. This is fully compatible with chapterbib. I don't think CTAN has anything like this, so maybe I'll submit it as a mini-package.

萌逼全场 2024-09-01 22:32:39

我还没有尝试过,但当我读到它时,它表明:

\usepackage[sectionbib]{natbib} % Note the option in the optional argument
\usepackage{chapterbib}

虽然我只是猜测这些行的正确顺序。

I haven't tried it but as I read that it suggests:

\usepackage[sectionbib]{natbib} % Note the option in the optional argument
\usepackage{chapterbib}

though I'm only guessing at the correct order of those lines.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文