0

I have a problem with the title of a section moving up to a wrong page. In my document I have a few pages that have got only pictures and no texts except the captions and the section titles. Some of these images are so big as to fit in the whole page. The second section's title goes up to the first page which is irrelevant to it. I guess it is happening because there's space on the first page to fit the title, so its going up. But I don't want that.

I'm talking about D.2 Schematic and PCB Layout

How do I fix this? I don't want to start on a new page, just let it flow naturally.enter image description here

It should appear between the pictures on this page:-

enter image description here

4
  • 1) try to set the h! option of the figure environment. \begin{figure}[h!]; 2) Try the H option of the float package; 3) Do not use the figure environment and manually place the figures wherever you prefer (for the captions you can use \captionof provided by the caption package). The first two solutions are generally not advisable for several reasons, but in some cases they can be useful
    – Ivan
    May 10 at 11:37
  • @Ivan Thanks for your suggestion. I tried the [!h] and [h!] both, but the figures are in the right position, it is the section title that is wrongly placed. What could I do about that? (i.e, the D.2 title)
    – SM32
    May 10 at 16:57
  • Why not put \clearpage before the second section's title? This will output all previous floats before the title (which will start on a new page). May 10 at 17:56
  • @PeterWilson Putting a \clearpage puts the lower picture of my 2nd page in a fresh page, but I want the 2 images to be on the same page as shown, just the title not to go up (just because it found space up there).
    – SM32
    May 10 at 18:00
0

Without having a MWE that reproduces the problem, it is difficult to give a detailed solution. In general, when you want to force the positioning of the figures, you should not use the figure environment. This is not a good practice but in some cases it is necessary to do it. The following MWE tries to reproduce your problem and provides a solution by doing without the figure environment. Clearly the page fill leaves a lot to be desired.

\documentclass{book}
\usepackage{graphicx}
\usepackage{caption}
\newenvironment{myfig}{\medskip\begin{center}}{\end{center}\medskip}

\begin{document}

\appendix
\chapter{Schematics and layouts}

\section{Title}

\begin{myfig}
\includegraphics{example-image-a}
\captionof{figure}{The caption}
\end{myfig}
\clearpage

\begin{myfig}
\includegraphics[width=10cm]{example-image-b}
\captionof{figure}{The caption}
\end{myfig}

\section{Title}

\begin{myfig}
\includegraphics[width=10cm]{example-image-c}
\captionof{figure}{The caption}
\end{myfig}

\end{document}

enter image description here

1
  • Thanks so much! This worked!
    – SM32
    May 10 at 19:09

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.