Biblatex: imprime algunas citas (\cite) en negrita

Biblatex: imprime algunas citas (\cite) en negrita

Me gustaría imprimir todos \cite{}los artículos de un autor determinado en negrita en mi documento. Por ahora, lo hago shorthand = {\textbf{Foo23}}en mi .bib, pero no es realmente práctico y no solo tiene el problema de manejar entradas mal duplicadas que tienen la misma taquigrafía, lo que es más importante,el orden alfabético está roto:

ingrese la descripción de la imagen aquí

\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}

Respuesta1

Por lo general, es mejor evitar formatear los comandos tanto como sea posible en .bibla entrada. Como habrás notado, los comandos se tratarán más o menos como texto normal y pueden estropear los cálculos de clasificación y unicidad.

En su lugar, es mejor establecer un marcador semántico en los datos y actuar en consecuencia biblatex. Una opción sería establecer una palabra clave.

Sorprendentemente, no hay una forma sencilla biblatexde resaltar toda la etiqueta de la cita, por lo que debemos incorporarla en el citebibmacro.

\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}

"[SSP20a; SSP20b; AA20]" con "SSP20a" en negrita

información relacionada