1

I'm trying to fix some orphans (penalties are already at 9999) in the final layout using \looseness=-1. However, this does not lead to any change in the text layout. I've tried increasing the tolerance, however, I'm not sure that I do so at the right position:

\tolerance=1000 \looseness=-1 As can be seen in ...

I have relatively short paragraphs. Am I just expecting too much for it to remove e.g. the final 4-letter-word in an 11-line paragraph? Do I need to specify \tolerance differently? Or is there likely something preventing it in the template I use? (https://www.latextemplates.com/template/masters-doctoral-thesis (I made some alterations, but the problem also exists in the original template))

Compilation is on Windows, TexMaker with the quick F1-compile if that makes a difference.

Tobl
  • 115
  • How about using a tie between the last two words in the paragraph instead? – Werner Jan 08 '20 at 23:02
  • that draws the second-to-last word into the final line. I'm also more interested in figuring out why \looseness doesn't work because I'll have to correct a few more orphans. This was just the example where I was most sure that it should work. – Tobl Jan 08 '20 at 23:06
  • 1
    Note that \tolerance has a maximum of 10000 (which is considered "infinite")... but "no change" implies that there's no adequate line-breaking options that leaves with an optimal paragraph layout within the given \tolerance. You can, of course, also consider shrinking/stretching the space between words. See How to shorten/shrink spaces between words?. – Werner Jan 08 '20 at 23:15
  • I've also tried it with other paragraphs and growing instead of shrinking (in that case using paragraphs where the last line was almost full). Is it really that likely that not one of these was possible? – Tobl Jan 08 '20 at 23:21
  • 2
    you should post an example document, but changing looseness often has no effect there typically needs to be quite a long paragraph before it can be made shorter, you might need to play with \spaceskip to allow interword space to shrink more than it would otherwise and/or add more non-standard hyphenation points – David Carlisle Jan 09 '20 at 00:09
  • 1
    not related but the setting as you show sets looseness just for the one paragraph but tolerance for the rest of the docuemnt. – David Carlisle Jan 09 '20 at 00:11
  • 1
    You might also look for a word near the end of a line that could be hyphenated but isn't. TeX's hyphenation is good, but there are words that don't match the available patterns, so remain unbroken. If that's the case, insertion of some discretionary hyphens (\-) might make the difference. – barbara beeton Jan 09 '20 at 01:47
  • Re my earlier comment, for tightening a paragraph, it's words near the beginning of lines that should be checked for possible hyphenation. In the first paragraph shown in the answer by @DavidCarlisle, "tiger" isn't hyphenated by TeX, so it's worth trying to modify that to ti\-ger. Not a great break, but acceptable, and it might help. (To test hyphenation, run plain TeX from the command line, input \relax <cr>\showhyphens{tiger othertestwords}<cr>. End the session with \bye. – barbara beeton Jan 09 '20 at 17:52

1 Answers1

3

It all depends on the text:

enter image description here

(1) is a default setting of an 11 line line paragraph with a single four letter word on the last line. the setting is fairly loose and there are a lot of short words so a lot of inter word space, and the looseness setting you suggest produces (2) with it compressed to 10 lines still with some space at the end of the last line.

(3) is a similar text but with longer words and a default tighter setting, but still 11 lines ending with a four letter word.

Your suggested setting produces (4) where the paragraph is actually looser with more space and two words (or at least one and a half words) on the last line. That is actually the effect of the changed tolerance changing the hyphenation choices, looseness itself had no effect here as can be seen with (5) which only changed that setting. However if you really allow inter word space to shrink it give TeX the tools to achieve the \looseness setting and so (6) again sets the text in 10 (very tight) lines.

\documentclass{article}
\parskip=5pt
\addtolength\textheight{12\baselineskip}
\pagestyle{empty}
\begin{document}

\vspace*{-11\baselineskip}

\def\test{One two three four red. Blue yellow apple orange elephant football,
tiger, penguin, cricket green. Five six seven nineteen twenty.
One two three four red. Blue yellow apple orange elephant football,
tiger, penguin, cricket green. Five six seven nineteen twenty.
One two three four red. Blue yellow apple orange elephant football,
tiger, penguin, cricket green. Five six seven nineteen twenty.
One two three four red. Blue yellow apple orange elephant football,
tiger, penguin, cricket green. Five six seven nineteen twenty.
One two three four red. Blue yellow apple orange elephant football,
tiger, penguin, cricket green. Five six seven nineteen twenty.
One two three four red. Blue yellow apple orange elephant football,
tiger, penguin, cricket green. Five six seven four.\par}

\def\testb{Onetwo threefour red.Blue yellowapple orangeelephant football,
tiger, penguin, cricketgreen. Fivesix sevennineteen twenty.
Onetwo threefour red.Blue yellowapple orangeelephant football,
tiger, penguin, cricketgreen. Fivesix sevennineteen twenty.
Onetwo threefour red.Blue yellowapple orangeelephant football,
tiger, penguin, cricketgreen. Fivesix sevennineteen twenty.
Onetwo threefour red.Blue yellowapple orangeelephant football,
tiger, penguin, cricketgreen. Fivesix sevennineteen twenty.
Onetwo threefour red.Blue yellowapple orangeelephant football,
tiger, penguin, cricketgreen. Fivesix sevennineteen twenty.
One\-two threefour red.Blue yellowapple orangeelephant football,
tiger, penguin, cricketgreen. Fivesix sevenfour.
some text to restore eleven lines: more complicated word.\par}

1 \test

{\tolerance=1000 \looseness=-1 2 \test }

3 \testb

{\tolerance=1000 \looseness=-1 4 \testb }

{\looseness=-1 5 \testb }

{\looseness=-1 6 \spaceskip= 2pt plus 1pt minus 1.5pt  \spaceskip= 3pt plus 2pt minus 2pt \testb }


\end{document}

David Carlisle
  • 757,742