当 BibTeX 字段类型为“期刊”时,期刊名称不会以自定义引用样式显示

当 BibTeX 字段类型为“期刊”时,期刊名称不会以自定义引用样式显示

我目前正在(再次)尝试实现一种自定义引用样式,该样式应以出版物列表结尾,并且通常有效。我的 tex 文件非常简单:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[datamodel=reference_class_definitions,backend=biber,maxbibnames=99,giveninits=true,style=science]{biblatex}

\addbibresource{publication_data.bib}
\input{citation_style_definitions}

\begin{document}

\begin{refsection}
\begin{enumerate}
\item \fullcite{Author1981}.
\end{enumerate}
\end{refsection}

\end{document}

它使用文件reference_class_definitions.dbxcitation_style_definitions.tex以某种方式定义自定义输出样式,请参阅下文了解其内容)和publication_data.bib(包含一篇论文的书目数据):

@Article{Author1981,
  author   = {Author, One and Author, Two},
  journal_name  = {Journal of Fancy Research},
  title    = {Some paper title},
  year     = {1981},
  number   = {6},
  pages    = {1247-1260},
  volume   = {20},
  doi   = {10.someRandomNumber},
  type     = {Journal Article},
}

输出正是我想要的:

输出日记帐名称

但是,当我尝试将 中的字段“journal_name”的名称更改为“journal”时,我观察到一种奇怪的行为。当然,我也将和publication_data.bib中的所有“journal_name”实例更改为“journal”,但输出不显示日志名称:reference_class_definitions.dbxcitation_style_definitions.tex

输出不带日记帐名称

我无法理解这种行为,所以我的问题是:将“journal_name”更改为“journal”后,期刊名称为什么不显示?任何其他名称都可以,例如,使用“published_in”代替“journal_name”完全没有问题。但我更喜欢“journal”,因为据我所知,它是标准书目样式识别的字段之一。


reference_class_definitions.dbx包含:

\DeclareDatamodelEntrytypes{article}
\DeclareDatamodelFields[type=field,datatype=literal]{
  title,
  journal_name,
  volume,
  pages,
  ISSN,
  DOI,
  url,
  year,
  type
}
\DeclareDatamodelFields[type=list,datatype=name]{
  author
}
\DeclareDatamodelEntryfields[article]{
  author,
  title,
  journal_name,
  volume,
  pages,
  ISSN,
  DOI,
  url,
  year,
  type}

citation_style_definitions.tex包含:

\DeclareFieldFormat[article]{author}{#1\isdot}
\DeclareFieldFormat[article]{title}{\mkbibquote{\textit{#1}}\isdot}
\DeclareFieldFormat[article]{journal_name}{\textit{#1}\isdot}
\DeclareFieldFormat[article]{volume}{\textit{#1}\isdot}
\DeclareFieldFormat[article]{pages}{#1\isdot}
\DeclareFieldFormat[article]{DOI}{#1\isdot}
\DeclareFieldFormat[article]{year}{\textbf{#1}\isdot}

\DeclareBibliographyDriver{article}{%
  \printnames{author}%
  \addcomma\setunit{\addspace}%
  \printfield{title}%
  \addcomma\setunit{\addspace}%
  \printfield{journal_name}%
  \setunit{\addspace}%
  \printfield{year}%
  \addcomma\setunit{\addspace}%
  \printfield{volume}
  \addcomma\setunit{\addspace}%
  \printfield{pages}
  \addcomma\addspace%
  DOI:\setunit{\addspace}\printfield{DOI}
  \addperiod\setunit{\addspace}%
}

答案1

journal是一个有点棘手的字段。它实际上不是标准数据模型的一部分。相反,它journaltitle通过默认驱动程序源映射 (ll. 1339-1371 在biblatex.def)。在您的示例中,journal源映射被执行并重新映射journaljournaltitle,然后您的数据模型就再也看不到任何journal

您可以用它清除默认驱动程序源图\DeclareDriverSourcemap[datatype=bibtex]{}(或者您可以只复制您喜欢的部分,并从上面链接的定义中删除您不喜欢的部分)。

\begin{filecontents}{reference_class_definitions.dbx}
\DeclareDatamodelEntrytypes{article}
\DeclareDatamodelFields[type=field,datatype=literal]{
  title,
  journal,
  volume,
  pages,
  ISSN,
  DOI,
  url,
  year,
  type
}
\DeclareDatamodelFields[type=list,datatype=name]{
  author
}
\DeclareDatamodelEntryfields[article]{
  author,
  title,
  journal,
  volume,
  pages,
  ISSN,
  DOI,
  url,
  year,
  type}

\end{filecontents}

\begin{filecontents}{\jobname.bib}
@Article{Author1981,
  author   = {Author, One and Author, Two},
  journal  = {Journal of Fancy Research},
  title    = {Some paper title},
  year     = {1981},
  number   = {6},
  pages    = {1247-1260},
  volume   = {20},
  doi      = {10.someRandomNumber},
  type     = {Journal Article},
}
\end{filecontents}
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[datamodel=reference_class_definitions,backend=biber,maxbibnames=99,giveninits=true,style=science]{biblatex}

\DeclareDriverSourcemap[datatype=bibtex]{}

\DeclareFieldFormat[article]{author}{#1\isdot}
\DeclareFieldFormat[article]{title}{\mkbibquote{\textit{#1}}\isdot}
\DeclareFieldFormat[article]{journal_name}{\textit{#1}\isdot}
\DeclareFieldFormat[article]{volume}{\textit{#1}\isdot}
\DeclareFieldFormat[article]{pages}{#1\isdot}
\DeclareFieldFormat[article]{DOI}{#1\isdot}
\DeclareFieldFormat[article]{year}{\textbf{#1}\isdot}

\DeclareBibliographyDriver{article}{%
  \printnames{author}%
  \addcomma\setunit{\addspace}%
  \printfield{title}%
  \addcomma\setunit{\addspace}%
  \printfield{journal}%
  \setunit{\addspace}%
  \printfield{year}%
  \addcomma\setunit{\addspace}%
  \printfield{volume}
  \addcomma\setunit{\addspace}%
  \printfield{pages}
  \addcomma\addspace%
  DOI:\setunit{\addspace}\printfield{DOI}
  \addperiod\setunit{\addspace}%
}

\addbibresource{\jobname.bib}

\begin{document}

\begin{refsection}
\begin{enumerate}
\item \fullcite{Author1981}.
\end{enumerate}
\end{refsection}

\end{document}

1. O. Author,T. Author,《某些论文标题》,Journal of Fancy Research 1981,20,1247-1260,DOI:10.someRandomNumber。

至少在这个例子中,我完全不明白为什么你需要新的数据模型。除了你定义的所有字段(以及我们刚刚讨论的/type问题)之外,标准数据模型中已经知道了。使用 已经暗示了,但如果你需要更细粒度的控制,可以使用。journal_namejournal@articletype = {Journal Article},@articleentrysubtype

\addcomma在参考书目驱动程序或 bibmacros 中,不鼓励在 and 朋友之外使用裸标点符号(如\setunitand 朋友),因为它们会绕过标点符号缓冲区,并可能导致不良(双重)标点符号。同样,通常不鼓励在那里使用像“DOI:”这样的裸文本,而应将其移至\DeclareFieldFormatand 朋友。

相关内容