1

My aim is to use BiBLaTeX with the numeric-comp style and family-given/given-family way of sorting author's names, with all names in bold. Here's my MWE:

\documentclass{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

\usepackage[
backend=biber,
style=numeric-comp,
sorting=none,
]{biblatex}

\addbibresource{test.bib}

\DeclareNameAlias{sortname}{family-given/given-family-bold}
\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}}}

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

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

    \usepackage{filecontents}

    \begin{filecontents}{test.bib}
        @book{Doe86,
            author = {Doe, John},
            year = {1986},
            title = {some book},
        }
    \end{filecontents}


\begin{document}

I'm citing \cite{Doe86}

\printbibliography

\end{document}

Strangely, it produces the following ouput, no matter how often I compile (both latex and biber). What am I doing wrong?

enter image description here

  • @moewe, thanks, it looks normal again and is so much better for its shortness! It's weird that the other one doesn't work because I copy-pasted the code from one of your answers. Could it be a version issue? However, now the 'family-given/given-family' sorting is not maintained, how do I go about that? – Anne Morbach Aug 17 at 16:14
1

With a current version of biblatex I would use name wrappers to apply the boldface to the names. If you want the mixed family-given/given-family order, you still need to redefine the name format as well (because the default for numeric styles is given-family order).

\documentclass{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

\usepackage[
  backend=biber,
  style=numeric-comp,
  sorting=none,
]{biblatex}

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

\DeclareNameAlias{author}{sortname}
\DeclareNameAlias{editor}{sortname}
\DeclareNameAlias{translator}{sortname}

\DeclareNameWrapperFormat{sortname}{\mkbibbold{#1}}

\DeclareNameWrapperAlias{author}{sortname}
\DeclareNameWrapperAlias{editor}{sortname}
\DeclareNameWrapperAlias{translator}{sortname}

\addbibresource{biblatex-examples.bib}

\begin{document}
I'm citing \cite{sigfridsson,nussbaum}

\printbibliography
\end{document}

**Sigfridsson, Emma and Ulf Ryde**. “Comparison of methods for deriving atomic charges from the electrostatic potential and moments”. In: Journal of Computational Chemistry 19.4 (1998), pp. 377–395. doi: 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P.//**Nussbaum, Martha**. Aristotle’s “De Motu Animalium”. Princeton: Princeton University Press, 1978. (bold text marked with double asterisks)


The problem with the code from the question was that it defined one name format (family-given/given-family-bold), but then used a different, non-existing format (given-family-bold). Non-existing formats result in the weird output you got. The could could be reworked as follows (but I still prefer the solution above).

\documentclass{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

\usepackage[
  backend=biber,
  style=numeric-comp,
  sorting=none,
]{biblatex}


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

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

\DeclareNameAlias{author}{sortname}
\DeclareNameAlias{editor}{sortname}
\DeclareNameAlias{translator}{sortname}


\addbibresource{biblatex-examples.bib}

\begin{document}
I'm citing \cite{sigfridsson,nussbaum}

\printbibliography
\end{document}

The output is the same.

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.