# ConTeXt: Define word space dimensions

How would you define the length of a common word space? The word space length ConTeXt uses by itself is okay on the longer end, but way too short on the most compressed end.

The wiki entry for \setuptolerance suggests changing word spaces with:

\spaceskip .5em plus .25em minus .25em


So it sounds like there is a way to define the mean length, as well as maximum deviations for word spaces.

How would I use that setting throughout my document as the default word space?

-
Looking at the contextgarten page, it seems that you have to say \setuptolerance[horizontal,space]. –  egreg Mar 15 '12 at 23:48
@egreg: but looking at the sources, it seems that \setuptolerance[space] only fixes \spaceskip and cannot change it. –  mbork Mar 16 '12 at 0:04
@mbork Probably. But I don't think that setting \spaceskip is a good idea to begin with. –  egreg Mar 16 '12 at 0:10
Agreed. Sometimes, however, it might make sense (though \emergencystretch is probably usually the better way to go). (This, either, does not have any high-level interface in ConTeXt, except for \setuptolerance[stretch].) –  mbork Mar 16 '12 at 8:05

Did you try just putting something like

\spaceskip .5em plus .25em minus .25em


somewhere at the beginning of your document? Short explanation: \spaceskip is (low-level) TeX parameter responsible exactly for that.

Edit: Notice that em depends on the current font, so you should first set the font (e.g. by \setupbodyfont) and only then issue the above command.

Also, strangely enough, after skimming through the ConTeXt (MkIV) sources, it seems to me that ConTeXt does not have a high-level interface for that (\setraggedskips is not what I'd call a "high-level" interface). This has a benefit of making me quite sure that nothing (e.g. in \starttext) is going to change \spaceskip.

Edit: as egreg points out in the comments, changing \spaceskip is probably a bad idea; it might be better to use \emergencystretch, which (in case TeX cannot typeset a paragraph within its "badness" limits, even with hyphenation) is added to the "stretch" compoment of \spaceskip, so it is considered only, well, in emergency (bibliographies or twocolumn layout are two examples when one might want to use it - sparingly, of course!).

Notice that there is also \xspaceskip, which has a similar application as \spaceskip, but TeX uses it at the end of the sentence (unless \frenchspacing is in use).

-
It would be nice if everytime one states “Thing x is good/bad”, there would also be a short explanation why the writer thinks so. In this instance, it is left unclear whether setting \spaceskip is bad for setting global interword spacing, and if so, is it bad because there are \fontdimens for that, or if it is bad because users should trust on the values provided by the font designer, or the underlying software? Or something else entirely? –  morbusg Mar 16 '12 at 11:20
@morbusg: very good point. I guess that fiddling with \[x]spaceskip is bad, because I assume that the font author already put the good-looking values into the font itself. The only reason I can imagine now for changing it is to make typesetting narrow columns easier (without too much hyphenation/overfull boxes). For that, \emergencystretch (and \tolerance & friends) seems better (well, less worse in fact: really better might be making your font smaller and/or setting the relevant portion of text flushleft). –  mbork Mar 17 '12 at 18:30
while i agree that the font author probably defined a proper space width for the font, i still went with spaceskip and manual fiddling because context, as a rule, seems to see fit to slightly stretch or squash what the font author intended as a fixed value. thus, in cases, context OK'ed a word space value that was too damn short for the font. (=shorter than the font authors intended value) –  raphael Mar 21 '12 at 21:33
Well, grepping the (MkIV) sources gave me certainty that ConTeXt seems not to change the font constant with respect to \spaceskip and its stretch and shrink components, unless you use verbatim-type environments (or \setuptolerance[space]). –  mbork Mar 22 '12 at 4:08
but doesnt the default value 'verystrict' imply a slight tolerance for horizontal spacing? if not that, how would some lines end up with legible spaces and some with almost colliding words? –  raphael Mar 25 '12 at 9:50