14

I need to refer to seven figures which are not continuous in sequence (say figures 5.3b, 5.3d, 5.3f, 5.4b, 5.4d, 5.5b, 5.5d).

When I am using

\cref{5-3-b,5-3-d,,5-3-f,5-4-b,5-4-d,5-5-b,,5-5-d}

It prints

Figures 5.3b to 5.5b, 5.3d to 5.5d and 5.3f)

Note: the figures are from three different subfigures.

I do not want those "to" in between. How do I do it correctly?

1
  • 1
    Please do provide a full minimal example document that demonstrates the problem. The double-comma in @Mico's answer merely works-around the issue. What you're seeing could be a bug, or it could be a misunderstanding of what cleveref does, but without a ME it's impossible to tell. Nov 18 '13 at 22:07
21

Something very odd seems to be going on in your document, as cleveref does not normally engage in the type of behavior you say is occurring. How are the figures and subfigures constructed in your document? Please consider posting a full MWE (minimum working example) that generates the problem behavior you're looking to fix.

At any rate, the following should work for your setup:

\cref{5-3-b,,5-3-d,,5-3-f,,5-4-b,,5-4-d,,5-5-b,,5-5-d}

See section 5, entitled "Sorting and compressing", of the package's user guide for an explanation of how the double comma constructs work.


Here's an MWE (minimum working example), which demonstrates that both \cref{5-3-b,5-3-d,5-3-f,5-4-b,5-4-d,5-5-b,5-5-d} and \cref{5-3-b,,5-3-d,,5-3-f,,5-4-b,,5-4-d,,5-5-b,,5-5-d} produce the same output if normal setup rules are obeyed.

enter image description here

\documentclass{article}
\usepackage{subcaption} % for 'subfigure' environment and counter
\usepackage[colorlinks,allcolors=blue]{hyperref} % optional
\usepackage[noabbrev]{cleveref}
\counterwithin{figure}{section}

\begin{document}
\setcounter{section}{5}
\setcounter{figure}{2}

\cref{5-3-b,5-3-d,5-3-f,5-4-b,5-4-d,5-5-b,5-5-d}

\cref{5-3-b,,5-3-d,,5-3-f,,5-4-b,,5-4-d,,5-5-b,,5-5-d}

% the following code is deliberately minimalist
\refstepcounter{figure}
\refstepcounter{subfigure}
\refstepcounter{subfigure}\label{5-3-b}
\refstepcounter{subfigure}
\refstepcounter{subfigure}\label{5-3-d}
\refstepcounter{subfigure}
\refstepcounter{subfigure}\label{5-3-f}

\refstepcounter{figure}
\refstepcounter{subfigure}
\refstepcounter{subfigure}\label{5-4-b}
\refstepcounter{subfigure}
\refstepcounter{subfigure}\label{5-4-d}

\refstepcounter{figure}
\refstepcounter{subfigure}
\refstepcounter{subfigure}\label{5-5-b}
\refstepcounter{subfigure}
\refstepcounter{subfigure}\label{5-5-d}

\end{document}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.