I defined some macros to store data. Them, I typeset them in a table. If one of the macro is not executed (the corresponding data is not available, the row should not appear.



    \ifthenelse{\isundefined{\theversion}}{}{Version: &\theversion\\}%
    \ifthenelse{\isundefined{\therevised}}{}{Revised by: &\therevised\\}%
    \ifthenelse{\isundefined{\theapproved}}{}{Approved by:&\theapproved\\}%

\revised{J. Joe}
\approved{A. Uthor}

The code runs fine if I comment the \revised{J. Joe} line. But if I comment \approved{A. Uthor}, them the following error is rised:

! Misplaced \noalign.
\bottomrule ->\noalign 
                       {\ifnum 0=`}\fi \@aboverulesep =\aboverulesep \global...
l.34 \mytable

Can anyone help me to find the bug? Thanks in advance.


I don't know precisely what's going on, but it's clearly an expansion problem. It can be solved with more direct syntax:


    p{\dimexpr 0.4\linewidth-2\tabcolsep\relax}
    p{\dimexpr 0.6\linewidth-2\tabcolsep\relax}
    \ifdefined\theversion Version: &\theversion\\\fi
    \ifdefined\therevised Revised by: &\therevised\\\fi
    \ifdefined\theapproved Approved by:&\theapproved\\\fi

There's no need to declare those commands as robust. Moreover tabular* is useless and it's necessary to correct the width to take into account the separation between columns.

  • Thanks for the solution. The actual table is defined inside a sidenote of the tufte-latex package, and it is necessary to use the starred version of tabular (I don't know why) – TeXtnik Jul 19 '11 at 7:06

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.