在 wrapfigure 环境中引用子图时出现问题

在 wrapfigure 环境中引用子图时出现问题

我刚刚尝试使用 wrapfigure(将文本环绕在我的图形周围,呵呵)。现在我发现我无法引用我的子图。

这是我的 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}

下面是一张与我的结果相配的漂亮图片。

在此处输入图片描述

非常感谢所有帮助!

答案1

\sidesubfloat命令需要\label强制参数内的命令,即与要显示的内容一起(\includegraphics此处的命令)。

我不会\vspace{-30pt}在这里更改 OP 的手动设置……

\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}

在此处输入图片描述

相关内容