[Tex/LaTex] Labeling and referencing subfigures

floatrow

I am trying to use the floatrow package to place to figures side by side in a subfloatrow, while this works fine I have problems following the sugested labeling method from the manual.

On page 73, of the 2009/08/02 version of the english manual of floatrow it reads:

The label command \Flabel can be defined like following:
preamble>
\newseparatedlabel\Flabel{figure}{subfigure}
preamble>

or, for all floats:

preamble>
\makeatletter
\newseparatedlabel\Flabel{\@captype}{sub\@captype}
\makeatother
preamble>

However, if I try to define the \Flabel command like that I get an errormessage saying that \newseparatedlabel is undefined.

What is the correct way to label figures in subfloatrows?


MNWE(minimal NON working example):

\documentclass{article}
\usepackage{floatrow}                           %subfigures
\makeatletter
\newseparatedlabel\Flabel{\@captype}{sub\@captype}
\makeatother   
\begin{document}
    \ldots    
\end{document}

Best Answer

I don't know floatrow package at all. For subfigures I use subfig package:

\documentclass{article}
\usepackage{subfig}
\usepackage{graphicx}

\begin{document}
\begin{figure}
  \subfloat[Foo]{\includegraphics[width=.4\textwidth]{foo}\label{fig:foo}}\hfil
  \subfloat[Bar]{\includegraphics[width=.4\textwidth]{bar}\label{fig:bar}}
  \caption{Figures of Foo and Bar}\label{fig}
\end{figure}
Here in fig. \ref{fig} we can see Foo in fig. \ref{fig:foo} and Bar in fig. \ref{fig:bar}.
\end{document}

Here in fig. 1 we can see Foo in fig. 1a and Bar in fig. 1b.

If you want to have "Foo in fig. 1 and Bar in fig. 2" you can use minipage cheat:

\begin{figure}
 \begin{minipage}{.49\textwidth}
  \includegraphics[width=\textwidth]{foo}
  \caption{Foo}\label{fig:foo}
 \end{minipage}\hfil
 \begin{minipage}{.49\textwidth}
  \includegraphics[width=\textwidth]{bar}
  \caption{Bar}\label{fig:bar}
 \end{minipage}
\end{figure}

Edit: Using floatrow you can achieve same result with this code:

 \documentclass[a4paper]{article}
 \usepackage{floatrow}
 \usepackage{subfig}
 \usepackage{graphicx}

 \begin{document}

 \begin{figure}[H]
 \ffigbox[\FBwidth]
 {\begin{subfloatrow}
   \sidesubfloat[Foo]{\includegraphics{foo}\label{fig:foo}}%
   \sidesubfloat[Bar]{\includegraphics{bar}\label{fig:bar}}%
   \end{subfloatrow}}
 {\caption{CCC}\label{fig}}
 \end{figure}

 See \ref{fig:foo}.

 \end{document}

For more options see chapter 7.1 in floatrow manual.