
我想\cite{}
在我的文件中以粗體列印所有給定作者。目前,我shorthand = {\textbf{Foo23}}
在 my 中這樣做.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
。一種選擇是設定關鍵字。
令人驚訝的是,沒有簡單的方法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}