I have been using the optional package in order to conveniently create solutions in the same document. I had been writing solutions longhand by placing it inside:
\opt{optS}{\color{blue} \textbf{Solution:} asdfasdf \color{black}}
But I'd like to save time by creating an environment that includes the \opt{optS} call. I tried doing it with the following code:
\newenvironment{sol}
{ \opt{optS}{\color{blue} \textbf{Solution:} }}
It appears to work nicely when I have optS selected when I compile. But if optO is used during compiling, the solutions still appear but now in black. Is there something I'm missing with including the \opt{optS} inside a new environment? Thank you for the help!
edit
Sorry for the lack of clarity. My intention is to have
\begin{sol} text of solution here \end{sol}
such that the \newenvironment{sol} wraps the "text of solution here" inside an \optS{ } so that the solution only appears when compiled with the optS optional argument. I additionally had it automatically making it blue and putting "Solution:" before it but that works fine. I think the real issue is that the \optS{ needs be included in the prior arguments to \newenvironment but the closing } needs to be in the ending arguments and I don't think \newenvironment allows unequal brackets in that way.