%22%20si%20una%20entrada%20.bib%20contiene%20m%C3%A1s%20de%202%20autores%3F.png)
Esta pregunta está muy relacionada con la pregunta aquí:
Cita "et al." sólo para cuatro y más autores con natbib y jf.bst
En la respuesta a esa pregunta, Mico ha mostrado cómo reemplazar la función format.lab.names en jf.str para que una entrada .bib se muestre como "Autor et al. (año)" siempre que haya más de 4 autores presentes en la entrada. Sin embargo, esto se hace para la versión jf.str que se encuentra en el sitio web de nyu.edu. Quiero poder lograr el mismo comportamiento con el archivo .str que se encuentra aquí
http://pages.stern.nyu.edu/~dbackus/GE_asset_pricing/BGTZ/jf.bst
que si bien tiene el mismo nombre tiene algunas modificaciones para ajustarse a los requerimientos bibliográficos de Econometrica.
Entonces la pregunta es ¿alguien puede explicarme por qué cuando reemplazo la FUNCIÓN {format.lab.names} con
FUNCTION {format.lab.names}
{'s :=
"" 't :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr
"{vv~}{ll}" format.name$
't :=
nameptr #1 >
{
nameptr #2 =
numnames #2 > and
{ "others" 't :=
#1 'namesleft := }
'skip$
if$
namesleft #1 >
{ ", " * t * }
{
s nameptr "{ll}" format.name$ duplicate$ "others" =
{ 't := }
{ pop$ }
if$
t "others" =
{ " et~al." * }
{
numnames #2 >
{ "," * }
'skip$
if$
bbl.and
space.word * t *
}
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
}
No aparece "Autor et al. (año)" cada vez que una entrada .bib tiene más de 2 autores. (Me di cuenta de que esto podría ser algo muy simple y comencé a leer Tame the Beast enhttp://www.lsv.ens-cachan.fr/~markey/BibTeX/doc/ttb_en.pdf). Gracias.
Aquí hay un archivo .tex para fines de prueba:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{abd:2007,
author = "Torben G. Andersen and Tim Bollerslev and Francis X. Diebold",
title = "Roughing it up: {Including} jump components in the
measurement, modeling and forecasting of return volatility",
journal = "Review of Economics and Statistics",
year = 2007,
volume = 89,
number = 4,
month = "November",
pages = "701--720",
}
@article{abde:2001,
author = "Torben G. Andersen and Tim Bollerslev and Francis X. Diebold
and Heiko Ebens",
title = "The distribution of realized stock return volatility",
journal = "Journal of Financial Economics",
year = 2001,
volume = 61,
number = 1,
month = "July",
pages = "43--76",
}
@unpublished{gavazzoni-santacreu-2015,
Author = {Gavazzoni, Federico and Ana Maria Santacreu},
Note = {manuscript, December},
Title = {International R\&D spillovers and Asset prices},
Year = {2015}
}
@article{segal-shaliastovich-yaron-2013,
Author = {Gill, Segal and Ivan Shaliastovich and Amir Yaron},
Journal = {Journal of Financial Economics},
Title = {Good and bad uncertainty: macroeconomic and financial market implications},
Volume={117},
Pages={369-397},
Year = {2015}
}
\end{filecontents*}
\usepackage[round,authoryear,comma]{natbib}
\bibliographystyle{jf_nyu} % or: jf3
\begin{document}
Here's the output \\
\cite{abd:2007}\\
\cite{abde:2001}\\
\cite{gavazzoni-santacreu-2015}\\
\cite{segal-shaliastovich-yaron-2013}\\
\bibliography{\jobname}
\end{document}
Respuesta1
Ahora que nos indicó el bib
estilo correcto para modificar, aquí hay un reemplazo mucho más breve para format.lab.names
:
FUNCTION {format.lab.names}
{ 's :=
s num.names$ 'numnames :=
s #1 "{vv~}{ll}" format.name$
numnames #1 >
{ s #2 "{vv~}{ll}" format.name$ 't :=
numnames #2 >
t "others" =
or
{ " et~al." * }
{ " and " * t * }
if$
}
'skip$
if$
}
En su archivo de muestra (ligeramente ordenado, ver más abajo) produce
La función funciona de la siguiente manera. Primero almacene la lista de autores en formato s
. Almacene el número de autores en numnames
. Formatee la primera #1
entrada ( ) y envíela. Luego, si hay más de un nombre, formatee el siguiente nombre y asígnelo a t
. Si t
hubo "others"
o en realidad hay más de dos autores, et al.
otros generarán el segundo (último) autor precedido por and
.
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{abd:2007,
author = "Torben G. Andersen and Tim Bollerslev and Francis X. Diebold",
title = "Roughing it up: {Including} jump components in the
measurement, modeling and forecasting of return volatility",
journal = "Review of Economics and Statistics",
year = 2007,
volume = 89,
number = 4,
month = "November",
pages = "701--720",
}
@article{abde:2001,
author = "Torben G. Andersen and Tim Bollerslev and Francis X. Diebold
and Heiko Ebens",
title = "The distribution of realized stock return volatility",
journal = "Journal of Financial Economics",
year = 2001,
volume = 61,
number = 1,
month = "July",
pages = "43--76",
}
@unpublished{gavazzoni-santacreu-2015,
Author = {Gavazzoni, Federico and Ana Maria Santacreu},
Note = {manuscript, December},
Title = {International R\&D spillovers and Asset prices},
Year = {2015}
}
@article{segal-shaliastovich-yaron-2013,
Author = {Gill, Segal and Ivan Shaliastovich and Amir Yaron},
Journal = {Journal of Financial Economics},
Title = {Good and bad uncertainty: macroeconomic and financial market implications},
Volume={117},
Pages={369-397},
Year = {2015}
}
\end{filecontents*}
\usepackage[round,authoryear,comma]{natbib}
\bibliographystyle{jf1} % or: jf3
\begin{document}
Here's the output
\cite{abd:2007}
\cite{abde:2001}
\cite{gavazzoni-santacreu-2015}
\cite{segal-shaliastovich-yaron-2013}
\bibliography{\jobname}
\end{document}