[Tex/LaTex] Fixed-width interword space


I would like to typeset post--World War II with what Adobe InDesign calls a "quarter space". The en-dash is there to be wider than a normal space, to clarify the constituent structure ([post-[[World War] II]]), but in good typesetting, the two spaces in this expression should, unlike other spaces in the same typeset line, not stretch.

How do I typeset a fixed-width "quarter space" in LaTeX?

(I used to think that the right way was post--World\ War\ II, but I just found out that \␣ isn't a fixed space at all but is just a line-breaking variant of the line␣break--preventing ~.)

Really, I need two different macros: one that allows for a linebreak and one that doesn't. For example, the expression above should be linebroken in the following ways:

  • ok: post--/World␣War␣II
  • ok: post--World/War␣II
  • bad: post--World␣War/II

(Let's just assume that this is how we want it and leave the question of whether the second linebreak option is typographically good or not for another debate.)

Let's also assume that linebreaking points in a component word are to be retained. Two examples (from Wikipedia's "Dash" article):

  • "Fran·cis·co" in non--San␣Francisco
  • "min·is·ter" in ex--prime␣minister


Best Answer

Just set \spaceskip; if this parameter is nonzero, TeX will use it for the interword space, ignoring the font defined parameters.

  \xspaceskip=0pt\relax % just to be sure
\newcommand{\WWII}{{\color{blue}post--World War II}}

\makebox[\textwidth][s]{a text \fixedspaceword{\WWII} and so ends}

\makebox[\textwidth][s]{a text \fixedspaceword[.75]{\WWII} and so ends}


With \makebox[\textwidth][s]{...} interword spaces that can stretch do.

enter image description here

With the optional argument you can reduce (or expand) the interword space in the \fixedspaceword bit.

If you prefer that spaces are allowed to shrink together with the other spaces in the line, change the definition into

  \spaceskip=#1\fontdimen2\font minus \fontdimen4\font
  \xspaceskip=0pt\relax % just to be sure

The space won't be allowed to stretch, because \spaceskip has zero stretch component.

Related Question