[Tex/LaTex] How to rotate Figure caption to fit under rotated figure

captionsfloatsrotating

I wish to put the caption of a rotated figure underneath the figure, rather than at the bottom of the page.

Here is my code:

\documentclass{article}
\usepackage{array,ragged2e,titlesec}
\usepackage[demo]{graphicx}
\usepackage{rotating}
\usepackage{caption}

\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}

\begin{figure}
    \centering
        \includegraphics[angle=270,scale=0.6]{figure.eps}
    \caption{text here}
    \label{fig:}
\end{figure}


\end{document}

thanks!
Michael

Best Answer

Since you're loading the rotating package, I assume you're interested in using that package's sidewaysfigure environment. This environment behaves very much like the regular figure environment, except that it's rotated 90 degrees counterclockwise (at least when used in a "standard" setup of the article document class). Note also that there can be only one sidewaysfigure per page; however, each sidewaysfigure could contain several images, each with its own \caption and \label.

Here's a modified form of your code; the main modification is the replacement of figure with sidewaysfigure. You'll see I've also commented out most of the preamble code as it's not relevant for the issue at hand.

enter image description here

\documentclass{article}
\usepackage[demo]{rotating}

%% Commented out the rest of the preamble ...

%\usepackage{array,ragged2e,titlesec}
%\usepackage[demo]{graphicx}
%\usepackage{caption}
%\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}
\begin{sidewaysfigure}
    \centering
        \includegraphics[width=\textwidth]{figure.eps}
    \caption{text here}
    \label{fig:a}
\end{sidewaysfigure}
\end{document}