
text
私は、pdflatex (biber) を使用して、文献情報の言語依存 (カスタマイズ) を取得しようとしています。
私は、これを実行するための少なくとも 3 つのアプローチを見つけました。
\DefineBibliographyStrings{language}{bibfield={formatting}}
\NewBibliographyString
- 新しいbibstringを作成し、次のように使用します。この例\iffieldequalstr{hyphenation}{language}{true}{false}
しかし、最初のアプローチ
\DefineBibliographyStrings{english}{series = {Ser\adddot\addcolon\space{#1}\isdot}}
\DefineBibliographyStrings{russian}{series = {Сер\adddot\addcolon\space{#1}\isdot}}
次のエラーが発生します:
パッケージ keyval エラー: シリーズが未定義です。}
2番目のアプローチtext tuples
カスタマイズする項目が多い場合は実装が難しくなります。
3番目のアプローチ
\DeclareFieldFormat{series}{\iffieldequalstr{hyphenation}{russian}{Сер}{Ser}\adddot\addcolon\space{#1}\isdot} %
のような言語指向のフィールドでは機能しませんhyphenation
。
1 と 3 のアプローチの問題を解決する答えを教えてください。
ムウェ
\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}
望ましい出力
答え1
まず、ファイル内の数値以外の値は.bib
中括弧(または引用符)で囲む必要があることに注意してください。hyphenation = russian
は誤りであり、警告が表示されますWARN - BibTeX subsystem: <filename>, line 29, warning: undefined macro "russian"
。
hyphenation = {russian},
はレガシーエイリアスな\iffieldequalstr{hyphenation}{russian}
ので機能しませんhyphenation
。内部的にはフィールドは と呼ばれます langid
。したがって、
\iffieldequalstr{langid}{russian}
動作します。
しかし、私は文献文字列を使ったアプローチを好みます。文字列はseries
まだ定義されていないので、まず で宣言する必要があります\NewBibliographyString{series}
。次に で定義を与えることができます。この定義には翻訳された文字列のみを含め、追加の句読点やその他のマクロのような書式設定を含めないでください。最後に、フィールド形式で\DefineBibliographyStrings
で文字列を使用できます。これは基本的に、\bibsring
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}
3 番目のアプローチは、3 番目の言語を追加する場合、すぐに手に負えなくなることに注意してください。最初のアプローチは、biblatex
ローカリゼーション (bibstrings) と一般的な書式設定 (フィールド形式など) を分離するため、単純に機能しません。ただし、2 番目のアプローチは、最初のアプローチよりも作業量が多くなるわけではありません。実際、この例ではコードの重複を回避できます。