Is there a way to underline a specific author (instead of making it bold such as in the code snippet provided here):
\newcommand*{\mkboldifhashinlist}[1]{%
\xifinlist{\thefield{hash}}{\nhblx@boldhashes}
{\mkbibbold{#1}}
{#1}}
\makeatother
Inspired from the following answers:
- Make specific author bold using biblatex
- Make one author's name bold every time it shows up in the bibliography
- Making specific author bold using biblatex
EDIT 1
So I tried to implement the answer in my answer in my code but get an error
%https://tex.stackexchange.com/questions/73136/make-specific-author-bold-using-biblatex/416416#416416
%https://tex.stackexchange.com/questions/602723/making-specific-author-bold-using-biblatex/602735?noredirect=1#comment1511845_602735
\documentclass[british]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{enumitem}
\usepackage{color}
\usepackage{soul}
\usepackage{import}
\usepackage{soul}
\setlist[enumerate]{itemsep=0mm}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
right=20mm,
top=20mm,
}
\usepackage[backend=biber,style=authoryear,maxcitenames=2,maxbibnames=50,firstinits=true,uniquelist=false,uniquename=init,isbn=false,doi=false,useprefix=true]{biblatex}
%\usepackage{biblatex}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\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}[1]{%
\stepcounter{nhblx@name}%
\edef\nhblx@tmp@nocite{%
\noexpand\AfterPreamble{%
\noexpand\setbox0\noexpand\vbox{%
\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{#1}}, %
options = {dataonly=true},}%
}%
}
\AtEndDocument{%
\closeout\nhblx@bibfile}
\addbibresource{\nhblx@bibfile@name}
\newcommand*{\nhblx@boldhashes}{}
\DeclareNameFormat{nhblx@hashextract}{%
\xifinlist{\thefield{hash}}{\nhblx@boldhashes}
{}
{\listxadd{\nhblx@boldhashes}{\thefield{hash}}}}
\DeclareCiteCommand{\nhblx@getmethehash}
{}
{\printnames[nhblx@hashextract][1-999]{author}}
{}
{}
\newcommand{\addboldnames}{\forcsvlist\nhblx@writenametobib}
\newcommand{\resetboldnames}{\def\nhblx@boldhashes{}}
\newcommand*{\mkboldifhashinlist}[1]{%
\xifinlist{\thefield{hash}}{\nhblx@boldhashes}
%{\mkbibbold{#1}}
{\ul{#1}}
{#1}}
\makeatother
\DeclareNameWrapperFormat{boldifhashinlist}{%
\renewcommand*{\mkbibcompletename}{\mkboldifhashinlist}%
#1}
\DeclareNameWrapperAlias{sortname}{default}
\DeclareNameWrapperAlias{default}{boldifhashinlist}
% just for demonstration
\ExecuteBibliographyOptions{maxnames=99,giveninits}
\DeclareNameAlias{default}{family-given/given-family}
\setlength\bibitemsep{1.5\itemsep}
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
\newtoggle{myrefs}
\newcommand{\myref}[1]{\iftoggle{myrefs}{\underline{#1}}{#1}}
\begin{filecontents}{\jobname.bib}
@MISC{test1,
AUTHOR = {Last1, First1 and Last2, First2 and Last3, First3},
}
@MISC{test2,
AUTHOR = {Last2, First2 and Last3, First3 and Last1, First1},
}
@MISC{test3,
AUTHOR = {Last4, First4 and Last3, First3 and Last1, First1 and Last2, First2},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\DeclareLabeldate[online]{%
\field{date}
\field{year}
\field{eventdate}
\field{origdate}
\field{urldate}
}
\usepackage[dvipsnames]{xcolor}
\definecolor{myblue}{RGB}{0, 32, 255}
\usepackage[colorlinks]{hyperref}
\hypersetup{
colorlinks,
filecolor=magenta,
linkcolor=blue,
urlcolor=myblue,
final
}
\usepackage{titlesec}
\titleformat{\section}
{\normalfont\large\bfseries}{\thesection}{0.8em}{}[{\titlerule[0.8pt]}]
\titleformat{\subsection}
{\normalfont\normalsize\bfseries}{\thesubsection}{0.8em}{}
\titleformat{\subsubsection}
{\normalfont\normalsize\bfseries}{\thesubsubsection}{0.8em}{}
\begin{document}
\title{ \vspace{-2.5cm} \textbf{Publications - Eric Buffle, MD-PhD}\vspace{-0.6cm}}
%\date{\today}
\date{\vspace{-5ex}}
\maketitle
\nocite{*}
\addboldnames{{Last2, First2}}
\begin{enumerate}
\item \fullcite{test1}
\item \fullcite{test2}
\item \fullcite{test3}
\end{enumerate}
\end{document}
and I get the following error
LaTeX Warning: No \author given.
! Argument of \etb@ifdefmacro has an extra }.
<inserted text>
\par
l.149 \item \fullcite{test1}
?
soul's\ul. Sorry. As I said the only safe implementation that allows line breaks that I know of islua-ul's\underLine, which works here. (You could also use the standard\underlineif you don't mind not having line breaks.) – moewe Sep 21 '23 at 18:35