\documentclass[11pt, authoryear, longnamesfirst]{elsarticle}
\usepackage{natbib}
\usepackage{filecontents}
\begin{filecontents}{ref.bib}
@article{fransoo2020exiting,
title={Exiting a COVID-19 Lockdown: The Bumpy Road Ahead for Many Supply Chains},
author={Fransoo, Jan C and Udenio, Maximiliano},
journal={Available at SSRN 3590153},
year={2020} }
\end{filecontents}
\begin{document}
\textbf{Getting problem in using Harvard Style referencing}
\begin{enumerate}
\item All mentions of authors in the running text should be in the format of Author’s Last Name (year), and should include the word “and” rather than an ampersand (\&). Below is the example of running text:
\begin{itemize}
\item \cite{fransoo2020exiting} says that this work is right. Here “and” is coming in the citation which is right. This is an example of running text citation.
\end{itemize}
\item The problem is happening with In-text citations. In Harvard style, the requirement is as described below: In-text citations for sources with multiple authors should use an ampersand (\&) to join the last two. Below is the example of in text citation: authors’ names.
\begin{itemize}
\item This work is exemplary \citep{fransoo2020exiting}. Here the desired output as per Harvard style is “\&” but “and” is coming in between the authors name. This is an example of In-text citation.
\end{itemize}
\end{enumerate}
\bibliographystyle{agsm}
\bibliography{ref}
\end{document}
\endinput
答案1
您可以重新定义\harvardand
以发出and
(\citet
这和 相同\cite
)和\&
。\citep
需要修补这两个命令以插入条件设置。\harvardand
必须制作宏\protected
,以免不合时宜地展开。
\begin{filecontents*}{\jobname.bib}
@article{fransoo2020exiting,
title={Exiting a {COVID-19} Lockdown: The Bumpy Road Ahead for Many Supply Chains},
author={Fransoo, Jan C. and Udenio, Maximiliano},
journal={Available at SSRN 3590153},
year={2020},
}
\end{filecontents*}
\documentclass[11pt, authoryear, longnamesfirst]{elsarticle}
\usepackage{natbib}
\usepackage{xpatch}
\makeatletter
\newif\ifharvardand@ampersand@
\AtBeginDocument{%
\xpatchcmd{\citet}
{\begingroup}
{\begingroup\harvardand@ampersand@false}
{}{}%
\xpatchcmd{\citep}
{\begingroup}
{\begingroup\harvardand@ampersand@true}
{}{}%
\protected\def\harvardand{\ifharvardand@ampersand@\&\else and\fi}%
}
% also make & to appear in the bibliography
\AddToHook{env/thebibliography/begin}{\harvardand@ampersand@true}
\makeatother
\begin{document}
\textbf{Getting problem in using Harvard Style referencing}
\begin{enumerate}
\item All mentions of authors in the running text should be in the format of
Author’s Last Name (year), and should include the word “and” rather than
an ampersand (\&). Below is the example of running text:
\item \cite{fransoo2020exiting} says that this work is right. Here “and”
is coming in the citation which is right. This is an example of running
text citation.
\item The problem is happening with In-text citations. In Harvard style,
the requirement is as described below: In-text citations for sources
with multiple authors should use an ampersand (\&) to join the last
two. Below is the example of in text citation: authors’ names.
\item This work is exemplary \citep{fransoo2020exiting}. Here the
desired output as per Harvard style is “\&” but “and” is coming
in between the authors name. This is an example of In-text citation.
\end{enumerate}
\bibliographystyle{agsm}
\bibliography{\jobname}
\end{document}
非常奇怪的风格。就我个人而言,除了在商业名称中,我从来不会使用 &,在引用中肯定不会。
如果你有 2020-10-01 之前的 LaTeX 版本,你可以使用
\AtBeginEnvironment{thebibliography}{\harvardand@ampersand@true}
而不是
\AddToHook{env/thebibliography/begin}{\harvardand@ampersand@true}
但是,这看起来像是一个 XY 问题。您需要使用 APA 格式,而不是 Harvard 格式。
\begin{filecontents*}{\jobname.bib}
@article{fransoo2020exiting,
title={Exiting a {COVID-19} Lockdown: The Bumpy Road Ahead for Many Supply Chains},
author={Fransoo, Jan C. and Udenio, Maximiliano},
journal={Available at SSRN 3590153},
year={2020},
}
\end{filecontents*}
\documentclass[11pt,nonatbib]{elsarticle}
\usepackage[natbibapa]{apacite}
\begin{document}
\textbf{Getting problem in using Harvard Style referencing}
\begin{enumerate}
\item All mentions of authors in the running text should be in the format of
Author’s Last Name (year), and should include the word “and” rather than
an ampersand (\&). Below is the example of running text:
\item \cite{fransoo2020exiting} says that this work is right. Here “and”
is coming in the citation which is right. This is an example of running
text citation.
\item The problem is happening with In-text citations. In Harvard style,
the requirement is as described below: In-text citations for sources
with multiple authors should use an ampersand (\&) to join the last
two. Below is the example of in text citation: authors’ names.
\item This work is exemplary \citep{fransoo2020exiting}. Here the
desired output as per Harvard style is “\&” but “and” is coming
in between the authors name. This is an example of In-text citation.
\end{enumerate}
\bibliographystyle{apacite}
\bibliography{\jobname}
\end{document}