80

I am writing my CV in LaTeX. I am using biblatex and want my name (and only my name) to be bold for every reference. Is there a magic way to do this?

A similar question Make one author's name bold every time it shows up in the bibliography was asked, but that answer used BibTeX. While I use the BibTeX backend, I use biblatex.

Any suggestions?

46

You can patch the name:last, name:first-last and name:last-first macros defined in biblatex.def. These are used by all of the default name formatting directives and take four arguments:

{<last name>}{<first name>}{<name prefix>}{<name affix>}

or

{<last name>}{<first name (initials)>}{<name prefix>}{<name affix>}

In the following we match only on the first and last name parts.

\documentclass{article}
\usepackage{biblatex}
\usepackage{xpatch}% or use http://tex.stackexchange.com/a/40705

\makeatletter
\newbibmacro*{name:bold}[2]{%
  \edef\blx@tmp@name{\expandonce#1, \expandonce#2}%
  \def\do##1{\ifdefstring{\blx@tmp@name}{##1}{\bfseries\listbreak}{}}%
  \dolistloop{\boldnames}}
\newcommand*{\boldnames}{}
\makeatother

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

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

% just for demonstration
\ExecuteBibliographyOptions{maxnames=99,giveninits}
\DeclareNameAlias{default}{family-given/given-family}

\addbibresource{biblatex-examples.bib}
\forcsvlist{\listadd\boldnames}
  {{Herrmann, Wolfgang~A.}, {Herrmann, W.~A.}, {Herrmann, Wolfgang\bibnamedelima A.},
   {Herrmann, W\bibinitperiod\bibinitdelim A\bibinitperiod}}

\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}
\begin{document}
\fullcite{herrmann}

