Biblatex-apa 與 mhchem 的問題

Biblatex-apa 與 mhchem 的問題

當使用BibLaTeX' cite-styleapa以及mhchembib 檔案包含帶有下標/上標的化學式時,我發現了一個問題。 MWE 是

\documentclass{article}
\usepackage[version=4]{mhchem}
\usepackage[style=apa, backend=biber]{biblatex}
%\usepackage[style=authoryear, backend=biber]{biblatex}
\addbibresource{Bib.bib}

\begin{document}

This is a citation with only simple chemistry: \parencite{Cite1}.

This is a citation with superscript: \parencite{Cite2}.

\printbibliography
\end{document}

Cite1 僅包含一個簡單的化學式,並且工作得非常好:

@Article{Cite1,
  author       = {Author, A.},
  date         = {2020},
  journaltitle = {A Journal},
  title        = {A title with just some \ce{Mg/Ca} chemistry},
  issue        = {2},
  pages        = {1--4},
  volume       = {1},
  timestamp    = {2020-03-27},
}

引用 2 包含上標,並導致 14 個錯誤:

@Article{Cite2,
  author       = {Author, B.},
  date         = {2020},
  journaltitle = {Another Journal},
  title        = {A title with some more complicated \ce{\delta^{18}O} chemistry and a longer title},
  issue        = {1},
  pages        = {2--6},
  volume       = {8},
  timestamp    = {2020-03-27},
}

問題似乎是,BibLaTeX切換到數學模式,儘管\ce應該防止這種情況:

在此輸入影像描述

一個簡單的\protect,如 中{\protect\ce{\delta^{18}O}},解決了這個問題,但又產生了另一個問題,因為現在“O”變成了小寫。

在此輸入影像描述

我需要相當複雜的版本{\protect\ce{\delta^{18}\MakeUppercase{O}}}才能最終得到正確的結果:

在此輸入影像描述

由於真正的圍脖文件包含許多條目,因此我可以理解地不想手動更改所有條目。奇怪的是,它與 - 風格完美配合authoryear,問題顯然是apa- 特定的。我將非常感謝任何關於如何解決這個問題的建議。

答案1

biblatex-apa應用句子大小寫\MakeSentenceCase*.該巨集相當複雜,基本上只能處理純文字而不會中斷。

如果您的標題中有複雜的宏,您需要用一對大括號隱藏/保護它們。

支架保護的複雜規則意味著您需要如果大括號中的內容以巨集開頭並且您想要保留大括號,請使用大括號對。

\documentclass{article}
\usepackage[version=4]{mhchem}
\usepackage[style=apa, backend=biber]{biblatex}


\begin{filecontents}{\jobname.bib}
@Article{Cite1,
  author       = {Author, A.},
  date         = {2020},
  journaltitle = {A Journal},
  title        = {A Title with Just Some {{\ce{Mg/Ca}}} Chemistry},
  issue        = {2},
  pages        = {1--4},
  volume       = {1},
}
@Article{Cite2,
  author       = {Author, B.},
  date         = {2020},
  journaltitle = {Another Journal},
  title        = {A Title with Some More Complicated {{\ce{\delta^{18}O}}}
                  Chemistry and a Longer Title},
  issue        = {1},
  pages        = {2--6},
  volume       = {8},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
This is a citation with only simple chemistry: \parencite{Cite1}.

This is a citation with superscript: \parencite{Cite2}.

\printbibliography
\end{document}

作者,A.(2020)。一個只有一些鎂/鈣化學成分的標題。期刊,1, 1–4。標題包含一些更複雜的 δ 18 O 化學和較長的標題。另一本期刊,8, 2-6。

相關內容