biblatex 中强调大小写保护

biblatex 中强调大小写保护

问题 在参考书目数据库中存储标题时,应使用什么大小写?我将标题以标题大小写的形式存储在 .bib 文件中,并{保护}专有名词等。到目前为止,我一直在使用,biblatex-chicago没有遇到任何问题,因为芝加哥无论如何都要求使用标题大小写。

但现在我遇到了麻烦biblatex-apa——APA 更喜欢句子大小写——带有引号和强调。由于\mkbibquote{}\mkbibemph{}已经对里面的内容进行了大小写保护,因此将它们括在一组额外的括号中{\mkbibquote{}}可以取消大小写保护。但是,我遇到了很多问题。

考虑一下这个MWE:

% !TEX TS-program = xelatexmk
\documentclass{article} 

\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\usepackage{csquotes}
\usepackage[style=apa]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{bib.bib}

@book{Author2000,
    Title = {This is a Title with Something in {\mkbibquote{Quotes that Should Be Downcased}}},
    Author = {Author, Anton},
    Date = {1990},
}
@book{Author2000a,
    Title = {{\mkbibquote{But if the Title starts in Quotes}} It Turns into All Caps},
    Author = {Author, Anton},
    Date = {2000},
}
@book{Author2000b,
    Title = {A Discussion of the Book {\mkbibemph{{My} New Book}}: It Should Keep the First Word Capitalized},
    Author = {Author, Anton},
    Date = {2010},
}
@book{Author2000c,
    Title = {{\mkbibemph{And if the Title starts with Emphasis}} It also Turns into All Caps and Doesn't Apply the Emphasis},
    Author = {Author, Anton},
    Date = {2001},
}
@book{Author2000d,
    Title = {And If {\mkbibquote{an Acronym {{{AAEE}}} is Included}}, How to Preserve it?},
    Author = {Author, Anton},
    Date = {2011},
}

\end{filecontents}
\addbibresource{bib.bib}

\begin{document}
\autocites{Author2000,Author2000a,Author2000b,Author2000c,Author2000d}
\printbibliography % print the bibliography 
\end{document}

它给出这个输出:

在此处输入图片描述

存在许多问题。如果在字符串开头发出mkbibquote或,则它会将整个字符串变成全大写。另外,我不知道如何保护已经用或括起来的字符串中的特定单词。mkbibemphmkbibquotemkbibemph

答案1

的句子大小写功能biblatex是在 LaTeX 中实现的。而 BibTeX 的句子大小写则直接在 BibTeX 中实现。这意味着两者之间存在一些细微的和不那么细微的差异。特别是biblatex的句子大小写功能将尝试扩展宏(如果可能)。

这里的主要问题是花括号的含义过多:对于 LaTeX,它们用作参数分隔符或应用分组;对于 BibTeX,它们保护字符串免受大小写变化的影响,并为非 ASCII 字符标记 LaTeX 宏,例如ä -> {\"a}(参见如何在参考书目中书写“ä”及其他变音符号和重音字母?)。不同的含义有时会发生冲突,在这种情况下需要采用变通方法来解决问题。

另请参阅最近的https://github.com/plk/biblatex/issues/871和相关问题以及文档补充https://github.com/plk/biblatex/commit/863fea969a9f1d37d7f944265cb276cf18293334https://github.com/plk/biblatex/commit/a291e72a6c8ba2b896eb3f53ada6cc938c2cfa86

对于您在 MWE 中展示的用例,我可以提供以下解决方法。这个想法是通过使用分隔参数(一种\foo <argument>\endfoo语法)来避免使用括号。分隔参数在嵌套时会带来自己的问题,但它们在 MWE 中运行良好。

\documentclass{article} 
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa]{biblatex}

\protected\def\horriblemkbibquote#1\endhorriblemkbibquote{\mkbibquote{#1}}
\let\endhorriblemkbibquote\relax
\protected\def\horriblemkbibemph#1\endhorriblemkbibemph{\mkbibemph{#1}}
\let\endhorriblemkbibemph\relax

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{Author2000,
  title  = {This is a Title with Something in {\mkbibquote{Quotes that Should Be Downcased}}},
  author = {Author, Anton},
  date   = {1990},
}
@book{Author2000a,
  title = {\horriblemkbibquote {But} if the Title starts in Quotes\endhorriblemkbibquote{} It Turns into All Caps},
  author = {Author, Anton},
  date = {2000},
}
@book{Author2000b,
  title = {A Discussion of the Book \horriblemkbibemph{My} New Book\endhorriblemkbibemph{}: It Should Keep the First Word Capitalized},
  author = {Author, Anton},
  date = {2010},
}
@book{Author2000c,
  title = {\horriblemkbibemph {And} if the Title starts with Emphasis\endhorriblemkbibemph{} It also Turns into All Caps and Doesn't Apply the Emphasis},
  author = {Author, Anton},
  date = {2001},
}
@book{Author2000d,
  title = {And If \horriblemkbibquote an Acronym {AAEE} is Included\endhorriblemkbibquote{}, How to Preserve it?},
  author = {Author, Anton},
  date = {2011},
}

\end{filecontents}
\addbibresource{\jobname.bib}


\begin{document}
\autocites{Author2000,Author2000a,Author2000b,Author2000c,Author2000d}
\printbibliography % print the bibliography 
\end{document}

作者,A。(1990)。这是带有“应小写引号”内容的标题。//作者,A。(2000)。“但是,如果标题以引号开头”,则它会全部大写。//作者,A。(2001)。如果标题以强调开头,它也会全部大写,并且不会强调。//作者,A。(2010)。关于我的新书一书的讨论:它应该将第一个单词大写。//作者,A。(2011)。如果“包含首字母缩略词 AAEE”,如何保留它?

从长远来看,我认为理想的解决方案是实现一个新的大小写转换函数,该函数使用不同的标记来指定受保护的字符串,这样花括号就不会再与它发生冲突。

值得一提的是,BibTeX 的大小写转换函数也有类似的问题。它不会将字符串开头的单词大写,因此不会出现全大写问题,但其他两个“protect-within-unprotect”问题也存在。

相关内容