我的问题与问题相关 我怎样才能获得 [作者年份] 格式的参考文献列表?。我定制了在参考标签中获取 1 位作者和年份,但我注意到当文章有 2 位作者时,两个名字都会出现。
如何定制样式才能使标签中始终只有 1 个作者?
尽管我的序言与上一个问题相比没有什么变化,但我还是将其复制/粘贴到这里,以便于您检查。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear, backend=biber, dashed=false]{biblatex}
\addbibresource{biblatex-examples.bib}
% implementation copied from biblatex-ext
\makeatletter
\newbibmacro*{bbx:introcite}{\usebibmacro{cite}}
\DeclareFieldFormat{bbx@introcite}{#1}
\newcommand*{\introcitepunct}{\addcolon\space}
\newcommand*{\introcitebreak}{\leavevmode\newline}
\newlength{\extbl@this@introcitewidth}
\newlength{\introcitewidth}
\setlength{\introcitewidth}{8\biblabelsep}
\newlength{\introcitesep}
\setlength{\introcitesep}{\biblabelsep}
\newbibmacro{introcite:typeset}{%
\begingroup
\iftoggle{blx@citation}
{}
{\togglefalse{blx@bibliography}%
\toggletrue{blx@citation}}%
\delimcontext{bbx@introcite}%
\csuse{blx@hook@cite}%
\csuse{blx@hook@citekey}%
\DeclareFieldFormat{bibhyperref}{##1}%
\undef\cbx@lasthash
\undef\cbx@lastyear
\citetrackerfalse\pagetrackerfalse\backtrackerfalse
\defcounter{maxnames}{\blx@maxcitenames}%
\defcounter{minnames}{\blx@mincitenames}%
\printtext[bbx@introcite]{\usebibmacro{bbx:introcite}}%
\endgroup
}
% This macro is used in \defbibenvironment
\newbibmacro*{introcite:break}{%
\settowidth{\extbl@this@introcitewidth}
{\usebibmacro{introcite:typeset}}%
\ifdimgreater{\extbl@this@introcitewidth}{\introcitewidth}
{\introcitebreak}
{}}
\defbibenvironment{bibliography}
{\list
{\usebibmacro{introcite:typeset}}
{\setlength{\labelwidth}{\introcitewidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\introcitesep}%
\addtolength{\leftmargin}{\labelsep}%
\renewcommand*{\makelabel}[1]{##1\hss}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}}
{\endlist}
{\item
\usebibmacro{introcite:break}}
\makeatother
% customisation starts here
\DeclareFieldFormat{bbx@introcite}{\mkbibbrackets{#1}}
\setlength{\introcitewidth}{8\biblabelsep}
\setlength{\introcitesep}{\biblabelsep}
\begin{document}
\cite{sigfridsson,worman,geer,knuth:ct:a,knuth:ct:b}
\printbibliography
\end{document}
答案1
使用:
\usepackage[style=authoryear, dashed=false, maxnames=1]{biblatex}
maxnames=1
告诉biblatex
在引用和参考书目标签中只使用一个名称。
有时,为了避免歧义,您仍会打印多个名称。您可以使用uniquename
和uniquelist
选项来控制这一点。
从下面的评论来看,您想要的选项是:
\usepackage[style=authoryear, dashed=false, maxcitenames=1, maxbibnames=999,
uniquelist=false]{biblatex}
请注意,如果有多个名称,仍会打印“et. al.”