考慮以下 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}