我已经按照以下说明编写了自己的条目类型和参考书目驱动程序我之前的问题。我希望条目有两组日期(一个系列日期和一个“正常”日期),并且它们的格式都与我完全一样\printdate
。
seriesdate 字段声明如下:
\DeclareDatamodelFields[type=field, datatype=date]{
seriesdate}
但是,使用\printfield{seriesdate}
会输出空字符串。大概,我必须告诉 biblatex 如何输出该字段,可能使用\DeclareFieldFormat
但我不确定如何...
答案1
如果您想要一个新date
类型的字段,您不仅需要请求日期字段,还需要请求相应的datepart
字段。您还需要定义新的条目类型并指定哪些字段允许这些类型。
该命令\printseriesdate
可用于漂亮地打印我们的新seriesdate
。
完整 MWE(改编自您对Biblatex:引用复杂嵌套的未发表资料)
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@archivalsource{Test,
title = {Test Source},
contains = {ITEM1 and ITEM2}}
@archivalitem{ITEM1,
title = {Transcript},
author = {J. Doe},
date = {1920-04-03},}
@archivalitem{ITEM2,
title = {Report},
author = {J. Moe},
seriesdate = {1900-01-01/1900-06-06},}
\end{filecontents*}
\begin{filecontents*}{archival.dbx}
\DeclareDatamodelEntrytypes{
archivalsource,
archivalitem}
\DeclareDatamodelFields[type=list, datatype=literal]{
contains}
\DeclareDatamodelFields[type=field, datatype=date, skipout]{
seriesdate}
\DeclareDatamodelEntryfields[archivalsource]{
title,
contains,
seriesdate,
seriesday,
seriesendday,
seriesendhour,
seriesendminute,
seriesendmonth,
seriesendseason,
seriesendsecond,
seriesendtimezone,
seriesendyear,
serieshour,
seriesminute,
seriesmonth,
seriesseason,
seriessecond,
seriestimezone,
seriesyear}
\DeclareDatamodelEntryfields[archivalitem]{
author,
title,
seriesdate,
seriesday,
seriesendday,
seriesendhour,
seriesendminute,
seriesendmonth,
seriesendseason,
seriesendsecond,
seriesendtimezone,
seriesendyear,
serieshour,
seriesminute,
seriesmonth,
seriesseason,
seriessecond,
seriestimezone,
seriesyear}
\end{filecontents*}
\documentclass[british]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[datamodel=archival, backend=biber]{biblatex}
\usepackage{hyperref}
\addbibresource{\jobname.bib}
\DeclareBibliographyDriver{archivalitem}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\printnames{author}%
\setunit{\addspace\textendash\space}%
\printfield{title}%
\setunit{\addspace}%
\printseriesdate
\usebibmacro{finentry}}
\DeclareListFormat{contains}{
\item \entrydata{#1}{\usedriver{}{\thefield{entrytype}}}
}
\DeclareBibliographyDriver{archivalsource}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\printfield{title}%
\setunit{\addperiod\space}%
\printtext{Contains:}%
\begin{enumerate}%
\printlist{contains}%
\end{enumerate}%
\iflistundef{contains}{\finentry}{}}
\begin{document}
\nocite{*}
\printbibliography
\end{document}