0

I am working on a promotion and tenure CV's publication section. I would like the following features:

  1. Make certain authors bold (myself)
  2. Dagger (\dag) certain authors (students)
  3. Double dagger certain authors (postdocs)

I was able to make the first one work by:

\usepackage[backend=biber,style=numeric,defernumbers=true,sorting=ydnt,maxbibnames=99]{biblatex}
\addbibresource{references.bib}
\newcommand{\makeauthorbold}[1]{%
  \DeclareNameFormat{author}{%
    \ifthenelse{\value{listcount}=1}
    {%
      {\expandafter\ifstrequal\expandafter{\namepartfamily}{#1}{\mkbibbold{\namepartfamily\addcomma\addspace \namepartgiveni}}{\namepartfamily\addcomma\addspace \namepartgiveni}}
      %
    }{\ifnumless{\value{listcount}}{\value{liststop}}
        {\expandafter\ifstrequal\expandafter{\namepartfamily}{#1}{\mkbibbold{\addcomma\addspace \namepartfamily\addcomma\addspace \namepartgiveni}}{\addcomma\addspace \namepartfamily\addcomma\addspace \namepartgiveni}}
        {\expandafter\ifstrequal\expandafter{\namepartfamily}{#1}{\mkbibbold{\addcomma\addspace \namepartfamily\addcomma\addspace \namepartgiveni\addcomma\isdot}}{\addcomma\addspace \namepartfamily\addcomma\addspace \namepartgiveni\addcomma\isdot}}%
      }
    \ifthenelse{\value{listcount}<\value{liststop}}
    {\addcomma\space}
  }
}
\makeauthorbold{MyLastName}

I originally hoped to repeat a similar process for points two and three, and creating a \makeauthordag and \makeauthorddag commands but only the last one will work (seems to be overwriting previous commands actions).

Mensch
  • 65,388

1 Answers1

2

I would work with name hashes here instead of string comparison.

We can parametrise the approach recommended in my answer to Make specific author bold using biblatex to allow for several independent lists of hashes.

With \markname{<marker>}{<list of names>} we can define names that will be marked as <marker>. We can then test for this marker with \ifnamemarked{<marker>}{<true>}{<false>}.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[backend=biber,style=numeric]{biblatex}

\addbibresource{biblatex-examples.bib}

\makeatletter \def\nhblx@bibfile@name{\jobname -nhblx.bib} \newwrite\nhblx@bibfile \immediate\openout\nhblx@bibfile=\nhblx@bibfile@name

\immediate\write\nhblx@bibfile{% @comment{Auto-generated file}\blx@nl}

\newcounter{nhblx@name} \setcounter{nhblx@name}{0}

\newcommand*{\nhblx@writenametobib}[2]{% \ifcsundef{nhblx@#1list} {\csdef{nhblx@#1list}{}} {}% \stepcounter{nhblx@name}% \edef\nhblx@tmp@nocite{% \noexpand\AfterPreamble{% \noexpand\setbox0\noexpand\vbox{% \noexpand\def\noexpand\nhblx@listname{nhblx@#1list}% \noexpand\nhblx@getmethehash{nhblx@name@\the\value{nhblx@name}}}}% }% \nhblx@tmp@nocite \immediate\write\nhblx@bibfile{% @misc{nhblx@name@\the\value{nhblx@name}, author = {\unexpanded{#2}}, % options = {dataonly=true},}% }% }

\AtEndDocument{% \closeout\nhblx@bibfile}

\addbibresource{\nhblx@bibfile@name}

\DeclareNameFormat{nhblx@hashextract}{% \xifinlistcs{\thefield{hash}}{\nhblx@listname} {} {\listcsxadd{\nhblx@listname}{\thefield{hash}}}}

\DeclareCiteCommand{\nhblx@getmethehash} {} {\typeout{\nhblx@listname}\printnames[nhblx@hashextract][1-999]{author}} {} {}

\newcommand{\markname}[1]{\forcsvlist{\nhblx@writenametobib{#1}}} \newcommand{\resetmark}[1]{\csdef{nhblx@#1list}{}}

\newcommand*{\ifnamemarked}[1]{% \xifinlistcs{\thefield{hash}}{nhblx@#1list}} \makeatother

\newcommand*{\studentorpostdoc}[1]{% \ifnamemarked{student}{\dag}{}% \ifnamemarked{postdoc}{\ddag}{}% #1}

\newcommand*{\nameformatter}[1]{% \ifnamemarked{me} {\mkbibbold{#1}} {\studentorpostdoc{#1}}}

\DeclareNameWrapperFormat{nameformatter}{% \renewcommand*{\mkbibcompletename}{\nameformatter}% #1}

\DeclareNameWrapperAlias{sortname}{default} \DeclareNameWrapperAlias{default}{nameformatter}

\markname{me}{{Sigfridsson, Emma}} \markname{student}{Philipp Jaff{'e}} \markname{postdoc}{Ulf Ryde}

\begin{document} \nocite{sigfridsson,jaffe}

\printbibliography \end{document}

Bibliography with bold, daggers and double daggers.

moewe
  • 175,683
  • Turns out, something similar can be found in https://tex.stackexchange.com/q/585723/35864. – moewe Feb 27 '23 at 06:24