0

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[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
\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]{
        \field[padside=left,padwidth=2,padchar=0]{month}
        \literal{00}
    }
    \sort[direction=descending]{
        \field[padside=left,padwidth=2,padchar=0]{day}
        \literal{00}
    }
    \sort[direction=descending]{
        \field[padside=left,padwidth=4,padchar=0]{volume}
        \literal{9999}
    }
    \sort{
        \name{sortname}
        \name{author}
        \name{editor}
        \name{translator}
        \field{sorttitle}
        \field{title}
    }
    \sort{
        \field{sorttitle}
        \field{title}
    }
}

\addbibresource{mybiblio2016.bib}


\setlength{\biblabelsep}{0pt}

%Make Bold author name
\newcommand{\makeauthorbold}[1]{%
    \DeclareNameFormat{author}{%
        \ifnumequal{\value{listcount}}{1}
        {\ifnumequal{\value{liststop}}{1}
            {\expandafter\ifstrequal{##1}{#1}{\textbf{##1\addcomma\addspace ##4\addcomma\isdot}}{##1\addcomma\addspace ##4\addcomma\isdot}}
            {\expandafter\ifstrequal{##1}{#1}{\textbf{##1\addcomma\addspace ##4}}{##1\addcomma\addspace ##4}}}
        {\ifnumless{\value{listcount}}{\value{liststop}}
            {\expandafter\ifstrequal{##1}{#1}{\textbf{\addcomma\addspace ##1\addcomma\addspace ##4}}{\addcomma\addspace ##1\addcomma\addspace ##4}}
            {\expandafter\ifstrequal{##1}{#1}{\textbf{\addcomma\addspace ##1\addcomma\addspace ##4\addcomma\isdot}}{\addcomma\addspace ##1\addcomma\addspace ##4\addcomma\isdot}}%
        }%
    }%
}
\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}
  • 1
    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
  • 1
    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
1

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}{}
\forcsvlist{\listadd\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]{
    \field[padside=left,padwidth=2,padchar=0]{month}
    \literal{00}
  }
  \sort[direction=descending]{
    \field[padside=left,padwidth=2,padchar=0]{day}
        \literal{00}
  }
  \sort[direction=descending]{
    \field[padside=left,padwidth=4,padchar=0]{volume}
    \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},
  publisher={Springer Science+Business Media},
  year=2014,
  address={New York, USA},
  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}
\addbibresource{\jobname.bib}

\setlength{\biblabelsep}{0pt}

\begin{document}
\fullcite{Silva:2014a}

\printbibliography
\end{document}
  • Thanks Moewe, your MWE works fine just need to take the various hashes related to my name in the .bbl. just one more point that bothers me, I d like to get rid of the numbering since it is for a CV bibliography, I can't even by using : \DeclareFieldFormat{labelnumberwidth}{} \setlength{\biblabelsep}{0pt} , any suugestions? – MKS Jun 22 '16 at 9:56
  • got it just need to put \DeclareFieldFormat{labelnumberwidth}{} \setlength{\biblabelsep}{0pt} just after the \nocite(*) function. Thanks – MKS Jun 22 '16 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.