I encounter various problems when i want to control the display of a table with a ifthenelse test. For example, consider the following M(non)WE :
\documentclass{article}
\usepackage{multirow}
\usepackage{ifthen}
\newcommand{\essai}[1]{
\begin{tabular}{cc}
a&b \\ \hline
\ifthenelse{\equal{#1}{coucou}}{\multicolumn{2}{|c|}{oui - #1} \\ \hline}{non \\ \hline}
\end{tabular}
}
\begin{document}
\essai{coucou}
\end{document}
If i call \essai{hallo}, then the ifthenelse test is false, and it compiles : the second line of the table has 2 columns, as expected.
If i call \essai{coucou}, then the test is true and i would expect to have a multicolumn line. But it gives a compilation error Misplaced \omit...
\noaligndo exactly ? – Loic Rosnay Jan 26 '12 at 12:40\noalignis a TeX primitive designed so that you can put in some vertical matter for example a paragraph that does not take part in the table, and then the table rows continue afterwards. The amsmath alignments have a command that uses noalign in this way but if you search for noalign in the latex sources (eg latex.ltx) you'll see it is used all over the place for the reason given here. It is used in processing\\so it can handle looking for optional arguments, it's used in\hlineto hide the code that looks for a following\hlineagain so that\multicolumnworks. etc... – David Carlisle Jan 26 '12 at 13:13