[Tex/LaTex] Sidewaysfigure in a page with section title

rotatingsectioningsidewaysfigure

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}

Best Answer

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}
Related Question