考虑以下 MWE:
\documentclass{beamer}
\usepackage[isbn=false,giveninits=true,uniquename=init,style=authoryear-comp,backend=biber,sorting=ynt,natbib,maxbibnames=99,maxcitenames=3,hyperref=true,sortcites=true,language=british,backref=true,url=false,doi=false]{biblatex}
\DeclareFieldFormat[misc]{title}{\mkbibemph{#1}\nopunct}
\usepackage{cleveref}
\addbibresource{References.bib}
\begin{document}
\citet{uncharter_45}
\printbibliography
\end{document}
其中书目条目为:
@misc{uncharter_45,
title = {Charter of the United Nations},
author = {{United Nations}},
year = {1945},
shorthand = {UN~Charter}
}
我想去掉标题末尾的点,因为我需要(引用第 1 页)以小写字母开头。我怎样才能去掉标题末尾的点?我已遵循此建议回答通过添加\DeclareFieldFormat[misc]{title}{\mkbibemph{#1}\nopunct}
,但如 MWE 所示,它不起作用。
答案1
Beamer 修补了几个 biblatex 宏,例如,为参考书目中的各个元素获取正确的颜色。除其他外,它还使用了此补丁:
\apptocmd{\abx@macro@title}
{\ifcsundef{abx@field@title}{}{\ifpunct{}{\midsentence\newunitpunct}}%
\newblock\unspace\usebeamercolor[fg]{bibliography entry note}}{}{}
这似乎导致了您观察到的文章和投影仪类别之间的不同行为。
您可以使用以下方法撤消补丁:
\documentclass{beamer}
%\documentclass{article}
\usepackage[isbn=false,giveninits=true,uniquename=init,style=authoryear-comp,backend=biber,sorting=ynt,natbib,maxbibnames=99,maxcitenames=3,hyperref=true,sortcites=true,language=british,backref=true,url=false,doi=false]{biblatex}
\DeclareFieldFormat[misc]{title}{\mkbibemph{#1}\nopunct}
\usepackage{cleveref}
\addbibresource{\jobname.bib}
\setbeamercolor{bibliography entry author}{fg=red}
\setbeamercolor{bibliography entry title}{fg=cyan}
\setbeamercolor{bibliography entry location}{fg=green}
\setbeamercolor{bibliography entry note}{fg=orange}
\makeatletter
\let\oldmacrotitle\abx@macro@title
\makeatother
\begin{document}
\makeatletter
\let\abx@macro@title\oldmacrotitle
\apptocmd{\blx@env@bibliography}
{\let\makelabel\beamer@biblabeltemplate}{}{}
\apptocmd{\abx@macro@begentry}
{\let\bbx@tempa\@empty%
\usebeamercolor[fg]{bibliography entry author}}{}{}
\pretocmd{\abx@macro@labeltitle}
{\ifboolexpr{ test {\ifcsundef{abx@field@label}}
and test {\ifcsundef{abx@field@labeltitle}} }{}{\let\bbx@tempa\labelnamepunct}}{}{}
\pretocmd{\abx@macro@title}
{\ifcsundef{abx@name@labelname}{}{\let\bbx@tempa\labelnamepunct}%
\bbx@tempa\newblock\unspace\usebeamercolor[fg]{bibliography entry title}}{}{}
\apptocmd{\abx@macro@title}
{\ifcsundef{abx@field@title}{}{}%
\newblock\unspace\usebeamercolor[fg]{bibliography entry note}{}{}}
\makeatother
\begin{frame}
\citet{uncharter_45}
\index{test}
\printbibliography
\end{frame}
\end{document}