biblatex: uniquename = false の場合も「et al.」

biblatex: uniquename = false の場合も「et al.」

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}}}を使用しての機能を維持するにはどうすればよいですか?biblatexuniquename = false


編集 カルロス下記に回答うまくいきますが、今度は、作品の著者が 3 人以上いる場合にのみ のAuthor 1, Author 2, and Author 3省略形が有効になるようにこれを制限できる方法を知りたいと思います。以下の MWE では、 2 番目の引用では のままにする必要がありますが、2 番目の引用ではに省略する必要があります。Author 1 et al.Lennon and McCartney 1963Lennon, McCartney, Harrison, and Starkey 1970Lennon 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}

ここに画像の説明を入力してください


編集から編集へ

以下の Carlo の回答は完璧に機能します。ただし、私はコードを少し簡略化し、後で見たときに少なくとも理解できるように少し調整しました:)

\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 = 99オプションbiblatex\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}

ここに画像の説明を入力してください

編集 編集の質問に対する回答。##

2つの方法を見つけたので、両方を投稿します。

最初

これは最良の形式ではありません。最初は他に見つけられませんでした。この方法では は使用されません。は、リスト内の合計数のカウンタ(、...または)として\AtEveryCitekey使用されます。カウンタは、listtotalauthoreditorslabelnamelisttotalリストの書式設定ディレクティブであり、他の場所で使用された場合、意味のある値を保持しません。

において、\patchlabelnameformatの値listtotalが 2 より大きく、それが最初の引用である場合は、liststopの (印刷する項目リストの最大数)を設定します\value{listtotal}。 が最初の引用でない場合、 はlisttop1 に設定されます。一方、 の値がlisttotal2 より小さい場合listtop、 は に設定されます\value{listtotal}

MWE:

\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。 ロジックは最初の方法と同じですが、 はリスト フォーマット ディレクティブではないためlisttotal、は使用できません。 次に、この方法では カウンターを使用し、 を設定します。 オプションでを使用する必要があります。listtop\AtEveryCitekeylabelnamemaxnamesuniquelist=falsebiblatex

MWE:

\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}

ここに画像の説明を入力してください

関連情報