7

Or, to phrase more precisely: How do I avoid that text goes over the right margin in ConTeXt?

7

The LaTeX definition of \sloppy is

\def\sloppy{%
  \tolerance 9999%
  \emergencystretch 3em%
  \hfuzz .5\p@
  \vfuzz\hfuzz}

That means that lines with badness of 9999 will be tolerated, interword spaces may be stretched by an additional 3em and boxes which bleed by less that 0.5pt into the margin are not even considered overfull.

Tolerance and emergencystretch can also be set in ConTeXt. There is no high-level command to set hfuzz and vfuzz. For a setup similar to \sloppy one uses

\setupalign[verytolerant,stretch]

This sets tolerance to 4500 and emergencystretch to the body font size.

Here is a short MWE:

\setuppapersize[A6][A6]
\setupalign[nothyphenated] % to generate overfull boxes
\starttext
\input knuth
\page
\setupalign[verytolerant,stretch]
\input knuth
\stoptext

However, I think it is better not to increase tolerance and emergencystretch but rather use the advanced features of microtypography such as margin kerning (called hanging punctuation) and font expansion (called HZ). Before you can use these features you have to enable the corresponding font features

\definefontfeature
  [default][default]
  [protrusion=quality,
   expansion=quality]

Then you can enable both via

\setupalign[hz,hanging]

If you still get bad breaks, try rewording the sentence or try \looseness=1 or \looseness=-1 on the paragraph with the bad break.

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.