# sorting authorname and highlight it in bold

I used to use the piece of code below (that I actually found here) to highlight in my name bold in my bibliography for CV or thesis. It worked just fine but for the last 3 weeks or so I get a bunch of errors whereas neither the code nor my .bib file were modified. I understood that some options have been simplified which impact the code. any chance to get an updated code for this function.

\documentclass[a4paper,twoside,numbered,fontsize=11pt]{scrartcl} % KOMA-article class
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm}     % Math packages
\usepackage{graphicx}                    % Enable pdflatex
\usepackage[svgnames]{xcolor}            % Colors by their 'svgnames'
\usepackage{geometry}
%\textheight=700px                    % Saving trees ;-)
\usepackage{url}
\usepackage{float}
\usepackage{etaremune}
\usepackage{wrapfig}
\usepackage{eurosym}
\usepackage{textcomp}
\usepackage{csquotes}
\usepackage{attachfile}
\usepackage{fancyhdr}
%sorting section
\usepackage[backend=biber,sorting=ddatent,style=phys,isbn=true]{biblatex}

%sorting by date
\DeclareSortingScheme{ddatent}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort[direction=descending]{
\field[strside=left,strwidth=4]{sortyear}
\field[strside=left,strwidth=4]{year}
\literal{9999}
}
\sort[direction=descending]{
\literal{00}
}
\sort[direction=descending]{
\literal{00}
}
\sort[direction=descending]{
\literal{9999}
}
\sort{
\name{sortname}
\name{author}
\name{editor}
\name{translator}
\field{sorttitle}
\field{title}
}
\sort{
\field{sorttitle}
\field{title}
}
}

\setlength{\biblabelsep}{0pt}

%Make Bold author name
\newcommand{\makeauthorbold}[1]{%
\DeclareNameFormat{author}{%
\ifnumequal{\value{listcount}}{1}
{\ifnumequal{\value{liststop}}{1}
{\ifnumless{\value{listcount}}{\value{liststop}}
}%
}%
}
\makeauthorbold{Myname}

\DeclareFieldFormat{labelnumberwidth}{}

%%% Papers
\newpage
\nocite{*}
\printbibliography[type=article,title={\uppercase{Journal articles}}]
\printbibliography[type=inproceedings,title={\uppercase{Conference papers}}]
\printbibliography[type=book,title={\uppercase{Books chapters}}]
\printbibliography[type=patent,title={\uppercase{Patents}}]
\printbibliography[type=unpublished,title={\uppercase{Presentations}}]
\printbibliography[type=inreference,title={\uppercase{Invited talks}}]
\printbibliography[type=incollection,title={\uppercase{Posters}}]
\printbibliography[type=report,title={\uppercase{Technical notes}}]
\printbibliography[type=thesis,title={\uppercase{Thesis}}]

\end{document}

• Can Highlight an author in bibliography using biblatex allowing bibliography style to format it and its linked questions help you? If not, it would be very helpful if you could provide a full MWE that shows how you use the code from above (you may also want to add a link to where you found the code if it was on this site). – moewe Jun 21 '16 at 5:55
• Dear Moewe, I tried a few code in the former answers but i still get an incredible number of errors related to the last piece of code and Makeauthorbold function, I am stuck. I pasted part of the full code in the question hope it helps. – MKS Jun 21 '16 at 23:44
• I recommend using the functionality shown here going forward - it was designed for this sort of situation and doesn't require any messing about with internals . tex.stackexchange.com/questions/73136/… – PLK Jun 22 '16 at 6:41

I suggest you use the solution from Highlight an author in bibliography using biblatex allowing bibliography style to format it which in turn is based on Audrey's solution to Make specific author bold using biblatex, but with hashes instead of string comparison.

Since in biblatex 3.3 some internal macros were renamed (see Biblatex 3.3 name formatting) you now need to redefine name:family, name:given-family and name:family-given.

You can add hashes of names that should be highlighted as follows. Those hashes can be found by looking at the .bbl file. More details in the other answer.

\forcsvlist{\listadd\boldnames}
{{5e1df516fe8816ee66169b8616522816}}


MWE (with slightly fewer packages)

\documentclass{scrartcl}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{csquotes}
\usepackage[backend=biber,sorting=ddatent,style=phys,isbn=true]{biblatex}

\usepackage{xpatch}

\newcommand*{\boldnames}{}

\newcommand*{\doboldnames}[1]{%
\iffieldequalstr{hash}{#1}
{\bfseries\listbreak}
{}}%

\newbibmacro*{name:bold}{%
\forlistloop{\doboldnames}{\boldnames}}

\xpretobibmacro{name:family}{\begingroup\usebibmacro{name:bold}}{}{}
\xpretobibmacro{name:given-family}{\begingroup\usebibmacro{name:bold}}{}{}
\xpretobibmacro{name:family-given}{\begingroup\usebibmacro{name:bold}}{}{}
\xpretobibmacro{name:delim}{\begingroup\normalfont}{}{}

\xapptobibmacro{name:family}{\endgroup}{}{}
\xapptobibmacro{name:given-family}{\endgroup}{}{}
\xapptobibmacro{name:family-given}{\endgroup}{}{}
\xapptobibmacro{name:delim}{\endgroup}{}{}

\renewcommand*{\boldnames}{}
{{5e1df516fe8816ee66169b8616522816}}

%sorting by date
\DeclareSortingScheme{ddatent}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort[direction=descending]{
\field[strside=left,strwidth=4]{sortyear}
\field[strside=left,strwidth=4]{year}
\literal{9999}
}
\sort[direction=descending]{
\literal{00}
}
\sort[direction=descending]{
\literal{00}
}
\sort[direction=descending]{
\literal{9999}
}
\sort{
\name{sortname}
\name{author}
\name{editor}
\name{translator}
\field{sorttitle}
\field{title}
}
\sort{
\field{sorttitle}
\field{title}
}
}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@incollection{Silva:2014a,
title={Radio Resource Management for Device-to-Device Communications in Long Term Evolution Networks},
author={Carlos F. M. Silva and Silva, Jr., Jos\'{e} Mairton B. and Tarcisio F. Maciel},
booktitle={Resource Allocation and {MIMO} for {4G} and Beyond},
year=2014,
editor={Francisco Rodrigo Porto Cavalcanti},
pages={105-156},
doi={10.1007/978-1-4614-8057-0_3},
isbn={978-1-4614-8056-3},
}
\end{filecontents}