0

I am using the sidewaysfigure command to place a large figure in a landscape position. However, I am not able to place the figures between the texts. All figures are displaced to the end of the PDF document.

Here is the mini-example:

\documentclass{article}
\usepackage{rotating}
\usepackage{float}
\usepackage{lipsum}

\begin{document}

\section{lipsum1}

\lipsum[1-4]

\begin{sidewaysfigure}[ht]
\centering
\noindent\includegraphics[scale=1]{example-image-a}\qquad
\caption{A.}
\label{fig_A}
\end{sidewaysfigure}

\section{lipsum2}
\lipsum

\begin{sidewaysfigure}[ht]
\centering
\noindent\includegraphics[scale=1]{example-image-b}\qquad
\caption{B.}
\label{fig_B}
\end{sidewaysfigure}

\end{document}
  • 2
    The placement directive [ht] has absolutely no effect: each sidewaysfigure environments is always placed on a page by itself. Your MWE is very short: one page of text and two pages of figures. Where would you expect LaTeX to place the figures (given that they must reside on a page by themselves)? – Mico Nov 19 '19 at 5:42
  • You don't HAVE to use \sidewaysfigure. In fact, I would avoid it. See tex.stackexchange.com/questions/429987/… for example. – John Kormylo Nov 19 '19 at 17:19
  • Actually, I am using \sidewaysfigure to rotate the caption as well as the figures. – Ahmed Nov 19 '19 at 18:54
0

From the rotating documentation:

The package provides:

  • two new environments, sidewaystable and sidewaysfigure, each of which produces a single page-size float with contents rotated ±90 degrees; ...

So sidewaysfigure always inserts a full-page figure at the next possible pagebreak. As such, position arguments like [ht] don't make any sense here. In fact, [ht] seems to break the default behaviour such that the figures appear at the end of the document, and not at the next pagebreak after the current section.

Compiling your MWE just without the two occurences of [ht] results in the expected behaviour: The first figure on page 2, the second figure as last page of the document.

\documentclass{article}
\usepackage{rotating}
\usepackage{float}
\usepackage{lipsum}

\begin{document}

\section{lipsum1}

\lipsum[1-4]

\begin{sidewaysfigure}
\centering
\noindent\includegraphics[scale=1]{example-image-a}\qquad
\caption{A.}
\label{fig_A}
\end{sidewaysfigure}

\section{lipsum2}
\lipsum

\begin{sidewaysfigure}
\centering
\noindent\includegraphics[scale=1]{example-image-b}\qquad
\caption{B.}
\label{fig_B}
\end{sidewaysfigure}

\end{document}

enter image description here

  • Thanks a lot. I did not expect that the displacement option ht can do such weird behavior. – Ahmed Nov 19 '19 at 18:51

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.