%20fett%20drucken.png)
Ich möchte alle Einträge \cite{}
eines bestimmten Autors in meinem Dokument fett drucken. Im Moment mache ich das shorthand = {\textbf{Foo23}}
in meinem .bib
, aber das ist nicht wirklich praktisch und es hat nicht nur das Problem, schlecht duplizierte Einträge mit derselben Abkürzung zu verarbeiten, sondern, was noch wichtiger ist,die alphabetische Reihenfolge ist kaputt:
\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}
Antwort1
Normalerweise ist es am besten, Formatierungsbefehle in der .bib
Eingabe so weit wie möglich zu vermeiden. Wie Sie bemerkt haben, werden die Befehle mehr oder weniger wie normaler Text behandelt und können die Sortierung und Eindeutigkeitsberechnungen durcheinander bringen.
Stattdessen ist es besser, einen semantischen Marker in den Daten zu setzen und darauf zu reagieren biblatex
. Eine Möglichkeit wäre, ein Schlüsselwort zu setzen.
Überraschenderweise gibt es seitlich keine einfache Möglichkeit, biblatex
das gesamte Zitatlabel hervorzuheben, daher müssen wir das in das cite
Bibmacro einbauen.
\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}