Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
velit, quis malesuada ante.
\end{document}

which produces this output:

beginning of the document

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?

share|improve this question
    
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
add comment

1 Answer 1

up vote 3 down vote accepted

enter image description here

\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
velit, quis malesuada ante.
\end{document}
share|improve this answer
    
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
add comment

Your Answer

 
discard

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.