# Subref with floatrow (without subcaption)

I have subfigures created with the floatrow package instead of the subcaption package. The latter is not loaded.

\begin{figure}[htbp]
\ffigbox[\FBwidth]
{\begin{subfloatrow}[2]
\ffigbox[\FBwidth]
{\caption{Cap1}\label{lab1}}
{Test1}
\ffigbox[\FBwidth]
{\caption{Cap2}\label{lab2}}
{Test2}
\end{subfloatrow}}
{\caption{Cap}
\label{lab}}
\end{figure}


The display is just as I want it. The main caption has the label "Fig. 1:", the subcaptions have "(a)" and "(b)".

However, I miss the \subref macro of the subcaption package to directly link to subfigures. With floatrow I can only do \ref{lab1} yielding "1a". The former \subref{lab1} gave just "a" or even better "(a)" (to match the labelformat=parens).

Can I do something similar with only floatrow and caption loaded? And if not, how can I redefine the \ref macro to match the labelformat and thus display "1(a)" instead of "1a"?

• Can you turn your code snippet into a complete, compilable example? Makes it easier for anyone wanting to help. – Torbjørn T. Mar 17 '14 at 17:21
• You should have been able to do as described in section 6.2 of floatrows manual, but that doesn't work as \newseparatedlabel is undefined. Seems like the manual for the feature has been written, but the feature itself has not been added to the package. – Torbjørn T. Mar 17 '14 at 18:47
• Yes, that's the problem. :( The minimal example was missing, right. Sorry for that. But the answer below has one. I am still looking for a possibility to only get "(a)" instead of "1(a)"... – monoceros84 Mar 18 '14 at 15:35

## 1 Answer

Here's how you can do it with caption:

\documentclass{article}
\usepackage{floatrow}
\usepackage{caption}
\usepackage{graphicx}

\DeclareCaptionSubType[alph]{figure}

\renewcommand\thesubfigure{(\alph{subfigure})}
\captionsetup[subfloat]{labelformat=simple,listformat=simple}

\begin{document}

\listoffigures

\begin{figure}[htbp]
\ffigbox[\FBwidth]
{\begin{subfloatrow}[2]
\ffigbox[\FBwidth]
{\caption{Caption for subfigure 1}\label{lab1}}
{\rule{5cm}{1cm}}
\ffigbox[\FBwidth]
{\caption{Caption for subfigure 2}\label{lab2}}
{\rule{5cm}{1cm}}
\end{subfloatrow}}
{\caption{General caption}
\label{lab}}
\end{figure}

As we see in subfigures~\ref{lab1} and~\ref{lab2}, which are subfigures to Figure~\ref{lab}...

\end{document}


If you don't want subfigures to appear in the LoF, change

\captionsetup[subfloat]{labelformat=simple,listformat=simple}


to

\captionsetup[subfloat]{labelformat=simple,list=no}

• Works perfectly, thank you! This will be my workaround until I find a way to really ref the subfigure displaying "(a)" instead of "1(a)". – monoceros84 Mar 18 '14 at 15:38