4

The solution proposed is the discussion Make a specific author bold using biblatex, does not work properly when using "french" language with the babel package. I suppose that french option in babel over write the given name format produced by biblatex. Is there a solution ?

This problem can be reproduced with the code below. I'am using the last updated version of biblatex (v3.10) and babel (v3.17).

Is there a way of extending this code to highlight in the same reference some author's name in bold and some other author's name with underline font ?

% !TeX TXS-program:bibliography = txs:///biber
\documentclass{article}

%\usepackage[french]{babel}

\usepackage{xpatch}
\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},
        AUTHOR+an                = {1=gras},
        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}


%% Other alternative which don't work.
%\renewcommand*{\mkbibnamegiven}[1]{%
%    \ifitemannotation{gras}
%    {\textbf{#1}}
%    {#1}}
%
%\renewcommand*{\mkbibnamefamily}[1]{%
%    \ifitemannotation{gras}
%    {\textbf{#1}}
%    {#1}}


\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}
    Examples :
    \nocite{*}
    \printbibliography

\end{document}
  • An obvious problem is that you either need a text font that supports boldface small caps or change the typesetting of the authors removing the choice of small caps. The former strategy doesn't work, so there's more behind the issue. – egreg Jan 27 '18 at 18:21
4

The general approach of the annotation feature as explained in PLK's answer to Make specific author bold using biblatex works.

If you use french, the macro \mkbibnamefamily is automatically changed so that it prints the author name in small caps. This means that your redefinition of \mkbibfamily is overwritten. You can avoid this with

\DefineBibliographyExtras{french}{\restorecommand\mkbibnamefamily}

In full

\documentclass{article}
\usepackage{libertine}
\usepackage[french]{babel}

\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},
  AUTHOR+an                = {1=gras},
  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}



\renewcommand*{\mkbibnamegiven}[1]{%
  \ifitemannotation{gras}
    {\mkbibbold{#1}}
    {#1}}

\renewcommand*{\mkbibnamefamily}[1]{%
  \ifitemannotation{gras}
    {\mkbibbold{#1}}
    {#1}}

\DefineBibliographyExtras{french}{\restorecommand\mkbibnamefamily}

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

enter image description here

If you want authors in small caps, you need

\renewcommand*{\mkbibnamefamily}[1]{%
  \ifitemannotation{gras}
    {\mkbibbold{\textsc{\textnohyphenation{#1}}}}
    {\textsc{\textnohyphenation{#1}}}}

but then you need a font that supports bold small caps (Latin modern does not).

enter image description here

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.