
参考文献をキーワードでグループ化できることは知っています。しかし、これは当てはまりません。アルファベット順の並べ替えと数値スタイルを使用しない場合、参考文献をキーワードで分割できます。しかし、並べ替えられた参考文献と数値番号が必要で、それを分割しようとすると、番号が壊れてしまいます。必要なのは、ある言語の参考文献項目を別の言語項目より前にすることです。例:
\documentclass[a4paper]{article}
\usepackage{fontspec}
\usepackage[english,greek,russian]{babel} % English please
\setmainfont[
BoldFont={DeJavu Serif Bold},
ItalicFont={DeJavu Serif Italic},
BoldItalicFont={DeJavu Serif BoldItalic}
]{DeJavu Serif}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{AlKarapan,
author = {Καραπαναγοπούλου, Αλέξανδρος Κ.},
title = {Η Μεγάλη Σύνοδος της Ορθοδόξου Ανατολικής Εκκλησίας},
publisher = {auto-édition},
date = {1990/1998},
volumes = {6},
address = {Αθήνα},
langid={greek},
}
@Inbook{CypinIstorijaRPC,
author = {Владислав Цыпин},
title = {История Русской Церкви 1917--1997},
chapter = {VIII},
publisher = {Издательство Спасо-Преображенского Валаамского монастыря},
address = {Москва},
date = {1997},
urldate = {2010-10-25},
url = {http://old.pravoslavie.by/podpod.asp?id=135&Session=10},
langid={russian},
}
@Inbook{authorrus,
author = {Другой Автор},
title = {Название},
chapter = {VIII},
publisher = {Издательство},
address = {Москва},
date = {1997},
urldate = {2010-10-25},
langid={russian},
}
@article{baez/article,
author = {Baez, John C. and Lauda, Aaron D.},
title = {Higher-Dimensional Algebra {V}: 2-Groups},
journaltitle = {Theory and Applications of Categories},
date = 2004,
volume = 12,
pages = {423-491},
version = 3,
eprint = {math/0307200v3},
eprinttype = {arxiv},
langid = {english},
langidopts = {variant=american},
annotation = {An \texttt{article} with \texttt{eprint} and
\texttt{eprinttype} fields. Note that the arXiv reference is
transformed into a clickable link if \texttt{hyperref} support
has been enabled. Compare \texttt{baez\slash online}, which
is the same item given as an \texttt{online} entry},
hyphenation={english},
}
@article{another,
author = {Another,Author and One more, Author},
title = {Title},
journaltitle = {Journal},
date = 2004,
volume = 12,
pages = {423-491},
version = 3,
eprint = {math/0307200v3},
eprinttype = {arxiv},
langid = {english},
langidopts = {variant=american},
hyphenation={english},
}
\end{filecontents*}
\usepackage[russian,greek,english]{babel}
\usepackage[natbib=true,
style=numeric,
isbn=true,
url=true,
defernumbers=false,
sorting=nyt,
firstinits=true,
backend=biber,
language=auto,
autolang=other]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
\cite{AlKarapan,CypinIstorijaRPC,baez/article}
\nocite{*}
\printbibliography
\end{document}
出力は次のようになります。英語、ギリシャ語、ロシア語の項目。BBLファイルを編集して、最初にロシア語のエントリを移動し、次にギリシャ語のエントリ、最後に英語のエントリを移動します。ビバーを走らせないでエントリを引用して lualatex または xelatex を実行するだけで、すべてうまくいきます。
Biblatex/Biber は参考文献をソートし、bbl ファイル内の特定の言語のエントリを手動で移動します。特定の言語でソートされたエントリと、必要な言語順序が取得されます。
質問: bblファイルを編集せずにこのような順序付けを行うことはできますか?
連続した番号が必要なので、複数のビブを使用することはできません
答え1
もちろん、\sort{\field{langid}}
ソート手順に を入れるだけで済みますが、そうすると言語が辞書順にソートされるため、英語が最初に表示され、次にギリシャ語、ロシア語の順になり、希望どおりにはなりません。
しかし、ちなみに、下降辞書順に並べると、MWE で必要な順序が得られます。
\DeclareSortingScheme{lnyt}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort[direction=descending]{\field{langid}}
\sort{
\field{sortname}
\field{author}
\field{editor}
\field{translator}
\field{sorttitle}
\field{title}
}
\sort{
\field{sortyear}
\field{year}
}
\sort{
\field{sorttitle}
\field{title}
}
\sort{
\field[padside=left,padwidth=4,padchar=0]{volume}
\literal{0000}
}
}
もちろん、これは、必要な並べ替え順序が言語名の逆辞書式順序と一致するためです。
今すぐご利用くださいsorting=lnyt
。
よりカスタマイズ可能ですが、少し複雑なソリューションでは、presort
フィールドと Biber のソースマッピング機能を使用します。
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=langid, match=\regexp{\Arussian\Z}, final]
\step[fieldset=presort, fieldvalue=1]
}
\map{
\step[fieldsource=langid, match=\regexp{\Agreek\Z}, final]
\step[fieldset=presort, fieldvalue=2]
}
\map{
\step[fieldsource=langid, match=\regexp{\Aenglish\Z}, final]
\step[fieldset=presort, fieldvalue=3]
}
}
}
各言語は、フィールドに書き込まれる番号に単純にマッピングされますpresort
。このpresort
フィールドは、他のソート フィールドよりも先に考慮されます。
これにより、辞書式順序に従わない並べ替え順序が可能になります。
ムウェ
\documentclass[a4paper]{article}
\usepackage{fontspec}
\usepackage[english,greek,russian]{babel} % English please
\setmainfont[
BoldFont={DeJavu Serif Bold},
ItalicFont={DeJavu Serif Italic},
BoldItalicFont={DeJavu Serif BoldItalic}
]{DeJavu Serif}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{AlKarapan,
author = {Καραπαναγοπούλου, Αλέξανδρος Κ.},
title = {Η Μεγάλη Σύνοδος της Ορθοδόξου Ανατολικής Εκκλησίας},
publisher = {auto-édition},
date = {1990/1998},
volumes = {6},
address = {Αθήνα},
langid={greek},
}
@Inbook{CypinIstorijaRPC,
author = {Владислав Цыпин},
title = {История Русской Церкви 1917--1997},
chapter = {VIII},
publisher = {Издательство Спасо-Преображенского Валаамского монастыря},
address = {Москва},
date = {1997},
urldate = {2010-10-25},
url = {http://old.pravoslavie.by/podpod.asp?id=135&Session=10},
langid={russian},
}
@Inbook{authorrus,
author = {Другой Автор},
title = {Название},
chapter = {VIII},
publisher = {Издательство},
address = {Москва},
date = {1997},
urldate = {2010-10-25},
langid={russian},
}
@article{baez/article,
author = {Baez, John C. and Lauda, Aaron D.},
title = {Higher-Dimensional Algebra {V}: 2-Groups},
journaltitle = {Theory and Applications of Categories},
date = 2004,
volume = 12,
pages = {423-491},
version = 3,
eprint = {math/0307200v3},
eprinttype = {arxiv},
langid = {english},
langidopts = {variant=american},
annotation = {An \texttt{article} with \texttt{eprint} and
\texttt{eprinttype} fields. Note that the arXiv reference is
transformed into a clickable link if \texttt{hyperref} support
has been enabled. Compare \texttt{baez\slash online}, which
is the same item given as an \texttt{online} entry},
hyphenation={english},
}
@article{another,
author = {Another,Author and One more, Author},
title = {Title},
journaltitle = {Journal},
date = 2004,
volume = 12,
pages = {423-491},
version = 3,
eprint = {math/0307200v3},
eprinttype = {arxiv},
langid = {english},
langidopts = {variant=american},
hyphenation={english},
}
\end{filecontents*}
\usepackage[russian,greek,english]{babel}
\usepackage[natbib=true,
style=numeric,
isbn=true,
url=true,
defernumbers=false,
sorting=nyt,
firstinits=true,
backend=biber,
language=auto,
autolang=other]{biblatex}
\addbibresource{\jobname.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=langid, match=\regexp{\Arussian\Z}, final]
\step[fieldset=presort, fieldvalue=1]
}
\map{
\step[fieldsource=langid, match=\regexp{\Agreek\Z}, final]
\step[fieldset=presort, fieldvalue=2]
}
\map{
\step[fieldsource=langid, match=\regexp{\Aenglish\Z}, final]
\step[fieldset=presort, fieldvalue=3]
}
}
}
\begin{document}
\cite{AlKarapan,CypinIstorijaRPC,baez/article}
\nocite{*}
\printbibliography
\end{document}
答え2
以下は moewe さんの回答の簡略版です。
BibTeXソースファイル
次の BibTeX ファイルは に保存されます~/TestBib.bib
。
@book{shakespeare,
author = {William Shakespeare},
title = {Hamlet},
year = {1600},
langid = {english}
}
@book{homer,
author = {Homer},
title = {Illiad \& Oddysey},
year = {8th century BC},
langid = {greek}
}
@book{tolstoy,
author = {Leo Tolstoy},
title = {War and Peace},
year = {1869},
langid = {russian}
}
参考文献付きのシンプルなLaTeX文書
\documentclass{article}
\usepackage{biblatex}
\addbibresource{TestBib.bib}
\begin{document}
\cite{shakespeare}\cite{homer}\cite{tolstoy}
\printbibliography
\end{document}
実行の結果
> cd ~
> lualatex テスト
> biber テスト
> lualatex テスト
は
英語が最初、その他はデフォルトの順序に従って
\documentclass{article}
\usepackage{biblatex}
\DeclareSourcemap {
\maps {
\map {
\step [
fieldsource=langid,
match=english,
fieldset=presort,
fieldvalue=a
]
}
}
}
\addbibresource{TestBib.bib}
\begin{document}
\cite{shakespeare}\cite{homer}\cite{tolstoy}
\printbibliography
\end{document}
英語が第一、ロシア語が第二
ここで、ソース マップを追加して、英語のエントリが最初、ロシア語のエントリが 2 番目になるように書誌エントリを順序付けます。
\documentclass{article}
\usepackage{biblatex}
\DeclareSourcemap {
\maps {
\map {
\step [
fieldsource=langid,
match=english,
fieldset=presort,
fieldvalue=a
]
\step [
fieldsource=langid,
match=russian,
fieldset=presort,
fieldvalue=b
]
}
}
}
\addbibresource{TestBib.bib}
\begin{document}
\cite{shakespeare}\cite{homer}\cite{tolstoy}
\printbibliography
\end{document}
出力は次のようになります。
ノート
はオプションのデフォルト値であるため、(moewe の回答のように)
datatype=bibtex
オプションを に渡す必要はありません。マニュアルの 199 ページ、v. 3.18b、2022 年 7 月 12 日を参照してください。\maps
bibtex
datatype
biblatex
正規表現に有効な TEX コマンドでもある文字シーケンスが含まれていない限り、正規表現を囲む必要はありません
\regexp
(moewe の回答のように)。マニュアルの 204 ページを参照してください。特殊フィールドの値のデータ型は、数値ではなく文字列として
presort
解釈されますbiblatex
。(マニュアルの 31 ページを参照してください。) したがって、その値に適用される順序は、数値ではなく辞書式です。 したがって、私の意見では、直感的でない結果を避けるために、このフィールドに数値を割り当てることは避けるのが最善です (moewe の回答で行われたように)。 たとえば、私の「英語が最初、ロシア語が 2 番目」の例では、英語のエントリにpresort
の値を2
、ロシア語のエントリpresort
に の値をそれぞれ割り当てた場合10
、参考文献ではロシア語のエントリが英語のエントリの前に表示されてしまいます。明示的に指定されない限り、書誌エントリの
presort
フィールドは自動的に に設定されますmm
。(マニュアルの 83 ページのセクション 3.6「並べ替えオプション」の 2 番目の段落を参照してください。) したがって、並べlangid
替えの基準にしたい の値が正確に 3 つある場合、(moewe の回答のように) 3 つすべての値を明示的に指定する必要はありません。そのうちの 2 つの値のみを明示的に指定し、両方とも辞書式で より小さいことを確認するだけpresort
で十分です。presort
mm
これは、特定のエントリを参考文献の先頭に表示したいが、残りのエントリの相対的な順序を指定する必要がない場合にも役立つ情報です。これは、私が「英語を最初に、その他はデフォルトの順序に従う」という例で行ったようにです。
ソース マッピングは、マニュアルの付録 C1-C3 で説明されているデフォルトの組み込みテンプレートを含む、すべてのソート テンプレートが適用される前に行われることに注意してください。(マニュアルの 199 ページのセクション 4.5.3「データの動的変更」の 2 番目の段落を参照してください。) したがって、デフォルトのソート テンプレートのいずれかを使用する場合、つまり、
nty
ソート テンプレートを明示的に指定しない場合に使用されるデフォルトのソート テンプレートを使用する場合 (マニュアルの 48 ページのセクション 3.1.2.1「パッケージ オプション/プリアンブル オプション/全般」を参照)、各グループ内のエントリの順序はpresort
、テンプレートによって規定されたとおり、つまり期待どおりになります。step
賢明に配置すると、 s とsの数をmap
大幅に減らすことができ、s の数をfinal
減らすか、完全になくすことさえできます。moewe の回答と私の「英語が最初、ロシア語が 2 番目」の例を比較してください。final
相談の意味についてmoeweによるこの回答マニュアルが不明瞭で、誤解を招く恐れもあるためです。