I have this command that's part of something bigger
\newcommand{\customParagraph}[2][1]{% Title, Name
\ifthenelse{\isempty{#1}}
{\def \customParTitle{}}
{\edef\customParTitle{ -- #1}}
\edef\customParTitle{#2\customParTitle} % This can be used by other commands to populate ToC
\subparagraph*{\customParTitle}
}
In my documents I call it like \customParagraph{Proof}
or \customParagraph[Proof of something]{Proof}
to get my subparagraphs. If I put some inline math in the first argument it's fine, but as soon as I put a command in there like \customParagraph[Proof of something in $\R$]{Proof}
, where \R
is defined as \newcommand*{\R}{\mathbb{R}}
, I get an Undefined control sequence error at the corresponding line. Putting \mathbb{R}
directly gives the same result.
How can I fix this command to get the expected result? Keep in mind that the definition of \customParTitle
can be used as below
\addcontentsline{toc}{...}{\customParTitle}