I defined a variable \@afwezig that holds people that were not present at a certain meeting.


Now I want to make the header of the meeting report as follows :

\begin{tabularx}{\linewidth}{l X}
  Aanwezig&: \@aanwezig \\
  Verontschuldigd&: \@verontschuldigd \\
 Afwezig&: \@afwezig \\
 \fi %



This is supposed to give a table with "Afwezig:" if I specify \afwezig{somename} in my document, but a table without the part "Afwezig:" if nothing is specified. Problem is, the part "Afwezig:" is displayed if I didn't specify '\afwezig', and I get tons of errors when I put \afwezig{} in my document file.

The first error:

! Incomplete \ifx; all text was ignored after line 10.

What am I doing wrong here?

PS : could somebody create a label with condition or if-else or so? thx

1 Answer 1


You should internally think about tabular cells as being local groups, so you can't open an \ifx in one cell and close it in another. To work around this problem, you need to use an expansion trick:

{Afwezig&: \@afwezig \\}

In general, this is a much cleaner way to deal with TeX conditions. Programming packages such as expl3 and etoolbox provide an easier way to write these constructs; e.g., in the former:

\tl_if_empty:NTF \@afwezig
  {Afwezig&: \@afwezig \\}
  • thx for the info. I figured out that if I delete the \relax, the code actually works as expected. I'll surely take a look at the packages you provided.
    – Joris Meys
    Oct 13, 2010 at 14:43
  • Even if it does in that case, be sure to be careful around conditionals and tabular material :-) Oct 14, 2010 at 14:47
  • I realized. I took your advice and rewrote the part already. Thx again for the help.
    – Joris Meys
    Oct 15, 2010 at 11:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .