15

My document contains many short, justified lines, so the lines often appear with many spaces between words, e.g.:

These    words    have    a    space
so that they can fit nicely into the
available line.

In most situations, this is no problem, however, there are some select situations where I want a group of two or more words to appear together, even if other words in the lines are pulled apart, e.g., with "these words" linked:

These words     have     a     space
so that they can fit nicely into the
available line.

How can this be done?

I'm looking for either a ConTeXt or TeX solution.

16

\hbox{These words} will do. Or, if you prefer a macro,

\def\nespace{\hskip\fontdimen2\font\relax}

and

These\nespace words

This space has no stretch or shrink component, but is the same as the normal interword space. If you want to add shrinkability:

\def\nespace{\hskip\fontdimen2\font minus\fontdimen4\font\relax}

The main difference between the \hbox approach and \nespace is that a line break can be taken at \nespace. Shouldn't you want it, just add \nobreak before \hskip as glue is not a feasible break point if preceded by discardable items and \nobreak adds a penalty, which is discardable.

3
  • 1
    How about line breaks? Are they permitted at \nespace?
    – lockstep
    Apr 14 '12 at 12:19
  • 1
    @lockstep Yes, of course: any glue is a feasible line break point if it's not preceded by discardable items. In order not to break, one can add \nobreak before \hskip.
    – egreg
    Apr 14 '12 at 12:21
  • 1
    In that case, please point out the difference to \hbox in your answer.
    – lockstep
    Apr 14 '12 at 12:22

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.