6

I can use \cpageref to output a list of page references. For example, the markup:

You should check \cpageref{sec:section1,sec:section2,sec:section3}.

... renders as:

You should check pages 3, 5 and 7.

However, what I need in a specific case is the output to be:

You should check pages 3, 5, 7.

Do I have any way to tell \cpageref to always use commas and not "and"?

1 Answer 1

8

If you need this behavior all over the document, simply add the following line in your preamble

\newcommand{\creflastconjunction}{,\nobreakspace}

MWE:

\documentclass{article}
\usepackage[sort]{cleveref}
\usepackage{lipsum} % just for the example

\newcommand{\creflastconjunction}{,\nobreakspace}

\begin{document}

\section{First}\label{sec:section1}
\lipsum[1-5]

\section{Second}\label{sec:section2}
\lipsum[1-5]

\section{Third}\label{sec:section3}
\lipsum[1-5]

\bigskip

You should check \cpageref{sec:section1,sec:section2,sec:section3}.

\end{document} 

Output:

enter image description here

Otherwise, if you only need it in a specific place, use

{\renewcommand{\creflastconjunction}{,\nobreakspace}\cpageref{sec:section1,sec:section2,sec:section3}}

MWE:

\documentclass{article}
\usepackage[sort]{cleveref}
\usepackage{lipsum} % just for the example

\begin{document}

\section{First}\label{sec:section1}
\lipsum[1-5]

\section{Second}\label{sec:section2}
\lipsum[1-5]

\section{Third}\label{sec:section3}
\lipsum[1-5]

\bigskip

You should check \cpageref{sec:section1,sec:section2,sec:section3}.

And now check again 
{\renewcommand{\creflastconjunction}{,\nobreakspace}\cpageref{sec:section1,sec:section2,sec:section3}}.

\end{document} 

Output:

enter image description here

1
  • 1
    One can also do {\renewcommand{\creflastconjunction}{,~}\cpageref{...}} if the final comma is wanted only in a specific place, which seems what the OP wants.
    – egreg
    Jan 9, 2015 at 17:48

You must log in to answer this question.

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