[Tex/LaTex] Landscape caption for a rotated figure in a portrait page

captionsgraphicslandscaperotating

I've managed to rotate an image 90 degrees to be as if in landscape mode, but I still need to change location and rotation of the caption to match the image's orientation, while keeping the page in portrait mode (headers, pagination…etc). I use memoir AND caption package (yes I know it emulates caption functionality).

The caption options:

\usepackage{caption}
\captionsetup{font=small,labelfont=bf}

The figure environment:

\begin{figure}[htbp]
\centering
\includegraphics[width=17cm,angle=90]{./Images/1-PsychrometricChart}
\caption[The Psychrometiric Chart]{The Psychrometric Chart \cite{szokolay08} \label{PsychroChart}}
\end{figure}

Addendum: An option that defines two cases of the image being placed on either the recto or verso pages would be a major plus, after all the image could be placed on either for many reasons. Let's say if it's on the recto page it faces the right margin, and if on the verso page faces the left margin.

Best Answer

You can save the figure + caption in a box and then rotate the box, or use the sidewaysfigure environment from the rotating package. It puts the figure on its own page. For a small figure you can use the \rotcaption command to rotate the caption.

\documentclass{memoir}
\usepackage{caption}
    \captionsetup{font=small,labelfont=bf}
\usepackage{graphicx}
\usepackage{rotating}

\newsavebox{\savefig}
\begin{document}

Save the figure + caption in a box and rotate
\begin{figure}[htbp]
    \centering
    \savebox{\savefig}{\rule{8cm}{5cm}}
    \rotatebox{90}{%
        \begin{minipage}{\wd\savefig}
            \usebox{\savefig}
            \caption{Rotated saved box}
        \end{minipage}}
\end{figure}

Just rotate the caption
\begin{figure}[htbp]
    \hfill
    \rule{5cm}{8cm}%
    \hspace{\abovecaptionskip}%
    \begin{minipage}[b][8cm][c]{2\baselineskip}
        \rotcaption{Just rotate caption}
    \end{minipage}
    \hfill\mbox{}
\end{figure}

Use the sidewaysfigure environment
\begin{sidewaysfigure}
    \centering
    \rule{15cm}{10cm}
    \caption{A sideways figure}
\end{sidewaysfigure}

\end{document}