
引用管理ツール Citavi を使用しているのですが、 形式でしかエクスポートできないという問題がありますurldate = {dd.mm.yyyy}
。しかし、Bibtex には 形式が必要ですurldate = {yyyy-mm-dd}
。私の場合、多くのエントリがあり、エクスポートするたびにやり直す必要があるため、参考文献の日付をすべて手動で変更するのは現実的ではありません。
たとえば、私の bibtex エントリは次のようになります。
@Misc{FAO.2011,
Title = {{FAOSTAT: Food balance sheet}},
Author = {FAO},
Year = {2011},
Address = {Rome},
Url = {http://faostat3.fao.org/download/FB/FBS/E},
Urldate = {15.1.2014}
}
その後、BibTexでコンパイルすると、次の警告が表示されます。
Package biblatex Warning: Biber reported the following issues
(biblatex) with 'FAO.2011':
(biblatex) - Datamodel: Entry 'FAO.2011' (literature.bib): Inval
id format '15.1.2014' of date field 'urldate' - ignoring.
urldate
Bibtexのフォーマットを変更する方法はありますか?urldate = {dd.mm.yyyy}
または、何らかの方法で変換できますか?urldate = {yyyy-mm-dd}
。
インターネットで検索しましたが、この問題の解決策は見つかりませんでした。これは Citavi 固有の問題のようです。Citavi がカスタマイズできないのは残念です。
私の質問は次のようなものです:biblatex/biber の警告を排除するために、参考文献フィールド (例: "urldate") を無視します。ただし、このトピックでは私の問題に対する解決策は提供されていません。この場合は はurldate
必要ないため、無視されました。しかし、 を提供する必要がありますurldate
。
答え1
Giacomo のフィードバックのおかげで、この特定の問題に対する別の解決策を見つけました。
この問題は、Citavi に関係しているようですが、Citavi は LaTeX ほど明確でも透明でもありません。今後、同様の問題に遭遇する可能性のある他の人のために、Citavi は 形式で日付を入力するように求めますが、urldate={dd.mm.yyyy}
と入力できますurldate = {yyyy-mm-dd}
。エクスポートでは問題は発生しません。不思議なことに、1 つのエントリを変更するだけで、他のすべてのエントリがそれに応じてエクスポートされます。もっと早く試さなかったのは私の責任です。もっと早く試すべきでした。
答え2
biblatex
パッケージを使用している場合は、
\DeclareSourcemap{
\maps{
\map[overwrite]{
\step[fieldsource=urldate,
match=\regexp{([0-9]{2})\.([0-9]{2})\.([0-9]{4})},
replace={$3-$2-$1},
final]
}
}
}
入力ファイルurldate
のフィールドを再フォーマットするには、プリアンブルで指定します。*.bib
答え3
BibTeX でフォーマットを強制するには、二重中括弧を使用します。例:
Urldate = {{15/01/2014}}
答え4
urldate の形式を変更する小さな Python スクリプトを書きました。.bib ファイルをこのスクリプトと同じディレクトリに配置し、「quellen.bib」という名前を付けてスクリプトを実行します。「changedFile.bib」という名前の新しい形式のファイルが表示されます。
import re
file = open("quellen.bib","r");
fileChanged = open("changedFile.bib","w");
pattern = re.compile("([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})");
for line in file:
if "urldate =" in line and pattern.search(line):
#save end of line to add it later to the modified date
endline = line[line.index('}')+1:len(line)];
date = line[line.index('{')+1:line.index('}')];
month = int(date[0:date.index('/')]);
date = date[date.index('/')+1:len(date)];
day = int(date[0:date.index('/')]);
date = date[date.index('/')+1:len(date)];
year = int(date);
if month > 12:
# check if month and day are reversed
temp = day;
day = month;
month = temp;
# check if every value is ledgit
if(month > 0 and month < 13 and day >0 and day < 32 and year > 1000):
if(month<10):
#add 0 if month or day is less then 10
month = "0"+str(month);
if(day<10):
day = "0"+str(day);
fileChanged.write(" urldate = {"+ str(year)+"-"+str(month)+"-"+str(day)+"}"+endline);
else:
print("something is wrong with this line: ");
print("day: ",day,"montH: ",month, "year: ",year);
print(line);
else:
fileChanged.write(line);
file.close;
fileChanged.close;