
Com a biblatex
opção uniquename = true
(e citetracker = true, maxcitenames = 1
), posso, com a adição do código, \AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}
abreviar qualquer trabalho de vários autores para Author et al.
após sua primeira citação completa, cf. o MWE abaixo:
\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}
Mas ao mudar uniquename = true
para uniquename = false
, isso não funciona:
Pergunta: Como posso manter a funcionalidade \AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}
também com a biblatex
opção uniquename = false
?
EDITAR
Carlosresponda abaixofunciona, mas agora estou curioso para saber como restringir isso para que a Author 1, Author 2, and Author 3
abreviação Author 1 et al.
só entre em ação quando há três ou mais autores de uma obra. No MWE abaixo, Lennon and McCartney 1963
deve permanecer como tal na segunda citação, mas Lennon, McCartney, Harrison, and Starkey 1970
deve ser abreviado para Lennon et al. 1970
na segunda citação.
\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}
EDITAR para EDITAR
A resposta de Carlo abaixo funciona perfeitamente. Porém, simplifiquei um pouco o código e ajustei-o um pouco para que pelo menos eu possa entendê-lo quando olhar para ele mais tarde :)
:
\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
}
Responder1
“Mude a lógica”. maxcitenames = 99
nas biblatex
opções e \defcounter{maxnames}{1}
no True
de ifciteseen
.
MWE
\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}
EDITAR Resposta à pergunta de edição.##
Encontrei duas maneiras e vou postar as duas.
O primeiro
Esta não é a melhor forma, inicialmente não encontrei outra. Desta forma não é usado \AtEveryCitekey
. É usado listtotal
um contador do número total da lista ( author
, editors
... ou labelname
). O contador listtotal
só é permitido emlista diretivas de formatação e não possui um valor significativo quando usado em qualquer outro lugar.
No \patchlabelnameformat
if o valor de listtotal
for maior que dois e for a primeira citação defina o liststop
(número máximo da lista de itens a serem impressos) no \value{listtotal}
. Se não for a primeira citação, é listtop
definido como 1. Por outro lado, se o valor de listtotal
for menor que dois, listtop
é definido como \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}
O segundo
A melhor forma. É usado \AtEveryCitekey
. A lógica é a mesma da primeira forma, mas não é possível utilizá-la listtotal
e listtop
porque \AtEveryCitekey
não é uma diretiva de formatação de lista. Então, desta forma é utilizado o contador labelname
e definido o maxnames
. É necessário usar uniquelist=false
nas biblatex
opções.
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}