考虑以下 MWE
\documentclass{article}
\usepackage[style=authoryear-comp,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}
\AtBeginDocument{%
\renewcommand*{\mkbibnamelast}[1]{\textsc{#1}}
}
\begin{document}
\textcite{knuth:ct:e}\\
\fullcite{salam}\\
Footcite\footfullcite{baez/article}
\printbibliography
\end{document}
这将在文档和参考书目中为所有引用命令打印小写作者姓氏。仅对于命令,\textcite
我希望姓氏(即示例中的 Knuth)以常规字体而不是小写字体打印在文本中。
编辑:截至 2016 年 3 月(biblatex 3.3),您需要更改\mkbibnamefamily
而不是\mkbibnamelast
答案1
一种可能的解决方案是引入一个切换开关来确定我们是否在文本引用中。然后将的修改参数\mkbibnamelast
化为切换开关。此解决方案使用xpatch
包来修改textcite
bibmacro,在执行宏之前将切换开关设置为 true ,在执行宏textcite
之后立即将其设置为 false 。textcite
\newtoggle{textcite}
\AtBeginDocument{
\renewcommand*{\mkbibnamelast}[1]{%
\iftoggle{textcite}{#1}{\textsc{#1}}}
}
\xpretobibmacro{textcite}{\toggletrue{textcite}}{}{}
\xapptobibmacro{textcite}{\togglefalse{textcite}}{}{}
答案2
\documentclass{article}
\usepackage[style=authoryear-comp,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}
\AtBeginDocument{%
\renewcommand*\mkbibnamelast[1]{\textsc{#1}}}
\let\TC\textcite
\renewcommand\textcite[1]{{\def\mkbibnamelast##1{##1}\TC{#1}}}% hold it local
%% If you need the optional argument of \textcite then we have to modify
%% the macro
\begin{document}
\textcite{knuth:ct:e}\\
\fullcite{salam}\\
Footcite\footfullcite{baez/article}
\printbibliography
\end{document}
答案3
对于较新版本的biblatex
我们可以使用类似圭多的回答,但我们不是修补引用命令来设置标志,而是测试分隔符上下文。
\documentclass{article}
\usepackage[style=authoryear-comp,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}
\makeatletter
\renewcommand*{\mkbibnamefamily}{%
\ifcsundef{mkbibnamefamily@\blx@delimcontext}
{\textsc}
{\csuse{mkbibnamefamily@\blx@delimcontext}}}
\newcommand*{\mkbibnamefamily@textcite}[1]{#1}
\makeatother
\begin{document}
\textcite{knuth:ct:e}
\fullcite{salam}
Footcite\footfullcite{sigfridsson}
\printbibliography
\end{document}