我如何才能firstinits=true
启用文内引用,但在参考书目中写全名?我使用biblatex
后端biber
。这是一个 MWE:
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{KandR, AUTHOR={Kernighan, Brian},TITLE={{The C Programming Language Second Edition}},YEAR={1988},}
\end{filecontents*}
\documentclass{article}
\usepackage[backend=biber,style=authortitle,firstinits=false,citestyle=verbose-ibid]{biblatex}
\addbibresource{\jobname.bib}
\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{default}{last-first}
\begin{document}
Hello \footcite{KandR}. How are you?
\printbibliography
\end{document}
我\footcite
希望只保留首字母,同时保留全名\printbibliography
答案1
您可以使用
\renewbibmacro*{cite:full}{%
\usebibmacro{cite:full:citepages}%
\printtext[bibhypertarget]{%
\usedriver
{\DeclareNameAlias{sortname}{labelname-revinit}}
{\thefield{entrytype}}}%
\usebibmacro{shorthandintro}}
\DeclareNameFormat{labelname-revinit}{%
\ifnum\value{uniquename}<2%
\ifuseprefix
{\usebibmacro{name:last-first}{#1}{#4}{#5}{#8}}
{\usebibmacro{name:last-first}{#1}{#4}{#6}{#8}}%
\else
\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}%
\fi
\usebibmacro{name:andothers}}
同时,uniquename=full
如果可能的话,我们可以打印首字母缩写,如果需要消除歧义,还可以打印全名。如果您不设置uniquename=full
,您将始终获得首字母缩写,即使这可能会导致姓氏相同的两个作者之间产生混淆。
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{KandR, AUTHOR={Kernighan, Brian},TITLE={{The C Programming Language Second Edition}},YEAR={1988},}
@BOOK{utha, AUTHOR={Uthor, Anne},TITLE={Lorem},YEAR={1990},}
@BOOK{uthb, AUTHOR={Uthor, Beatrix},TITLE={Ipsum},YEAR={1991},}
@BOOK{wrm, AUTHOR={Riter, William},TITLE={Dolor},YEAR={1992},}
@BOOK{wrd, AUTHOR={Riter, Willard},TITLE={Sit},YEAR={1993},}
\end{filecontents*}
\documentclass{article}
\usepackage[backend=biber,firstinits=false,style=verbose-ibid, uniquename=full]{biblatex}
\addbibresource{\jobname.bib}
\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{default}{last-first}
\renewbibmacro*{cite:full}{%
\usebibmacro{cite:full:citepages}%
\printtext[bibhypertarget]{%
\usedriver
{\DeclareNameAlias{sortname}{labelname-revinit}}
{\thefield{entrytype}}}%
\usebibmacro{shorthandintro}}
\DeclareNameFormat{labelname-revinit}{%
\ifnum\value{uniquename}<2%
\ifuseprefix
{\usebibmacro{name:last-first}{#1}{#4}{#5}{#8}}
{\usebibmacro{name:last-first}{#1}{#4}{#6}{#8}}%
\else
\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}%
\fi
\usebibmacro{name:andothers}}
\begin{document}
Hello \footcite{KandR}. How\footcite{utha,uthb} are you\footcite{wrm,wrd}?
\printbibliography
\end{document}