# Why do I get an “Incomplete \ifx” in this MWE?

I am trying to redefine the figure environment, which works fine in general. However, if the body of the figure environment to be replaced includes a tabular environment inside a conditional expression, I receive the error

"Incomplete \ifx; all text was ignored after line 11"

I find this pretty surprising, since my renewed environment does not even used that body. It does not strictly depend on tabular, a tikzpicture raises the same error. Also, it does not depend on \ifpdf, other valid conditionals raise the same error, too.

This is my code:

\documentclass{article}
\usepackage{environ}
\RenewEnviron{figure}{It's gone!}

\usepackage{ifpdf}
\begin{document}
\begin{figure}
\ifpdf
\begin{tabular}{l}
This works without RenewEnviron, ifpdf or tabular!
\end{tabular}
\else\fi
\end{figure}
\end{document}

• Interesting: it seems to work if you enclose the tabular in a group. – campa Jan 30 at 7:55
• \usepackage{newenviron} and \renewenviron{figure}{It's gone!} fixes the issue, too. – bers Jan 30 at 8:24
• hmmmm \Push@Begins #1\begin #2->\ifx \end #2\else b\expandafter \Push@Begins \fi  Not good :-) – David Carlisle Jan 30 at 9:11