0

I am trying to compose a page with a section header and a couple of figures: they should stay on the SAME page, but there is no way to force them to, an extra page is always added between the section and the first figure. Here is the incriminated code:

\subsection{Lipsum} % this works OK
\lipsum[1- 3 ]

\FloatBarrier  % attempt implementing suggestions from this forum
\newpage
\subsection{Graphs}
\begin{figure}[H]
      \centering
      \includegraphics[width=0.5\hsize,height=0.3\vsize,keepaspectratio] {Figures/fig00001.png}
      \\{ Figure 001: Pipponzolo }
\end{figure}

\begin{figure}[H]
      \centering
      \includegraphics[width=0.5\hsize,height=0.3\vsize,keepaspectratio] {../Figures/WashEagle.png}
      \\{ Figure 002: Washington Eagle }
\end{figure}  
\FloatBarrier

the suggestions from Latex Section header and figure won't print on same page did not work.

Wrapping the page between \begin{samepage} and \end{samepage} did not work either.

I am at the end of my rope: any suggestions?

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Apr 28 '14 at 15:52
  • Welcome to tex.sx, you can use the {} button to format code sections. Please always post a complete document, it is hard to help from a fragment such as the above. since you force a page break before Graphs it seems surprising that you get a page break afterwards (assuming you have loaded the float package to define [H]) – David Carlisle Apr 28 '14 at 15:54
  • 2
    unrelated but don't do \\{ Figure 001: Pipponzolo } try to avoid using \\ outside tables) use \caption{Pipponzolo} – David Carlisle Apr 28 '14 at 15:55
  • you can wrap your block content in a vbox-environment: \begin{vbox} figure1 figure2... \end{vbox} Its content will stay on the same page. – musicman Apr 28 '14 at 16:18
  • @musicman there is no vbox environment in latex (it is not even possible for a contributed package to define such a thing) – David Carlisle Apr 28 '14 at 16:25
3

You need the float package to define the [H] option.

Also it is always better to let latex handle the numbering and caption, so formatting is more consistent and as it knows it is a caption it can then handle cross references and lists of tables, etc.

| improve this answer | |

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.