
Con la biblatex
opción uniquename = true
(y citetracker = true, maxcitenames = 1
), puedo, añadiendo el código, \AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}
abreviar cualquier trabajo de varios autores Author et al.
después de su primera cita completa, cf. el MWE a continuación:
\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}
Pero al cambiar uniquename = true
a uniquename = false
, esto no funciona:
Pregunta: ¿Cómo puedo conservar la funcionalidad de \AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}
también con la biblatex
opción uniquename = false
?
EDITAR
carlosResponda abajofunciona, pero ahora tengo curiosidad por saber cómo se puede restringir esto para que la Author 1, Author 2, and Author 3
abreviatura Author 1 et al.
solo se active cuando hay tres o más autores de una obra. En el MWE a continuación, Lennon and McCartney 1963
debe permanecer como tal en su segunda cita, mientras que Lennon, McCartney, Harrison, and Starkey 1970
debe abreviarse a Lennon et al. 1970
en su segunda cita.
\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
La respuesta de Carlo a continuación funciona perfectamente. Sin embargo, simplifiqué un poco el código y lo modifiqué un poco para que al menos lo entienda cuando lo mire más 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
}
Respuesta1
"Cambiar la lógica". maxcitenames = 99
en las biblatex
opciones y \defcounter{maxnames}{1}
en el 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 Respuesta a la pregunta de edición.##
Encontré dos formas y voy a publicar ambas.
La primera
Esta no es la mejor forma, inicialmente no encontré otra. De esta manera no se utiliza \AtEveryCitekey
. Se utiliza listtotal
que es un contador del número total en la lista ( author
, editors
... o labelname
). El mostrador listtotal
sólo está permitido enenumera directivas de formato y no tiene un valor significativo cuando se usa en cualquier otro lugar.
Si \patchlabelnameformat
el valor de listtotal
es mayor que dos y es la primera cita, establezca liststop
(número máximo de lista de elementos para imprimir) en el archivo \value{listtotal}
. Si no es la primera cita, se listtop
establece en 1. Por otro lado, si el valor de listtotal
es menor que dos, listtop
se establece en \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}
El segundo
La mejor forma. Esta usado \AtEveryCitekey
. La lógica es la misma que la primera, pero no es posible utilizarla listtotal
porque listtop
no \AtEveryCitekey
existe una directiva de formato de lista. Luego, de esta manera se utiliza el contador labelname
y se configura el maxnames
. Es necesario utilizar uniquelist=false
en las biblatex
opciones.
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}