3

I have long used to below macro, originally adapted from another Answer. This macro is used with BibLaTeX, to automatically bold the provided author.

%------------------------------------------------
% Bold specific author; adapted from: https://tex.stackexchange.com/a/328286
\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}
  }
}
%------------------------------------------------

As of recent TeX Live versions, this macro no longer works. It now causes some later environments to consistently be viewed by LaTeX as un-closed. This results in complex and difficult to localize downstream errors.

This appears to actually be answered in a comment by moewe, on that specific question. In particular, this appears to have been caused by updates to complex BibLaTeX code, as discussed on a GitHub issue.

I have now replaced my macro, to the updated code, provided by moewe, to the originally Accepted Answer.

That said, I would prefer a macro like my prior one, where I need only execute a single command to bold the indicated author (searching for and matching the entire author, from just a last name) in the foregoing, encapsulated, list of citations.

If someone could instead provide such an improved macro, I'd appreciate it.


Thanks to cfr's pointing me to another more recent Answer, I've learned this functionality is within BibLaTeX, and one can just use author annotations for this.

I would, however, need them to automatically be added for every entry for me, ideally as a \step in my existing \map commands. This would also need to be compatible with my current solution for authorship annotation, which also seems to no longer be working with any of these methods.


The currently suggested macro, to bold author names, does not seem to work with all styles or configurations of BibLaTeX. In my case, with a custom set of style files, it is not able to match my name to bold it.

Is it possible to directly get this macro to work, without completely re-engineering the approach, provided we presume no author prefixes nor suffixes? Alternatively, could a \map type solution to add author+an = {1=highlight} be added (if any only if no other author is already so highlighted), that is also compatible with other such annotations, and ideally able to automatically search for the author position?

Coby Viner
  • 1,939

1 Answers1

4

The macro you originally used had deep issues even before biblatex got updated. Its syntax was always wrong and if things worked, that was only only by accident. It was also quite destructive w.r.t. to the settings of the used style: It simply hard-coded bits of the output and completely overrode some style features.

I believe that the most flexible approach to bold names is the one in my answer to Make specific author bold using biblatex. It uses the safest method to compare names (Biber-generated hashes) and uses the least intrusive method to influence the name format (\mkbibcompletename wrapped in a \DeclareNameWrapperFormat). It should be compatible with a multitude of styles and other custom settings, but depending on what you or your style do at the moment, you may have to adjust the formatting definitions a bit. Specifically, if you already redefine \mkbibcompletename you will have to combine your definition with the change required for bold names. (That, however, is pretty much unavoidable: Every piece of code has the potential to override pre-existing code. So there can be no guarantee that code works in all situations. Plus, it is at least clear where changes have to be made.)

moewe
  • 175,683