Occasionally I find that internal package code contains the macro \space
(defined as \def\space{ }
by LaTeX). The most-taught way to produce "explicit" spaces in paragraph text is to use \␣
, and I think I haven't seen any source teach \space
as a user-level command.
What community knowledge or practices are there regarding the use of \space
, especially as compared with \␣
?
Here some examples, from the memoir
class, which uses \space
as well as \␣
in its definitions.
- For example it defines
\newcommand*{\booknamenum}{\space}
; this macro is "called between printing the book name and the number". - A macro the user is more likely to encounter is
\printchapternum
;memoir
defines it using\renewcommand*{\printchapternum}{\centering\chapnumfont \thechapter\space\space}
, with two consecutive\space
s. - The class defines
\wrappingoff
(for use withinverbatim
environments) via\newcommand*{\wrappingoff}{\def\@xobeysp{\leavevmode\penalty\@M\ }\def\wrapright{}}
.
Related:
(An interesting observation regarding visual appearance within code: a\space\space␣b
and a\␣\␣b
within paragraph text give seemingly the same output (but note that I haven't tested the exact linebreaking behavior). I personally find \space
visually clearer than \␣
: when I see the letter string "space", I immediately know what it is. Backslashes and spaces are so ubiquitous in LaTeX that the combination \␣
is harder to make out on the screen. That said, such aspects should only be considered in contexts where there is functionally no difference between the two: only then can it be considered a question of coding style.)
\space
is expandable,\␣
isn't. Would you please add some examples?\cite{....}
with[]
).\␣
and\space
are equivalent with respect to the typographic output, the former (\␣
) is less obtrusive in user-level (document) code (where textual/mathematical content matters), while the latter (\space
) is clearer in a programming context (where function/semantics matters).