2

I have rotated my figure to 90 degrees using adjustbox as follows:

\begin{figure}[ht]
  \begin{adjustbox}{addcode={\begin{minipage}{\width}}{\caption{%
      My caption
      }\end{minipage}},rotate=90,center}
      \includegraphics[scale=.60]{my_figure.PNG}%
  \end{adjustbox}
  \label{fig:my_figure}
\end{figure}

Now when I want to use this figure as reference like \ref{fig:my_figure}, I am seeing ?? as the reference. I will be thankful if anyone could help me with this.

  • 1
    The \label command must go next to the caption, either inside the argument to \caption or just before \end{minipage}. – egreg Feb 7 '15 at 16:59
  • you mean like {\caption{% My Caption} {\label{fig:my_label}}? – Sadiksha Gautam Feb 7 '15 at 17:02
  • 1
    Yes, but no additional braces around \label{fig:my_label} – egreg Feb 7 '15 at 17:03
5

The \label is too far from \caption; more precisely, the caption is set inside a minipage, which forms a group, so what LaTeX sets up for being remembered along with \label is forgotten at \end{minipage}.

\begin{figure}[ht]

\begin{adjustbox}{
  addcode=
    {\begin{minipage}{\width}}
    {\caption{My caption}\label{fig:my_figure}\end{minipage}},
  rotate=90,
  center
}
\includegraphics[scale=.60]{my_figure.PNG}
\end{adjustbox}

\end{figure}

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.