44

I have a figure I'm trying to insert which is in landscape and I'm using the following (snipped) code:

\documentclass[12pt, oneside]{book}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{epstopdf}

\begin{document}

\begin{figure}[ht]
    \includegraphics{../figures/pics/DivLibPropProfile}
    \caption{Property profile of the diverse library compared to the compound pool.}
    \label{fig:PropProf}
\end{figure}

\end{document}

When I compile this with pdfLaTeX the output behaves as I'd expect – page in portrait with the caption at the bottom but the figure in the "wrong" orientation.

However when I compile using LaTeX, the page is turned landscape with the figure now in the correct orientation but with the caption at what is now the left of the page rather than under the figure, which you should get using \begin{landscape}.

When I do use the landscape environment and compile with LaTeX the caption the whole page is turned upside-down and everything is wrong.

Any ideas how I can get the correct orientation of landscape figure on landscape page with the caption under the figure (attached for reference)? I also need to use LaTeX rather that pdfLaTeX for another package to function.

54

This should work for you, without removing "unnecessary" packages:

\documentclass[12pt, oneside]{book}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{epstopdf}

\begin{document}

\begin{sidewaysfigure}[ht]
    \includegraphics{../figures/pics/DivLibPropProfile}
    \caption{Property profile of the diverse library compared to the compound pool.}
    \label{fig:PropProf}
\end{sidewaysfigure}

\end{document}

This is a general minimal example using rotating

\documentclass{article}
% For rotating figures, tables, etc.
%  including their captions
\usepackage{rotating}

\begin{document}

% A small example on how to use the "rotating" package.
%  Displays a figure and it's caption in landscape
\begin{sidewaysfigure}[ht]
    \includegraphics[width=\textwidth]{figure.png}
    \caption{Caption in landscape to a figure in landscape.}
    \label{fig:LandscapeFigure}
\end{sidewaysfigure}

\end{document}
  • 6
    Could you please include an explanation of that code? – N.N. Mar 30 '12 at 10:55
  • 1
    read the docs of the rotating package: it makes whole-page floats that are rotated by +/- 90 degrees; the caption rotates with the figure. – wasteofspace Mar 30 '12 at 16:11
  • 1
    Note that the only package that is actually needed to use sidewaysfigure is the rotating package. – tiagoboldt Dec 31 '16 at 15:55
  • 6
    -1 because code is not commented and it is unclear which packages are actually needed. – NoBackingDown Feb 14 '17 at 16:09
  • 1
    The rotating package seems to want to place figures at the end... This is not always desired :-) – David Roberts Apr 2 '18 at 23:42
36

You can use the angle=90 option provided by graphicx package.

\documentclass[12pt, oneside]{book}
\usepackage[demo]{graphicx}%<----remove demo in your file
\usepackage{wrapfig}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{epstopdf}
\begin{document}
\begin{figure}[ht]
\centering
    \includegraphics[angle=90]{../figures/pics/DivLibPropProfile}%<---angle here
    \caption{Property profile of the diverse library compared to the compound pool.}
    \label{fig:PropProf}
\end{figure}

\begin{figure}[ht]
\centering
    \includegraphics[angle=0]{../figures/pics/DivLibPropProfile}
    \caption{Property profile of the diverse library compared to the compound pool - not rotated.}
    \label{fig:PropProf}
\end{figure}
    \end{document}

enter image description here

1

Option 1

This way keeps your caption at the bottom. In addition to the rotation, I also need to scale the image: scale=0.6.

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}[!htb]
    \centering
    \includegraphics[angle=-90, scale=0.6]{figure.png}
    \caption{Caption in landscape to a figure in landscape.}
    \label{fig:LandscapeFigure}
\end{figure}

\end{document}

Option 2

If the rotation is not in your desired direction, like Sideways figure always rotates clockwise

You may try to add figuresleft option to package

\documentclass{article}
% For rotating figures, tables, etc.
%  including their captions
\usepackage[figuresleft]{rotating}

\begin{document}

% A small example on how to use the "rotating" package.
%  Displays a figure and it's caption in landscape
\begin{sidewaysfigure}[!htb]
    \includegraphics[width=\textwidth,keepaspectratio]{figure.png}
    \caption{Caption in landscape to a figure in landscape.}
    \label{fig:LandscapeFigure}
\end{sidewaysfigure}

\end{document}
  • I'm trying to use your answer. However, when I use the option [ht], the figure doesn't show up... Do you know why? – An old man in the sea. Jul 9 at 16:37
  • That's a position issue, not related to rotation, h means here, t means top position preferred, so if you want the image exactly here use H. Alternatively, use !htb will put your image as close as possible to the position set, ! means overwrite page settings, b is bottom. – Miranda Jul 10 at 0:25

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.