The following two constructions,
This is the 1.{} sentence.
and
This is the 1.\ sentence.
have different results. You get a sentential space in the first case and the interword space in the second. Why? In the first case {}
begins and ends a group, but in the end, the effect is null: the last item in the horizontal box is a .
and spacefactor still has the sentential-space value (3000 by default), so the following space in appended with the sentential spacefactor value. In the second case, \␣
, a primitive TeX command, directly appends glue to the horizontal box, "using the same amount that a space token inserts when the space factor is 1000" (TeXbook p. 285).
To extend the example to \␣
vs. {}
to usage after an argumentless command, imagine a macro that might expand to something ending with .
.
\def\macro{1.}
Then, for the same reason as above, the effect of the following two chunks of code is different.
This is the \macro{} sentence.
This is the \macro\ sentence.
In this case, I would use the second construction, because the assumption is that the result of \macro
is a non-sentential phrase, like a single word. If, however, \macro
might expand to something sentential, using the first construction would be better since then the ending punctuation of the macro (if any) would control the width of the space following it.
EDIT: As Bruno Le Floch pointed out in a comment, a well-written macro should be defined as \def\macro{1.\@}
, "to avoid hiding a change in space factor inside a macro". Thus, in a perfect world, the difference between \macro{}
and \macro\␣
disappears.
Regarding \␣
vs. \@␣
, I know of no difference between them (barring the pathological situations like some macro tearing apart \@
and ␣
or somebody changing the value of \@m
which \@
depends on). Thus I'd agree with the comments that using one or another is truly a matter of style. (By the way, I find it somewhat funny that \␣
, which seems more complex on the surface, is actually a primitive TeX command.)
You want to set \spaceskip
to a non null value (and perhaps also \xspaceskip
).
\documentclass{article}
\usepackage{fontspec}
\usepackage{xpatch}
\setmainfont{Linux Libertine O}[
SmallCapsFeatures = {
Letters = SmallCaps,
LetterSpace = 20,
}
]
\xapptocmd{\scshape}
{\spaceskip=3\fontdimen2\font plus 3\fontdimen3\font minus \fontdimen4\font
\xspaceskip=2\fontdimen7\font}
{}{}
\begin{document}
The title of my article is \textsc{This is the moment your life changed forever}.
Here the space is normal.
\end{document}
The values are of course exaggerated: here the interword space is set to three times the normal value.
When \spaceskip
has a nonzero value, it is used for the interword space instead of the default font defined one. The relevant font parameters are
\fontdimen2\font
(the natural width of the interword space)
\fontdimen3\font
(the stretch component)
\fontdimen4\font
(the shrink component)
Thus, specifying
\spaceskip=3\fontdimen2\font plus 3\fontdimen3\font minus \fontdimen4\font
we're telling to use three times the normal interword space, stretchable three times as much it is normally and shrinking it the same as the default. The parameter \xspaceskip
is related to the space factor: when the space factor is >2000, TeX adds its value to the normal interword space (this is how the space is increased after periods); by default TeX uses \fontdimen7\font
, but it uses \xspaceskip
if it is nonzero.
Best Answer
The amount of shrinkability is defined by the font metrics of the current font. Its value can be retrieved as
\fontdimen4\font
and it should be compared to the standard interword space, residing in\fontdimen2\font
. The standard Computer Modern Roman font at 10pt has\fontdimen 2 = 3.33333pt
\fontdimen 4 = 1.11111pt
whereas the NewTX font (a clone of Times) has
\fontdimen 2 = 2.5pt
\fontdimen 4 = 1.00006pt
so the interword space can shrink up to 1.5pt. By contrast, TeX Gyre Bonum, which is quite a wide font has
\fontdimen 2 = 3.2pt
\fontdimen 4 = 1.06999pt
There is no “universal threshold”: the font designer decides.
You can change the value of the relevant
\fontdimen
, but there are some points to be considered:\fontdimen
is global;\fontdimen
must be done for every font variant (shape, weight or size) you use.So, if you do
this would only affect the
\normalfont
at\normalsize
. You might hook into\selectfont
for setting\fontdimen4\font
to, say, one third of\fontdimen2\font
, but this would also act on the monospaced fonts that, usually, have zero shrinkability.Example.
Without the
\AddToHook
declaration, the same code would produce