อ้างกับ En Dash
บางครั้งฉันจำเป็นต้องเขียนตัวประมาณค่า 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}
ด้วยวิธีนี้ฉันสามารถอ้างถึงกระดาษที่มีชื่อผู้แต่งเชื่อมต่อผ่าน en dash ได้หรือไม่?
คำตอบ
หากรูปแบบบรรณานุกรมของคุณรองรับตัวคั่นชื่อที่ปรับแต่งได้สิ่งนี้จะง่ายพอ ๆ กับการเปลี่ยนตัวคั่นนี้ น่าเสียดายที่ไม่ใช่ทุก.bstไฟล์ที่รองรับตัวคั่นชื่อที่ปรับแต่งได้ แต่ส่วนมากจะเข้ารหัสเฉพาะ "และ" เท่านั้น
ขั้นตอนที่ 1 คือการapalikeใช้ตัวคั่นที่ปรับแต่งได้ในการอ้างอิง ด้วยเหตุนี้
ค้นหา
apalike.bstบนเครื่องของคุณ คุณสามารถทำได้โดยพิมพ์kpsewhich apalike.bstลงในบรรทัดคำสั่ง / เทอร์มินัล หรือรับสำเนาของไฟล์จาก CTANhttp://mirrors.ctan.org/biblio/bibtex/base/apalike.bstคัดลอกไฟล์ไปยังตำแหน่งที่ TeX สามารถค้นหาได้ ไดเร็กทอรีเอกสารจะทำได้ดี ดูสิ่งนี้ด้วยhttps://texfaq.org/FAQ-inst-wlcf
เปลี่ยนชื่อไฟล์เป็น
apalike-namedelim.bstพูด (สิทธิ์การapalike.bstใช้งานกำหนดให้คุณเปลี่ยนชื่อหากคุณแก้ไขไฟล์)ค้นหา
FUNCTION {format.lab.names}(ล. 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$ }เพิ่มความคิดเห็นพร้อมชื่อของคุณวันที่ปัจจุบันและคำอธิบายสั้น ๆ ของการเปลี่ยนแปลงที่ด้านบนของไฟล์
ใช้
\bibliographystyle{apalike-namedelim}แทน\bibliographystyle{apalike}ในเอกสารของคุณ
อีกทางเลือกหนึ่งสำหรับขั้นตอนที่ 1 ถึง 5 คุณสามารถรับไฟล์เวอร์ชันแพตช์ได้ที่ https://gist.github.com/moewew/1808df0569958a79ce5058b133495260
ขั้นตอนที่ 2 คือการใช้ประโยชน์จากมาโครที่ปรับแต่งได้ในคำสั่งใหม่ที่เรากำหนดเพื่อจุดประสงค์ในการอ้างถึงด้วยเครื่องหมายขีดกลาง เราเพียงแค่คัดลอกคำจำกัดความของ\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}
เนื่องจากคุณใช้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}