BibLaTeX 后端缺少“-”字符

BibLaTeX 后端缺少“-”字符

希望这个问题能够快速而干净地得到解决。我正在直接深入研究我在使用 biblatex 包选项时遇到的问题。

我有一个工作副本文档,其中包含使用 biber 作为后端选项的 biblatex 包。到目前为止,没有什么异常。一切都很顺利。

但由于一些限制,我需要将后端从 biber 更改为 bibtex(然后是 bibtex8,但结果与 bibtex 相同)。然后,我开始看到一些差异。第一次很难发现差异,即使我在 1-2 天后才发现。问题在于缺少一个“-”字符。并且,它位于文档代码和其名称之间,用作拆分这两个字符串。

下面你可以通过使用找到我的 biblatex 包定义比伯作为后端及其输出:

\usepackage[backend=biber, style=numeric, sorting=none, defernumbers=true]{biblatex}

Biber 输出

下面你可以通过使用找到我的 biblatex 包定义比博特作为后端及其输出:

\usepackage[backend=bibtex, style=numeric, sorting=none, defernumbers=true]{biblatex}

Bibtex 输出

从文档代码后可以看出,其名称以空格开头(.bib 未共享,检查了很多次,并且“-”字符一直存在,相信我,这不是问题)。但实际上不应该有这个空格。如上文 biber 示例所示,参考输出应包含文档代码及其名称,中间应有“-”字符,以便能够将两者分开。


这里列出命令(与上面给出的两个示例相同)来创建参考和适用的文档:

\section{APPLICABLE and REFERENCED DOCUMENTS}

\subsection{Reference Documents}
\printbibliography[keyword={RD},heading=none,resetnumbers=true]

\subsection{Applicable Documents}
\printbibliography[keyword={AD},heading=none,resetnumbers=true]


您可以在这里找到上面每个示例的 .bib 文件:

Biber 参考 .bib 文件:

@misc{A14-000,
  author       = {A14-000000-NNNNN-002-A - NNN},
  title        = {},
  howpublished = {},
  year         = {},
  keywords     = {RD}
}


@misc{A14-001,
  author       = {A14-000000-NNNNN-001-A - NNN},
  title        = {},
  howpublished = {},
  year         = {},
  keywords     = {RD}
}

@misc{A14-002,
  author       = {NNN - NNN},
  title        = {},
  howpublished = {},
  year         = {},
  keywords     = {RD}
}

Biber适用的.bib文件:

     @misc{A14-004,
  author       = {A14-000000-NNNNN-001-B - NNN},
  title        = {},
  howpublished = {},
  year         = {},
  keywords     = {AD}
}

@misc{A14-005,
  author       = {A14-000000-NNNNN-001-B - Test 1},
  title        = {},
  howpublished = {},
  year         = {},
  keywords     = {AD}
}

@misc{A14-006,
  author       = {A14-000000-NNNNN-001-B - Test 2},
  title        = {},
  howpublished = {},
  year         = {},
  keywords     = {AD}
}

Bibtex 参考.bib 文件:

@misc{A14-004,
  author       = {A14-000000-NNNNN-001-B - NNN},
  title        = {},
  howpublished = {},
  year         = {},
  keywords     = {AD}
}

Bibtex适用的.bib文件:

@misc{A14-SSSSSS-MMMMM-001,
  author       = {A14-SSSSSS-MMMMM-001 - Service Platform Dummy Document 1},
  title        = {},
  howpublished = {},
  year         = {},
  keywords     = {AD}
}


@misc{A14-SSSSSS-MMMMM-002,
  author       = {A14-SSSSSS-MMMMM-002 - Service Platform Dummy Document 2},
  title        = {},
  howpublished = {},
  year         = {},
  keywords     = {RD}
}

@misc{A14-GGGGGG-LLLLL-002,
  author       = {A14-GGGGGG-LLLLL-002 - General Applicable Document},
  title        = {},
  howpublished = {},
  year         = {},
  keywords     = {AD}
}


我认为,可能的错误可能是这两个后端选项之间的编码支持。因为 biber 比 bibtex 具有最先进的编码支持。但这只是猜测。

我不知道这里到底是谁惹的祸?到底是谁惹的祸?

答案1

如果你写

author = {A14-SSSSSS-MMMMM-001 - Service Platform Dummy Document 1},

然后 BibTeX 尝试将字段解析为由姓和名组成的人名。显然,这在这里完全没有意义。显然在解析过程中-会丢失。这不是 独有的biblatex,也可以使用natbib样式重现

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}

\usepackage{natbib}

\begin{filecontents}{\jobname.bib}
@misc{A14-SSSSSS-MMMMM-001,
  author       = {A14-SSSSSS-MMMMM-001 - Service Platform Dummy Document 1},
  keywords     = {AD}
}
\end{filecontents}


\begin{document}
Lorem \citep{A14-SSSSSS-MMMMM-001}

\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}

A14-SSSSSS-MMMM-001 服务平台虚拟文档 1.

解决方案是不要滥用该author字段来输入明显不是作者姓名的内容。或者至少将字段内容括在花括号中,以阻止 BibTeX 尝试将其解析为姓名。

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=bibtex, style=numeric, sorting=none, defernumbers=true]{biblatex}

\begin{filecontents}{\jobname.bib}
@misc{A14-004,
  author       = {{A14-000000-NNNNN-001-B - NNN}},
  keywords     = {AD}
}
@misc{A14-SSSSSS-MMMMM-001,
  author       = {{A14-SSSSSS-MMMMM-001 - Service Platform Dummy Document 1}},
  keywords     = {AD}
}
@misc{A14-SSSSSS-MMMMM-002,
  author       = {{A14-SSSSSS-MMMMM-002 - Service Platform Dummy Document 2}},
  keywords     = {RD}
}
@misc{A14-GGGGGG-LLLLL-002,
  author       = {{A14-GGGGGG-LLLLL-002 - General Applicable Document}},
  keywords     = {AD}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
Lorem \nocite{*}

\section{APPLICABLE and REFERENCED DOCUMENTS}
\printbibliography[
  keyword={RD},
  title = {Reference Documents},
  heading=subbibnumbered,
  resetnumbers=true
]
\printbibliography[
  keyword={AD},
  title = {Applicable Documents},
  heading=subbibnumbered,
  resetnumbers=true
]
\end{document}

A14-SSSSSS-MMMM-002 – 服务平台虚拟文档 2。

相关内容