I am looking for a case equivalent of \ifx. So, when I have nested uses of \ifx it would be cleaner to specify it in some sort of syntax similar to:
\newcommand*{\ColorSymbol}[1]{%
\ifxcase#1{%
{\exists}{\color{red}#1}%
{\ge}{\mathrel{\color{orange}#1}}%
{\le}{\mathrel{\color{blue}#1}}%
}[#1\footnote{Unknown symbol: \string#1}]%
}%
instead of nesting \ifxs as is done in the MWE.
Notes:
- Don't require the syntax to be identical to that, just something easier to read than the MWE.
MWE:
\documentclass{article}
\usepackage{mathtools}
\usepackage{xstring}
\usepackage{xcolor}
\newcommand*{\ColorSymbol}[1]{%
\ifx#1\exists
{\color{red}#1}%
\else
\ifx#1\ge
\mathrel{\color{orange}#1}%
\else
\ifx#1\le
\mathrel{\color{blue}#1}%
\else
#1%
\footnote{Unknown symbol: \string#1}%
\fi
\fi
\fi
}%
%%% Would prefer some case like syntax:
%\newcommand*{\ColorSymbol}[1]{%
% \ifxcase#1{%
% {\exists}{\color{red}#1}%
% {\ge}{\mathrel{\color{orange}#1}}%
% {\le}{\mathrel{\color{blue}#1}}%
% }[#1\footnote{Unknown symbol: \string#1}]%
%}%
\begin{document}
$\ColorSymbol\exists x$
$A \ColorSymbol= B$
$a \ColorSymbol\ge n$,
$x \ColorSymbol\le z$
\end{document}

