# Non-breaking \hspace in ConTeXt

The only non-breakable space command in ConTeXt that I know of is the tilde (~) command, but I'd like to have finer control over how long the non-breaking space will be. In LaTeX, I could accomplish this with \hspace*, but ConTeXt only offers the non-starred version of the command, and this produces a breakable space.

Does ConTeXt offer a non-breaking version of its \hspace command, or is there another preferred way of doing this in ConTeXt? I'd be content with temporarily modifying the width of the ~ space, but I'm also not sure how I might do that.

• Are you familiar with \kern1cm, \kern5em, etc? – Mico Apr 15 at 3:23
• I was not, so thanks for letting me know! – Joey McCollum Apr 15 at 12:08

You can use \kern as Mico suggested in a comment, however, that has the disadvantage, that it doesn't stretch or shrink.

To get a horizontal space that can't be broken around and that stretches and shrinks like interword space, you can use

\nobreak\hskip1em plus 1em minus .5em\nobreak


However, that also doesn't fit well with the ConTeXt philosophy of first class Unicode support. Instead of specifying space manually, maybe have a look at all the predefined horizontal spaces in spac-chr.mkiv, which are natively supported by ConTeXt. The big advantage of those is that they properly export to XML and are copy-pastable from PDF. If they are breakable, it should be possible to just surround them with \nobreak like above.

Here is a shortened excerpt from spac-chr.mkiv:

\edef\nobreakspace            {\normalUchar"00A0} % space