我读过用户手册xifthen
包裹。
但是我没有找到“不等于”命令。我该如何设置以下规则:
\ifthenelse \cnttest{\Var} equal A: Do newcommand AAA
\ifthenelse \cnttest{\Var} equal B: Do newcommand BBB
\ifthenelse \cnttest{\Var} equal C: Do newcommand CCC
\ifthenelse \cnttest{\Var} not equal A, AND not equal B, AND not equal C: Do newcommand ABC
其他规则如下:
\ifthenelse \cnttest{\Var} not equal A, AND not equal B, AND not equal C: Do newcommand ABC
预先感谢
答案1
该\ifthenelse
宏有三个参数:
\ifthenelse{<test>}{<code for true>}{<code for false>}
因此你可以简单地嵌套调用:
\ifthenelse{\cnttest{\Var}{=}{1}}{Case 1}{%
\ifthenelse{\cnttest{\Var}{=}{2}}{Case 2}{%
\ifthenelse{\cnttest{\Var}{=}{3}}{Case 3}{%
{Case not 1, not 2, not 3}%
}%
}%
}