I'm writing a tabular using the spreadtab package for some calculus. I want to write it's rows only under a certain condition, i.e. to test in each of its rows if the condition is true, and then write this row, and not write the row it if the condition is false. All is ok when I do this in a tabular environment, like in this example, where the line of 3 is not written, because '1=2' is false:
Tabular\\
\begin{tabular}{|c|c|}
\hline
1&1 \\ \hline
\ifnum 1=1 2&2 \fi \\ \hline
\ifnum 1=2 3&3 \\ \hline\fi
\ifnum 1=1 4&4 \fi \\ \hline
\end{tabular}
\\
End of Tabular
which compiles well like this:
Now if I insert the same tabular in a spreadtab environment, like in this macro:
\begin{spreadtab}{{tabular}{|c|c|}}
\hline
1&1\\
\ifnum 1=1 2&2 \fi \\ \hline
\ifnum 1=2 3&3 \\ \hline\fi
\ifnum 1=1 4&4 \fi \\ \hline
\end{spreadtab}
The program doesn't compile and I have this message of error:
! Undefined control sequence.
<argument> 2 \fi \@@nil
&
l.26 ^^I\end{spreadtab}
what is the problem in my program and how can I repair it ? Thank you