我正在使用 biblatex 和 biber 引用历史课上展示的作品。以世纪为单位的数据(12 世纪或12世纪法语中“年份”一词非常常见。我过去常常在“年份”字段中输入此类日期,自上次升级以来,它一直有效:
以下是 MWE 使用 TexLive 2015 编译的内容……
\documentclass{article}
\usepackage{biblatex}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Thesis{exemple_image,
Title = {Title of the work},
Author = {Artist Name},
Location = {Switzerland},
Year = {{\siecle{15}}},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\newcommand{\siecle}[1]{%
\textsc{\romannumeral #1}\textsuperscript{e}~siècle
}
\nocite{*}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
...但在 TexLive 2016 中不再如此,我遇到了一个错误:! Use of /sortlist doesn't match its definition
。
我猜 Biblatex 3.5 对“年份”字段的宽容度较低。我在文档中搜索过但没有结果,我愿意听取所有建议。
答案1
使用 3.10 及更高版本的新 ISO 8601 日期功能,biblatex
您可以输入一个世纪作为
date = {19XX}
不幸的是,标准日期格式不能通过显示“20 世纪”或类似的输出来处理这个问题,它们只会写“1900-1999”,但我们可以按如下方式处理世纪
\documentclass[french]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@thesis{exemple_image,
title = {Title of the work},
author = {Artist Name},
location = {Switzerland},
date = {16XX},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\NewBibliographyString{century}
\DefineBibliographyStrings{french}{century = {siècle}}
\makeatletter
\renewcommand*{\RNfont}{\textsc}
\DeclareFieldFormat{datecentury}{\RN{#1}\textsuperscript{e}}
\renewrobustcmd*{\mkdaterangetrunc}[2]{%
\begingroup
\blx@metadateinfo{#2}%
\iffieldundef{#2year}
{}
{\printtext[#2date]{%
\datecircaprint
% Such a season component can only come from an EDTF 5.1.5 season which replaces
% a normal month so if it exists, we know that a normal date print is ruled out
\iffieldequalstr{dateunspecified}{yearincentury}
{\printtext[datecentury]{\number\numexpr\thefield{#2year}/100+1\relax}\setunit{\addnbspace}\bibstring{century}}
{\iffieldundef{#2season}
{\iffieldsequal{#2year}{#2endyear}
{\iffieldsequal{#2month}{#2endmonth}
{\csuse{mkbibdate#1}{}{}{#2day}}
{\csuse{mkbibdate#1}{}{#2month}{#2day}}}
{\csuse{mkbibdate#1}{#2year}{#2month}{#2day}%
\iffieldsequal{#2dateera}{#2enddateera}{}
{\dateeraprint{#2year}}}}
{\iffieldsequal{#2year}{#2endyear}
{\csuse{mkbibseasondate#1}{}{#2season}}
{\csuse{mkbibseasondate#1}{#2year}{#2season}%
\iffieldsequal{#2dateera}{#2enddateera}{}
{\dateeraprint{#2year}}}}%
\dateuncertainprint
\iffieldundef{#2endyear}
{}
{\iffieldequalstr{#2endyear}{}
{\mbox{\bibdaterangesep}}
{\bibdaterangesep
\enddatecircaprint
\iffieldundef{#2season}
{\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}
{\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}%
\enddateuncertainprint
\dateeraprint{#2endyear}}}}}}%
\endgroup}
\makeatother
\begin{document}
\nocite{*}
\printbibliography
\end{document}
检查一个世纪时\iffieldequalstr{dateunspecified}{yearincentury}
,格式datecentury
控制世纪的输出,而 bibstringcentury
可用于进一步本地化输出。
另请参阅96-dates.tex
以及§2.3.8日期和时间规范,第 4.2.4.1 节通用字段的文档biblatex
。
答案2
答案3
另一种方法是依靠 Biber 将year
字段映射到另一个字段。(此示例使用addendum
。)从示例中不清楚您是否想要或需要将源映射限制为特定的条目子集,但有多种方法可以做到这一点。(此示例限制为特定文件.bib
和条目类型thesis
,仅作为示例。)
Biber 将会完成,没有任何警告或错误。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Thesis{exemple_image,
Title = {Title of the work},
Author = {Artist Name},
Location = {Switzerland},
Year = {{\siecle{15}}},
}
\end{filecontents}
\usepackage[backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\newcommand{\siecle}[1]{%
\textsc{\romannumeral #1}\textsuperscript{e}~siècle
}
\DeclareSourcemap{
\maps[datatype=bibtex, overwrite]{
\map{
\perdatasource{\jobname.bib}% <-- If you have them in a special bib file
\pertype{thesis}% <-- If you want to limit by type
\step[fieldsource=year]
\step[fieldset=addendum, origfieldval]
\step[fieldset=year, null]
}
}
}
\nocite{*}
\begin{document}
\nocite{*}
\printbibliography
\end{document}