單獨的羅馬數字參考書目,可隨處引用

單獨的羅馬數字參考書目,可隨處引用

我想在我的博士論文中包含兩份參考書目,其中第一個列出了我自己在論文中發表的出版物,並出現在開頭,用羅馬數字編號。然後,文本的主體應該能夠使用羅馬數字引用該參考書目,並使用普通數字引用主要參考書目。

到目前為止我最好的嘗試如下帶有羅馬數字和 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 所建議的,使用羅馬數字的速記欄位基本上可以解決問題。分離部分的工作原理是不對正文使用反省。

對於任何有興趣嘗試改進這一點的人來說,剩下的缺點是:

  • 需要在速記欄位中手動輸入羅馬數字
  • 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} 

相關內容