![脚注内的引文预注不起作用(Biblatex)](https://linux22.com/image/424930/%E8%84%9A%E6%B3%A8%E5%86%85%E7%9A%84%E5%BC%95%E6%96%87%E9%A2%84%E6%B3%A8%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8%EF%BC%88Biblatex%EF%BC%89.png)
我遇到了一个看似是一个错误的问题。
使用 BibLatex 以 MLA 格式在脚注内进行引用时\footnote{\cite[myPrenote][myPostnote]{ref}}
,预注无法正确显示。如果我包含预注,它会将“预注”打印为预注,而不是给定的输入。
此外,如果预注留空,它会打印“参见”作为预注,我无法将其删除,并且当使用英语以外的语言书写时会出现问题,因为它不会被翻译(使用 babel,法语)。
编辑:我已在 \biblatex-mla\mla.cbx 中搜索了 prenote,命令\cite{}
定义在第 722 行和第 749 行,但我没有发现问题。不过,删除第 723 行至第 725 行似乎可以解决问题。
以下是第 722 行及后续行:
\DeclareCiteCommand{\cite}% 1.9 added support for smart switching when used in footnote
{\iffootnote{\iffieldundef{prenote}
{\global\undef\cbx@lastprenote
\printtext{See\addspace}}}
\usebibmacro{prenote}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite:mla}}%
{}%
{\usebibmacro{postnote}}
这是第一期的 MWE。
\documentclass{article}
\usepackage[style=mla,backend=biber]{biblatex}
\begin{filecontents}{sample.bib}
@article{Art1,
author = "Mike Wazowsky",
title = "How to scare",
date = "2020-12-03"
}
\end{filecontents}
\addbibresource{sample.bib}
\begin{document}
Some text with a footnote\footnote{There should not be "prenote" here: \cite[Look at][p. 12]{Art1}}.
\end{document}
答案1
这确实看起来像是一个错误。请总是通过软件包文档中提到的渠道向软件包的开发人员报告错误。(特别是,TeX.SX 不是报告错误。
的公共错误跟踪器biblatex-mla
位于https://github.com/jmclawson/biblatex-mla/issues,但该项目似乎处于停滞状态。自 2016 年底以来没有任何更新,而且一些较新的错误报告尚未得到回复。
目前,我会再三考虑是否使用它,biblatex-mla
因为它似乎不再积极开发,并且存在一些已知问题(请参阅未解决问题列表https://github.com/jmclawson/biblatex-mla/issues)。
在这种情况下,问题确实是
\DeclareCiteCommand{\cite}% 1.9 added support for smart switching when used in footnote
{\iffootnote{\iffieldundef{prenote}
{\global\undef\cbx@lastprenote
\printtext{See\addspace}}}
\usebibmacro{prenote}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite:mla}}%
{}%
{\usebibmacro{postnote}}
如果我们稍微改变一下 prenote 代码的缩进,我们就能看到问题
\DeclareCiteCommand{\cite}% 1.9 added support for smart switching when used in footnote
{\iffootnote{%
\iffieldundef{prenote}
{\global\undef\cbx@lastprenote
\printtext{See\addspace}}}
\usebibmacro{prenote}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite:mla}}%
{}%
{\usebibmacro{postnote}}
<false>
条件分支缺少\iffootnote
花括号。这意味着如果\iffootnote
为真,则只\usebibmacro
吞噬,而{prenote}
留在输入流中并最终打印。此外,\iffieldundef
条件缺少完整的<false>
分支。
语法正确的版本是
\DeclareCiteCommand{\cite}% 1.9 added support for smart switching when used in footnote
{\iffootnote
{\iffieldundef{prenote}
{\global\undef\cbx@lastprenote
\printtext{See\addspace}}
{\usebibmacro{prenote}}}
{}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite:mla}}%
{}%
{\usebibmacro{postnote}}
其他几个\cite
宏也有同样的问题。由于所有命令中都重复了相同的代码,我建议您使用 bibmacro 来减少重复次数。
\documentclass{article}
\usepackage[style=mla,backend=biber]{biblatex}
\makeatletter
\newbibmacro{mla:prenote:see}{%
\iffootnote
{\iffieldundef{prenote}
{\global\undef\cbx@lastprenote
\printtext{See\addspace}}
{\usebibmacro{prenote}}}
{}}
\DeclareCiteCommand{\cite}% 1.9 added support for smart switching when used in footnote
{\usebibmacro{mla:prenote:see}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite:mla}}%
{}%
{\usebibmacro{postnote}}
\DeclareCiteCommand{\textcite}
{\usebibmacro{mla:prenote:see}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite:mla}}%
{}%
{\usebibmacro{postnote}}
\DeclareCiteCommand{\headlesscite}% 1.9 added alias to starred command for Chicago compatibility
{\usebibmacro{mla:prenote:see}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite:mla:starred:title}}
{}%
{\usebibmacro{postnote}}
\DeclareCiteCommand*{\cite}% 1.9 added support for smart switching when used in footnote
{\usebibmacro{mla:prenote:see}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite:mla:starred:title}}
{}%
{\usebibmacro{postnote}}
\DeclareCiteCommand{\fullcite}%
{\usebibmacro{mla:prenote:see}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite:mla:title}}
{}%
{\usebibmacro{postnote}}
\DeclareCiteCommand{\headlessfullcite}
{\usebibmacro{mla:prenote:see}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite:mla:starred:title}}
{}%
{\usebibmacro{postnote}}
\makeatother
\addbibresource{biblatex-examples.bib}
\begin{document}
Some text with a footnote\footnote{There should not be "prenote" here: \cite[Look at][12]{sigfridsson}}.
\end{document}
现在,如果您根本不想看到自动“查看”,您可以将其从 bibmacro 中删除。
\newbibmacro{mla:prenote:see}{%
\usebibmacro{prenote}}
如果您想要查看,但希望将其本地化,请使用
\newbibmacro{mla:prenote:see}{%
\iffootnote
{\iffieldundef{prenote}
{\global\undef\cbx@lastprenote
\bibstring{see}}
{\usebibmacro{prenote}}}
{}}
如果您想看到后记中的“p.”前缀,最好不要在后记中包含“p.”,而是告诉您的样式自动包含“p.”。使用biblatex-mla
,以下两行应该会有所帮助
\DeclareFieldAlias{ibidpostnote}{postnote}%
\DeclareFieldAlias{footpostnote}{postnote}%