# How can one make LaTeX break lines between graphics correctly?

Consider the following code:

\documentclass[]{scrartcl}
\usepackage[demo]{graphicx}
\setlength{\parindent}{0cm}

\begin{document}
\includegraphics[width=3.5cm]{}
\includegraphics[width=3.5cm]{}
\includegraphics[width=3.5cm]{}
\includegraphics[width=3.5cm]{}
\includegraphics[width=3.5cm]{}
\includegraphics[width=3.5cm]{}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus molestie
nunc non lectus convallis auctor. Cras nisl arcu, placerat et pretium at,
blandit ut nunc. Proin ut est ac dolor porttitor pellentesque. Donec commodo
ornare nisi. Nam non elit in arcu placerat rhoncus nec sed erat. Donec non mi
\end{document}


which produces this output:

Why is it that LaTeX does not break the line when there is no more space left for an entire figure? How can I ensure LaTeX breaks the lines correctly?

-
The space between the figures has to stretch too much in order to fill the line, so the tolerance is exceeded and TeX prefers to typeset an overfull box to warn you about the problem. Could you please make a more "real world" example? –  egreg Mar 19 '13 at 21:42
@egreg this is the real example, just that the graphics aren't blanks. trying to fill a page with labels to be cut out eventually. –  barbaz Mar 19 '13 at 21:49
Is it one repeating label or are they different? –  egreg Mar 19 '13 at 21:51
Different sizes actually –  barbaz Mar 19 '13 at 21:53
Then issue \raggedright as justification is probably not important. –  egreg Mar 19 '13 at 22:03

\documentclass[]{scrartcl}
\usepackage[demo]{graphicx}
\setlength{\parindent}{0cm}

\begin{document}
\sloppy
\includegraphics[width=3.5cm]{}
\includegraphics[width=3.5cm]{}
\includegraphics[width=3.5cm]{}
\includegraphics[width=3.5cm]{}
\includegraphics[width=3.5cm]{}
\includegraphics[width=3.5cm]{}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus molestie
nunc non lectus convallis auctor. Cras nisl arcu, placerat et pretium at,
blandit ut nunc. Proin ut est ac dolor porttitor pellentesque. Donec commodo
ornare nisi. Nam non elit in arcu placerat rhoncus nec sed erat. Donec non mi

That did it. Totally forgot that LaTeX tries to create justified paragraphs by default. So either adding sloppy or using ragged2e to have a flush left text works fine to solve the problem. Thanks. –  barbaz Mar 19 '13 at 21:52