I want to have a command that does the following:
\documentclass[a4paper]{letter}
\newcommand{\stuffing}[2][]{\ensuremath{W_{\mathtt{#2}}^{^{\left[#1\right]}}}}
\begin{document}
what I want: $W_\mathtt{a}$ and \stuffing[5]{a}
but what I get: \stuffing{a} and \stuffing[5]{a}
\end{document}
So, is there a way to include the brackets only when the optional argument is included? Or should I just make a new comment when the superscript is added? Since I cannot enter this: \stuffing[\left[5\right]]{a}
output of the example: