我有一份包含三个参考书目的报告,我想要不同的引用样式:
- 主要部分:作者-年份引用
- 附录 A:数字引用,需要在表格中容纳许多引用。
- 附录 B:作者年份引用。
附录 A 或 B 可以互换,但这对问题没有影响。
我尝试使用 biblatex 和 natbib + multibib 来实现这一点。使用 biblatex 根本无法实现,而使用 natbib + multibib 则有些接近,但在第三次引用/参考部分出现错误,请参阅下面 natbib + multibib 的 mwe。
这两种方法的问题似乎是只能有一种“基线”引用样式。最好使用类似于\def\@mb@citenamelist{...}
这样的技巧来定义样式\setcitestyletwo{...}
,但这似乎是不可能的。使用 pdfLaTeX 或 LuaLaTeX 进行编译没有区别。
有没有什么办法可以让这个设置正常工作?
最好的,罗伯特
\documentclass{article}
% needs to have the numbers option, otherwise the second cite will never display numbers
\usepackage[numbers]{natbib}
% https://tex.stackexchange.com/questions/66778/citation-alias-with-multibib-and-natbib
\def\@mb@citenamelist{cite,citep,citet,citealp,citealt,citeptwo,citettwo,citepthree,citetthree}
\usepackage[resetlabels]{multibib}
\newcites{two}{Second-Literature}
\newcites{three}{Third-Literature}
\begin{document}
\section{First}
\setcitestyle{authoryear,round}
Authoryear style cites: \citet{Knuth:1990}
\bibliographystyle{apalike}
\bibliography{testlib}
\section{Second}
\setcitestyle{numbers,square}
Numbers style cites: \citeptwo{Lamport:94} wrote latex.
\bibliographystyletwo{unsrtnat}
\bibliographytwo{testlib}
\section{Third}
\setcitestyle{authoryear,round}
(Desired) Authoryear style cites: \citetthree{Lamport:94alt} wrote latex, but is wrongly cited using the numbers format instead of year!
\bibliographystylethree{apalike}
\bibliographythree{testlib}
\end{document}
%%%% With the contents of testlib.bib as:
@Book{Knuth:1990,
author = {Knuth, Donald E.},
title = {The Texbook},
year = {1990},
isbn = {0-201-13447-0},
publisher = {Addison\,\textendash\,Wesley},
}
@Book{Lamport:94,
author = {Lamport, Leslie},
title = {latex: A Document Preparation System},
year = {1994},
isbn = {0-021-52983-1},
publisher = {Addison\,\textendash\,Wesley},
}
@Book{Lamport:94alt,
author = {Lamport, Leslie},
title = {latex: A Document Preparation System},
year = {1994},
isbn = {0-021-52983-1},
publisher = {Addison\,\textendash\,Wesley},
}