使用短划线引用

使用短划线引用

有时我需要写一个Newey–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}

这样,我可以引用作者姓名通过短划线连接起来的论文吗?

答案1

如果您的参考书目样式支持可自定义的名称分隔符,那么这就像在本地更改此分隔符一样简单。不幸的是,并非所有.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 步是利用我们为使用短划线引用而定义的新命令中的可自定义宏。我们只需从\citet和复制定义并注入一些代码来更改。\citeauthornatbib.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}

Newey 和 West (1987) 估计量。//Newey–West (1987) — 带引文别名


有了 ,这些事情就会简单一些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

由于您使用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}

相关内容