Skip to content

Instantly share code, notes, and snippets.

@hensing
Created October 17, 2016 15:38
Show Gist options
  • Save hensing/d0420bb14af9448bd007a37368a35f74 to your computer and use it in GitHub Desktop.
Save hensing/d0420bb14af9448bd007a37368a35f74 to your computer and use it in GitHub Desktop.
Make specific author bold using biblatex
% use boldface for specific author in biblatex bibliography
% http://tex.stackexchange.com/questions/73136/make-specific-author-bold-using-biblatex
%
% usage:
% \input{boldauthorname}
% ...
% \begin{document}
% \boldname{Doe}{John}{J.}
% \printbibliography
% \end{document}
%
% deactivate:
% \boldname{}{}{}
%
\def\makenamesetup{%
\def\bibnamedelima{~}%
\def\bibnamedelimb{ }%
\def\bibnamedelimc{ }%
\def\bibnamedelimd{ }%
\def\bibnamedelimi{ }%
\def\bibinitperiod{.}%
\def\bibinitdelim{~}%
\def\bibinithyphendelim{.-}}
\newcommand*{\makename}[2]{\begingroup\makenamesetup\xdef#1{#2}\endgroup}
\newcommand*{\boldname}[3]{%
\def\lastname{#1}%
\def\firstname{#2}%
\def\firstinit{#3}}
\boldname{}{}{}
% Patch new definitions
\renewcommand{\mkbibnamegiven}[1]{%
\makename{\currname}{#1}%
\makename{\findname}{\firstname}%
\makename{\findinit}{\firstinit}%
\ifboolexpr{ test {\ifdefequal{\currname}{\findname}}%
or test {\ifdefequal{\currname}{\findinit}} }%
{\mkbibbold{#1}}{#1}%
}
\renewcommand{\mkbibnamefamily}[1]{%
\makename{\currname}{#1}%
\makename{\findname}{\lastname}%
\ifboolexpr{ test {\ifdefequal{\currname}{\findname}} }%
{\mkbibbold{#1}}{#1}%
}
@buhtz
Copy link

buhtz commented Apr 5, 2019

Hi. This is not working for me with biber and xelatex. The code runs without errors. But the name is not bold.

Any idea?

\documentclass{scrartcl}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@InProceedings{Paulicke2019a,
  author       = {Denny Paulicke and Christian Buhtz and Karsten Schwarz and Katrin Wedler and Dietrich Stoevesandt and Patrick Jahn},
  title        = {Technische Assistenzsysteme in der Pflegeausbildung},
  subtitle     = {Eine Online-Erhebung},
  eventtitle   = {20. Jahrestagung EbM-Netzwerk 2019 - EbM und digitale Transformation in der Medizin},
  eventdate    = {2019-03-22},
  venue        = {Berlin},
  organization = {Deutschen Netzwerks Evidenzbasierte Medizin e. V. (DNEbM)},
  publisher    = {German Medical Science GMS Publishing House},
  doi          = {10.3205/19ebm059},
  eprint       = {nbn:de:0183-19ebm0591},
  eprinttype   = {urn},
  year         = {2019},
}
\end{filecontents}

\usepackage{xltxtra}
\usepackage{microtype}

\input{boldauthorname}

\usepackage{csquotes}
\usepackage{polyglossia}
\setdefaultlanguage[spelling=new]{german}

\usepackage{hyperref}
\usepackage[
    backend=biber,
    style=apa,
    sortlocale=auto,
    language=german
]{biblatex}
\addbibresource{\jobname.bib}
\DeclareLanguageMapping{german}{german-apa}

\begin{document}
\boldname{Buhtz}{Christian}{C.}
\boldname{Christian}{Buhtz}{}
\nocite{*}
\printbibliography
\end{document}

@hensing
Copy link
Author

hensing commented Oct 16, 2020

Hey!

Sorry for the late response. I think you should change the order of first and last name of the authors to

author = {Paulicke, Denny and Buhtz, Christian and [...]}

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment