1

I noticed that some long lines does not break as expected. For example test the following:

\documentclass[12pt,twoside]{article}
\usepackage[a4paper,inner=1.5cm,outer=1.5cm]{geometry}


\begin{document}

here some text here some text here some text here some text here some text here some text here
some text here some text here some text here some text here some text here some text here some
text here some text here some text here some text here some text.

The line that does not break as wanted

\noindent
\fbox{1}~$(x,y,z), (x,y,z), (x,y,z)$;
\qquad
\fbox{2}~$(x,y,z), (x,y,z), (x,y,z)$;
\qquad
\fbox{3}~$(x,y,z), (x,y,z), (x,y,z)$;
\qquad
\fbox{4}~$(x,y,z), (x,y,z), (x,y,z)$ 
\end{document}

If I make the third item just one character longer, for example \fbox{3}~$(x,y,z), (x,y,z), (x,y,z)A$;

Then the line splits correctly. (But if I add my A to the fourth item, then it does not work)

So I would like that a long line would split, even if one piece would result "too short".

Is there some kind of tolerance parameter that I could set for that purpose?

5
  • 4
    Here LaTeX have decided that since it is trying to maintain straight left and right edges it would have to stretch the line consisting of 1,2,3 too much if part 4 was moved on to the next line. Additionally, by default latex will never line break at commas inside inline math, though you can tell where it is allowed via \allowbreak.
    – daleif
    Dec 21, 2022 at 13:25
  • 2
    \emergencystretch=1em (or a greater value) seems to do the trick.
    – frabjous
    Dec 21, 2022 at 13:26
  • @daleif where should I put \allowbreak?
    – user126154
    Dec 21, 2022 at 13:27
  • @frabjous where should I put \emergancystretch=1em? In the preamble is ok?
    – user126154
    Dec 21, 2022 at 13:27
  • Probably anywhere before it.
    – frabjous
    Dec 21, 2022 at 22:53

1 Answer 1

2

sloppypar may helps you:

\documentclass[12pt,twoside]{article}
\usepackage[a4paper,inner=1.5cm,outer=1.5cm]{geometry}

\usepackage{showframe}

\begin{document}

here some text here some text here some text here some text here some text here some text here
some text here some text here some text here some text here some text here some text here some
text here some text here some text here some text here some text.

The line that does not break as wanted


\begin{sloppypar}
\noindent\fbox{1}~$(x,y,z), (x,y,z), (x,y,z)$;
\qquad
\fbox{2}~$(x,y,z), (x,y,z), (x,y,z)$;
\qquad
\fbox{3}~$(x,y,z), (x,y,z), (x,y,z)$;
\qquad
\fbox{4}~$(x,y,z), (x,y,z), (x,y,z)$ 
\end{sloppypar}
\end{document}

enter image description here

Note that, have added the package showframe just for putting frame

2
  • 2
    In the question, it looks like the badly broken line should not be indented. Move the \noindent instide the sloppypar. Dec 21, 2022 at 14:51
  • @barbarabeeton Yes, noted, modified per your advise (Thanks...)
    – MadyYuvi
    Dec 21, 2022 at 15:16

You must log in to answer this question.

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