Gents,
Please advise with the following problem.
I am using subcaption package for figures:
\usepackage[labelfont={rm,it}, textfont=rm, font=default, list=true, labelformat=brace, belowskip=0pt, listformat=subparens, labelseparator=none, labelsep=space]{subcaption}
and use '\subcaptionbox' to generate subcaption for figures
\subcaptionbox{
Text\label{fig:pic:1a}
}[0.50\textwidth]
So now my caption looks like:
"a) Text".
However, when I cite that label: "~\ref{fig:pic:1a}" - it appears like
"1a" without any separation or brackets between the main fogire number "1" and subcaption label "a".
How can I control appearance of a reference ?
Ideally, I would like to separately control appearance of subreferences and subcaptions.
I would be simply satisfied to have just simple format like:
"1(a)" and "1(a-d)" (though label of subcaption still will be "a)").
But also it would be also great to know ho to do smth like
"1a)" or "1.a".
I tried to play with "\renewcommand" smth like
\renewcommand\thesubfigure{\thefigure\alph{subfigure}}
but it also changes how subcaption appears but not only references to labels of subcaptions.
Thanks in advance !
I spend quite a bit of time on this and desperately looking for advice !
I would greatly appreciate your help.
PS
1. I do not want to use subfigures for a reason, but just use subcaption to imitate subfigures.
2. I still want to use "\subcaptionbox" since it allows for putting subcaption label together with text on teh same line: "a) Text".
Graphics, Figures & Tables ⇒ 'subcaption' and '\ref'
NEW: TikZ book now 40% off at Amazon.com for a short time.
'subcaption' and '\ref'
Hi johnsap,
By using the option "labelsep" one can select an additional visual effect for the labels (and only the labels, nothing else).
HTH,
Axel
Yes, by redefining \thesubfigure. But please note that this change affects all subfigure numbers, references and list entries and the labels, too.johnsap wrote:How can I control appearance of a reference ?
By using the option "labelsep" one can select an additional visual effect for the labels (and only the labels, nothing else).
Because of the "a-d" stuff this can only be done by using a helper macro. See example below.I would be simply satisfied to have just simple format like:"1(a)" and "1(a-d)" (though label of subcaption still will be "a)").
This is more straight-ahead, just redefine \thesubfigure so a closing brace is added, and use "labelformat=simple" to prevent a double brace in labels. See example below.But also it would be also great to know ho to do smth like "1a)"
And the label should still look like "a)"? This would need some kind of helper macro, too.or "1.a"
Code: Select all
\documentclass{article}
\usepackage{ifthen}
\usepackage{caption,subcaption}
\begin{document}
\captionsetup[subfigure]{labelformat=brace}
\newcommand\Subref[3][]{%
\ref{#2}(\subref{#3}%
\ifthenelse{\equal{#1}{}}{}{-\subref{#1}}%
)}
\begin{figure}[!ht]
\subcaptionbox{A\label{A}}[2cm]{A}
\subcaptionbox{B\label{B}}[2cm]{B}
\caption{A and B\label{AB}}
\end{figure}
I would be simply satisfied to have just simple format like:
\Subref{AB}{A} and \Subref[B]{AB}{A} (though label of subcaption
still will be "a)").
\captionsetup[subfigure]{labelformat=simple}
\renewcommand\thesubfigure{\alph{subfigure})}
\begin{figure}[!ht]
\subcaptionbox{C\label{C}}[2cm]{C}
\subcaptionbox{D\label{D}}[2cm]{D}
\caption{C and D\label{CD}}
\end{figure}
But also it would be also great to know ho to do smth like
\ref{C}.
\end{document}
Axel