**Update
I am trying to refer to multiple subfigures in a figure caption as well as in the body of the text. The issue is that when I call \labelcref{...
I am still getting the figure number in the caption when I really only want the letter. In the example below, I've highlighted what I would like to read "a-c" instead of "1a to 1c".
Here is my MWE:
\documentclass{article}
\usepackage{mwe}
\usepackage{subcaption}
\RequirePackage{xcolor} % Required for specifying custom colors
\usepackage{hyperref}
\hypersetup{pdfpagemode={UseOutlines},
bookmarksopen=true,
bookmarksopenlevel=0,
hypertexnames=true, % reference roman numerals and numeric pages
colorlinks=true,% Set to false to disable coloring links
citecolor=blue,% The color of citations
linktoc=all,
linkcolor=red,% The color of references to document elements (sections, figures, etc)
urlcolor=green,% The color of hyperlinks (URLs)
pdfstartview={FitV},
unicode,
breaklinks=true, % split up links
}
\usepackage{cleveref}
\captionsetup[sub]{labelsep=none, subrefformat=parens} % parentheses around subfigure references
%\crefrangelabelformat{subfigure}{(#3\crefstripprefix{#2}{#1}#4--#5\crefstripprefix{#1}{#2}#6)}
\begin{document}
\section{Section 1}
\begin{figure}[tbp]
\centering
\begin{subfigure}{.3\linewidth}
\includegraphics[width=\linewidth]{image-a}
\subcaption{\label{fig:1a}}
\end{subfigure}
\begin{subfigure}{.3\linewidth}
\includegraphics[width=\linewidth]{image-b}
\subcaption{\label{fig:1b}}
\end{subfigure}
\begin{subfigure}{.3\linewidth}
\includegraphics[width=\linewidth]{image-c}
\subcaption{\label{fig:1c}}
\end{subfigure}\\[1ex]
\begin{subfigure}{.3\linewidth}
\includegraphics[width=\linewidth]{example-image-plain}
\subcaption{\label{fig:1d}}
\end{subfigure}
\begin{subfigure}{.3\linewidth}
\includegraphics[width=\linewidth]{example-image-golden}
\subcaption{\label{fig:1e}}
\end{subfigure}
\begin{subfigure}{.3\linewidth}
\includegraphics[width=\linewidth]{example-image-16x10}
\subcaption{\label{fig:1f}}
\end{subfigure}
\caption{The top row \labelcref{fig:1a,fig:1b,fig:1c} are letters of the
alplhabet. \subref{fig:1a} `A'. \subref{fig:1b} `B'. \subref{fig:1c}
`C'. The bottom row \labelcref{fig:1d,fig:1e,fig:1f} are place holders.
\subref{fig:1d} `Plain'. \subref{fig:1d} `Golden Ratio' \subref{fig:1f}
`16x10'.}
\label{fig:fig1}
\end{figure}
I can refer to \cref{fig:1a,fig:1b,fig:1c} and \cref{fig:1d,fig:1e,fig:1f}, or
even \cref{fig:1a,fig:1b,fig:1c,fig:1d,fig:1e,fig:1f}.
\end{document}
The output is as follows:
Is there a way to define a custom \labelcref
command that I can call in a figure caption vs. in text?
\labelcref{fig:1a,fig:1b,fig:1c}
to \captionlabelcref{fig:1a,fig:1b,fig:1c}
?
Thanks!
\subref{fig:fig1a} - \subref{fig:fig1c}
? I don't believesubref
allows for multiple inputs like\subref{fig:fig1a,fig:fig1b,fig:fig1c}
.\newlabel{sub@fig:1a}{{a}{1}{\relax }{figure.caption.1}{}} \newlabel{sub@fig:1a@cref}{{[subfigure][1][1]1a}{[1][1][]1}}