biblatex:“等人。”當 uniquename = false 時也是如此

biblatex:“等人。”當 uniquename = false 時也是如此

使用biblatex選項uniquename = true(和citetracker = true, maxcitenames = 1),我可以通過添加程式碼\AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}將任何多人創作的作品縮寫為Author et al.在其第一次完整引用之後,請參見。 MWE如下:

\documentclass{article}
\usepackage[style = authoryear-comp, citetracker = true, maxcitenames = 1, uniquename = true]{biblatex}
\AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}} % cite all authors of multi-authored works only once
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{lennon1963,
    AUTHOR = "John Lennon and Paul McCartney",
    TITLE = "She loves you",
    YEAR = "1963"}
@BOOK{lennon2004,
    AUTHOR = "Sean Lennon",
    TITLE = "My father was John Lennon",
    YEAR = "2004"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\noindent\cite{lennon1963}\\
\cite{lennon1963}\\
\cite{lennon2004}
\end{document}

在此輸入影像描述

但是當更改uniquename = true為 時uniquename = false,這不起作用:

在此輸入影像描述

問題:如何保留\AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}選項biblatex的功能uniquename = false


編輯 卡洛的回答如下有效,但現在我很好奇如何限制這一點,以便只有當一件作品有三個或更多作者時Author 1, Author 2, and Author 3縮寫才起作用。Author 1 et al.在下面的 MWE 中,Lennon and McCartney 1963在第二次引文中應保持原樣,而在第二次引文中Lennon, McCartney, Harrison, and Starkey 1970應縮寫為。Lennon et al. 1970

\documentclass{article}
\usepackage[style = authoryear-comp, citetracker = true, maxcitenames = 99, mincitenames = 2, uniquename = false]{biblatex}
\AtEveryCitekey{\ifciteseen{\defcounter{maxnames}{1}}{}} % cite all authors of multi-authored works only once
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{lennon1963,
    AUTHOR = "John Lennon and Paul McCartney",
    TITLE = "She loves you",
    YEAR = "1963"}
@BOOK{lennon1970,
    AUTHOR = "John Lennon and Paul McCartney and George Harrison and Richard Starkey",
    TITLE = "We're breaking up now",
    YEAR = "1970"}
@BOOK{lennon2004,
    AUTHOR = "Sean Lennon",
    TITLE = "My father was John Lennon",
    YEAR = "2004"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\noindent\cite{lennon1963}\\
\cite{lennon1963}\\
\cite{lennon1970}\\
\cite{lennon1970}\\
\cite{lennon2004}
\end{document}

在此輸入影像描述


編輯到編輯

卡羅下面的回答非常有效。不過,我對程式碼進行了一些簡化,並對其進行了一些調整,以便至少我稍後查看時會理解它:)

\AtEveryCitekey% for every citation
    {%
        \ifnumgreater{\value{labelname}}{2}% if there are >2 authors
            {%
                \ifciteseen% and if citation has been seen before
                    {\setcounter{maxnames}{1}}% then cite only one author
                    {\setcounter{maxnames}{\value{labelname}}}% otherwise cite all authors
            }
            {\setcounter{maxnames}{\value{labelname}}}% otherwise cite ≤2 authors
    }

答案1

「改變邏輯」。maxcitenames = 99biblatex選項和的\defcounter{maxnames}{1}中。Trueifciteseen

微量元素

\documentclass{article}
\usepackage[style = authoryear-comp, citetracker = true, maxcitenames = 99, uniquename = false]{biblatex}
\AtEveryCitekey{%
    \ifciteseen
    {\defcounter{maxnames}{1}}
    {}} % cite all authors of multi-authored works only once
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{lennon1963,
    AUTHOR = "John Lennon and Paul McCartney",
    TITLE = "She loves you",
    YEAR = "1963"}
