I try to place images with a fixed width from the section title. My question somehow is close to this one, though not covered in the response: How do I remove white space before or after the figures and tables?
I slightly modify the MWE from there, so that it just has a section and a figure. I want the distance between section and figure to be always \baselineskip, not more or less. The image is not allowed to float so I use the package float and [H]
for placement. In the case an image is at the end of the page it should move the title and the image to the next page.
\documentclass[11pt,a4paper,twoside,openany]{scrbook}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[demo]{graphicx}
\raggedbottom
\RedeclareSectionCommand[
beforeskip=2\baselineskip,
afterskip=\baselineskip
]{section}
% provides the H option
\usepackage{float}
% produces random text for testing
\usepackage{blindtext}
\begin{document}
\section{Test}
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth,height=50mm]{}
\end{figure}
\blindtext[2]
\section{Test}
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth,height=50mm]{}
\end{figure}
\end{document}
\includegraphicsdirectly – David Carlisle Jan 03 '18 at 09:42