%20%E3%82%92%E5%A4%AA%E5%AD%97%E3%81%A7%E5%8D%B0%E5%88%B7%E3%81%99%E3%82%8B.png)
\cite{}
文書内で特定の著者名を太字で印刷したいのですが、今のところshorthand = {\textbf{Foo23}}
は で行っています.bib
が、あまり実用的ではありません。また、同じ略語を持つ重複エントリの処理が不十分なだけでなく、さらに重要なことに、アルファベット順が崩れている:
\documentclass{article}
\usepackage[
style=alphabetic,% also
minalphanames=3,maxalphanames=4, % [Foo+99] -> [FBB+99].
maxnames=99, % Do not put "et al". Sets maxbibnames, maxcitenames and maxsortnames.
sortcites=true,
sortcites=false, % \cite{B,A,C}: [A,B,C] --> [B,A,C]
]{biblatex}
\usepackage{filecontents}
\begin{filecontents}[overwrite]{\jobname.bib}
@article{a1,
author={John Smith and Mary Stuart and Peter Pan},
year = 2020,
shorthand = {\textbf{SSP20}},
journal = {I should should have a Awesome Journal},
volume = 3
}
@article{a2,
author={John Smith and Mary Stuart and Peter Pan},
year = 2020,
journal = {Another Journal},
volume = 3
}
@article{a3,
author={Abc Abc and Def Ahi},
year = 2020,
journal = {I should appear first in the list as it is sorted alphabetically},
volume = 3
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\cite{a1,a2,a3}
\printbibliography
\end{document}
答え1
通常、入力時にコマンドをフォーマットすることはできるだけ避けるのが最善です.bib
。お気づきのとおり、コマンドは多かれ少なかれ通常のテキストのように扱われ、並べ替えや一意性の計算が混乱する可能性があります。
代わりに、データにセマンティック マーカーを設定し、それに基づいて操作する方が適切ですbiblatex
。 1 つのオプションは、キーワードを設定することです。
biblatex
驚いたことに、引用ラベル全体を強調表示する簡単な方法がないので、それをcite
bibmacro に組み込む必要があります。
\documentclass{article}
\usepackage[
style=alphabetic,% also
minalphanames=3,maxalphanames=4, % [Foo+99] -> [FBB+99].
maxnames=99, % Do not put "et al". Sets maxbibnames, maxcitenames and maxsortnames.
sortcites=true,
sortcites=false, % \cite{B,A,C}: [A,B,C] --> [B,A,C]
]{biblatex}
\DeclareFieldFormat{citelabel}{%
\ifkeyword{importantauthor}
{\mkbibbold{#1}}
{#1}}
\DeclareFieldFormat{labelalphawidth}{%
\mkbibbrackets{%
\ifkeyword{importantauthor}
{\mkbibbold{#1}}
{#1}}}
\renewbibmacro*{cite}{%
\printtext[bibhyperref]{%
\printtext[citelabel]{%
\printfield{labelprefix}%
\printfield{labelalpha}%
\printfield{extraalpha}%
\ifbool{bbx:subentry}
{\printfield{entrysetcount}}
{}}}}
\begin{filecontents}{\jobname.bib}
@article{a1,
author = {John Smith and Mary Stuart and Peter Pan},
year = 2020,
journal = {I should should have a Awesome Journal},
volume = 3,
keywords = {importantauthor},
}
@article{a2,
author = {John Smith and Mary Stuart and Peter Pan},
year = 2020,
journal = {Another Journal},
volume = 3,
}
@article{a3,
author = {Abc Abc and Def Ahi},
year = 2020,
journal = {I should appear first in the list as it is sorted alphabetically},
volume = 3,
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\cite{a1,a2,a3}
\printbibliography
\end{document}