TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a large document based on the book documentclass with text and images, and sometimes I encounter a new sentence that has a huge space after a period. It looks like this:
enter image description here

I have attempted to make a MWE, but failed to get the problem.

This problem generally occurs when I have code that has this general structure:

A sentence that explains something shown in the images.
    \includegraphics[clip=true, trim=0 0 0 0, width=0.9\linewidth, angle=0]{image}
    \includegraphics[clip=true, trim=0 0 0 0, width=0.9\linewidth, angle=0]{image}
    \includegraphics[clip=true, trim=0 0 0 0, width=0.8\linewidth, angle=0]{image} 
Another sentence that continues on the explanation.

It compiles then to something like this:

A sentence that explains something shown in the images.    Another sentence that continues on the explanation.

What could be causing this large jump? Is there some package/option that is known to give this discrepancy? As said I've tried to compile a MWE but failed to achieve this "error". If I knew what might cause this I could re-attempt to produce an MWE.

share|improve this question
Add figure environments between paragraphs, not inside them. – egreg Mar 20 '14 at 15:31
Change \end{figure} to \end{figure}% twice. There are spaces at the end of the lines. – Malipivo Mar 20 '14 at 15:36
Not sure if it's a duplicate. It's the same subject/problem, but the linked question approaches it from the other side ("what does this solution do?") and my question is more along the lines of "I have this problem, how do I solve this". – Saaru Lindestøkke Mar 20 '14 at 16:03
@Werner This is rather different from the canonical % at eol question. For a single figure you don't need the % and LaTeX explicitly checks for and compensates for any white space. It is just that its checks can not cope with a run of alternating insert and space nodes. – David Carlisle Mar 20 '14 at 16:35
up vote 7 down vote accepted

It's OK to put figures in paragraphs but if you put them one after the other you must have no space between them. You have a word space between each from the end of line, and the figures float away leaving the space.


LaTeX takes precautions so that if there is space before and after a figure only one space appears in the final paragraph, however it doesn't (and can't easily) check that a space between two figures is "after" one figure and "before" the next so both figures see a space and add a single space to the final para so you get two spaces.

share|improve this answer
Is it good practice to write \end{environment}% in general? Or is this something which I should consider per case? – Saaru Lindestøkke Mar 20 '14 at 15:39
@BartArondson I moved the answer to that comment into my updated answer. – David Carlisle Mar 20 '14 at 16:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.