4

I have just tried using wrapfigure (to wrap text around my figure, duh). Now I find that I'm unable to reference my subfigures.

Here's my MWE

\documentclass[a4paper,11pt]{book} 
\usepackage{wrapfig}
\usepackage{floatrow}
\usepackage{subfig}
\renewcommand{\thesubfigure}{\Alph{subfigure}}
\usepackage{graphicx}
\graphicspath{{./Figurer/}}
\usepackage{parskip}

\begin{document}

\begin{wrapfigure}{r}{0.5\textwidth}
    \vspace{-30pt}
    \begin{center}
        \sidesubfloat[]{\includegraphics[width=1\textwidth]{test}}\label{label1}

        \quad

        \sidesubfloat[]{\includegraphics[width=1\textwidth]{test}}\label{label2}
    \end{center}
    \vspace{-10pt}
    \caption{nice caption}\label{label3}
\end{wrapfigure}


My attempt at referencing figure \ref{label1}

And also figure \ref{label2}.

I had hoped for something like "figure 1A" and "figure 1B"

But the overall figure \ref{label3} seems to work. 

\end{document}

And here's a nice picture of my result to go with it.

enter image description here

All help is much appreciated!

1 Answer 1

3

The \sidesubfloat command requires the \label command within the mandatory argument, i.e. together with the content to be displayed (the \includegraphics command here).

I won't change the manual \vspace{-30pt} settings from the O.P. here...

\documentclass[a4paper,11pt]{book} 
\usepackage{wrapfig}
\usepackage{floatrow}
\usepackage{subfig}
\renewcommand{\thesubfigure}{\Alph{subfigure}}
\usepackage{graphicx}
\graphicspath{{./Figurer/}}
\usepackage{parskip}

\begin{document}

\begin{wrapfigure}{r}{0.5\textwidth}
    \vspace{-30pt}
    \begin{center}
      \sidesubfloat[]{\includegraphics[width=1\textwidth]{ente}\label{label1}}
      \quad
      \sidesubfloat[]{\includegraphics[width=1\textwidth]{ente}\label{label2}}
    \end{center}
    \vspace{-10pt}
    \caption{nice caption}\label{label3}
\end{wrapfigure}


My attempt at referencing figure \ref{label1}

And also figure \ref{label2}.

I had hoped for something like "figure 1A" and "figure 1B"

But the overall figure \ref{label3} seems to work. 

\end{document}

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.