# I can't rotate the caption when rotating image to face the left

How can I include the caption to fit below the figure when turned 90 degrees to face the left? this code should work but I'm not sure why it isn't, possibly due to the captionsetup?

here is the code:

\documentclass[12pt]{report}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{fixltx2e}
\usepackage{grffile}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{floatrow}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage[notlof,notlot]{tocbibind}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{epstopdf}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{tabu}
\usepackage{ragged2e}
%\usepackage[justification=centering]{caption}
\usepackage[titles]{tocloft}
\usepackage{caption}
\usepackage{tocloft}
\usepackage{graphicx}
\usepackage{rotating}

\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}

\titleformat{\section}
{\normalfont\fontsize{14}{12}\bfseries}{\thesection}{1em}{}
\makeatletter
\renewcommand{\paragraph}{%
\@startsection{paragraph}{4}%
{\z@}{1.2ex \@plus 1ex \@minus .2ex}{-1em}%
{\normalfont\normalsize\bfseries}%
}
\renewcommand{\baselinestretch}{1.0}
\makeatother
\setcounter{secnumdepth}{3}

\begin{document}
\sloppy

\captionsetup{width=\textwidth}

\begin{figure}
\centering
\begin{turn}{-90}
\begin{minipage}{8in}
\centering
\includegraphics[scale=0.6]{reggrid_Vs_Alongtrackgrid.eps}
\caption{A comparison between SSH [mm] averaged between 31$^{st}$ December, 1992 to 9$^{th}$ January, 1993 on a regular grid (top) and SSH [mm] along track during the same period (bottom).}
\label{fig:reggrid_Vs_Alongtrackgrid}
\end{minipage}
\end{turn}
\end{figure}


Is anyone else having trouble logging into the website? I try to log in but it doesn't work so I created a new account and this still brings up a page error. it's annoying because I have to create new questions rather than adding to the original :-(

thanks, Michael

You should not call the package caption and graphicx twice. Then you need package adjustbox from here.

The minimal code will be:

\documentclass[12pt]{report}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{graphicx}

\begin{document}

Some text here.

\begin{figure}[h!]
\includegraphics[scale=0.6]{noimage}
\caption{A comparison between SSH [mm] averaged between 31$^\mathrm{st}$ December, 1992 to 9$^\mathrm{th}$ January, 1993 on a regular grid (top) and SSH [mm] along track during the same period (bottom).}%
\label{fig:reggrid_Vs_Alongtrackgrid}
\end{minipage}},rotate=90,center}
\end{figure}

\end{document}


And the result is:

The problem is not caused by the \captionsetup, if you by trial and error remove all the packages not influencing the problem, you're left with

    \documentclass{report}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage{rotating}
\begin{document}
\begin{figure}
\centering
\begin{turn}{-90}
\begin{minipage}{8in}
\centering
\includegraphics[width=7cm]{example-image}
\caption{Text}
\label{fig:reggrid_Vs_Alongtrackgrid}
\end{minipage}
\end{turn}
\end{figure}
\end{document}


This code shows the problem, but if you remove

\usepackage{floatrow}


it works fine. Exactly why it happens I do not know, perhaps floatrow redefines \caption or something.

If you're using floatrow only to place a caption beside a figure, then you can remove it and use a pair of minipages, as in the code below. Note that I changed the width of the minipage in the turn environment.

\documentclass{report}
\usepackage{graphicx}
\usepackage{rotating}
\begin{document}
\begin{figure}[h]
\centering
\begin{turn}{-90}
\begin{minipage}{5cm}
\centering
\includegraphics[width=5cm]{example-image}
\caption{Text}
\label{fig:reggrid_Vs_Alongtrackgrid}
\end{minipage}
\end{turn}
\end{figure}

\begin{figure}[h]
\begin{minipage}{.45\linewidth}
\includegraphics[width=5cm]{example-image}
\end{minipage}%
\begin{minipage}{.45\linewidth}
\caption{Annual and semi-annual harmonics calculated from along-track weighted altimetry data.}
\end{minipage}
\end{figure}
\end{document}


And as Václav Pavlík says, there is no need to load packages more than once. You have two of tocloft as well.

## protected by Community♦Sep 16 '14 at 12:51

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).