biblatex 中強調個案保護

biblatex 中強調個案保護

跟隨問題 在參考書目資料庫中儲存標題時使用的正確大小寫是什麼?我將標題儲存在 .bib 檔案中的 Title Case 和 {Protecting} 專有名詞等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}

它給出了這個輸出:

在此輸入影像描述

有很多問題。如果mkbibquotemkbibemph在字串的開頭發出,則它將整個字串變為全部大寫。另外,我不知道如何保護已由mkbibquoteor括起來的字串中的特定單字mkbibemph

答案1

for 的句子大小寫功能biblatex是在 LaTeX 中實現的。另一方面,BibTeX 的句子大小寫是直接在 BibTeX 中實現的。這意味著兩者之間存在一些微妙和不那麼微妙的差異。特別是biblatex的句子大小寫函數將在可能的情況下嘗試擴展巨集。

這裡的主要問題是花括號的含義過多:對於 LaTeX,它們用作參數分隔符號或應用分組;對於 BibTeX,它們保護字串不會發生大小寫更改,並為非 ASCII 字元標記 LaTeX 宏,例如ä -> {\"a}(cf.參考書目中的“ä”以及其他元音變音和重音字母如何書寫?)。不同的含義有時會發生衝突,在這種情況下需要解決方法來解決問題。

另請參閱最近的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)。這是一個標題,其中包含「應小寫的引號」。 “但如果標​​題以引號開頭”,則全部大寫。如果標題以強調開頭,它也會變成全部大寫並且不應用強調。關於這本書的討論我的新書:它應該保持第一個單字大寫。如果“包含縮寫AAEE”,如何保存?

從長遠來看,在我看來,理想的解決方案是實現一個新的大小寫更改函數,該函數使用不同的標記來指定受保護的字串,以便大括號不再與其發生衝突。

FWIW BibTeX 的大小寫變更功能也有類似的問題。它不會在字串開頭大寫單詞,因此不會遇到全大寫問題,但也存在其他兩個“保護內保護”問題。

相關內容