I would like to have a macro \ignorepars
that removes all \par
s following it. I wrote the following code:
\def\eat{}
\def\ignorepars{\futurelet\next\ignoreparsA}
\def\ignoreparsA{\ifx\next\par\expandafter\ignorepars\eat\fi}
but it does not work (it causes a TeX capacity exceeded error).
Suppose, for example, I have \ignorepars\par x
. Then, according to me, the expansion of \ignorepars
makes \next
like \par
and the token list becomes \ignoreparsA\par x
; next after expanding \ignoreparsA
it remains \expandafter\ignorepars\eat\par x
; so, after another expansion the token list becomes \ignorepars x
; which make \next
have the value x and expands to \ignoreparsA x
; this expands to nothing becase the \ifx
predicate is false.
What is happening instead?
EDIT: \def\eat{}
should have been \long\def\eat#1{}
(it was a typing error)
\eat
should take a paramater to actually eat something, i.e.\def\eat#1{}
.\eat
should be\long