LaTeX is trying to add a missing $ that I don't want to the following code. Minimal working example:
\documentclass[letter,12pt]{article}
\newcommand{\monkeyBeans}[2][]{
\parbox{4in}{#1}
}
\begin{document}
\parbox{4in}{$[a, b]$}
\monkeyBeans[$[a, b]$]{yo monkey}
\end{document}
If I try any of the following lines in my document instead of the call to monkeyBeans, there is no error:
\parbox{4in}{$[a, b]$}
\monkeyBeans[yo monkey]{$[a, b]$}
\monkeyBeans[$(a, b)$]{yo monkey}
\monkeyBeans{$[a, b]$}{yo monkey}
What is the deal with square brackets in optional arguments?
tabularthat is ended in\monkeyBeans? A minimal working example (MWE) would really help here. It should start with\documentclass{...}and end with\end{document}. – Werner Nov 28 '12 at 03:15\monkeyBeans[{$[a, b]$}]{yo monkey}or[${[a, b]}$], …) otherwise the inner/first]is used as the end of your optional argument, and then all hell breaks loose. – Qrrbrbirlbel Nov 28 '12 at 05:04