1

This answer (Make one author's name bold every time it shows up in the bibliography) works fine, but when there are two authors with the same last name and different first names it makes both of them bold. How can I make only one of them bold?

\documentclass[11pt,a4paper]{moderncv}
\usepackage[sorting=ydnt,dashed=false,backend=bibtex,maxcitenames=4, mincitenames=4,maxbibnames=500, minbibnames=500]{biblatex} 
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
% suppress the "In:" for @article (only): 
\renewbibmacro{in:} 
{% `    
\ifentrytype{article}{} 
{% 
    \printtext{\bibstring{in}\intitlepunct}}} 

\newcommand{\makeauthorbold}[1]{%
    \DeclareNameFormat{author}{%
    \edef\tempname{{#1}}%
    \ifnumequal{\value{listcount}}{1}
    {\ifnumequal{\value{liststop}}{1}
        {\expandafter\ifstrequal\tempname{##1}{\textbf{##1\addcomma\addspace ##4\addcomma\isdot}}{##1\addcomma\addspace ##4\addcomma\isdot}}
        {\expandafter\ifstrequal\tempname{##1}{\textbf{##1\addcomma\addspace ##4}}{##1\addcomma\addspace ##4}}}
    {\ifnumless{\value{listcount}}{\value{liststop}}
        {\expandafter\ifstrequal\tempname{##1}{\textbf{\addcomma\addspace ##1\addcomma\addspace ##4}}{\addcomma\addspace ##1\addcomma\addspace ##4}}
        {\expandafter\ifstrequal\tempname{##1}{\textbf{\addcomma\addspace ##1\addcomma\addspace ##4\addcomma\isdot}}{\addcomma\addspace ##1\addcomma\addspace ##4\addcomma\isdot}}%
    }%
}%
}
\makeauthorbold{Doe}
\defbibenvironment{bibliography}
{\list
{\printtext[labelnumberwidth]{% label format from numeric.bbx
        \printfield{prefixnumber}%
        \printfield{labelnumber}}}
{\setlength{\topsep}{0pt}% layout parameters from moderncvstyleclassic.sty
    \setlength{\labelwidth}{\hintscolumnwidth}%
    \setlength{\labelsep}{\separatorcolumnwidth}%
    \leftmargin\labelwidth%
    \advance\leftmargin\labelsep}%
\sloppy\clubpenalty4000\widowpenalty4000}
{\endlist}
{\item}

\moderncvstyle{banking} 
\moderncvcolor{black}  

\firstname{John}
\familyname{Doe}
\addbibresource{pub.bib}
\title{Curriculum Vitae}                            
\address{Here}{There}
\phone[fixed]{+66~66~(666)~6666}
\phone[fax]{+66~66~(666)~6666}
\email{john.doe@johndoe.edu}                  
\homepage{johndoe.com}  


\makeatother
\begin{document}
\makecvtitle
\nocite{*}
\setlength\hintscolumnwidth{20pt} 
\setlength\separatorcolumnwidth{20pt} 
\printbibliography[title={Publications}]
\end{document}

and the pub.bib files looks like:

@Article{pmid01,
Author="Doe, J. and Sam, A. and Kim, B",
Title="{Making author bold}",
Journal="Latex",
Year="2015",
Pages=" ",
Month="Jul"
}
@Article{pmid02,
Author="Doe, J. and Sam, A. and Doe, F",
Title="{Making one author bold}",
Journal="Latex",
Year="2014",
Pages=" ",
Month="Jul"
}
Dan R
  • 19
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. The answer you linked certainly appears to test the author's full name, while you only reference the surname in your fragment. – Mike Renfro Aug 17 '15 at 11:39
  • I edited the code to make it compilable. However I tried it with full name and it didn't work. When I use the full name it doesn't make any of them bold, and when I only use last name it makes both of them bold. Thanks – Dan R Aug 17 '15 at 17:49

0 Answers0