1

I'm trying to get a language dependent (customized) text in biblioraphy with pdflatex (biber).

I've found at least 3 approaches to do this by means of:

  1. \DefineBibliographyStrings{language}{bibfield={formatting}}
  2. \NewBibliographyString - create new bibstring and use it like in this example
  3. \iffieldequalstr{hyphenation}{language}{true}{false}

However, first approach

\DefineBibliographyStrings{english}{series = {Ser\adddot\addcolon\space{#1}\isdot}}

\DefineBibliographyStrings{russian}{series = {Сер\adddot\addcolon\space{#1}\isdot}}

leads to the error:

Package keyval Error: series undefined. }

Second approach is hard to implement if you have a lot of text tuples to be customizied.

Third approach

\DeclareFieldFormat{series}{\iffieldequalstr{hyphenation}{russian}{Сер}{Ser}\adddot\addcolon\space{#1}\isdot} % 

does not work with any laguage-oriented field like hyphenation.

Please, help me with the answer, which solves problems with 1 and 3 approaches.

MWE

\documentclass{memoir}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@INBOOK{Inbook,
  author       = {Peter Eston},
  title        = {The title of the work},
  booktitle    = {Book title},
  chapter      = {8},
  pages        = {201-213},
  publisher    = {The name of the publisher},
  year         = {1993},
  volume       = {4},
  series       = {5},
  address      = {The address of the publisher},
  edition      = {3},
  month        = {7},
  hyphenation     = {english}
}

@Book{avtonomova:fya,
  author = {Н. С. Автономова},
  title = {Философский язык Жака Деррида},
  year = 2011,
  publisher = {Российская политическая энциклопедия (РОССПЭН)},
  location = {М.},
  isbn = {978-5-8243-1618-6},
  series = {Российские Пропилеи},
  pagetotal = 510,
  hyphenation =russian,
}
\end{filecontents}

\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}[2014/04/30]         %
\usepackage[english, russian]{babel}[2014/03/24]% 


\usepackage[%
backend=biber,
bibencoding=utf8,
style=gost-numeric,
babel=other, 
defernumbers=true,
sortcites=true,
doi=true,
]{biblatex}[2016/09/17]
%add Ser.: to series format

%%% First approach
%\DefineBibliographyStrings{english}{series = {Ser\adddot\addcolon\space{#1}\isdot}}
%
%\DefineBibliographyStrings{russian}{series = {Сер\adddot\addcolon\space{#1}\isdot}}


%%% Third approach
\DeclareFieldFormat{series}{\iffieldequalstr{hyphenation}{russian}{Сер}{Ser}\adddot\addcolon\space{#1}\isdot} % do not work

%% Work perfectly
%\DeclareFieldFormat{series}{\iffieldequalstr{pagetotal}{510}{Сер}{Ser}\adddot\addcolon\space{#1}\isdot} %
\addbibresource{\jobname.bib}

\begin{document}

\cite{avtonomova:fya,Inbook}

\printbibliography

\end{document}

Desired output

enter image description here

1

Note first that you must give non-numeric values in the .bib file with curly braces (or quotation marks). hyphenation = russian is wrong and produces the warning WARN - BibTeX subsystem: <filename>, line 29, warning: undefined macro "russian". It should be

hyphenation = {russian},

The \iffieldequalstr{hyphenation}{russian} does not work because hyphenation is a legacy alias. Internally the field is now called langid. Hence,

\iffieldequalstr{langid}{russian}

works.

I would, however, prefer an approach with bibliography strings. Since the string series is not yet defined you need to declare it first with \NewBibliographyString{series}. Then you can give its definition in \DefineBibliographyStrings. Note that this definition should only contain the translated string, no additional punctuation and no other macro-like formatting. Finally you can use the string with \bibsring in the field format. This is basically the second approach from Creating new commands inside the bibfile.

\documentclass{memoir}
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}[2014/04/30]         %
\usepackage[english, russian]{babel}[2014/03/24]%

\usepackage[%
  backend=biber,
  style=gost-numeric,
  babel=other,
  defernumbers=true,
  sortcites=true,
  doi=true,
]{biblatex}[2016/09/17]

\NewBibliographyString{series}
\DefineBibliographyStrings{english}{series = {Ser\adddot}}
\DefineBibliographyStrings{russian}{series = {Сер\adddot}}

\DeclareFieldFormat{series}{\bibstring{series}\addcolon\space{#1}\isdot}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@INBOOK{Inbook,
  author       = {Peter Eston},
  title        = {The title of the work},
  booktitle    = {Book title},
  chapter      = {8},
  pages        = {201-213},
  publisher    = {The name of the publisher},
  year         = {1993},
  volume       = {4},
  series       = {5},
  address      = {The address of the publisher},
  edition      = {3},
  month        = {7},
  hyphenation  = {english}
}
@Book{avtonomova:fya,
  author      = {Н. С. Автономова},
  title       = {Философский язык Жака Деррида},
  year        = 2011,
  publisher   = {Российская политическая энциклопедия (РОССПЭН)},
  location    = {М.},
  isbn        = {978-5-8243-1618-6},
  series      = {Российские Пропилеи},
  pagetotal   = 510,
  hyphenation = {russian},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{avtonomova:fya,Inbook}

\printbibliography
\end{document}

"Ser.: 5" in English and "Сер.: Российские Пропилеи" in Russian.

Note that the third approach gets out of hand quickly if you want to add a third language. The first approach simply does not work because biblatex separates localisation (bibstrings) and general formatting (field formats etc.). But the second approach is not a lot more work than the first approach. In fact you even avoid code duplication in this example.

1
  • thank you so much for the answer. Third approad seems to be more dirty, indeed, e.g. \DeclareFieldFormat{series}{\iffieldequalstr{langid}{russian}{Сер}{\iffieldequalstr{langid}{english}{Bingo}{NotSpecified}}\adddot\addcolon\space{#1}\isdot} – Vladimir Parkhomenko Mar 20 '19 at 15:04

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.