For some (stupid) report, I have to put a bibliography with some authors in bold and some authors underlined.
Thanks to some posts/answer here, I succeed to make a specific one bold. However, all other tricks tested here to make other underlined failed (either not compiling or not producing anything).
Here is a MWE for the bold. Let say I would like Billy Bob and Jane Doe underlined.
\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage{ulem}
\usepackage[style=alphabetic, maxnames=99, sorting=ydnt, backend=bibtex]{biblatex}
\begin{filecontents}{\jobname.bib}
@article{article1,
author={Smith, John and Doe, Jane and Foo, Bar},
title={Title},
journal={Journal}
}
@article{article2,
author={Smith, John and Billy, Bob},
title={Title2},
journal={Journal2}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\DeclareBibliographyDriver{article}{%
\printfield{title} %
\par
\newblock%
\printnames{author}%
\par%
\newblock%
{%
\footnotesize\itshape%
\usebibmacro{journal}%
}
\par\vspace{0.3\baselineskip}
}
\newcommand*{\boldname}[3]{%
\def\lastname{#1}%
\def\firstname{#2}%
\def\firstinit{#3}}
\renewcommand{\mkbibnamegiven}[1]{%
\ifboolexpr{ ( test {\ifdefequal{\firstname}{\namepartgiven}} or test {\ifdefequal{\firstinit}{\namepartgiven}} ) and test {\ifdefequal{\lastname}{\namepartfamily}} }
{\mkbibbold{#1}}{#1}%
}
\renewcommand{\mkbibnamefamily}[1]{%
\ifboolexpr{ ( test {\ifdefequal{\firstname}{\namepartgiven}} or test {\ifdefequal{\firstinit}{\namepartgiven}} ) and test {\ifdefequal{\lastname}{\namepartfamily}} }
{\mkbibbold{#1}}{#1}%
}
\boldname{Smith}{John}{}
\begin{document}
\nocite{*}
\printbibliography[type={article}]
\end{document}
