I am trying to define a new command representing a ternary operator
\newcommand{\ternary}[1][2][3]{\textbf{if} \quad #1 \quad \textbf{then} \quad #2 \quad \textbf{else} \quad #3}
Do you see why this error occurs and how it could be fixed?
\newcommand{\ternary}[3]{...}
\newcommand{\ternary}[1][2][3]{...}
\def\ternary#1#2#3{...}
xparse
\newcommand{\ternary}[3]{...}, not\newcommand{\ternary}[1][2][3]{...}. Maybe you are mixing it with the plain TeX way which would be\def\ternary#1#2#3{...}. – campa Jun 22 '21 at 12:17xparsepackage for writing macros, it makes it much easier in my opinion. – likethevegetable Jun 22 '21 at 18:04