I am writing a document that contains some mathematical proofs. I would like to define a command in LaTeX that enables me to write some additional passages to my proofs which are shown only when a certain option is enabled. Moreover, these additional passages should have a different color from the rest of the text.
\documentclass{article}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{etoolbox}
\providetoggle{detail}
\settoggle{detail}{true}
\newcommand{\note}[2]{\iftoggle{detail}{
\color{red} #1 }{#2}}
\begin{document}
\begin{align}
a & = \note{b \\
& = c \\
& = d \\
& = } e.
\end{align}
\end{document}
The code above is a minimal example. LaTeX is compiling as expected, but the color applies only to "b" and not to the other terms contained in the \note.



