%20en%20la%20bibliograf%C3%ADa%20(error%20con%20%5CDefineBibliographyStrings%7Blanguage%7D%20y%20%5Ciffieldequalstr%7Bhyphenation%7D%20roto).png)
Estoy intentando obtener un idioma dependiente (personalizado) text
en bibliografía con pdflatex (biber).
He encontrado al menos 3 enfoques para hacer esto mediante:
\DefineBibliographyStrings{language}{bibfield={formatting}}
\NewBibliographyString
- crea un nuevo babero y úsalo como eneste ejemplo\iffieldequalstr{hyphenation}{language}{true}{false}
Sin embargo,primer enfoque
\DefineBibliographyStrings{english}{series = {Ser\adddot\addcolon\space{#1}\isdot}}
\DefineBibliographyStrings{russian}{series = {Сер\adddot\addcolon\space{#1}\isdot}}
conduce al error:
Error de valor de clave del paquete: serie no definida. }
Segundo enfoqueEs difícil de implementar si hay mucho text tuples
que personalizar.
Tercer enfoque
\DeclareFieldFormat{series}{\iffieldequalstr{hyphenation}{russian}{Сер}{Ser}\adddot\addcolon\space{#1}\isdot} %
no funciona con ningún campo orientado al lenguaje como hyphenation
.
Por favor, ayúdenme con la respuesta, que resuelve problemas con 1 y 3 enfoques.
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}
Salida deseada
Respuesta1
Tenga en cuenta primero que debe proporcionar valores no numéricos en el .bib
archivo entre llaves (o comillas). hyphenation = russian
es incorrecto y produce la advertencia WARN - BibTeX subsystem: <filename>, line 29, warning: undefined macro "russian"
. Debería ser
hyphenation = {russian},
No \iffieldequalstr{hyphenation}{russian}
funciona porque hyphenation
es un alias heredado. Internamente el campo ahora se llama langid
. Por eso,
\iffieldequalstr{langid}{russian}
obras.
Sin embargo, preferiría un enfoque con cadenas de bibliografía. Dado que la cadena series
aún no está definida, primero debe declararla con \NewBibliographyString{series}
. Luego puedes dar su definición en \DefineBibliographyStrings
. Tenga en cuenta que esta definición solo debe contener la cadena traducida, sin puntuación adicional ni ningún otro formato similar a una macro. Finalmente puedes usar la cadena con \bibsring
en el formato de campo. Este es básicamente el segundo enfoque deCreando nuevos comandos dentro del 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}
Tenga en cuenta que el tercer enfoque se sale de control rápidamente si desea agregar un tercer idioma. El primer enfoque simplemente no funciona porque biblatex
separa la localización (bibstrings) y el formato general (formatos de campo, etc.). Pero el segundo enfoque no requiere mucho más trabajo que el primero. De hecho, en este ejemplo incluso evitas la duplicación de código.