1

Already the title sounds complicated since I need to use the caption on the side of the rotated image in landscape mode. I tried some spacing as you see in lines commented with %, but it did not work well. Could you please suggest any universal solution without sizing every image individually, so that the image is centred both vertically and horizontally and the long caption does not go out of the margins?

Here is the code:

\documentclass[12pt,a4paper,fleqn,parskip=half]{scrartcl}
\usepackage{graphicx}
\usepackage{pdflscape}
\usepackage{showframe} %% just to show frames.

\begin{document}

\begin{landscape}
%\vspace*{\fill}
\begin{figure}[H]
 %\vspace*{-3.5cm}
 %\hspace*{3cm}
 \rotatebox[origin=c]{-90}{
  \begin{minipage}{1.0\linewidth}
   \centering
   \includegraphics[scale=1.0,angle=90]{example-image-a}
   \caption{A very very very very very very very very very very very very very very very very very very very very very very very very very very long caption.}
   \label{a}
   \end{minipage}
 }
\end{figure}
%\vspace*{\fill}
\end{landscape}

\end{document}

Here is the outcome I get:

example-image-a

Here a mockup:

mockup

farhigh
  • 45
  • Could you create a mockup of the desired result? Its not quite clear to me why you use so many rotations. – Harald Dec 05 '14 at 11:58
  • Harald, please see the attached sketch. Why so many rotations? I thought using the \usepackage{showframe} is clear enough. But here some more explanation for you. The main document is in the portrait mode. But as soon as the image is wide and should be rotated to fit the whole page for better visibility, I would like the pdf page to be in the landscape. However, the caption should remain at the bottom of the DOCUMENT (here side of the image) - see where my header, footer and page numbering are. – farhigh Dec 05 '14 at 12:21
  • So this is just a normal portrait page with a rotated image, right? The explicit landscape mode seems to fiddle with the page margins which should stay the same. So instead of rotating the page, the image, and the caption, why not only rotate the image. – Harald Dec 05 '14 at 12:35
  • Because rotating only the image I would get the soft copy pdf page in portrait. I want the page to be in landscape when I open the pdf document. – farhigh Dec 05 '14 at 13:14
  • That can be handled separately, see my answer – Harald Dec 05 '14 at 13:20

1 Answers1

2

This solution may be very specific to your case and not applicable to the general question title. More on the topic can be found in this question.

As everything except the image should stay the same as in the normal portrait mode, you should probably just rotate the image and rotate the page only with a pdf attribute instead of using pdflandscape. I had to get rid of the float environment to control the pagebrakes and pdf attributes on the very page of the image. The capt-of package emulates the figure environment for creating the appropriate caption type.

\documentclass[12pt,a4paper,fleqn,parskip=half]{scrartcl}
\usepackage{graphicx}
\usepackage{showframe} %% just to show frames.
\usepackage{capt-of}

\newenvironment{rotatepage}%
    {\pagebreak\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 90}}%
    {\pagebreak\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 0}}%

\begin{document}
blindtext

\begin{rotatepage}
  \vspace*{\fill} % this and the the vspace below will center the image vertically
  \centering      % this will center the image horizontally
  \includegraphics[scale=1.2,angle=90]{example-image-a}
  \captionof{figure}{A very very very very very very very very very very very very
     very very very very very very very very very very very very very very long caption.}       
  \label{a} 
  \vspace{\fill}
\end{rotatepage}

blindtext
\end{document}

Result: enter image description here

Harald
  • 1,349