如果 .bib 條目包含超過 2 位作者,是否修復 .bst 檔案以顯示「作者等人(年份)」?

如果 .bib 條目包含超過 2 位作者,是否修復 .bst 檔案以顯示「作者等人(年份)」?

這個問題與這裡的問題非常相關:

引用“等”。僅適用於 natbib 和 jf.bst 的四位及以上作者

在這個問題的答案中,Mico 展示瞭如何替換jf.str 中的format.lab.names 函數,以便每當4 個以上的作者出現時,.bib 條目就會顯示為「Author et al.(年份) ”入口。然而,這是針對 nyu.edu 網站上找到的 jf.str 版本完成的。我希望能夠使用此處找到的 .str 檔案實現相同的行為

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

雖然它具有相同的名稱,但有一些修改以適應計量經濟學的參考書目要求。

所以問題是任何人都可以向我解釋為什麼當我將 FUNCTION {format.lab.names} 替換為

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

每當 .bib 條目有超過 2 位作者時,我就不會收到「作者等人(年份)」。 (我意識到這可能是非常簡單的事情,並開始閱讀《馴服野獸》http://www.lsv.ens-cachan.fr/~markey/BibTeX/doc/ttb_en.pdf)。謝謝。

這是用於測試目的的 .tex 檔案:

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

答案1

現在您向我們指出了bib要修改的正確樣式,這裡有一個更短的替換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$
}

在您的範例文件(稍微整理一下,見下文)上它會生成

樣本輸出

該函數的工作原理如下。首先將作者列表儲存在s.將作者數量儲存在numnames.格式化第一個 ( #1) 條目並將其輸出。然後,如果有多個名稱,則格式化下一個名稱並將其指派給t。如果t曾經"others"或實際上有兩個以上的作者,則輸出et al.其他人的輸出,第二個(最後一個)作者前面帶有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}

相關內容