目标是拥有一个可以获取引用关键字并将其显示在节标题中的环境,除其他事项外。为了 MWE,我大大简化了环境。代码如下:
\documentclass[10pt]{article}
\usepackage[globalcitecopy,subsectionbib]{bibunits}
\usepackage[round]{natbib}
\usepackage[nottoc,numbib]{tocbibind}
\begin{filecontents*}{mwecitations.bib}
@book{goossens93,
author = "Frank Mittelbach and Michel Goossens and Johannes Braams and David Carlisle and Chris Rowley",
title = "The {LaTeX} Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts"
}
@article{fujita2010economic,
title={Economic effects of the unemployment insurance benefit},
author={Fujita, Shigeru},
journal={FRB Phil. Business Review},
volume={4},
year={2010}
}
@article{rothstein2011unemployment,
title={Unemployment insurance and job search in the {Great Recession}},
author={Rothstein, Jesse},
journal={NBER},
volume={w17534},
year={2011}
}
\end{filecontents*}
\newenvironment{thediscussion}[1]{\section*{\cite*{#1}}}{\putbib \pagebreak}
\defaultbibliography{mwecitations}
\defaultbibliographystyle{plainnat}
\bibliographystyle{plainnat}
\begin{document}
\bibliographyunit[\section]
\tableofcontents
\begin{thediscussion}[goossens93]
Discussion goes here.
\end{thediscussion}
\begin{thediscussion}[rothstein2011unemployment]
More discussion here.
Additional citations are \cite*{rothstein2011unemployment} and \cite*{fujita2010economic}.
\end{thediscussion}
\section{Appendix}
\renewcommand{\bibname}{Global bibliography}
\bibliography{mwecitations}
\end{document}
输出看起来很奇怪:
似乎这些部分无法被识别,或者我输入的环境参数不正确。我做错了什么?
答案1
您已将环境定义为具有一个强制参数,因此语法应该是
\begin{thediscussion}{goossens93}
不是
\begin{thediscussion}[goossens93]
事实上,您正在将参数传递[
给环境(这将是一个未知的引用),然后将其排版goosens93]
为根本不在参数中的文本。