[texhax] ifthenelse - how to check if an argument is empty?

Johan Glimming glimming at kth.se
Wed Mar 2 16:21:45 CET 2005


Hi

I have written a little wrapper around mathparir's \inferrule (aka 
\infer) macro as follows:

   \newcommand\twolines[2]
     {\begin{tabular}{l}#1 \\ #2\end{tabular}}
   \newcommand\inference[4][]
     {
      \ifthenelse{\equal{#2}{}}
         {\mbox{\infer[#1]{#3}{#4}}}
         {\mbox{\infer[\twolines{#1}{\normalfont{#2}}]{#3}{#4}}}
     }

This typesets an inference rule with label #1 and side-condition #2,
premises #3, and conclusions #4.

However, the above macro gives me errors when I included the above bad 
code for checking if no side condition is given. If a side condition is 
given I use a tabular environment to stack the label and the 
side-condition over the actual rule.

The question is really: how can I check if #2 is empty? #2 may contain 
math mode content.

Johan Glimming.



More information about the texhax mailing list