
私は解決策を適応させようとしていますここそしてここ私の目標は次のとおりです。参考文献を 2 つのセクションに分割します。最初のセクションは引用の種類ごとに複数のサブセクションに分割し、この最初のセクションの引用には追加のプレフィックスを付けてAO
色付けします。2 番目のセクションの引用にはプレフィックスがなく、特定の分割や色付けはありません。
次のコードを使用すると、ほぼ満足のいく結果が得られます。
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{file1.bib}
@article{article1,
author = {Onymous, Anne},
title = {First Bibliography: An Journal Article},
date = {2000},
}
@inproceedings{inproc1,
author = {Onymous, Anne},
title = {First Bibliography: A Conference Article},
date = {1899},
}
\end{filecontents}
\begin{filecontents}{file2.bib}
@article{article2,
author = {Writer, William},
title = {Second Bibliography: A First Reference},
date = {2010},
}
@article{article2bis,
author = {Poetaster, Paula},
title = {Second Bibliography: A Second Reference},
date = {1767},
}
\end{filecontents}
\usepackage[
backend=biber,
hyperref=true,
backref=true,
giveninits=true,
citestyle=numeric-comp,
bibstyle=numeric,
sortcites=false,
maxbibnames=99,
maxcitenames=2,
sorting=none,
defernumbers=true,
]{biblatex}
\addbibresource{file1.bib}
\addbibresource{file2.bib}
\usepackage[dvipsnames]{xcolor}
% https://tex.stackexchange.com/questions/470852/different-colors-for-each-bib-file-and-custom-prefix
\DeclareSourcemap{
\maps[datatype=bibtex,overwrite]{
\map{
\perdatasource{file1.bib}
\step[fieldset=keywords, fieldvalue={,mypapers}, append]
}
}
\maps[datatype=bibtex,overwrite]{
\map{
\perdatasource{file2.bib}
\step[fieldset=keywords, fieldvalue={,otherpapers}, append]
}
}
}
% https://tex.stackexchange.com/questions/368247/how-to-colorise-specific-entries-in-the-bibliography-and-corresponding-reference
\renewbibmacro{in:}{}
\DeclareFieldFormat{labelprefix}{%
\ifkeyword{mypapers}
{\textcolor{red}{#1}}
{#1}}
\DeclareFieldFormat{labelnumber}{%
\ifkeyword{mypapers}
{\textcolor{red}{#1}}
{#1}}
\begin{document}
\title{Citation Test}
\author{Ann Onymous}
\maketitle
\cite{inproc1} \cite{article1} \cite{article2} \cite{article2bis}
\section*{Publications}
\newrefcontext[labelprefix=AO]
\printbibliography[type=inproceedings,keyword=mypapers,heading=subbibliography,title={Publications in Conference Post-Proceedings}]
\printbibliography[type=article,keyword=mypapers,heading=subbibliography,title={Journal Articles}]
\newrefcontext
\printbibliography[keyword=otherpapers]
\end{document}
しかし、ラベル付けが間違っています。引用はそれぞれ、、、とラベル付けされていますAO1
。AO1
理想2
的3
には、最初のセクションのすべての引用が一意のカウンターを共有し、つまりAO1
、、AO2
などのラベルが付けられ、2 番目のセクションの引用が 1 から再び始まり、つまり1
、、、2
などのラベルが付けられるようにしたいと思います。最初の引用が終了するところ、つまりこの例では から始まっても構いません3
。しかし、同じラベルを持つ 2 つの異なる引用を持つことは不可能です...
を削除するとnewrefcontext
、期待どおりの色付けと一意の番号付けが得られますが、プレフィックスが失われるため残念です。
resetnumbers
の鍵は見つかりました\printbibliography
が、正しい使い方がわかりません。
答え1
もうすぐ完了です。あとはコマンドresetnumbers
にいくつか追加するだけです\printbiliography
:
\newrefcontext[labelprefix=AO]
\printbibliography[type=inproceedings,keyword=mypapers,heading=subbibliography,title={Publications in Conference Post-Proceedings}]
\printbibliography[resetnumbers=false,type=article,keyword=mypapers,heading=subbibliography,title={Journal Articles}]
\newrefcontext
\printbibliography[resetnumbers=true,keyword=otherpapers]
を使用する場合defernumbers
、各ツールを何回実行するかに注意する必要があることに注意してください。補助ファイルがまったくないクリーンな状態から始めます (ほとんどのエディターには、.aux
など.bcf
のファイルをすべて削除する「クリーン」機能があります)。次に を実行します。を使用する場合は、 の後に を 2 回latex->biber->latex->latex
実行することが必須です(ドキュメントを参照)。ほとんどの IDE では、 を使用するにはこれが必要であることを警告するため、これを行うように指示されます。latex
biber
defernumbers
biblatex
defernumbers
type
技術メモ:やオプション、および を使用したより高度なフィルタリングなどkeyword
のすべての参考文献フィルタリング システムは、 が完了した後に実行されるため、データリストにはフィルタリングなしで、ソート順ですべてのエントリが引き続き含まれます。したがって、フィルタリングすると、基本的に順序/番号付けに「穴」が残るため、フィルタリングを適用した後で を使用して番号付けをやり直す必要があり、そのために追加の実行が必要になります。\printbibliography
\defbibfilter
\defbibcheck
biber
.bbl
defernumbers
latex