
私はよくドイツ語と英語で文章を書き、参考文献を整理するために JabRef を使用しています。多くの会議論文を引用しているので、文書の言語に応じて場所の言語を常に変更するのは非常に面倒です。そこで、biblatex に一種の辞書を提供して、データベースを毎回調整しなくても済むようにできないかと考えました。
例えば、前文では次のように定義したいと思います。
Munich = München
Germany = Deutschland
ドキュメントまたは Babel 言語が の場合ngerman
。
これは可能ですか?
ムウェ
\documentclass[ngerman]{article}
\usepackage[ngerman]{babel}
\begin{filecontents}{bla.bib}
@inproceedings{Orwell1984,
author = "George Orwell",
title = "1984",
year = "1948",
booktitle = "Books about big brothers",
location = "Munich, Germany",
}
\end{filecontents}
\RequirePackage[backend=biber,style=ieee-alphabetic]{biblatex}
\addbibresource{bla.bib}
\begin{document}
\cite{Orwell1984}. \\
\printbibliography
\end{document}
答え1
の bibstringsを使用してbiblatex
、特定のフレーズを翻訳できます。問題は、どのようなインターフェイスが適切かということです。任意の用語を 1 つのフィールドで組み合わせられるようにしたい場合は、次のような操作を行う必要があります (少し扱いにくい感じがします)。
\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=ieee-alphabetic]{biblatex}
\NewBibliographyString{munich,germany}
\DefineBibliographyStrings{german}{
munich = {München},
germany = {Deutschland},
}
\begin{filecontents}{\jobname.bib}
@inproceedings{Orwell1984,
author = {George Orwell},
title = {1984},
year = {1948},
booktitle = {Books about big brothers},
location = {\bibstring{munich}, \bibstring{germany}},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\autocite{Orwell1984}
\printbibliography
\end{document}
フィールドごとに1つの文字列のみを使用することに問題がない場合は、もう少し見栄えを良くすることができます。
\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=ieee-alphabetic]{biblatex}
\NewBibliographyString{de-munich}
\DefineBibliographyStrings{german}{
de-munich = {München},
}
\DefineBibliographyStrings{english}{
de-munich = {Munich, Germany},
}
\DeclareListFormat{location}{%
\usebibmacro{list:delim}{#1}%
\ifbibstring{#1}{\bibstring{#1}}{#1}\isdot
\usebibmacro{list:andothers}}
\begin{filecontents}{\jobname.bib}
@inproceedings{Orwell1984,
author = {George Orwell},
title = {1984},
year = {1948},
booktitle = {Books about big brothers},
location = {de-munich},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\autocite{Orwell1984}
\printbibliography
\end{document}
より BibTeX 的なソリューションでは、@string
を使用します。各場所の文字列を異なる.bib
ファイル (言語ごとに 1 つ) で定義し、.bib
ドキュメントで必要な言語のファイルを選択できます。
\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=ieee-alphabetic]{biblatex}
\begin{filecontents}{locationstrings-german.bib}
@string{de:munich = "München"}
\end{filecontents}
\begin{filecontents}{locationstrings-english.bib}
@string{de:munich = "Munich, Germany"}
\end{filecontents}
% select the bib file for the language you want
\addbibresource{locationstrings-german.bib}
\begin{filecontents}{\jobname.bib}
@inproceedings{Orwell1984,
author = {George Orwell},
title = {1984},
year = {1948},
booktitle = {Books about big brothers},
location = de:munich,
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\autocite{Orwell1984}
\printbibliography
\end{document}
まだ実験段階のマルチスクリプト版biblatex
興味深いかもしれません:https://github.com/plk/biblatex/issues/416
答え2
\documentclass[ngerman]{article}
\usepackage[ngerman]{babel}
\begin{filecontents}{german-strings.bib}
@string{muenchen={München}}
@string{germany={Deutschland}}
\end{filecontents}
\begin{filecontents}[overwrite]{bla.bib}
@inproceedings{Orwell1984,
author = "George Orwell",
title = "1984",
year = "1948",
booktitle = "Books about big brothers",
location = muenchen # ", " # germany
}
\end{filecontents}
\RequirePackage[backend=biber,style=ieee-alphabetic]{biblatex}
\addbibresource{german-strings.bib}
\addbibresource{bla.bib}
\begin{document}
\cite{Orwell1984}. \\
\printbibliography
\end{document}