4

I have a sidewaysfigure just after a section title. The figure is not too big for requires a new page. How can I indicate to put the sidewaysfigure after the section title?

Note: I have a serie of this figures

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{rotating}
\usepackage{graphicx}
\begin{document}
\section{Title Section}
\begin{sidewaysfigure}
\centering
\includegraphics[width=0.5\linewidth]{example-image-a}
\caption{Figure caption 1}
\end{sidewaysfigure}
\begin{sidewaysfigure}
\centering
\includegraphics[width=0.5\linewidth]{example-image-a}
\caption{Figure caption 2}
\end{sidewaysfigure}
\end{document}
4

From looking at rotating.sty, I believe this happens because sidewaysfigure puts the contents in a floating box whose size is \textheight. With the section heading on the page, there is insufficient space remaining on the page to place a \textheight sideways figure. This causes the sidewaysfigure to float to the next page.

The solution, I suggest, is don't use a float, which means don't use sidewaysfigure. An adjustbox can be used here. I put the two figures centered horizontally using the center key of adjustbox and vertically using \vspace*{\fill} at the top and bottom of the page content.

This is the result:

enter image description here

This is the MWE:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[showframe]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{adjustbox}
\usepackage{rotating}
\usepackage{graphicx}
\begin{document}
\section{Title Section}
\vspace*{\fill}
\begin{adjustbox}{angle=90,center,caption=Caption 1,nofloat=figure}
\includegraphics[width=0.5\linewidth]{example-image-a}
\end{adjustbox}
\begin{adjustbox}{angle=90,center,caption=Caption 2,nofloat=figure}
\includegraphics[width=0.5\linewidth]{example-image-a}
\end{adjustbox}
\vspace*{\fill}
\end{document}
|improve this answer|||||
  • It was I who was confused. I've already deleted my earlier comment. Sorry. – Mico Sep 25 '17 at 5:41
  • 1
    But captions must turn like figures too. – ömer koçhan Jun 4 '18 at 18:53

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.