Citando con En Dash

Oct 31 2020

A veces necesito escribir un estimador de Newey-West (1987) en lugar del estimador de Newey y West (1987) de la siguiente manera.

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

De esta manera, ¿puedo citar un artículo con nombres de autor conectados mediante un guión corto?

Respuestas

3 moewe Oct 31 2020 at 18:54

Si su estilo de bibliografía admite un delimitador de nombre personalizable, entonces esto sería tan fácil como cambiarlo localmente. Desafortunadamente, no todos los .bstarchivos admiten un delimitador de nombre personalizable, muchos simplemente codifican "y".

El paso 1 es apalikeutilizar un delimitador personalizable en las citas. Para tal fin

  1. Busque apalike.bsten su máquina. Puede hacer esto escribiendo kpsewhich apalike.bsten la línea de comando / terminal. Alternativamente, obtenga una copia del archivo de CTANhttp://mirrors.ctan.org/biblio/bibtex/base/apalike.bst

  2. Copie el archivo a una ubicación donde TeX pueda encontrarlo. El directorio de documentos funcionará bien. Ver tambiénhttps://texfaq.org/FAQ-inst-wlcf

  3. Cambie el nombre del archivo a apalike-namedelim.bst, digamos (la licencia de apalike.bstrequiere que cambie el nombre si modifica el archivo)

  4. Encuentre FUNCTION {format.lab.names}(ll. 841-587) y reemplace la definición de función completa con

     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. Agregue un comentario con su nombre, la fecha actual y una breve descripción de los cambios en la parte superior del archivo.

  6. Úselo en \bibliographystyle{apalike-namedelim}lugar de \bibliographystyle{apalike}en su documento.

Como alternativa para los pasos 1 a 5, puede obtener la versión parcheada del archivo en https://gist.github.com/moewew/1808df0569958a79ce5058b133495260

El paso 2 es hacer uso de la macro personalizable en los nuevos comandos que definimos con el propósito de citar con guiones cortos. Simplemente copiamos las definiciones de \citety \citeauthordesde natbib.stye inyectamos código para cambiar \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}


Este tipo de cosas son un poco más simples con 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

Dado que emplea el natbibpaquete de gestión de citas, puede emplear sus macros \defcitealiasy \citetaliaspara lograr su objetivo de formato.

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