New answers tagged


Your assignments within the macro make it not expandable, and therefore you cannot nest it within other macros. If you go without the assignment, then you can nest them: \documentclass{article} \newcommand{\nand}[2]{% \ifnum #1=#2 \ifnum #1=1 0\else 1 \fi \else 1 \fi } \begin{document} \verb|\nand{0}{0}|: \nand{0}{0}% 1 \verb|\nand{0}{1}|: \nand{0}{...


It works if you write it this way: \newcommand\nand[2]{ \ifnum #1=#2 \ifnum #1=1 0 \else 1 \fi \else 1 \fi }

Top 50 recent answers are included