@BOOK{lennon2004,
    AUTHOR = "Sean Lennon",
    TITLE = "My father was John Lennon",
    YEAR = "2004"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\noindent\cite{lennon1963}\\
\cite{lennon1963}\\
\cite{lennon2004}
\end{document}

在此輸入影像描述

編輯編輯問題的答案。

我找到了兩種方法,並將兩種方法都發布了。

首先

這不是最好的形式,最初我沒有找到其他形式。這樣就不用了\AtEveryCitekey。它用於listtotal列表中總數的計數器(authoreditors... 或labelname)。櫃檯listtotal只允許在列出格式化指令,並且在其他地方使用時不保留有意義的值

如果\patchlabelnameformat的值listtotal大於 2 並且是第一個引用,則liststop在 中設定(要列印的項目清單的最大數量)\value{listtotal}。如果不是第一次引用,listtoplisttotal設定listtop為1 \value{listtotal}

微量元素:

\documentclass{article}
\usepackage[style = authoryear-comp, citetracker = true,maxnames=2, minnames=2,uniquename=false]{biblatex}

\def\fgt{\setcounter{liststop}{\value{listtotal}}} %first and greater than two
\def\nfgt{\setcounter{liststop}{1}} %non first and greater than two

\def\flt{\setcounter{liststop}{\value{listtotal}}} %first and lower than two

\def\patchlabelnameformat{%
 \ifnumgreater{\value{listtotal}}{2}
    {\ifciteseen
       {\nfgt}
       {\fgt}}
    {\flt}}

\DeclareNameFormat{labelname}{%
 \patchlabelnameformat
 \ifcase\value{uniquename}%
    \usebibmacro{name:last}{#1}{#3}{#5}{#7}%
  \or
    \ifuseprefix
      {\usebibmacro{name:first-last}{#1}{#4}{#5}{#8}}
      {\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}}%
  \or
    \usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
  \fi
  \usebibmacro{name:andothers}}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{lennon1963,
    AUTHOR = "John Lennon and Paul McCartney",
    TITLE = "She loves you",
    YEAR = "1963"}
@BOOK{lennon1970,
    AUTHOR = "John Lennon and Paul McCartney and George Harrison and Richard Starkey",
    TITLE = "We're breaking up now",
    YEAR = "1970"}
@BOOK{lennon2004,
    AUTHOR = "Sean Lennon",
    TITLE = "My father was John Lennon",
    YEAR = "2004"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\noindent\cite{lennon1963}\\
\cite{lennon1963}\\
\cite{lennon1970}\\
\cite{lennon1970}\\
\cite{lennon2004}
\end{document}

第二

最好的形式。它被使用了\AtEveryCitekey。邏輯與第一種方式相同,但不可能使用listtotallisttop因為\AtEveryCitekey不是清單格式化指令。然後,以這種方式使用計數器labelname並設定maxnames。需要uniquelist=falsebiblatex選項中使用。

微量元素:

\documentclass{article}
\usepackage[style = authoryear-comp, citetracker = true,uniquename=false,uniquelist=false]{biblatex}

\AtEveryCitekey{\maxminformat} % cite all authors of

\def\fgt{\setcounter{maxnames}{\value{labelname}}} %first and greater than two
\def\nfgt{\setcounter{minnames}{1}\setcounter{maxnames}{1}} %non first and greater than two

\def\flt{\setcounter{maxnames}{\value{labelname}}} %first and lower than two

\def\maxminformat{%
 \ifnumgreater{\value{labelname}}{2}
    {\ifciteseen
       {\nfgt}
       {\fgt}}
    {\flt}}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{lennon1963,
    AUTHOR = "John Lennon and Paul McCartney",
    TITLE = "She loves you",
    YEAR = "1963"}
@BOOK{lennon1970,
    AUTHOR = "John Lennon and Paul McCartney and George Harrison and Richard Starkey",
    TITLE = "We're breaking up now",
    YEAR = "1970"}
@BOOK{lennon2004,
    AUTHOR = "Sean Lennon",
    TITLE = "My father was John Lennon",
    YEAR = "2004"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\noindent\cite{lennon1963}\\
\cite{lennon1963}\\
\cite{lennon1970}\\
\cite{lennon1970}\\
\cite{lennon2004}
\end{document}

在此輸入影像描述

相關內容