Please consider the following file:
\documentclass{article}
\newcommand{\ineq}[2][$0$]{#2<#1}
\[\ineq x\]
\end{document}
If I compile it, I get an error message, as it would be expected when one uses dollar signs within a \[…\] pair. The correct definition for the \ineq command should be
\newcommand{\ineq}[2][0]{#2<#1}
However, if I compile this file:
\documentclass{article}
\usepackage{amsmath}
\newcommand{\abc}[3][$0$]{\begin{cases}
#2& \text{ if } x \neq #1\\
#3&\text{ if } x= #1
\end{cases}}
\begin{document}
\[\abc ab\]
\end{document}
then I get no error message and everything works as if I had typed [0] instead of [$0$]. Why is it so?
