Eine .bst-Datei so reparieren, dass „Autor et al. (Jahr)“ angezeigt wird, wenn ein .bib-Eintrag mehr als 2 Autoren enthält?

Eine .bst-Datei so reparieren, dass „Autor et al. (Jahr)“ angezeigt wird, wenn ein .bib-Eintrag mehr als 2 Autoren enthält?

Diese Frage hängt eng mit der Frage hier zusammen:

Zitation "et al." nur ab vier Autoren bei natbib und jf.bst

In der Antwort auf diese Frage hat Mico gezeigt, wie man die Funktion format.lab.names in jf.str ersetzt, sodass ein .bib-Eintrag als „Autor et al. (Jahr)“ angezeigt wird, wenn mehr als 4 Autoren im Eintrag vorhanden sind. Dies wird jedoch für die jf.str-Version gemacht, die auf der Website von nyu.edu zu finden ist. Ich möchte dasselbe Verhalten mit der .str-Datei erreichen können, die hier zu finden ist.

http://pages.stern.nyu.edu/~dbackus/GE_asset_pricing/BGTZ/jf.bst

Obwohl es den gleichen Namen hat, weist es einige Modifikationen auf, um den Bibliographieanforderungen von Econometrica zu entsprechen.

Die Frage ist also, kann mir jemand erklären, warum, wenn ich die FUNKTION {format.lab.names} ersetze durch

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

Ich bekomme nicht "Autor et al. (Jahr)", wenn ein .bib-Eintrag mehr als 2 Autoren hat. (Mir ist klar, dass das etwas ganz Einfaches sein könnte, und ich habe angefangen, Tame the Beast zu lesen beihttp://www.lsv.ens-cachan.fr/~markey/BibTeX/doc/ttb_en.pdf). Danke schön.

Hier ist eine .tex-Datei zu Testzwecken:

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

Antwort1

Nachdem Sie uns nun den richtigen bibzu ändernden Stil gezeigt haben, folgt hier ein viel kürzerer Ersatz für 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$
}

Auf Ihrer Beispieldatei (leicht aufgeräumt, siehe unten) erzeugt es

Beispielausgabe

Die Funktion funktioniert folgendermaßen. Zuerst die Liste der Autoren in speichern s. Die Anzahl der Autoren in speichern numnames. Den ersten ( #1) Eintrag formatieren und ausgeben. Dann, falls mehr als ein Name vorhanden ist, den nächsten Namen formatieren und ihn zuweisen t. Falls mehr als zwei Autoren tvorhanden waren "others"oder es tatsächlich mehr als zwei Autoren gibt, et al.geben die anderen den zweiten (letzten) Autor aus, dem ein vorangestellter vorangestellt ist 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}

verwandte Informationen