假设我使用 biblatex,并引用了两位姓氏相同的作者的两篇论文,A. Smith (2019) 和 B. Smith (2020)。如果我使用,\textcite{Smith2020}
它可能会编译为
Lorem ipsum dolor sit amet, consecteturB.
史密斯 (2020)adipiscing elit, sed do eiusmod
我怎样才能让它像下面这样编译?
Lorem ipsum dolor sit amet, consectetur
B.史密斯 (2020)adipiscing elit, sed do eiusmod
答案1
最安全的方法可能是
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear]{biblatex}
\newbibmacro*{name:giveni-family}[4]{%
\usebibmacro{name:delim}{#2#3#1}%
\usebibmacro{name:hook}{#2#3#1}%
\mkbibcompletenamegivenfamily{%
\ifdefvoid{#2}
{}
{\mkbibnamegiven{#2}\isdot\addnbspace}%
\ifdefvoid{#3}
{}
{\mkbibnameprefix{#3}\isdot
\ifprefchar
{}
{\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}%
\mkbibnamefamily{#1}\isdot
\ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}}
\DeclareNameFormat{labelname}{%
\ifcase\value{uniquename}%
\usebibmacro{name:family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}%
\or
\ifuseprefix
{\usebibmacro{name:giveni-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffixi}}
{\usebibmacro{name:giveni-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefixi}
{\namepartsuffixi}}%
\or
\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}%
\fi
\usebibmacro{name:andothers}}
\begin{filecontents}{\jobname.bib}
@book{aelk,
author = {Anne Elk},
title = {A Theory on Brontosauruses},
year = {1972},
publisher = {Monthy \& Co.},
location = {London},
}
@book{celk,
author = {Catherine Elk},
title = {A Theory on Other Dionsaurs},
year = {2021},
publisher = {Monthy \& Co.},
location = {London},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
Lorem ipsum dolor sit amet dolor sit amet igitur a \textcite{aelk}
ipsum \autocite{celk}
\printbibliography
\end{document}
请注意,在此位置使用不可中断空格并不一定能保证整个名称移至下一行。您还可能会得到一行溢出。