控制 biblatex/bibtex 在参考书目中大写的单词

控制 biblatex/bibtex 在参考书目中大写的单词

我的出版商列出了大约 50 个单词,这些单词在书籍和文章的标题中需要小写,其余单词需要大写。出于性能原因,我们使用 BiBTeX,而不是 biber。

以下是调用:

\usepackage[backend=bibtex,language=american,style=authoryear]{biblatex}```
% Patch biblatex:
\urlstyle{sf}
\DeclareFieldFormat{url}{\url{#1}}

目前,我能想到的唯一遵守发布者列表的方法就是使用 Python 程序对 .bbl 文件进行后期处理。我当然可以这样做,但如果有更好的方法就更好了。

如果我确实需要对 .bbl 文件进行后处理,那么latexmk在运行 bibtex 之后,有没有办法运行我的 python 程序?从文档中看,我似乎可以设置运行 bibtex 的$bibtex = 'python bibwrap.py'位置bibwrap.py,然后运行我的后处理脚本。这样做可行吗?

答案1

对于 BibLaTeX + BibTeX,您可以使用DeclareFieldFormat定义标题大小写格式,然后使用 调用该格式作为标题\renewbibmacro*{title}。此过程在 中有描述扩展 DeclareFieldFormat 的参数来替换 biblatex 字段中的单词

结合Bibtex 中“标题大小写”的实现

\documentclass{article}
\begin{filecontents*}{changecase.bib}
@misc{casecheck,
   title = {a title that shows the use of titlecap},
   author = {John Doe},
   year = {2021}
}
\end{filecontents*}
\usepackage[backend=bibtex,language=american,style=authoryear]{biblatex}
\usepackage{titlecaps}
\Addlcwords{the of into}

\DeclareFieldFormat{captitle}{\titlecap{#1}}
\renewbibmacro*{title}{%
  \ifboolexpr{
    test {\iffieldundef{title}}
    and
    test {\iffieldundef{subtitle}}
  }
    {}
    {\printtext[title]{%
       \printfield[captitle]{title}%
       \setunit{\subtitlepunct}%
       \printfield[captitle]{subtitle}}%
     \newunit}%
  \printfield{titleaddon}}


\addbibresource{changecase.bib}
\begin{document}
Change case for \cite{casecheck}
\printbibliography
\end{document}

在此处输入图片描述

相关内容