En Dash로 인용

Oct 31 2020

때때로 나는 다음과 같이 Newey and West (1987) 추정기 보다는 Newey-West (1987) 추정기 를 작성해야 합니다.

\documentclass{article}

\usepackage{filecontents,natbib}
\begin{filecontents}{z.bib}
@article{newey1987simple,
  title={A Simple, Positive Semi-Definite, Heteroskedasticity and Autocorrelation},
  author={Newey, Whitney K and West, Kenneth D},
  journal={Econometrica},
  volume={55},
  number={3},
  pages={703--708},
  year={1987}
}
\end{filecontents}
\bibliographystyle{apalike}

\begin{document}

\citeauthor{newey1987simple}'s \citeyearpar{newey1987simple} estimator.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Newey--West (1987) estimator.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\bibliography{z}

\end{document}

이런 식으로 엔 대시로 연결된 저자 이름이있는 논문을 인용 할 수 있습니까?

답변

3 moewe Oct 31 2020 at 18:54

참고 문헌 스타일이 사용자 정의 가능한 이름 구분 기호를 지원하는 경우이 구분 기호를 로컬로 변경하는 것만 큼 쉽습니다. 안타깝게도 모든 .bst파일이 사용자 정의 가능한 이름 구분 기호를 지원하는 것은 아니며 많은 파일이 "and"를 하드 코딩합니다.

1 단계 apalike는 인용에 사용자 정의 가능한 구분 기호를 사용하는 것입니다. 이를 위해

  1. apalike.bst컴퓨터에서 찾습니다 . kpsewhich apalike.bst명령 줄 / 터미널 에 입력하여 이를 수행 할 수 있습니다 . 또는 CTAN에서 파일 사본을 얻으십시오.http://mirrors.ctan.org/biblio/bibtex/base/apalike.bst

  2. TeX가 찾을 수있는 위치에 파일을 복사합니다. 문서 디렉토리는 괜찮습니다. 또한보십시오https://texfaq.org/FAQ-inst-wlcf

  3. 파일 이름을 다음과 같이 변경합니다 (파일을 수정하는 경우 apalike-namedelim.bst라이센스에 apalike.bst따라 이름을 변경해야 함).

  4. FUNCTION {format.lab.names}(ll. 841-587)을 찾아 전체 함수 정의를 다음으로 바꿉니다.

     FUNCTION {format.lab.names}
     { 's :=
       s #1 "{vv~}{ll}" format.name$ s num.names$ duplicate$ #2 > { pop$ " et~al." * }
         { #2 <
             'skip$ { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
                 { " et~al." * }
                 { "\finalnamedelim " * s #2 "{vv~}{ll}" format.name$ * } if$
             }
           if$ } if$
     }
    
  5. 이름, 현재 날짜 및 변경 사항에 대한 간단한 설명이 포함 된 주석을 파일 상단에 추가합니다.

  6. 문서에서 \bibliographystyle{apalike-namedelim}대신 사용하십시오 \bibliographystyle{apalike}.

1 ~ 5 단계의 대안으로 다음 위치에서 패치 된 파일 버전을 얻을 수 있습니다. https://gist.github.com/moewew/1808df0569958a79ce5058b133495260

2 단계는 en-dash로 인용 할 목적으로 정의한 새 명령에서 사용자 정의 가능한 매크로를 사용하는 것입니다. 우리는 단지의 정의 복사 \citet및 \citeauthor에서 natbib.sty변화에 일부 코드 분사를 \finalnamedelim.

\documentclass{article}

\usepackage{natbib}
\bibliographystyle{apalike-namedelim}

\newcommand*{\finalnamedelim}{}
\DeclareRobustCommand*{\finalnamedelim}{ and }

\makeatletter
\newcommand*{\citetattr}{}
\DeclareRobustCommand\citetattr
   {\begingroup
    \DeclareRobustCommand*{\finalnamedelim}{--}%
    \NAT@swafalse\let\NAT@ctype\z@\NAT@partrue
     \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
     
\newcommand*{\citeauthorattr}{}
\DeclareRobustCommand\citeauthorattr
   {\begingroup
    \DeclareRobustCommand*{\finalnamedelim}{--}%
    \NAT@swafalse\let\NAT@ctype\@ne\NAT@parfalse
    \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}

\newcommand*{\Citetattr}{}
\DeclareRobustCommand\Citetattr
   {\begingroup
    \DeclareRobustCommand*{\finalnamedelim}{--}%
    \NAT@swafalse\let\NAT@ctype\z@\NAT@partrue
     \let\NAT@up\NAT@Up
     \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
\makeatother

\begin{filecontents}{\jobname.bib}
@article{newey1987simple,
  title   = {A Simple, Positive Semi-Definite, Heteroskedasticity 
             and Autocorrelation Consistent Covariance Matrix},
  author  = {Newey, Whitney K. and West, Kenneth D.},
  journal = {Econometrica},
  volume  = 55,
  number  = 3,
  pages   = {703--708},
  year    = 1987,
}
\end{filecontents}

\begin{document}
\citeauthor{newey1987simple}'s \citeyearpar{newey1987simple} estimator.

\citetattr{newey1987simple} --- with citation alias

\bibliography{\jobname}
\end{document}


이러한 종류의 작업은 biblatex.

\documentclass[british]{article}

\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}

\newcommand*{\textattrcite}{%
  \AtNextCite{\AtEachCitekey{\delimcontext{textattrcite}}}%
  \textcite}

\DeclareDelimFormat[textattrcite]{multinamedelim}{\textendash}
\DeclareDelimAlias[textattrcite]{finalnamedelim}[textattrcite]{multinamedelim}

\begin{filecontents}{\jobname.bib}
@article{newey1987simple,
  title   = {A Simple, Positive Semi-Definite, Heteroskedasticity 
             and Autocorrelation Consistent Covariance Matrix},
  author  = {Newey, Whitney K. and West, Kenneth D.},
  journal = {Econometrica},
  volume  = 55,
  number  = 3,
  pages   = {703--708},
  year    = 1987,
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\citeauthor{newey1987simple}'s \parencite*{newey1987simple} estimator.

\textattrcite{newey1987simple} --- with citation alias

\printbibliography
\end{document}
2 Mico Oct 31 2020 at 18:25

natbib인용 관리 패키지 를 사용하므로 서식 목표를 달성하기 위해 해당 \defcitealias및 \citetalias매크로를 사용할 수 있습니다.

\documentclass{article}

\begin{filecontents}[overwrite]{z.bib}
@article{newey1987simple,
  title  ={A Simple, Positive Semi-Definite, Heteroskedasticity 
           and Autocorrelation Consistent Covariance Matrix},
  author ={Newey, Whitney K. and West, Kenneth D.},
  journal={Econometrica},
  volume =55,
  number =3,
  pages  ={703--708},
  year   =1987,
}
\end{filecontents}

\usepackage{natbib}
\defcitealias{newey1987simple}{Newey--West (1987)}
\bibliographystyle{apalike}

\begin{document}
\setlength\parindent{0pt} % just for this example

\citeauthor{newey1987simple}'s \citeyearpar{newey1987simple} estimator.

\citetalias{newey1987simple} --- with citation alias

Newey--West (1987) --- brute force

\bibliography{z}
\end{document}