3

Is there a way to specify penalty only to the last word of a paragraph?

\righthyphenmin=3 sets, for instance, 3 letters as a minimum at the beginning of a line. On the other hand, \finalhyphendemerits=500000 avoids a hyphen at the next to last line, no matter how long this might be. Instead of this penalty, I would prefer to avoid only ending lines with, say, less than 5 characters.

  • Perhaps you can get ideas from impnattypo. – Thérèse Nov 13 '15 at 19:30
  • 2
    There's no such thing in legacy TeX. You can do it with LuaTeX. – egreg Nov 13 '15 at 23:32
3

If you are using LaTeX, the following code should help:

\setlength{\parfillskip}{2ex plus \dimexpr\linewidth-2\parindent}

Using this, you are telling LaTeX to leave white-space of at least 2ex and at most linewidth-2\parindent at the end of a paragraph. In this case, it means that anything on the last line of the paragraph has to be at least 2\parindent, which greatly reduces the chance of there being a hyphen (I have never had one using that setting and proper hyphenation penalties). it also prevents your line from being shorter than the next paragraph's indent, which would be ugly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.