2

How to add the prefix 'in' before the language in the bibliography? I would like to get this:

Einstein, A. 'Die Grundlage der allgemeinen Relativitätstheorie'. In German. Annalen der Physik 1916; 354(7), 769-822.

I thought something like \DeclareFieldFormat{pages}{#1} (used to remove the prefix for the pages field) would work, but I could not figure it out. I tried several field names like language or langid, but none worked (probably because it's a list rather than a string).

Thanks and best regards!

6
  • The exact solution will depend on the bibliography package and the style you use. I can see from the output you show that you do not use the standard styles. You can make it much easier for us to help you if you show us an MWE of what you have so far.
    – moewe
    Mar 27, 2018 at 9:11
  • 1
    Since you highlighted the In before the language, I'll assume you need to change what you have so far only in this regard. Then use \DeclareListFormat{language}{In #1}. Otherwise, as moewe said, please provide a MWE. Mar 27, 2018 at 9:16
  • Thanks @Christoph90, that works! Unfortunately, the language is now written in lowercase, how could I prevent this?
    – Pontis
    Mar 27, 2018 at 9:24
  • 1
    \DeclareListFormat{language}{In #1} is not a good solution. It does not localise the language names.
    – moewe
    Mar 27, 2018 at 9:25
  • @AnBr Can't reproduce that. It's still uppercase for me. Anyways, better ref. to moewe's answer. Mar 27, 2018 at 9:32

1 Answer 1

3

You need to redefine the list format. To insert the "in" in the appropriate place we can slightly modify the macro responsible for the list delimiters.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear, backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{appleby,
  author  = {Humphrey Appleby},
  title   = {Über die Bedeutung des Berufsbeamtentums},
  language = {german},
  date    = {1980},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\newbibmacro*{list:in:delim}[1]{%
  \ifnumgreater{\value{listcount}}{\value{liststart}}
    {\ifboolexpr{
       test {\ifnumless{\value{listcount}}{\value{liststop}}}
       or
       test \ifmoreitems
     }
       {\printdelim{multilistdelim}}
       {\lbx@finallistdelim{#1}}}
    {\bibstring{in}\addspace}}

\DeclareListFormat{language}{%
  \usebibmacro{list:in:delim}{%
    \ifbibstring{#1}
      {\bibxstring{#1}}
      {\ifbibstring{lang#1}
         {\bibxstring{lang#1}}
         {#1}}}%
  \ifbibstring{#1}
    {\bibstring{#1}}
    {\ifbibstring{lang#1}
       {\bibstring{lang#1}}
       {#1}}%
  \usebibmacro{list:andothers}}

\begin{document}
\cite{appleby}
\printbibliography
\end{document}

enter image description here

2
  • Thanks a lot! Sorry for not preparing a MWE, I thought something like a simple redefinition would be sufficient.
    – Pontis
    Mar 27, 2018 at 11:28
  • 1
    @AnBr The thing is: If you don't use the standard styles you could use a style that redefines the default behaviour, in that case it can not be guaranteed that things work if we don't know what the style changes. And even if you use the standard styles we don't know what you do to customise the bibliography, maybe you already have some code that interferes with this. We can only test our solutions if we get to see an MWE of your set-up. Plus an MWE makes it easier for us to get started, we can just copy and paste and start to write code.
    – moewe
    Mar 27, 2018 at 13:20

You must log in to answer this question.

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