我想使用 biblatex-chicago 对期刊文章使用句子大小写(无需编辑 bib 文件!),但不知道如何操作。到目前为止,\MakeSentenceCase*
对我来说看起来很有希望,但它无法为我改变大小写。我在 macOS Big Sur 上的 texlive 2020 上使用 lualatex + biber。下面是一个独立的示例。
\begin{filecontents}[overwrite]{tmp-refs.bib}
@article{paper:Title-Case,
title = {Title-Cased Title {ABC} DEF Hij},
author = {Author Aaa and Author Bbb},
year = {1986},
volume = {16},
pages = {1929-1943},
journal = {Journal of Something}
}
@article{paper:Sentence-case,
title = {Sentence-cased title {ABC} DEF Hij},
author = {Author Ccc and Author Ddd},
year = {1987},
volume = {17},
pages = {1943-1949},
journal = {Journal of Something Else}
}
@book{book:Title-Case,
title = {Title-Cased Book Title {ABC} DEF Hij},
author = {Author Eee},
year = {1988},
pages = {123},
publisher = {A Good Publisher}
}
@book{book:Sentence-case,
title = {Sentence-cased book {ABC} DEF Hij},
author = {Author Fff},
year = {1989},
pages = {567},
publisher = {Another Good Publisher}
}
\end{filecontents}
\documentclass[11pt,a4paper]{article}
\usepackage[authordate,backend=biber]{biblatex-chicago}
\bibliography{tmp-refs}
\DeclareFieldFormat{titlecase}{\MakeSentenceCase*{#1}}
%\DeclareFieldFormat{titlecase:title}{\MakeSentenceCase*{#1}}
\begin{document}
\autocite{paper:Title-Case}
\autocite{paper:Sentence-case}
\autocite{book:Title-Case}
\autocite{book:Sentence-case}
\printbibliography
\end{document}
答案1
与标准biblatex
样式不同,biblatex-chicago
不使用titlecase
字段格式。因此,我们需要修改相关的 bibmacro 以从noformat
字段格式切换到titlecase
。
\documentclass[11pt,a4paper]{article}
\usepackage[authordate,backend=biber]{biblatex-chicago}
\DeclareFieldFormat[article]{titlecase}{\MakeSentenceCase*{#1}}
\renewbibmacro*{mag+news+title}{%
\printtext[title]{%
\printfield[titlecase]{title}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}}%
\setunit{\ptitleaddonpunct}%\setunit{\addcomma\addspace}
\ifboolexpr{%
togl {cms@related}%
and
test {\iffieldequalstr{relatedtype}{reviewof}}%
}%
{\usebibmacro{related:init}%
\usebibmacro{related}}%
{\printfield{titleaddon}}%
}%\newcunit\newblock
\begin{filecontents}{\jobname.bib}
@article{paper:Title-Case,
title = {Title-Cased Title {ABC} DEF Hij},
author = {Author Aaa and Author Bbb},
year = {1986},
volume = {16},
pages = {1929-1943},
journal = {Journal of Something},
}
@article{paper:Sentence-case,
title = {Sentence-cased title {ABC} DEF Hij},
author = {Author Ccc and Author Ddd},
year = {1987},
volume = {17},
pages = {1943-1949},
journal = {Journal of Something Else}
}
@book{book:Title-Case,
title = {Title-Cased Book Title {ABC} DEF Hij},
author = {Author Eee},
year = {1988},
pages = {123},
publisher = {A Good Publisher}
}
@book{book:Sentence-case,
title = {Sentence-cased book {ABC} DEF Hij},
author = {Author Fff},
year = {1989},
pages = {567},
publisher = {Another Good Publisher}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\autocite{paper:Title-Case}
\autocite{paper:Sentence-case}
\autocite{book:Title-Case}
\autocite{book:Sentence-case}
\printbibliography
\end{document}