3

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}
  • 3
    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
  • 2
    hmmmm \Push@Begins #1\begin #2->\ifx \end #2\else b\expandafter \Push@Begins \fi Not good :-) – David Carlisle Jan 30 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.