尽管 uniquename 设置需要全名,但如何仅使用姓氏和 \textcite?

尽管 uniquename 设置需要全名,但如何仅使用姓氏和 \textcite?

我目前正在编写一份引用大量中国作者的文档。由于有许多作者姓氏相同,我决定使用设置uniquename=minfull,并为了避免这些名字被缩写为(例如 W. Wang),添加了一些代码,从而给出全名。

对于括号中的引用,此方法可正常工作。但是,我刚刚注意到,在以下情况下,此方法效果不佳,\textcite因为这样会导致姓氏和名字之间出现逗号(参见 MWE 的输出):

据王秀英(2020)...

对于中文名字,只需省略姓氏和名字之间的逗号即可(因为名字通常会写成 Wang Xiuying,所以我也想避免输出 Xiuying Wang),但这当然也会影响其他名字,因此不是一个选择。

我认为可以做的是省略名字仅有的对于\textcite命令(实际上忽略了uniquename这种情况下设置),因为我可以确保从上下文中可以清楚地知道指的是哪位作者。

我不太清楚该如何处理这个问题。创建一个新命令是否有意义,\textcitelast这样我就可以手动控制只使用姓氏的位置?非常感谢您的建议!

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage[style=authoryear-icomp,
  ibidpage=true,
  ibidtracker=constrict,
  idemtracker=context,
  mergedate=basic, 
  uniquename=minfull, 
  bibstyle=authoryear,
  backend=biber
  ]
 {biblatex}


% I wanted to avoid Chinese names being abbreviated to `W. Zhang', etc., so this bit forces it to use the full name
\DeclareNameFormat{labelname}{%
  \ifnumequal{\value{uniquename}}{0}
    {\usebibmacro{name:family}
       {\namepartfamily}
       {\namepartgiven}
       {\namepartprefix}
       {\namepartsuffix}}
    {\usebibmacro{name:family-given}
       {\namepartfamily}
       {\namepartgiven}
       {\namepartprefix}
       {\namepartsuffix}}
  \usebibmacro{name:andothers}}

\usepackage{filecontents}

\begin{filecontents*}{testbib.bib}

@online{test1,
  author = {Zhang, Xiuying},
  title = {Test title},
  year = {2020}
}

@online{test2,
  author = {Wang, Xiuying},
  title = {Another test title},
  year = {2020}
}

@online{test3,
  author = {Zhang, Wei},
  title = {Test title three},
  year = {2020}
}

@online{test4,
  author = {Wang, Wei},
  title = {Test title four},
  year = {2020}
}

\end{filecontents*}

\addbibresource{testbib.bib}


\begin{document}

Citation number one \autocite{test1}, another citation \autocite{test2} and yet another one \autocites{test3,test4}.

As \textcite{test1} argued \ldots\ According to \textcite{test2} \ldots\

\end{document}

答案1

当然,可以编写忽略uniquename数据并仅显示姓氏的姓名格式(见下文)。在本地将格式更改为这种新格式\DeclareNameFormat{family}{...}也很容易(使用)。您只需要一个好方法来更改姓名格式。labelname\DeclareNameAlias{labelname}{family}\textcite

为了使代码简短,我决定使用\cbx@textcite,但最优雅(最短/最快/自然/...)的方式将取决于您使用的风格和您的品味。答案的这一部分是专门为authoryear-icomp它可能不适用于其他风格而编写的。

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage[backend=biber,
  style=authoryear-icomp,
  uniquename=minfull,
  mergedate=basic,
  ibidtracker=constrict,
  idemtracker=context,
  ibidpage=true,
]{biblatex}

\DeclareNameFormat{labelname}{%
  \ifnumequal{\value{uniquename}}{0}
    {\usebibmacro{name:family}
       {\namepartfamily}
       {\namepartgiven}
       {\namepartprefix}
       {\namepartsuffix}}
    {\usebibmacro{name:family-given}
       {\namepartfamily}
       {\namepartgiven}
       {\namepartprefix}
       {\namepartsuffix}}%
  \usebibmacro{name:andothers}}

\makeatletter
\DeclareCiteCommand{\cbx@textcite}
  {\usebibmacro{cite:init}}
  {\usebibmacro{citeindex}%
   \DeclareNameAlias{labelname}{family}%
   \usebibmacro{textcite}}
  {}
  {\usebibmacro{textcite:postnote}}
\makeatother

\DeclareNameFormat{family}{%
  \usebibmacro{name:family}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}%
  \usebibmacro{name:andothers}}

\begin{filecontents*}{\jobname.bib}
@online{test1,
  author = {Zhang, Xiuying},
  title = {Test title},
  year = {2020}
}
@online{test2,
  author = {Wang, Xiuying},
  title = {Another test title},
  year = {2020}
}
@online{test3,
  author = {Zhang, Wei},
  title = {Test title three},
  year = {2020}
}
@online{test4,
  author = {Wang, Wei},
  title = {Test title four},
  year = {2020}
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}

Citation number one \autocite{test1}, another citation \autocite{test2} and yet another one \autocites{test3,test4}.

As \textcite{test1} argued \ldots\ According to \textcite{test2} \ldots\


\printbibliography
\end{document}

正如张 (2020) 所言...根据王 (2020)...


如果你对一个解决方案感兴趣,可以让非西方名字很好地显示出来,而不需要这些变通方法(但通过使用更复杂的机制和可能更笨拙的输入语法.bib),你可能需要看看CJK 书目问题,Biblatex-Chicago 作者日期样式(以及链接的问题)。如果您希望将其添加到您的文档中,但在将该答案中的代码移植到您的设置时遇到困难,请随时提出有关该问题的新问题。

相关内容