4

Somewhat related to Understanding \@ifnextchar question...

Is there any variant of \@ifnextchar which does not skip whitespace, i.e. which takes whitespace into account? For example, one would like to test whether a is immediately followed by b.

TeXnician
  • 33,589
ivankokan
  • 1,046
  • 2
    \futurelet, \@ifnextchar is a latex wrapper around \futurelet where skipping space is the main thing it does, – David Carlisle Dec 11 '17 at 14:30
  • 1
    As an addition you can look here: https://mirror.hmc.edu/ctan/macros/latex/contrib/ifnextok/ifnextok.pdf. – koleygr Dec 11 '17 at 14:44
  • // amsmath (technically amsgen) defines \new@ifnextchar but this appears to be an internal undocumented macro. – user202729 Oct 16 '22 at 05:08

1 Answers1

6

Package ltxcmds defines \ltx@ifnextchar@nospace that does not skip spaces. From its documentation:

\ltx@ifnextchar@nospace {⟨char⟩} {⟨yes⟩} {⟨no⟩}

Macro \ltx@ifnextchar@nospace behaves like macro \ltx@ifnextchar with the exception that optional spaces are not supported before char. Since 2011/04/14 v1.19.

Heiko Oberdiek
  • 271,626