\ifnum
works fine it it's got two straight numbers. However, when calculation is involved, I get bunch of ! Missing = inserted for \ifnum.
errors. Is there any way to solve that problem?
\newcommand{\axes}[1]{
\ifnum\ifnum#1>180 1\else\ifnum#1>-180 0\else1\fi\fi =1
blah;
\fi}
\axes{200}; % fine
\def\anga{20.5};
\axes{180+\anga}; % not fine
Best Answer
You can't use arithmetic expression in TeX primitives. However, since modern TeX all support eTeX extensions, you can use
\numexpr
to do the calculation:If you use
pgf
ortikz
to draw axis (why not?), you can usepgfmath
for length arithmetic.