1

I am using memoir and cleveref with the sort&compress keyword (that I assumed was default actually). When referencing multiple subfigures with one \Cref command, there are not ranges given. Taken from the MWE below, it says "Figures 0.1(a) and 0.1(b)" but I would like to have "Figures 0.1(a-b)", "Figures 0.1(a)-(b)" or "Figures 0.1(a) and (b)". (All of these are acceptable in case one is more difficult to produce.)

Question: How do I get automatically the second format, i.e. avoid the repetition of the main figure number automatically?

EDIT: Note that this question Combining cleveref and subref is about manually referencing a sub figure. I would only like to have the main figure number not repeated automatically.

MWE:

\documentclass{memoir}



\usepackage{varioref}
\usepackage[
hidelinks,
breaklinks=true,
bookmarksnumbered=true,
pdfpagemode=UseOutlines
]{hyperref} 
\usepackage[
nameinlink,
sort&compress, % not working?
]{cleveref}
\usepackage{nameref}


\newsubfloat{figure}% Allow subfloats in figure environment

\begin{document}
    \begin{figure}
        \centering
        \subbottom{\label{sub-I}random subfigure content I}
        \subbottom{\label{sub-II}random subfigure content II}
        \caption{random caption text}
    \end{figure}

    \Cref{sub-I,sub-II}

\end{document}
4
  • The sort&compress options seems to compress only, if there are three ore more items cited. For information on how to enable the compressing for two or more subfigures, see here: tex.stackexchange.com/q/114957/134144. Information on how to get rid of the repeated 'main figure number' can be fond here: tex.stackexchange.com/q/333223/134144.
    – leandriis
    Nov 12, 2017 at 15:38
  • @leandriis Thanks for the two references. I edited the question as your first suggestion was due to me not properly posing the question. The second reference is on manually removing the main figure number in certain cases. Would you know how to do that automatically in case the main figure number was already mentioned (within the same \Cref command)?
    – Tim
    Nov 12, 2017 at 16:06
  • I'm sorry I have to admit that creating such an automated functionality is far beyond my capabilities. Maybe someone more skilled can help you further.
    – leandriis
    Nov 12, 2017 at 19:46
  • @leandriis thank you for you comments anyway!
    – Tim
    Nov 13, 2017 at 10:30

0

Your Answer

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

Browse other questions tagged or ask your own question.