Latex:参考标签图中的单个图像

Latex:参考标签图中的单个图像

可能重复:
为什么环境的标签必须出现在标题之后?

我目前有:

\begin{wrapfigure}{R}{0.3\textwidth}
    \vspace{-20pt}
    \begin{center}
        \includegraphics[width=0.3\textwidth]{images/accumstatic}
        \label{accumst}
    \end{center}
    \vspace{-20pt}
    \caption{Accum static picture}
    \vspace{10pt}
    \begin{center}
        \includegraphics[width=0.3\textwidth]{images/accumdynamic}
        \label{accumdy}
    \end{center}
    \vspace{-20pt}
    \caption{Accum dynamic picture}
\end{wrapfigure}

这将创建一个如下所示的页面:

lorum ipsum trees freasa lorum ipsum trees freasa
lorum ipsum trees freasa lorum ##################
lorum ipsum trees freasa lorum #                #
lorum ipsum trees freasa lorum #     Fig.1      #
lorum ipsum trees freasa lorum #                #
lorum ipsum trees freasa lorum ##################
lorum ipsum trees freasa lorum #                #
lorum ipsum trees freasa lorum #     Fig.2      #
lorum ipsum trees freasa lorum #                #
lorum ipsum trees freasa lorum ##################
lorum ipsum trees freasa lorum ipsum trees freasa

然后我使用 cleverref 包引用它:

\paragraph{blah blah blah \cref{accumst}, blah blah blah \cref{accumdy}} 不幸的是accumdy引用了顶部图像(图 1)并accumst引用了前一节的编号...

如何让 \label{} 看到 wrapfigure 包含两幅图像?

答案1

需要注意的是\label应该在 之后\caption。因此将标签放在标题之后即可。

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{wrapfig,lipsum,cleveref}
%------------------------------------------
\begin{document}
This is where the table goes with text wrapping around it. You may
embed tabular environment inside wraptable environment and customize as you like.
%------------------------------------------
\begin{wrapfigure}{R}{0.3\textwidth}
    \vspace{-20pt}
    \begin{center}
        \includegraphics[width=0.3\textwidth]{images/accumstatic}            
    \vspace{-20pt}
    \caption{Accum static picture}\label{accumst}
    \end{center}
    \vspace{10pt}
    \begin{center}
        \includegraphics[width=0.3\textwidth]{images/accumdynamic}            
    \vspace{-20pt}
    \caption{Accum dynamic picture}\label{accumdy}
    \end{center}
\end{wrapfigure}
%------------------------------------------
This is where the table goes with text wrapping around it. You may
embed tabular environment inside wraptable environment and customize as you like. This is where the table goes with text wrapping around it. You may
embed tabular environment inside wraptable environment and customize as you like. This is where the table goes with text wrapping around it.
%
\lipsum[2-7]

\paragraph{blah blah blah \cref{accumst}, blah blah blah \cref{accumdy}} 
%------------------------------------------
\end{document}

在此处输入图片描述

相关内容