# Can cleveref be made to use the Oxford comma for multiple citations?

Simple question: Is there a simple way to get cleveref to use the Oxford comma?

\documentclass{article}
\usepackage[standard]{ntheorem}
\usepackage{cleveref}

\begin{document}

\begin{proposition}\label{thm:roses}
Roses are red.
\end{proposition}

\begin{proposition}\label{thm:violets}
Violets are blue.
\end{proposition}

\begin{proposition}
42.
\end{proposition}

\begin{proposition} \label{thm:orchids}
Orchids are orchid.
\end{proposition}

\begin{theorem}
There exist flowers in at least three different colors.
\end{theorem}
\begin{proof}
Immediate from \cref{thm:roses,thm:violets,thm:orchids}.
\end{proof}

\end{document}


Should say “propositions 1, 2, and 4.”

• Just wanted to make a note that the Oxford Comma is more generally known as a Serial Comma. Mostly noted for search engine indexing. – Patrick Feb 20 '14 at 16:12
• Well, it looks like Google knows they're synonyms, but thanks :-) – Luke Maurer Feb 20 '14 at 20:06

If you define this new command

\newcommand{\creflastconjunction}{, and\nobreakspace}


you will get Oxford comma everywhere you use multiple references like those.

MWE:

\documentclass{article}
\usepackage[standard]{ntheorem}
\usepackage{cleveref}

\newcommand{\creflastconjunction}{, and\nobreakspace}

\begin{document}

\begin{proposition}\label{thm:roses}
Roses are red.
\end{proposition}

\begin{proposition}\label{thm:violets}
Violets are blue.
\end{proposition}

\begin{proposition}
42.
\end{proposition}

\begin{proposition} \label{thm:orchids}
Orchids are orchid.
\end{proposition}

\begin{theorem}
There exist flowers in at least three different colors.
\end{theorem}
\begin{proof}
Immediate from \cref{thm:roses,thm:violets,thm:orchids}.
\end{proof}

\end{document}


Output:


cleveref defines, at the beginning of the document, a lot of commands depending on the language. If you don't specify any language, english is loaded. This is the relevant part of cleveref.sty:

\DeclareOption{english}{%
\AtBeginDocument{%
....
\def\creflastconjunction@preamble{ and\nobreakspace}%
....


Also, you can find the following lines

\AtBeginDocument{%
....
\@ifundefined{creflastconjunction}{%
\let\creflastconjunction\creflastconjunction@preamble%
}{%
....
}%


which, at the beginning of the document, assign to \creflastconjunction the meaning of \creflastconjunction@preamble when it has not been defined yet.

In other words, \creflastconjunction gets defined only after \begin{document}. In fact, if you try to put the line

\newcommand{\creflastconjunction}{, and\nobreakspace}


inside the document, you will get an error. In this case, you would have written

\renewcommand{\creflastconjunction}{, and\nobreakspace}

• Does \newcommand{\creflastconjunction}{, and~} work the same? In other words, can you replace the \nobreakspace with a ~? – MSC Jan 24 '17 at 22:22
• @MSC No problems with your substitution. – karlkoeller Jan 26 '17 at 17:55

\newcommand{\creflastconjunction}{, and~}


From the manual:

\creflastconjunction is used between the penultimate and final cross-reference in a list of more than two [pg. 12, at least for the 2012-03-07 version of the manual I have]

\documentclass{article}
\usepackage$standard${ntheorem}
\usepackage{cleveref}

\newcommand{\creflastconjunction}{, and~}

\begin{document}

\begin{proposition}\label{thm:roses}
Roses are red.
\end{proposition}

\begin{proposition}\label{thm:violets}
Violets are blue.
\end{proposition}

\begin{proposition}
42.
\end{proposition}

\begin{proposition} \label{thm:orchids}
Orchids are orchid.
\end{proposition}

\begin{theorem}
There exist flowers in at least three different colors.
\end{theorem}
\begin{proof}
Immediate from \cref{thm:roses,thm:violets,thm:orchids}.
\end{proof}

\end{document}


• This is already in my answer... – karlkoeller Feb 19 '14 at 20:22
• Shouldn't that be \renewcommand? – Luke Maurer Feb 19 '14 at 20:23
• @LukeMaurer: You'd think so, but surprisingly not. – Antal Spector-Zabusky Feb 19 '14 at 20:23
• So cleveref is actually checking for the existence of that macro? Weird. *shrug* – Luke Maurer Feb 19 '14 at 20:24
• @karlkoeller: So it is! I guess great minds think alike; I must have started writing my answer while you were finishing writing yours. – Antal Spector-Zabusky Feb 19 '14 at 20:25

You can use \crefmultiformat:

\documentclass{article}
\usepackage[standard]{ntheorem}
\usepackage{cleveref}

\crefmultiformat{proposition}{propositions~#2#1#3}%
{ and~#2#1#3}{, #2#1#3}{, and~#2#1#3}

\begin{document}

\begin{proposition}\label{thm:roses}
Roses are red.
\end{proposition}

\begin{proposition}\label{thm:violets}
Violets are blue.
\end{proposition}

\begin{proposition}
42.
\end{proposition}

\begin{proposition} \label{thm:orchids}
Orchids are orchid.
\end{proposition}

\begin{theorem}
There exist flowers in at least three different colors.
\end{theorem}
\begin{proof}
Immediate from \cref{thm:roses,thm:violets,thm:orchids}.
Immediate from \cref{thm:roses,thm:violets}.
\end{proof}

\end{document}


• Aha! It's a little piecemeal (will need to repeat for different theorem sets), but it should work. Thanks. – Luke Maurer Feb 19 '14 at 20:14
• @LukeMaurer see karlkoeller's answer for a solution affecting all reference types. – Gonzalo Medina Feb 19 '14 at 20:23
• Out of curiosity, why the #2#1#3 instead of #1#2#3? – Sean Allred Feb 20 '14 at 4:14