我希望我的博士论文中有两份参考书目,其中第一份列出论文中包含的我自己的出版物,并出现在开头,用罗马数字编号。然后正文的主体应该能够引用这份参考书目,使用罗马数字,而主要参考书目则使用普通数字。
这是我迄今为止最好的尝试,带罗马数字和 Biblatex 的子书目和一些其他线程,有两个缺点:第一个参考书目的引用是用拉丁数字编号的,而我根本无法在正文中引用第一个参考书目(我想要引用它的地方)。
最小(不完全)工作示例:
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\DeclareFieldFormat{Roman}{\RN{#1}}
% The following definition is copied from numeric.bbx
\defbibenvironment{roman-numerals}
{\list
{\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield[Roman]{labelnumber}}}
{\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hss##1}}
{\endlist}
{\item}
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
@misc{B02,
author = {Buthor, B.},
year = {2002},
title = {Bravo},
}
\end{filecontents}
\begin{filecontents}{\jobname-mine.bib}
@misc{Mine1,
author = {Me, M.},
year = {2001},
title = {Alpha},
}
@misc{Mine2,
author = {Me, M.},
year = {2002},
title = {Bravo},
}
@misc{Mine3,
author = {Me, M.},
year = {2003},
title = {Charlie},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{\jobname-mine.bib}
\begin{document}
\begin{refsection}[\jobname-mine.bib]
\nocite{*}
\printbibliography[title={My publications}, env=roman-numerals]
\end{refsection}
Some text that won't be here, but note roman numerals don't work even here \cite{Mine1, Mine3}.
\section{Main text}
\begin{refsection}[\jobname.bib]
Citing things in body \cite{A01, B02}. Would like to cite things in section mine \cite{Mine1}
\printbibliography[title=References]
\end{refsection}
\end{document}
答案1
我找到了一个足以满足我自己目的的解决方案,所以我回答了自己的问题。正如@cfr 所建议的,使用罗马数字的简写字段基本上可以解决问题。分隔部分通过不对正文使用 refsection 来工作。
对于有兴趣尝试改进这一点的人来说,剩下的缺点是:
- 需要在速记字段中手动输入罗马数字
- DeclareSourceMap 似乎有点过头了,因为它只是阻止我的出版物重新出现在主书目中。有没有更好的方法可以做到这一点?
- 如果有人想在主体中使用单独的引用部分,这将不起作用(幸运的是,我没有这样做)
代码:
\documentclass{article}
\usepackage[backend=biber]{biblatex}
%test data: other references
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
@misc{B02,
author = {Buthor, B.},
year = {2002},
title = {Bravo},
}
\end{filecontents}
%test data: my papers
\begin{filecontents}{\jobname-mine.bib}
@misc{Mine1,
author = {Me, M.},
year = {2001},
title = {My Alpha},
shorthand={\RN{1}}
}
@misc{Mine2,
author = {Me, M.},
year = {2002},
title = {My Bravo},
shorthand={\RN{2}}
}
@misc{Mine3,
author = {Me, M.},
year = {2003},
title = {My Charlie},
shorthand={\RN{3}}
}
\end{filecontents}
%Auto-add the keyword thpaper. Not strictly necessary, but saves some trouble
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{\perdatasource{\jobname-mine.bib} \step[fieldset = keywords, fieldvalue = {thpaper}]
}
}
}
\addbibresource{\jobname.bib}
\addbibresource{\jobname-mine.bib}
\begin{document}
%Print the references to my papers. Refsection allows easy shortcutting with nocite{*} limited to the correct file
\begin{refsection}[\jobname-mine.bib]
\nocite{*}
\printbibliography[title={My publications}]
\end{refsection}
\section{Main text}
Citing things in body \cite{A01, B02}. Would like to cite my own publications \cite{Mine1}, and now it works, with the roman numerals even.
%Print the main bibliography, notkeyword=thpaper keeps my papers from re-appearing.
%Using a refsection with a filename would be nicer, but that breaks the citations to my
%publications.
\printbibliography[title=References, notkeyword=thpaper]
\end{document}