TeX - LaTeX Asked by Fang Jing on December 18, 2020
By publisher requirement, when citing following the Harvard style the connector between authors needs to be "and" when in the running text, yet an ampersand "&" when in a parenthetical citation. How to achieve that?
In the current MWE the connector is "&" in both cases, but the first citation should rather appear as "Li and Wang (2020)".
documentclass{article}
usepackage[longnamesfirst]{natbib}
bibliographystyle{agsm}
usepackage{filecontents}
begin{filecontents}{references.bib}
@article{li2020most,
author = {Li, Ming and Wang, Qiang},
title = {The most important paper of the century},
journal = {Journal of Nonexistence},
volume = {25},
number = {4},
pages = {250--251},
year = {2020},
}
end{filecontents}
begin{document}
I first cite citet{li2020most} in the running text then cite the same paper
parenthetically citep{li2020most}.
bibliography{references}
end{document}
Your formatting requirement is best handled by switching from the natbib
citation management package to the apacite
package (with option natbibapa
, so that you can keep using citet
and citep
) and from the agsm
bib style to the apacite
bib style.
documentclass{article}
begin{filecontents}[overwrite]{references.bib}
@article{li2020most,
author = {Li, Ming and Wang, Qiang},
title = {The most important paper of the century},
journal = {Journal of Nonexistence},
volume = {25},
number = {4},
pages = {250--251},
year = {2020},
}
end{filecontents}
%usepackage[longnamesfirst]{natbib}
%bibliographystyle{agsm}
usepackage[natbibapa]{apacite}
bibliographystyle{apacite}
begin{document}
citet{li2020most}, citep{li2020most}.
bibliography{references}
end{document}
Addendum to address the OP's follow-up question. The OP has indicated that his/her publisher has a separate formatting requirement which may be violated by the approach suggested above. To meet the publisher's supplemental requirement, I suggest one should proceed as follows:
Find the file apacite.sty
in your TeX distribution. Make a copy of this file and call the copy, say apacite-natbibapa-nosort.sty
. (The reason for this choice of name will become apparent soon.)
Open the file apacite-natbibapa-nosort.sty
in text editor; the program you use to edit your tex files will do fine.
On line 46, change
ProvidesPackage{apacite}
to
ProvidesPackage{apacite-natbibapa-nosort}
Change all three instances of the string
[longnamesfirst,sort]
to
[longnamesfirst]
i.e., delete the 'sort' option. In my copy of the file, the strings occur on lines 998, 1000, and 1002.
Save the file apacite-natbibapa-nosort.sty
to the directory that contains your main tex file.
In your main tex file, be sure to include the instructions
usepackage[natbibapa]{apacite-natbibapa-nosort}
bibliographystyle{apacite}
in the preamble.
Happy BibTeXing.
Correct answer by Mico on December 18, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP