0

Many horizontal spacing commands are of course, found in What commands are there for horizontal spacing?.

I would like to inquire if, say, invoking the \enspace command, which produces a space of .5em, if it is possible to (simply) produce a horizontal space of exactly .25em by doing something analogous to the way one would scale an includegraphics picture?

Consider the code

\documentclass[12pt]{book}

\begin{document}
\thispagestyle{empty}
\noindent Adjust space.\\[10pt]
Adjust \enspace space.\\[10pt]
Adjust .5\enspace space.\\[10pt]
\end{document}

which produces

enter image description here

QUESTION: Is there something simple, along the lines of .5\enspace (which as you can see---does not work) that will produce a horizontal space (in this case) of .25em? More generally, if such can also be applied to other spacing commands such as \medspace or \quad, etc.?

Thank you.

3
  • 1
    no, \enspace is \kern0.5em just use \hspace{.25em} Commented Mar 25, 2023 at 18:16
  • Read the manual section 6.4.2 Spaces. Commented Mar 25, 2023 at 18:28
  • Depending on the font, the "em" and "en" might not actually be the expected values. TeX calculates one way, but the font does its own thing. If you actually want the specific width of a character (including its side bearings) you can put it in a box, measure the width of the box, but not actually use the box for print.
    – user287367
    Commented Mar 25, 2023 at 18:47

1 Answer 1

2

no, \enspace is \kern0.5em just use \hspace{.25em}

enter image description here

if you really want this you do not want to scale the command that adds the space, but you can see what space was added and scale that. This simple version discards any stretch component

\documentclass[12pt]{book}
\def\hscale#1{{%
\ifnum\lastnodetype=11
\skip0=\lastskip\unskip
\hskip#1\skip0\relax
\else
\ifnum\lastnodetype=12
\dimen0=\lastkern\unkern
\kern#1\dimen0\relax
\fi
\fi}\ignorespaces}

\begin{document}
\thispagestyle{empty}
\noindent Adjust space.\\[10pt]
Adjust\enspace space.\\[10pt]
Adjust\enspace\hscale{.5} space.\\[10pt]
Adjust\enspace\hscale{5} space.\\[10pt]
Adjust\quad space.\\[10pt]
Adjust\quad\hscale{2.5} space.\\[10pt]
xxx
\end{document}
1
  • Many thanks for this very helpful answer.
    – DDS
    Commented Mar 25, 2023 at 18:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .