8

I would like to rotate an image (in LATEX) keeping it at the same location (I just want to rotate it) In order to do that I used \begin{sidewaysfigure}[H] but is not working.

The current output: The image appears on the last sheets

what's going on? any idea? I also changed the height/widht but it doesn't work either:

\begin{sidewaysfigure}[H]
 \includegraphics{image}
 \caption{Swimlane Diagram.}
%\label{swim}
\end{sidewaysfigure}
3
  • 2
    From the package documentation of rotating: "two new environments, sidewaystable and sidewaysfigure, each of which produces a single page-size float with contents rotated ±90 degrees" Please clarify: Do you want to keep the rotated image on the same page as other unrotated content or do you want the image to be on a single page, but stay where it was used in the code?
    – leandriis
    Nov 13, 2019 at 16:22
  • 1
    Hard to say without seeing the image and an example document, but my guess is that \begin{figure}[H] ... \includegraphics[angle=90]{whatever} ... would achieve the result you need. Nov 13, 2019 at 16:31
  • I don't think sideways figure supports [H]. See tex.stackexchange.com/questions/262816/… and ignore the -90 version. Nov 13, 2019 at 16:50

2 Answers 2

5

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.

enter image description here

enter image description here

\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{Swimlane Diagram}
        \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}**

Taken from --https://tex.stackexchange.com/a/46337/197451

1
19

You can define the angle property in \includegraphics:

\begin{figure}[h]
    \includegraphics[width=\textwidth, angle=90]{c.jpg}
\end{figure}
2
  • 5
    keep in mind that this rotates the image from the corner, not from the center (which is more natural in my opinion). For the latter, add ,origin=c Mar 4, 2023 at 16:48
  • 1
    Works like a charm. Keep in mind, that after rotating width=\textwidth still references the original width of the figure, not the "new" width after rotating.
    – devbf
    Dec 14, 2023 at 6:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .