使用 MakeSentenceCase 时保留单个字母的大写

使用 MakeSentenceCase 时保留单个字母的大写

我希望我的参考书目中的条目采用句子大小写。为此,我\DeclareFieldFormat{titlecase}{\MakeSentenceCase*{#1}}在序言中一直使用这种方法。然后,我在条目中使用花括号来保留专有名词和其他单词的大写。但是,这种保护似乎不会影响单个字母。请考虑以下 MWE:

\documentclass{article}

\usepackage{filecontents}
\usepackage[backend=biber, style=authoryear, maxbibnames=10]{biblatex}

\DeclareFieldFormat{titlecase}{\MakeSentenceCase*{#1}}

\begin{filecontents}{\jobname.bib}
@Article{     creutz88,
  Title     = {Global Monte Carlo algorithms for many-fermion systems},
  Author    = {Creutz, Michael},
  Journal   = {Physical Review {D}},
  Volume    = {38},
  Number    = {4},
  Pages     = {1228--1238},
  Year      = {1988},
  Publisher = {APS}
}
@Article{     metropolis49,
  Title     = {The monte carlo method},
  Author    = {Metropolis, Nicholas and Ulam, Stanislaw},
  Journal   = {Journal of the {American} Statistical Association},
  Volume    = {44},
  Number    = {247},
  Pages     = {335--341},
  Year      = {1949},
  Publisher = {Taylor \& Francis}
}
\end{filecontents}

\addbibresource{\jobname}

\begin{document}

Stanislaw Ulam was one of the original pioneers of Monte Carlo methods
\parencite{metropolis49}.

With a problem of dimension $d$, the computational expense of a random-walk
sampler is $O(d^2)$, whereas the cost of Hamiltonian Monte Carlo is roughly
$O(d^{5/4})$ \parencite{creutz88}.

\printbibliography

\end{document}

这将产生参考书目:

Creutz, Michael (1988). “Global monte carlo algorithms for many-fermion sys-
tems”. In: Physical review d 38.4, pp. 1228–1238.
Metropolis, Nicholas and Stanislaw Ulam (1949). “The monte carlo method”.
In: Journal of the American statistical association 44.247, pp. 335–341.

条目按要求采用句子大小写。并且 的大写也American按预期保留。但是 的大写Physical Review {D}没有保留。

那么,我该如何保护参考书目中单个字母的大写?或者说我目前的方法有什么误解?

答案1

正如所提到的凯特回答使用当前版本的biblatexBiber 和 MWE 发布

物理评论D

用于期刊标题(我认为旧版本的 Biber 无意中在这里删除了太多的括号:括号在文件中可以表示很多不同的含义.bib,在某些情况下删除它们是有意义的,例如当它们用于传统的 ASCII 输入时{\"a}ä

因此,大括号保护应该可以起到作用,但我首先想办法避免使用大括号保护期刊标题。

虽然有些样式要求标题采用句子大小写,但期刊标题通常不是这样,期刊标题更类似于专有名称。所以我认为确保不适\MakeSentenceCase用于journaltitle/更为自然journal。标准样式采用全能titlecase格式,这使得这一点很棘手,但biblatex-ext样式提供了更细粒度的控制(例如,参见我的回答biblatex 中标题的句子大小写在 biblatex 中,将标题句改为大写,但不将期刊名称改为大写,请注意,这两个问题都收到了其他不太适用的答案biblatex-ext,所以如果你不想切换到它,你可能会发现其他答案之一很有帮助)。

\documentclass{article}

\usepackage[backend=biber, style=ext-authoryear, maxbibnames=10]{biblatex}

\DeclareFieldFormat{titlecase}{\MakeSentenceCase*{#1}}
\DeclareFieldFormat{titlecase:journaltitle}{#1}

\begin{filecontents}{\jobname.bib}
@article{creutz88,
  title     = {Global {Monte Carlo} Algorithms for Many-Fermion Systems},
  author    = {Creutz, Michael},
  journal   = {Physical Review D},
  volume    = {38},
  number    = {4},
  pages     = {1228--1238},
  year      = {1988},
}
@article{metropolis49,
  title     = {The {Monte Carlo} Method},
  author    = {Metropolis, Nicholas and Ulam, Stanislaw},
  journal   = {Journal of the American Statistical Association},
  volume    = {44},
  number    = {247},
  pages     = {335--341},
  year      = {1949},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\autocite{metropolis49,creutz88}

\printbibliography
\end{document}

Creutz, Michael (1988)。“多费米子系统的全局蒙特卡罗算法”。收录于:《物理评论 D》38.4,第 1228-1238 页。//Metropolis, Nicholas 和 Stanislaw Ulam (1949)。“蒙特卡罗方法”。收录于:《美国统计协会杂志》44.247,第 335-341 页。

答案2

对于我而言,您的示例生成了Physical review D小写字母d,请更新您的 biber/biblatex 版本。要保留整个名称,请使用{{Physical Review D}}

\documentclass{article}

\usepackage{filecontents}
\usepackage[backend=biber, style=authoryear, maxbibnames=10]{biblatex}

\DeclareFieldFormat{titlecase}{\MakeSentenceCase*{#1}}

\begin{filecontents}{\jobname.bib}
@Article{     creutz88,
  Title     = {Global Monte Carlo algorithms for many-fermion systems},
  Author    = {Creutz, Michael},
  Journal   = {{Physical Review D}},
  Volume    = {38},
  Number    = {4},
  Pages     = {1228--1238},
  Year      = {1988},
  Publisher = {APS}
}
@Article{     metropolis49,
  Title     = {The monte carlo method},
  Author    = {Metropolis, Nicholas and Ulam, Stanislaw},
  Journal   = {Journal of the {American} Statistical Association},
  Volume    = {44},
  Number    = {247},
  Pages     = {335--341},
  Year      = {1949},
  Publisher = {Taylor \& Francis}
}
\end{filecontents}

\addbibresource{\jobname}

\begin{document}

Stanislaw Ulam was one of the original pioneers of Monte Carlo methods
\parencite{metropolis49}.

With a problem of dimension $d$, the computational expense of a random-walk
sampler is $O(d^2)$, whereas the cost of Hamiltonian Monte Carlo is roughly
$O(d^5/4)$ \parencite{creutz88}.

\printbibliography

\end{document}

在此处输入图片描述

相关内容