[Tex/LaTex] sidewaysfigure error when adding a caption

captionserrorsrotating

I'm trying to include a uml diagram, which as it's quite large i'd like to rotate. However, if I try and add a caption I get an error and it won't build.

I'm adding the figure like this:

\usepackage{rotating}
...
\begin{sidewaysfigure}
\centering
\includegraphics[scale=0.6]{clientUML.eps}
\label{fig:clientUML}
\caption{UML for client} 
\end{sidewaysfigure}

And I get this error:

<clientUML.eps>
! Undefined control sequence.
\@tempf ... \@parboxrestore \normalsize \@fs@capt 
                                                  {\@nameuse {fnum@#1}}{\ign...
l.87 \caption{UML for client}

Any ideas? It works if I take the caption line out – but I need to include on.

Thanks in advance.

EDIT:

I also have this in my preamble – I need boxes round my figures:

\usepackage{float}
\floatstyle{boxed} 
\restylefloat{figure}

Best Answer

Did you use \restylefloat in your preamble? If you omit this command, there will be no error.

Instead of using the rotating and the float package you can simply use the rotfloat package.

\documentclass[a4paper]{report}
\usepackage{rotfloat}
\floatstyle{boxed} 
\restylefloat{figure}
\begin{document}
\begin{sidewaysfigure}
\centering
\includegraphics[scale=0.6]{test.jpg}
\label{fig:clientUML}
\caption{UML for client} 
\end{sidewaysfigure}
\end{document}