2

I would like to make a custom bibliography and have nearly everything working. The only things I need are bold, upopercased authors. Actually I got it working with example I found on stackexchange, but there is a bug in it that appears only if there is only one author.

They should be printed bold and in uppercase. As you see in the picture below, that is already the case. But in the first reference, the author's name is printed incorrectly. It should be "RAUCH, G." and not "G.G. RAUCH". Not sure why, but the first name's initial is printed twice.

\documentclass{article}

\usepackage[
    backend=biber,
    style=authoryear-icomp,
    sorting=nyt,
    maxbibnames=3,
    giveninits=true,
    dashed=false,
]{biblatex}

\usepackage{xpatch}

%\DeclareNameFormat{author}{\MakeUppercase{#1}}

\def\bmkbibbold#1\emkbibbold{\mkbibbold{#1}}
\xpretobibmacro{author}{\bmkbibbold}{}{}
\xpatchbibmacro{author}
{\usebibmacro{date+extradate}}
{\emkbibbold\usebibmacro{date+extradate}}
{}{}

\xpretobibmacro{bbx:editor}{\bmkbibbold}{}{}
\xpatchbibmacro{bbx:editor}
{\usebibmacro{date+extradate}}
{\emkbibbold\usebibmacro{date+extradate}}
{}{}

\xpretobibmacro{bbx:translator}{\bmkbibbold}{}{}
\xpatchbibmacro{bbx:translator}
{\usebibmacro{date+extradate}}
{\emkbibbold\usebibmacro{date+extradate}}
{}{}



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

\DeclareNameFormat{given-family-upper}{%
    \ifgiveninits
    {\usebibmacro{name:given-family}
        {\MakeUppercase{\namepartfamily}}
        {\MakeUppercase{\namepartgiveni}}
        {\MakeUppercase{\namepartprefix}}
        {\MakeUppercase{\namepartsuffix}}}
    {\usebibmacro{name:given-family}
        {\MakeUppercase{\namepartfamily}}
        {\MakeUppercase{\namepartgiveni}}
        {\MakeUppercase{\namepartprefix}}
        {\MakeUppercase{\namepartsuffix}}}%
    \usebibmacro{name:andothers}}


\begin{filecontents}{test2.bib}
@inproceedings{seabold2010,
    title={statsmodels: Econometric and statistical modeling with python},
    author={{Seabold, S.} and {Perktold, J.}},
    booktitle={9th Python in Science Conference},
    year={2010},
}
@online{rauch2022,
    author = {Rauch, G},
    title = {Was ist ein Software-Entwurf?},
    date = {2022},
    url = {https://www.dev-insider.de/was-ist-ein-software-entwurf-a-1088943/},
    urldate = {2022-03-29}
}
\end{filecontents}

\addbibresource{test2.bib}

\begin{document}

\cite{seabold2010} \\
\cite{rauch2022}

\printbibliography

\end{document}

enter image description here

Any idea what is the problem here?

2
  • Try author = {{Rauch, G.}},, so it matches the other entry.
    – Cicada
    Commented Jul 28, 2022 at 16:04
  • @Cicada That actually works for the bibliography. But then the citation is printed wrongly, like (Rauch, G. 2012). There shouldn't be the first name initial in the citation.
    – Marcel
    Commented Jul 28, 2022 at 20:16

1 Answer 1

4

There are now more elegant ways to get bold author names with \DeclareNameWrapperFormat (biblatex prints "family=, familyi=" etc. in bibliography), I suggest you use that instead of the tedious solution patching several bibmacros.

You also should not force a particular name format with curly braces. Instead select the desired name format with \DeclareNameAlias.

\documentclass{article}

\usepackage[
  backend=biber,
  style=authoryear-icomp,
  maxbibnames=3,
  giveninits=true,
  dashed=false,
]{biblatex}

\DeclareNameAlias{sortname}{family-given}
\DeclareNameWrapperFormat{sortname}{\mkbibbold{#1}}

\begin{filecontents}{\jobname.bib}
@inproceedings{seabold2010,
  title     = {statsmodels: Econometric and statistical modeling with python},
  author    = {Seabold, S. and Perktold, J.},
  booktitle = {9th Python in Science Conference},
  year      = {2010},
}
@online{rauch2022,
  author  = {Rauch, G.},
  title   = {Was ist ein Software-Entwurf?},
  date    = {2022},
  url     = {https://www.dev-insider.de/was-ist-ein-software-entwurf-a-1088943/},
  urldate = {2022-03-29}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{seabold2010,rauch2022}

\printbibliography
\end{document}

"Rauch, G. (2022). Was ist ein Software-Entwurf? url: https://www.dev-insider.de/was-ist-ein-software-entwurf-a-1088943/ (visited on 03/29/2022).
Seabold, S. and Perktold, J. (2010). “statsmodels: Econometric and statistical modeling with python”. In: 9th Python in Science Conference."
The names are bold

3
  • What would the uppercasing code look like?
    – Cicada
    Commented Jul 28, 2022 at 17:10
  • 1
    @Cicada Depends on what exactly is desired. Possibly \DeclareNameWrapperFormat{sortname}{\renewcommand*{\mkbibcompletename}{\MakeUppercase}\mkbibbold{#1}}. Possibly \DeclareNameWrapperFormat{sortname}{\renewcommand*{\mkbibnamefamily}{\MakeUppercase}\mkbibbold{#1}}. (That said, I'm not too fond of ALL CAPS, so I'd probably go with \textsc instead of \MakeUppercase, but then you need to use a font that has bold small caps.)
    – moewe
    Commented Jul 28, 2022 at 18:53
  • @moewe Thanks, the code for ALL CAPS works perfectly fine, just tested it.
    – Marcel
    Commented Jul 28, 2022 at 20:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .