0

The acmart package is directly available on Overleaf and can be downloaded here in section 2: https://www.acm.org/publications/authors/submissions

MWE:

\documentclass{acmart}
%\documentclass{article}
\citestyle{acmauthoryear}
\begin{filecontents}{mytestbib.bib}
@book{goossens93,
    author = "Frank Mittelbach and Michel Goossens  and Johannes Braams and David Carlisle  and Chris Rowley",
    title = "The {LaTeX} Companion",
    year = "1993",
    publisher = "Addison-Wesley",
    address = "Reading, Massachusetts"
}
\end{filecontents}
\usepackage{filecontents}
\usepackage{natbib}
\usepackage{bibentry}
\nobibliography*

\begin{document}

Using \texttt{citep}: \citep{goossens93}.

Using \texttt{cite}: \cite{goossens93}.

What I expect from \texttt{cite}: Mittelbach et al. [1993] (this is what you get if you comment \texttt{documentclass\{acmart\}} and \texttt{citestyle\{acmauthoryear\}} and uncomment \texttt{documentclass\{article\}}).


\bibliographystyle{plainnat}
\bibliography{mytestbib}

\end{document}

Result: enter image description here

After switching the document class to article, the desired behavior is achieved:

enter image description here

4
  • You can just use \citet.Or even \renewcommand{\cite}{\citet} if you want. Natbib sometimes treats \cite like \citep and sometimes like \citet but actually says in its documentation that plain \cite should be avoided. (Actually it looks like acmart.cls actually has \let\cite\citep in it. )
    – frabjous
    Sep 5, 2022 at 2:22
  • @frabjous Thank you - if you leave this as the answer, then I will mark it as correct Sep 5, 2022 at 4:02
  • OK I added an answer. You should change your question and its title from amsart to acmart, however, since both exist but you mean the latter.
    – frabjous
    Sep 5, 2022 at 15:59
  • @frabjous Of course you are right -- thanks Sep 5, 2022 at 18:52

1 Answer 1

1

To elaborate and reiterate what I wrote in the comments, natbib defines two primary citation commands \citep and \citet. For author-year citations:

  • \citep{mittelbach93} generates something like [Mittelbach et al., 1993] with the name inside the brackets or parentheses
  • \citet{mittelbach93} generates something like Mittelbach et al. [1993] with the name outside the brackets/parentheses

About plain \cite without t or p following, the natbib documentation says this:

Both \citep and \citet are defined by natbib and are thus not standard. The standard LATEX command \cite should be avoided, because it behaves like \citet for author–year citations, but like \citep for numerical ones.

So documents using natbib sometimes treat \cite as \citep and sometimes treat it like \citet. One would think that if you use \citestyle{acmauthoryear} in an acm document to get author-year citations it would treat \cite like \citet, but acmart.cls overrides that and has \let\cite\citep, so \cite behaves like \citep.

If you take natbib's documentation's advice, you should avoid \cite and then use \citet everywhere you want the name outside the brackets. But if you're too used to using \cite or your document is already written with \cite, and you want to make \citet-behavior default, you can redefine \cite:

\renewcommand{\cite}{\citet}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .