.bib 항목에 저자가 2명 이상 포함된 경우 "Author et al.(연도)"를 표시하도록 .bst 파일을 수정하시겠습니까?

.bib 항목에 저자가 2명 이상 포함된 경우 "Author et al.(연도)"를 표시하도록 .bst 파일을 수정하시겠습니까?

이 질문은 여기 질문과 매우 관련이 있습니다.

"등" 인용 natbib 및 jf.bst를 사용하는 4명 이상의 작성자에게만 해당

해당 질문에 대한 답변에서 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

이름은 동일하지만 Econometrica의 참고문헌 요구 사항에 맞게 일부 수정되었습니다.

따라서 질문은 내가 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명 이상 있을 때마다 "Author et al.(연도)"가 표시되지 않습니다. (나는 이것이 매우 간단한 것일 수도 있다는 것을 깨닫고 Tame the Beast를 읽기 시작했습니다.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. 2명 이상의 작성자가 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}

관련 정보