6

I am using an adaption of the verbose-ibid citestyle (as suggested here) and a custom bbx file based on authoryear. One of the things it changes is that it makes the author names appear bold. The only problem is that the verbose-ibid style seems to use the same macro and the bold names therefore appear in footcites as well.

Here is the relevant part of the bbx:

\RequireBibliographyStyle{authoryear}

\ExecuteBibliographyOptions{dashed=false,firstinits=true}

\renewbibmacro*{author}{%
  \ifboolexpr{
    test \ifuseauthor
    and
    not test {\ifnameundef{author}}
  }
    {\usebibmacro{bbx:dashcheck}
       {\bibnamedash}
       {\usebibmacro{bbx:savehash}%
        \textbf{\printnames{author}}% THIS IS THE IMPORTANT LINE
        \iffieldundef{authortype}
          {\setunit{\addspace}}
          {\setunit{\addcomma\space}}}%
     \iffieldundef{authortype}
       {}
       {\usebibmacro{authorstrg}%
        \setunit{\addspace}}}%
    {\global\undef\bbx@lasthash
     \usebibmacro{labeltitle}%
     \setunit*{\addspace}}%
  \usebibmacro{date+extrayear}}

\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{default}{last-first}

How can I apply textbf in the bibliography ony, not touching citations and footnotes?

4 Answers4

5

You can use the hook \AtBeginBibliography:

