4

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?

5
  • 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? Commented Mar 19, 2013 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. Commented Mar 19, 2013 at 21:49
  • Is it one repeating label or are they different? Commented Mar 19, 2013 at 21:51
  • Different sizes actually Commented Mar 19, 2013 at 21:53
  • Then issue \raggedright as justification is probably not important. Commented Mar 19, 2013 at 22:03

1 Answer 1

3

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} 
1
  • 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. Commented Mar 19, 2013 at 21:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.