Package natbib Warning: Citation `)’ multiply defined

acmacmartbibtexnatbib

When building a paper I'm writing for an ACM conference, I am getting the following error using the latest acmart files:

Package natbib Warning: Citation `)' multiply defined.

Further, I receive this error alongside the following:

Package natbib Warning: Citation `ufactory' on page 3 undefined on input line 21.

The above citation undefined message only appears for 3 misc citations as seen below, and the first warning message disappears when I remove the 3 misc citations.

In the output.aux file, I see the following for these citations:

\bibcite{)}{{33}{[n.\,d.(@}{{SDRplay}}{{}}}

\bibcite{)}{{37}{[n.\,d.(@}{{uArm Developer}}{{}}}

\bibcite{)}{{38}{[n.\,d.(@}{{UFACTORY}}{{}}}

The packages I am using in the preamble are as follows:

\documentclass[sigconf,anonymous,table]{acmart}

% Packages
\usepackage{xcolor}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{makecell}
\usepackage{booktabs}
\usepackage{array}
\usepackage{float}
\usepackage{enumitem}

Citations:

@misc{sdrplay2022, title={SDRuno}, url={https://www.sdrplay.com/sdruno}, author={SDRplay}}
@misc{ufactory, title={UFactory UArm}, url={https://www.ufactory.cc/uarm}, author={UFACTORY}}
@misc{uarmdeveloper, title={UARM-developer/UARM-Python-SDK: New Python Library for Swift, swift pro}, url={https://github.com/uArm-Developer/uArm-Python-SDK/tree/2.0}, author={uArm-Developer}}

EDIT:

The latest acmart files can be gathered on the official site: https://www.acm.org/publications/proceedings-template

The latex document MWE can be seen here:

\documentclass[sigconf,anonymous,table]{acmart} % anonymous

% Packages
\usepackage{xcolor}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{makecell}
\usepackage{booktabs}
\usepackage{array}
\usepackage{float}
\usepackage{enumitem}
% \graphicspath{{img/}}


\newcommand{\subscript}[2]{$#1 _ #2$}
\newcommand{\paragraphb}[1]{\vspace{0.03in}\noindent{\bf #1} }

\begin{document}

\title{My Paper}

\author{James Smith, John Nash}
\affiliation{%
    \institution{My Afill}
    \city{City}
    \country{ABC}
}
\email{{first.last}@afill.com}

\begin{abstract}
...
\end{abstract}


\keywords{a, b, c}
\maketitle

I used
uFactory's uARM Swift Pro~\cite{ufactory} and ... using
the uARM Python (3.8.X) SDK~\cite{uarmdeveloper}. The data capture ... uses ..
SDRuno~\cite{sdrplay2022} with ...

% References
\bibliographystyle{ACM-Reference-Format}
\bibliography{references}

\end{document}

And the references.bib file used is simply the following, omitting all other references used:

@misc{sdrplay2022, title={SDRuno}, url={https://www.sdrplay.com/sdruno}, author={SDRplay}}
@misc{ufactory, title={UFactory UArm}, url={https://www.ufactory.cc/uarm}, author={UFACTORY}}
@misc{uarmdeveloper, title={UARM-developer/UARM-Python-SDK: New Python Library for Swift, swift pro}, url={https://github.com/uArm-Developer/uArm-Python-SDK/tree/2.0}, author={uArm-Developer}}

Best Answer

I could reproduce the bug with the current ACM bibliography style downloaded from the link provided in the question (https://www.acm.org/publications/proceedings-template). This is version 2.1 of ACM-Reference-Format.bst which was written for acmart.cls version 1.79, dated 14 June 2017. The current version of acmart.cls is newer (2022/04/09 v1.84) but recent changes focus on BibLaTeX support with the BibTeX style remaining unchanged.

The class supports both numeric and author-year citations (for BibTeX as well as BibLaTeX). Numeric is default, but the .bst file generates the author-year labels in both cases in the optional argument of the \bibitem entries in the .bbl file (which are ignored with the numeric style).

For entries without a year field this creates a problem. The label formatter contains the following code:

year empty.or.unknown
    { "[n.\,d.]" }
    { year field.or.null purify$ #-1 #4 substring$}

This generates entries in the .bbl file such as the following:

\bibitem[SDRplay([n.\,d.])]%
        {sdrplay2022}

Because [] around n.\,d. is not escaped, the optional argument is parsed incorrectly and the ) after the first ] is parsed as the citekey for each entry without a year.

You can fix this bug by editing ACM-Reference-Format.bst, specifically FUNCTION { calc.basic.label } and FUNCTION { calc.label }. Removing the brackets from n.\,d. in both functions is sufficient:

year empty.or.unknown
    { "n.\,d." }
    { year field.or.null purify$ #-1 #4 substring$}

Then the (unused) optional argument looks like this:

\bibitem[SDRplay(n.\,d.)]%
        {sdrplay2022}

And the document compiles correctly:

enter image description here

Note that the bibliography still shows [n.d.] with square brackets, this output is from a different function in the .bst file that is unrelated to the formatting of the optional citekey.