0

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.

1 Answers1

1

No, because the following space has been swallowed by TeX's parser already before the command itself runs.

  • Do I right guess that an attempt to catch a space symbol after a command by construction\@ifnextchar ... \fi will 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 \@ifnextchar cannot easily be used for checking for space-tokens. Internally it uses \let in 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