\AtBeginBibliography{%
   \renewcommand*{\mkbibnamefirst}[1]{\mkbibbold{#1}}%
   \renewcommand*{\mkbibnamelast}[1]{\mkbibbold{#1}}%
   \renewcommand*{\mkbibnameprefix}[1]{\mkbibbold{#1}}%
   \renewcommand*{\mkbibnameaffix}[1]{\mkbibbold{#1}}%
}
Marco Daniel
  • 95,681
  • Maybe you would like to use \mkbibbold instead of \tetxbf. – moewe May 18 '14 at 12:34
  • @moewe: Indeed. It's done. – Marco Daniel May 18 '14 at 12:37
  • One draw-back of this solution is though that all names in the bibliography will be printed in bold, even editors and translators. Also the "and" between author names is not printed in bold. – moewe May 18 '14 at 12:44
  • @moewe Is there any way to prevent that? If not, I'll use your suggestion. – just.kidding May 26 '14 at 17:30
  • @just.kidding It will be hard to avoid the first shortcoming I mentioned above without redefining (potentially quite a lot of) other commands. The second issue (noon bold and) can probably be dealt with, even though this will cause all "and"s to be bold (bringing you back to issue #1). – moewe May 26 '14 at 17:49
  • Comment in passing: In my case, with beamer, I had to squeeze this inside a makeatletter and makeatother job. The AtBeginBibliography wasn't working. Of all the answers, this is the only one that worked for me! – PatrickT Jul 03 '18 at 13:59
  • \mkbibnamelast has become \mkbibnamefamily, apparently. – PatrickT Jul 05 '18 at 20:18
  • 1
    @PatrickT And \mkbibnamefirst has become \mkbibnamegiven; \mkbibnameaffix is \mkbibnamesuffix now. Note that this solution bolds all names (for example also editors of @incollections) which may or may not be desired. – moewe Jul 05 '18 at 20:27
  • Thanks moewe. Do you have a solution to bold only the authors of the articles and not the authors of the collection? Thanks. – PatrickT Jul 05 '18 at 20:52
  • @PatrickT Authors or editors? Did you try my solution above? It bolds only the "primary" names associated with the work (the first name in the bibliography entry, usually the author, for some the editor). It should work for most standard styles, but if you use APA style that probably won't work. In that case I suggest you ask a new question. – moewe Jul 06 '18 at 07:54
  • @moewe, thanks. I was indeed using the apa style. Well let me try it out with some other style and see if I can get something like what I was looking for (I'm not that fussy). May need a few days to get back to this. Thanks! – PatrickT Jul 06 '18 at 08:16
  • 1
    @PatrickT In general I would only use biblatex-apa if I have to follow the APA style - or a derived style with tiny modifications. Usually the standard styles are much easier to customise and modify because biblatex-apa has to work hard to implement the APA guidelines (the same goes for a specialist styles, biblatex-chicago, biblatex-mla, ...). style=authoryear or its derived styles might be a good start. – moewe Jul 06 '18 at 08:31
2

Most biblatex styles use the name format sortname to print the author names in the bibliography, so we can redefine that format.

In particular sortname is the name format used for the authoryear- and authortitle-based bibliography styles (including the verbose family). If you want a similar effect for numeric and alphabetic styles you should redefine the name formats author, editor and translator directly.

First we define a new format: first-last-bold, it is based on first-last, but with an added \mkbibbold{

\DeclareNameFormat{given-family-bold}{\mkbibbold{%
  \ifgiveninits
    {\usebibmacro{name:given-family}
      {\namepartfamily}
      {\namepartgiveni}
      {\namepartprefix}
      {\namepartsuffix}}
    {\usebibmacro{name:given-family}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}}%
  \usebibmacro{name:andothers}}}

similarly one could have

\DeclareNameFormat{family-given-bold}{\mkbibbold{%
  \ifgiveninits
    {\usebibmacro{name:family-given}
      {\namepartfamily}
      {\namepartgiveni}
      {\namepartprefix}
      {\namepartsuffix}}
    {\usebibmacro{name:family-given}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}}%
  \usebibmacro{name:andothers}}}

or

\DeclareNameFormat{family-given/given-family-bold}{\mkbibbold{%
  \ifnumequal{\value{listcount}}{1}
    {\ifgiveninits
       {\usebibmacro{name:family-given}
         {\namepartfamily}
         {\namepartgiveni}
         {\namepartprefix}
         {\namepartsuffix}}
       {\usebibmacro{name:family-given}
         {\namepartfamily}
         {\namepartgiven}
         {\namepartprefix}
         {\namepartsuffix}}%
     \ifboolexpe{%
       test {\ifdefvoid\namepartgiven}
       and
       test {\ifdefvoid\namepartprefix}}
       {}
       {\usebibmacro{name:revsdelim}}}
    {\ifgiveninits
       {\usebibmacro{name:given-family}
         {\namepartfamily}
         {\namepartgiveni}
         {\namepartprefix}
         {\namepartsuffix}}
       {\usebibmacro{name:given-family}
         {\namepartfamily}
         {\namepartgiven}
         {\namepartprefix}
         {\namepartsuffix}}}%
  \usebibmacro{name:andothers}}}

then we tell biblatex to use the new format

\DeclareNameAlias{sortname}{given-family-bold}

This last step might have to be

\DeclareNameAlias{author}{given-family-bold}
\DeclareNameAlias{editor}{given-family-bold}
\DeclareNameAlias{translator}{given-family-bold}

with some styles.

MWE

\documentclass{article}
\usepackage[style=verbose-ibid,backend=biber]{biblatex}

\addbibresource{biblatex-examples.bib}

\DeclareNameFormat{given-family-bold}{\mkbibbold{%
  \ifgiveninits
    {\usebibmacro{name:given-family}
      {\namepartfamily}
      {\namepartgiveni}
      {\namepartprefix}
      {\namepartsuffix}}
    {\usebibmacro{name:given-family}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}}%
  \usebibmacro{name:andothers}}}

\DeclareNameAlias{sortname}{given-family-bold}

\begin{document}
\cite{cicero,wilde,baez/article,knuth:ct,aristotle:physics}


\printbibliography
\end{document}

enter image description here

The answer has been updated to conform with the new name format in version 3.3, see Biblatex 3.3 name formatting.

moewe
  • 175,683
  • 1
    This doesn't work for more recent versions of biblatex: see this answer by Ulrike Fischer – David R May 16 '17 at 12:42
  • @DavidRobertson Indeed this is a common problem for answers about the name format. Are you interested in an updated answer or are you OK with the hint in Ulrike's answer? – moewe May 16 '17 at 22:02
  • I think I've got the hang of it; I'll try to post it as an answer later today. Thanks for the offer though! – David R May 17 '17 at 13:26
  • The full code of this style can be please. I could not get this performance. – H.Gorbanzad Sep 09 '20 at 12:16
  • @H.Gorbanzad The last code block (titled MWE) is a fully compilable example document that contains all the required code to get the output shown below. (In fact I will edit the answer soon since there is a much easier solution with newer versions of biblatex.) But the code requires biblatex and Biber. If you use BibTeX it may not be compatible with what you have so far. – moewe Sep 09 '20 at 15:29
  • @moewe I ask the question in https://tex.stackexchange.com/questions/561978/make-author-names-bold-in-bibliography?noredirect=1#comment1416883_561978, that should be with run by xlatex. Can you please help? – H.Gorbanzad Sep 09 '20 at 16:14
  • @H.Gorbanzad As I suspected you are using (classical) BibTeX and not biblatex (see https://tex.stackexchange.com/q/25701/35864, https://tex.stackexchange.com/q/13509/35864 for a short explanation of what BibTeX and biblatex are). This solution is not compatible with your approach so far. And I'm afraid to say getting this done is a bit tricky with BibTeX (since it uses quite an arcane programming language). Off the top of my head I can't offer you a BibTeX solution. Sorry. – moewe Sep 09 '20 at 19:02
0

You should be able to add the \textbf-command by using the xpatch-package.

In the preamble:

\usepackage{xpatch}

Then you have to write before the \printbibliography:

\xpatchbibmacro{author}{\printnames{author}}{\textbf{\printnames{author}}}{}{}

which will replace the command.

(untested)

musicman
  • 3,559
  • 1
    I think you mixed up the order of the arguments, it ought to be \xpatchbibmacro{author}{\printnames{author}}{\textbf{\printnames{author}}}{}{}. Also note that this will only work with styles that use the original author macro and will not set editors of @collections in bold even though they are displayed like authors in the bibliography. I would suggest you use \mkbibbold instead of \textbf. – moewe May 18 '14 at 12:42
  • you are right, i've read it wrong. and this of course only work for the wanted author-bibmacro. – musicman May 18 '14 at 14:56
0

Here's a version of moewe's answer that's updated to work with biblatex versions 3.3+. I'm not an expert with biblatex at all, but wanted to write down what what I did to update the name format.

On my machine at work, the system-wide installation of biblatex is version 2.8a. Section 4.4.2 of the documentation explains that \DeclareNameFormat takes an three arguments. Within the third argument, #1 through to #8 are used to refer to various components of a person's name. The odd numbers give the full string, whereas even numbers abbreviate this to just initials. Here they are. In brackets I've added what they'd be if my name was Richard Wayne "Dick" van Dyke Senior.

  • #1 and #2: Surname(s), aka family names (Dyke, or D.)
  • #3 and #4: First and middle name(s), aka given names (Richard Wayne ``Dick'')
  • #5 and #6: Any name prefixes (van)
  • #7 and #8: Any name suffixes, aka affixes (Senior)

More recent versions of biblatex don't pass this information around as positional arguments; instead they're available as named macros. (This certainly makes it easier for a novice to understand what the format is actually doing. Here's what the arguments numbers above need to be translated into. Notice that the abbreviated versions are the same macro with an i at the end.

  • \namepartfamily and \namepartfamilyi
  • \namepartgiven and \namepartgiveni
  • \namepartprefix and \namepartprefixi
  • \namepartsuffix and \namepartsuffixi

If we replace all instances of #1 through #8 in this way, we get a document that compiles happily with bold surnames in the bibliography. However, biblatex isn't completely happy with us.

Package biblatex Warning: '\iffirstinits' is deprecated, use '\ifgiveninits'.
Package biblatex Warning: 'name:first-last' is deprecated, please use 'name:given-family'.

I guess the change in terminology is to better support names where the family comes first, e.g. with Japanese names. After updating the macro and strings as requested, the MWE is as follows.

\documentclass{article}
\usepackage[style=verbose-ibid, backend=biber]{biblatex}

\addbibresource{biblatex-examples.bib}

\DeclareNameAlias{sortname}{first-last-bold}

\DeclareNameFormat{first-last-bold}{\mkbibbold{%
  \ifgiveninits
    {\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffix}}
    {\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}}%
  \usebibmacro{name:andothers}}}

\begin{document}
\cite{cicero,wilde,baez/article,knuth:ct,aristotle:physics}

\printbibliography
\end{document}

The output from LaTeX is just as in moewe's answer.

David R
  • 743