1

How do I make surnames in a bibliography small caps, except for 'author' when the keyword is 'primary'? Yes, I know I could just \textsc{…} them all, but I'd like this to be automated.

I suppose the answer to my question will be derivative of https://tex.stackexchange.com/a/29862/60686.


MWE:

\documentclass{scrartcl}
\usepackage{fontspec}
\usepackage[english]{babel}
\usepackage[style=verbose-ibid,backend=biber,]{biblatex}
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@article{roehrs2014,
    author = {Dorian Roehrs},
    title = {Inflections on Pre-Nominal Adjectives in Germanic},
    subtitle = {Main types, Subtypes, and Subset Relations},
    journaltitle = {Journal of Comparative Germanic Linguistics},
    journalshorttitle = {JCGL},
    volume = {18},
    year = {2015},
    pages = {213--271},
    doi = {10.1007/s10828-015-9076-z},
    keywords = {secondary},
}

@inbook{iwein-dkv,
    author = {Hartmann von Aue},
    title = {Iwein},
    booktitle = {Gregorius -- Der arme Heinrich -- Iwein},
    editor = {Volker Mertens},
    translator = {Volker Mertens},
    publisher = {Deutscher Klassiker Verlag},
    location = {Frankfurt/Main},
    year = {2008},
    series = {Deutscher Klassiker Verlag im Taschenbuch},
    number = {29},
    pages = {317--767},
    keywords = {primary},
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\begin{document}

\citeauthor{roehrs2014}\autocite{roehrs2014} and \citeauthor{iwein-dkv}\autocite{iwein-dkv}.

\nocite{*}
\printbibliography[keyword=primary, title={Primary Sources}, heading=subbibliography]
\printbibliography[keyword=secondary, title={Secondary Sources}, heading=subbibliography]

\end{document}

The way I want it, "Roehrs" and "Mertens" would be in small caps, while "von Aue" would be in normal type (ignoring that 'von Aue' is like 'da Vinci' not strictly speaking a surname, but whatever).

Jipí
  • 1,037

1 Answers1

3

We can use the \ifkeyword inside \mkbibnamelast

\renewcommand*{\mkbibnamelast}[1]{%
  \ifkeyword{primary}
    {#1}
    {\textsc{#1}}}

to check for primary only, but you can combine this with the more sophiscticated solution in Set author's last name in small caps but avoid them for editors, translators, etc using biblatex to

\def\ifmknamesc{%
  \ifboolexpr{ test {\ifcurrentname{labelname}}
               or test {\ifcurrentname{author}}
               or ( test {\ifnameundef{author}} and test {\ifcurrentname{editor}} ) }}

\renewcommand*{\mkbibnamelast}[1]{%
  \ifboolexpr{test {\ifkeyword{primary}} and test {\ifmknamesc}}
    {#1}
    {\textsc{#1}}}

You can apply the same to \mkbibnameprefix for the "von" part, \mkbibnamefirst for first names and \mkbibnameaffix for the "junior" part. In the MWE we change the last name and "von" part, but leave the rest as is.

MWE

\documentclass{scrartcl}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[style=verbose-ibid,backend=biber]{biblatex}
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@article{roehrs2014,
    author = {Dorian Roehrs},
    title = {Inflections on Pre-Nominal Adjectives in Germanic},
    subtitle = {Main types, Subtypes, and Subset Relations},
    journaltitle = {Journal of Comparative Germanic Linguistics},
    journalshorttitle = {JCGL},
    volume = {18},
    year = {2015},
    pages = {213--271},
    doi = {10.1007/s10828-015-9076-z},
    keywords = {secondary},
}

@inbook{iwein-dkv,
    author = {Hartmann von Aue},
    title = {Iwein},
    booktitle = {Gregorius -- Der arme Heinrich -- Iwein},
    editor = {Volker Mertens},
    translator = {Volker Mertens},
    publisher = {Deutscher Klassiker Verlag},
    location = {Frankfurt/Main},
    year = {2008},
    series = {Deutscher Klassiker Verlag im Taschenbuch},
    number = {29},
    pages = {317--767},
    keywords = {primary},
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\def\ifmknamesc{%
  \ifboolexpr{ test {\ifcurrentname{labelname}}
               or test {\ifcurrentname{author}}
               or ( test {\ifnameundef{author}} and test {\ifcurrentname{editor}} ) }}

\renewcommand*{\mkbibnamelast}[1]{%
  \ifboolexpr{test {\ifkeyword{primary}} and test {\ifmknamesc}}
    {#1}
    {\textsc{#1}}}
\renewcommand*{\mkbibnameprefix}[1]{%
  \ifboolexpr{test {\ifkeyword{primary}} and test {\ifmknamesc}}
    {#1}
    {\textsc{#1}}}

\begin{document}

\citeauthor{roehrs2014}\autocite{roehrs2014} and \citeauthor{iwein-dkv}\autocite{iwein-dkv}.

\nocite{*}
\printbibliography[keyword=primary, title={Primary Sources}, heading=subbibliography]
\printbibliography[keyword=secondary, title={Secondary Sources}, heading=subbibliography]
\end{document}

example output

moewe
  • 175,683
  • I didn't get around to updating the example image to the new MWE using the more elaborate code, so Mertens is currently not small-capsed. – moewe Nov 06 '15 at 07:53
  • That was more straightforward than I expected from browsing the Bibtex documentation last night :) Thank you. – Jipí Nov 06 '15 at 12:42