Is it possible to define a command \MyCommand which does not swallow the next space (standard) but inserts a real space after itself only if the next symbol followed by it is a real space-symbol or CR? The command is supposed to have no arguments.
Asked
Active
Viewed 406 times
0
1 Answers
1
No, because the following space has been swallowed by TeX's parser already before the command itself runs.
Harald Hanche-Olsen
- 15,968
-
Do I right guess that an attempt to catch a space symbol after a command by construction
\@ifnextchar ... \fiwill not help? – May 10 '18 at 12:20 -
@maximav The guess should not be about space symbols but about space tokens. (La)TeX' reading- and tokenizing-apparatus will not tokenize a space-character trailing something that was tokenized as a control word token. Besides this,the LaTeX2e-kernel-variant of
\@ifnextcharcannot easily be used for checking for space-tokens. Internally it uses\letin a way where space-tokens will be treated as<one optional space>which will be discarded, leading to unpredictable results. This is rectified with some packages that redefine\@ifnextchar. – Ulrich Diez May 31 '18 at 17:04
\MyCommand{}? – gusbrs May 06 '18 at 11:56