\forcsvlist{\listadd\boldnames}
  {{{\"{O}}fele, Karl}, {{\"{O}}fele, K.}, {{\"{O}}fele, K\bibinitperiod}}
\fullcite{herrmann}

\renewcommand*{\boldnames}{}
\forcsvlist{\listadd\boldnames}
  {{Hoffmann, Stephan~D.}, {Hoffmann, S.~D.}, {Hoffmann, Stephan\bibnamedelima D.},
   {Hoffmann, S\bibinitperiod\bibinitdelim D\bibinitperiod}}
\fullcite{herrmann}
\end{document}

enter image description here

Note that the name parts in the \boldnames etoolbox internal list should follow the format of the bbl file, which is backend-dependent. The example here covers both biber and BibTeX. With biber you can also perform matching using the hash field:

\iffieldequalstr{hash}{<hash string>}

where <hash string> can also be found in the bbl file.

If your name is consistently formatted in the bib file an alternative approach is to normalize name punctuation before matching. This example allows you to specify your name in BibTeX's format regardless of the backend.

\documentclass{article}
\usepackage{biblatex}
\usepackage{xpatch}% or use http://tex.stackexchange.com/a/40705

\def\makenamesetup{%
  \def\bibnamedelima{~}%
  \def\bibnamedelimb{ }%
  \def\bibnamedelimc{ }%
  \def\bibnamedelimd{ }%
  \def\bibnamedelimi{ }%
  \def\bibinitperiod{.}%
  \def\bibinitdelim{~}%
  \def\bibinithyphendelim{.-}}    
\newcommand*{\makename}[3]{\begingroup\makenamesetup\xdef#1{#2, #3}\endgroup}

\newbibmacro*{name:bold}[2]{%
  \makename{\currname}{#1}{#2}%
  \makename{\findname}{\lastname}{\firstname}%
  \makename{\findinit}{\lastname}{\firstinit}%
  \ifboolexpr{ test {\ifdefequal{\currname}{\findname}}
            or test {\ifdefequal{\currname}{\findinit}} }{\bfseries}{}}

\newcommand*{\boldname}[3]{%
  \def\lastname{#1}%
  \def\firstname{#2}%
  \def\firstinit{#3}}
\boldname{}{}{}

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

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

% just for demonstration
\ExecuteBibliographyOptions{maxnames=99,giveninits}
\DeclareNameAlias{default}{family-given/given-family}

\addbibresource{biblatex-examples.bib}
\boldname{Herrmann}{Wolfgang~A.}{W.~A.}

\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}
\begin{document}
\fullcite{herrmann}

\boldname{{\"O}fele}{Karl}{K.}
\fullcite{herrmann}

\boldname{Hoffmann}{Stephan~D.}{S.~D.}
\fullcite{herrmann}
\end{document}

enter image description here

This answer was updated to work with versions >= 3.3 of biblatex. See the edit history for older versions of biblatex. -- moewe

  • So this answer looks good (I haven't tried it yet, but I will). But now I have changed to using the biber backend. Will this make it easier? – jlconlin Sep 19 '12 at 21:39
  • @Jeremy Not really. You can do pattern matching with biber via \DeclareSourceMap, but it's the processed data that really matters - initials, location in the name list, etc. Biber also creates a hash string to identify each name, but its value isn't very meaningful. – Audrey Sep 20 '12 at 13:52
  • 2
    @K.-MichaelAye Yes, it provides a quick method for identifying a name but the identifier carries no meaning to us. In the above example \newbibmacro*{name:bold}[2]{\iffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac3‌​4863}{\bfseries}{}} would bold the first author's name. I pulled this hash string from the bbl file. – Audrey Nov 25 '12 at 22:30
  • 1
    @K.-MichaelAye With hash field matching all you need are the patches - prefix the name:* macros with \begingroup\iffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac3‌​‌​4863}{\bfseries}{} and append with \endgroup. – Audrey Nov 26 '12 at 3:04
  • 2
    Shouldn't this answer be updated to reflect the fact that first and last were deprecated in favor of given and family, respectively? Making the relevant changes fixes the second MWE in your answer, but even after making those changes, the first MWE no longer works for me. – Adam Liter Mar 26 '16 at 21:13
39

Since biblatex 3.4/biber 2.5, there is a general "annotation" functionality to do things like this, for example:

\documentclass{article}
\usepackage{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@MISC{test,
  AUTHOR    = {Last1, First1 and Last2, First2 and Last3, First3},
  AUTHOR+an = {2=highlight},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\renewcommand*{\mkbibnamegiven}[1]{%
  \ifitemannotation{highlight}
    {\textbf{#1}}
    {#1}}

\renewcommand*{\mkbibnamefamily}[1]{%
  \ifitemannotation{highlight}
    {\textbf{#1}}
    {#1}}

\begin{document}
\nocite{*}
\printbibliography

\end{document}

enter image description here

You can also annotate at the name part level and the top-level field level. See the biblatex PDF manual for details.

  • Interesting feature, indeed! Hope they also did something on the performance issues of biber, which recently made me to switch back to bibtex8. – Daniel Apr 18 '16 at 15:36
  • 3
    "They" is me ... I did indeed. I spent some time on biber performance and while biber is never going to be as fast as bibtex (partly because it does a lot more than bibtex in the biblatex use case), it currently shows, in version 2.5, 400% speed improvement in the large test cases I used for tuning compared with any previous versions. – PLK Apr 18 '16 at 16:17
  • 1
    This look really neat. Is there a way to use this to highlight a name without hard-coding that in the bibliography. I'd like to highlight my name in my CV but not in articles. Thank you! – tmalsburg Nov 15 '16 at 10:28
  • 1
    Great solution, thank you! I'm just wondering is it possible to use this only in the bibliography and not in the text? Currently citations also show text as bold – Vitomir Kovanovic May 15 '17 at 20:43
  • 1
    Yes, just wrap the \renewcommand macros in \AtEveryBibitem so that they only apply to bibliography items. – PLK May 15 '17 at 21:27
17

As I couldn't use https://tex.stackexchange.com/a/73246/7561 as well, and in case others stumble into this looking for a solution, I'm updating the answers. As pointed by Adam Liter, in the comments of that answer, the options used in the previous answer are deprecated and doesn't work (at least for me).

Solution

Instead, I redefined the \mkbibnamegiven and \mkbibnamefamily, and used the same ideas as before.

Basically, you use the \boldname to the define the name you want to mark as bold, like: \boldname{Lastname}{Givenname}{G.}.

\newcommand*{\boldname}[3]{%
  \def\lastname{#1}%
  \def\firstname{#2}%
  \def\firstinit{#3}}
\boldname{}{}{}

Then, we redefine the macros that generate the given and family names. The main idea is to search for the named defined above, and if it is found (including the given and family name) it makes it bold (using \mkbibbold), if not it leaves it as is.

% Patch new definitions
\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}%
}

Example

A full example:

% !BIB program = biber
\documentclass{article}
\usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}

\begin{filecontents}{\jobname.bib}
@InProceedings{identifier1,
  Title                    = {Some Awesome Title},
  Author                   = {Some Author and Another Author},
  Booktitle                = {Some Book about the Future},
  Year                     = {2042},
  Pages                    = {1--42}
}

@InProceedings{identifier2,
  Title                    = {Some So-So Title},
  Author                   = {First Author and Second Author},
  Booktitle                = {An okay Booktitle},
  Year                     = {2000},
  Pages                    = {1--100}
}

  @Book{test1,
  author          = {Goossens, Michel and Mittelbach, Frank
    and Samarin, Alexander},
  title           = {The LaTeX Companion},
  publisher       = {Addison-Wesley},
  location        = {Reading, Mass.},
  year            = {1994},

}

@Book{test2,
  author          = {Mittelbach, F. and Goossens, Michel
    and Samarin, Alexander},
  title           = {The LaTeX Companion},
  publisher       = {Addison-Wesley},
  location        = {Reading, Mass.},
  year            = {1994},

}

@Book{test3,
  author          = {Mittelbach, Frank and Samarin, Alexander
    and Goossens, Michel},
  title           = {The LaTeX Companion},
  publisher       = {Addison-Wesley},
  location        = {Reading, Mass.},
  year            = {1994},
} 
\end{filecontents}
\addbibresource{\jobname.bib}

\def\makenamesetup{%
  \def\bibnamedelima{~}%
  \def\bibnamedelimb{ }%
  \def\bibnamedelimc{ }%
  \def\bibnamedelimd{ }%
  \def\bibnamedelimi{ }%
  \def\bibinitperiod{.}%
  \def\bibinitdelim{~}%
  \def\bibinithyphendelim{.-}}    
\newcommand*{\makename}[2]{\begingroup\makenamesetup\xdef#1{#2}\endgroup}

\newcommand*{\boldname}[3]{%
  \def\lastname{#1}%
  \def\firstname{#2}%
  \def\firstinit{#3}}
\boldname{}{}{}

% Patch new definitions
\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{Author}{Some}{S.}

\begin{document}

\nocite{*}
\printbibliography

\boldname{Goossens}{Michel}{M.}
\printbibliography

\boldname{Mittelbach}{Frank}{F.}
\printbibliography

\end{document}

showcase

Update

Added support for checking given and family names before bolding the name.

  • 2
    Among solutions I found, only this one works for me (MikTex on Windows). Thanks. – Duke Nov 22 '16 at 3:19
  • I cannot get this to work with middle names the way the Audrey answer used to, eg. if the author were "Frank Allen Mittelbach." Any thoughts? – dayne May 14 '17 at 20:47
  • If you are using adn's solution for the moderncv class you need to change the \firstname \lastname commands to make it work (since they are in conflict with the classes commands) – Ohjeah Jun 9 '17 at 17:32
  • 1
    @Ohjeah could you provide a solution regarding to using this with moderncv? – K.-Michael Aye Nov 23 '17 at 0:59
4

There is still an issue with the last answer by adn: The sub macros that use the Strings in \boldname{Goossens}{Michel}{M.} only search for these strings (i.e., "Goossens", "Michel", and "M.") independently of each other. That is: any occurrence of "M." will be bold, no matter whether it belongs to a different author (like "M." for "Martin"). Improving the search scripts to only make the respective names bold if they are detected in a sequence would solve this behavior. In its current form, its usefulness is quite limited given there are more than just a couple of references.

Here a MWE that shows the problem:

\documentclass{article}
\usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}

\begin{filecontents}{\jobname.bib}
@InProceedings{identifier1,
  Title                    = {Some Awesome Title},
  Author                   = {Some Author and Another Author},
  Booktitle                = {Some Book about the Future},
  Year                     = {2042},
  Pages                    = {1--42}
}

@InProceedings{identifier2,
  Title                    = {Some So-So Title},
  Author                   = {First Author and Second Author},
  Booktitle                = {An okay Booktitle},
  Year                     = {2000},
  Pages                    = {1--100}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\def\makenamesetup{%
  \def\bibnamedelima{~}%
  \def\bibnamedelimb{ }%
  \def\bibnamedelimc{ }%
  \def\bibnamedelimd{ }%
  \def\bibnamedelimi{ }%
  \def\bibinitperiod{.}%
  \def\bibinitdelim{~}%
  \def\bibinithyphendelim{.-}}    
\newcommand*{\makename}[2]{\begingroup\makenamesetup\xdef#1{#2}\endgroup}

\newcommand*{\boldname}[3]{%
  \def\lastname{#1}%
  \def\firstname{#2}%
  \def\firstinit{#3}}
\boldname{}{}{}

% Patch new definitions
\renewcommand{\mkbibnamegiven}[1]{%
  \makename{\currname}{#1}%
  \makename{\findname}{\firstname}%
  \makename{\findinit}{\firstinit}%
  \ifboolexpr{ test {\ifdefequal{\currname}{\findname}}%
    or test {\ifdefequal{\currname}{\findinit}} }%
  {\mkbibbold{#1}}{#1}%
}

\renewcommand{\mkbibnamefamily}[1]{%
  \makename{\currname}{#1}%
  \makename{\findname}{\lastname}%
  \ifboolexpr{ test {\ifdefequal{\currname}{\findname}} }%
  {\mkbibbold{#1}}{#1}%
}

\boldname{Author}{Some}{S.}

\begin{document}

\nocite{*}
\printbibliography

\end{document}

It produces the following PDF, in which:

(a) all occurrences of "S." are bold, although one stands for "Second", which does not belong to the name "Some Author" and

(b) all occurrences of "Author" are bold (i.e., all four authors!), although just one matches the desired author "Some Author"

wrongly matched names, as described above

I hence propose another solution, which does solve this problem (however, there are other problems with it - and I would be glad if someone would present a solution for it). The solution was mentioned in Make one author's name bold every time it shows up in the bibliography (this link is also given in the very first post here one that page). However, (a) it does work with biblatex, although jlconlin says that it only works with bibtex and (b) I have extended it a bit to provide some further functionalities that you would not get without it (but that are provided by the previous answer, given by adn).

That solution simply uses a macro in the bibtex files instead of the actual authors' names. Then, the \textbf{} macro does work, while the document would not compile if \textbf{} would be inserted directly in the .bib file.

\documentclass{article}

\usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@InProceedings{identifier1,
  Title                    = {Some Awesome Title},
  Author                   = {\MyName[someKey]{S. Author} and Another Author},
  Booktitle                = {Some Book about the Future},
  Year                     = {2042},
  Pages                    = {1--42}
}

@InProceedings{identifier2,
  Title                    = {Some So-So Title},
  Author                   = {First Author and Second Author},
  Booktitle                = {An okay Booktitle},
  Year                     = {2000},
  Pages                    = {1--100}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}

\newcommand{\MyName}[2][\empty]{  % \empty is default for the opt. argument
  \ifthenelse{\equal{#1}{\empty}} % test the opt. argument
    {\hspace*{-.75mm}#2}          % it's empty! just show mand. argument   
    {\hspace*{-.75mm}\textbf{#2}} % it's not empty! make mand. argument (the name) bold
}

\nocite{*}
\printbibliography

\end{document}

It produces the following PDF: enter image description here

As can be seen: the problem is solved, as exactly those authors are shown bold that use the macro. To be more precise: the is now an optional argument, which can be instantiated by any String of the user's choice. This "key" can be used in the definition of \MyName to define more specific behavior. For instance, I use biblatex to use keywords (given in an extra keywords fields - not given here) in order to give several reference sections, divided by the keywords. If making an author's name bold should depend on that keyword (which is the case for me), that logic can be put into the if-then statement. (In my example, the name in the \MyName macro is shown bold if there is any keyword given and non-bold, otherwise. This can be extended -- obviously -- to match any specific key.

It is important to know that this solution does not support to abbreviate the authors' names given in the macro. You will see that I passed "S. Author" to \MyName instead of "Some Author", because latex/bibtex cannot produce "S. Author" from it. However, this does not make this solution any less practical, I think.

Its problem: All names which are put into the \MyName macro appear more to the right than without using the macro. That is, there is a space of approx. 2mm on the left of any such name. This occurs independently of the matching if case, i.e., no matter whether it is bold or not. This is the reason why I have added a negative \hspace in front of it. However,

(a) this quiet dirty. Isn't there a (la)tex macro that eliminates the additional space? and

(b) it is impossible to find the correct space that needs to be subtracted, because it is different for different bibtex entries (sometimes this automatically inserted space is larger, sometimes it is smaller)

  • 2
    Check the updated answer. Your approach is also a solution. But I wanted something that does not involve updating the bib files. – adn Nov 23 '16 at 17:36
4

This is more or less a copy of my answer to Highlight an author in bibliography using biblatex allowing bibliography style to format it.

The following implements Audrey's solution for name hashes. The advantage of using hashes is that you only have to give one version of the name, all normalisation will be performed by Biber. The great disadvantage of hashes is that they are not easy to handle for humans. biblatex can't create the hashes on the fly, so that they need to be looked up in the .bbl file. The following solution automates hash lookup from the .bbl, so that you can use it more easily.

The solution works by writing all names you want in bold to a separate .bib file called (\jobname -boldnames.bib Warning That file will be overwritten without warning. In the unlikely event you already have a file of that name, you can rename the file by changing \hlblx@bibfile@name.). The hash can then be extracted using a dummy cite command.

Usage is very simple. Use \addboldnames to add a list of names to be highlighted. \addboldnames accepts a comma-separated list of names in the same format as you would write them to the .bib file. If a name contains a comma, the entire name must be wrapped in curly braces.

\addboldnames{{Silva, Carlos F. M.},{Silva, Jr., José Mairton B.}}

or

\addboldnames{Emma Sigfridsson}

\addboldnames can be used in the preamble and the document body.

To reset the list of names to be highlighted, use \resetboldnames.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber,style=numeric]{biblatex}

\addbibresource{biblatex-examples.bib}

\usepackage{xpatch}

\makeatletter
\def\hlblx@bibfile@name{\jobname -boldnames.bib}
\newwrite\hlblx@bibfile
\immediate\openout\hlblx@bibfile=\hlblx@bibfile@name

\newcounter{hlblx@name}
\setcounter{hlblx@name}{0}

\newcommand*{\hlblx@writenametobib}[1]{%
  \stepcounter{hlblx@name}%
  \edef\hlblx@tmp@nocite{%
    \noexpand\AfterPreamble{%
      \noexpand\setbox0\noexpand\vbox{%
        \noexpand\hlblx@getmethehash{hlblx@name@\the\value{hlblx@name}}}}%
  }%
  \hlblx@tmp@nocite
  \immediate\write\hlblx@bibfile{%
    @misc{hlblx@name@\the\value{hlblx@name}, author = {\unexpanded{#1}}, %
          options = {dataonly=true},}%
  }%
}

\AtEndDocument{%
  \closeout\hlblx@bibfile}

\addbibresource{\hlblx@bibfile@name}

\newcommand*{\hlbxl@boldhashes}{}
\DeclareNameFormat{hlblx@hashextract}{%
  \xifinlist{\thefield{hash}}{\hlbxl@boldhashes}
    {}
    {\listxadd{\hlbxl@boldhashes}{\thefield{fullhash}}}}

\DeclareCiteCommand{\hlblx@getmethehash}
  {}
  {\printnames[hlblx@hashextract][1-999]{author}}
  {}
  {}

\newcommand*{\addboldnames}{\forcsvlist\hlblx@writenametobib}
\newcommand*{\resetboldnames}{\def\hlbxl@boldhashes{}}

\newbibmacro*{name:bold}{%
  \def\do##1{\iffieldequalstr{hash}{##1}{\bfseries\listbreak}{}}%
  \dolistloop{\hlbxl@boldhashes}%
}
\makeatother

\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}{}{}

\addboldnames{{Sigfridsson, Emma},{Vizedom, Monika B.}}

\begin{document}
\fullcite{sigfridsson}

\fullcite{knuth:ct:a}

\fullcite{vizedom:related}

\resetboldnames\addboldnames{Donald E. Knuth}
\fullcite{knuth:ct:a}

\resetboldnames\addboldnames{Philipp Jaff{\'e}}
\fullcite{jaffe}
\end{document}

Bibliography with several names highlighted in bold.

  • What about name variants such as D. E. Knuth and Donald E. Knuth? – jlconlin Feb 21 '18 at 10:18
  • @jlconlin Of course that does not work. As far as Biber/biblatex are concerned these two are different people. How would they know differently? – moewe Feb 21 '18 at 10:20
1

Combining solution by adn, and suggestion by Audrey to use the "hash" field generated by biber, this works (texlive 2017.20170818-1):

\documentclass{article}
\usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
\addbibresource{biblatex-examples.bib}

% Run biber once, find the hash you want in the generated .bbl file 
% (here, M. Goossens) and paste here:
\edef\authorhash{\detokenize{0743efb276e9219ee664a9b3dbd60619}}

\renewcommand{\mkbibnamegiven}[1]{%
  \iffieldequals{hash}{\authorhash}{\mkbibbold{#1}}{#1}}
\renewcommand{\mkbibnamefamily}[1]{%
  \iffieldequals{hash}{\authorhash}{\mkbibbold{#1}}{#1}}
\renewcommand{\mkbibnameprefix}[1]{%
  \iffieldequals{hash}{\authorhash}{\mkbibbold{#1}}{#1}}
\renewcommand{\mkbibnamesuffix}[1]{%
  \iffieldequals{hash}{\authorhash}{\mkbibbold{#1}}{#1}}

\begin{document}
\nocite{companion}
\printbibliography
\end{document}

Edit: Following moewe's good advices, fixes and verifications (thanks !) :

  • switched to using the distrib’s .bib sample
  • added support to prefix/suffix parts of the names
  • used a macro to avoid copy-pasting hash 4 times

Patching name: as suggested by Audrey would indeed be more efficient but apparently it does not work anymore for some reason (see comment Make specific author bold using biblatex).

  • 1
    Welcome to TeX.SX! You could make your answer more useful if you used biblatex-examples, a file that is automatically available if biblatex is installed, instead of mybiblio.bib, which we don't have. You can avoid having to paste the hash twice if you save it in a macro. Note also that if the name has a suffix or prefix that will not be printed in bold with your solution. – moewe Feb 8 '18 at 15:07
  • \edef\boldname{\detokenize{0743efb276e9219ee664a9b3dbd60619}} \renewcommand{\mkbibnamegiven}[1]{% \iffieldequals{hash}{\boldname}{\mkbibbold{#1}}{#1}% } \renewcommand{\mkbibnamefamily}[1]{% \iffieldequals{hash}{\boldname}{\mkbibbold{#1}}{#1}% } (modulo line breaks) works for me. The hashes are detokenized so we need to do the same. \mkbibnamesuffix and \mkbibnameprefix should work, not sure how you added the fields by hand. The great advantage of Audrey's patching the name: macros instead of \mkbibname... is that the entire name is processed in one go ... – moewe Feb 8 '18 at 20:16
  • ... and not each name part separately. – moewe Feb 8 '18 at 20:16
  • Patching name: does still work, but you have to replace last by family and first by given. There were some change in name handling in version 3.3, see tex.stackexchange.com/q/299036/35864 – moewe Feb 9 '18 at 15:24
  • See tex.stackexchange.com/q/274436/35864 for a full solution with hashes that works. – moewe Feb 9 '18 at 15:25

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.