I am writing a very simple how-to document with several screenshots. The document flow goes something like this:

A few sentences explaining action 1


A few sentences explaining action 2


However since the screenshots are often large, I sometimes get page breaks between the paragraph and the corresponding screenshot. I want the paragraph to always be on the same page as a screenshot.

I have used \clearpage after each screenshot, but that doesn't quite get what I want. \clearpage would make sure that there is a page break after each screenshot, but I still want multiple screenshots on the same page if they fit. Ideally, I would have something like this to guarantee that two items were on the same page, though wouldn't necessarily always cause a page break:


A few sentences explaining action 2



Is something like this possible? I'm not really looking for figures, because those don't tend to work well with longer descriptive paragraphs. Figures seem to be more optimized for a short sentence or sidenote.

  • 2
    Did you try what you have posted? Looks fine to me.
    – topskip
    Commented Oct 6, 2011 at 19:45
  • 13
    @Patrick Holy cow, I never tried samepage, I just thought such an environment was wishful thinking on my part. Turns out that it actually exists...
    – Phil
    Commented Oct 6, 2011 at 19:52

2 Answers 2


The minipage environment is what you're after. That is


A few sentences explaining action 2


  • 2
    BTW, this DOES work with an \item and the subsequent paragraph.
    – Leo
    Commented Jun 15, 2015 at 18:20
  • 9
    I think, using \noindent\begin{minipage}{\textwidth} is more appropriate...
    – kavadias
    Commented Jun 14, 2017 at 18:08
  • 7
    In my case, I needed not only \noindent before the minipage environment, but also \vspace{\parskip} in it before the end. Otherwise the contents of the minipage get way too close to the following content. Commented Mar 14, 2018 at 21:28
  • For those working with two columns format, {minipage}{\columnwidth} would be needed. Commented Sep 20, 2022 at 2:32

If you put everything together into a {minipage}{\textwidth} environment you ensure that everything is placed on one page. However, this doesn't allow for normal footnotes, which require more work. Also you will get ugly page breaks.

I would rather use figure environments for the screenshots together with \caption and \label so you can \ref-erence them in the text. You can place two \includegraphics into one figure with separate \captions to ensure they are always placed together.

You could also define a samepage environment which uses two zref page labels in the \begin and \end code. Then after one compiler run the \begin code can check if both are on separate pages and cause an \clearpage if not. The code in my answer to Test if a paragraph has a page break in it? could be used for this.

Not the answer you're looking for? Browse other questions tagged .