# Change color in both text and equations

Is it possible to make a command that changes the color of both text and math, including in equations, for everything between brackets.

So for example something that does either

Either:

\toRed{
text
$$1+1=2$$
}


or

{\toRed text
$$1+1=2$$
}


such that both the equation and the text are shown red.

P.S. If it screws up formatting it is okay with me as long as it is readable as this would be used only to put comments which won't be in any final product.

Update:

\textcolor{red}{text
$$1+1=2$$
more text

some more text
}


which gives an error. The problem was that the paragraph ended before the textcolor was closed. I see that \color as suggested in the answer does allow closing in a different paragraph. Since I want this to be allowed and prefer a command that opens and closes over including color within brackets I chose to go with:

\newcommand{\myname}[1]{ {\color{red} #1 }}

• Just an extra option, that you might find useful: marginnote - it is great for non-permanent comments in the compiled document. sharelatex.com/learn/Margin_notes – hpekristiansen Sep 17 '18 at 17:00
• what did you try? the standard color command should do that {\color{red} text .... – David Carlisle Sep 17 '18 at 17:16
• Wow sorry for asking this. That was really stupid. I did try something and it didn't work but now I can't even find anymore how I can not make it work. All the intuitive methods work. Even using textcolor which I thought might have been my mistake. I must have made a stupid different mistake. (I was tired) – Kvothe Sep 18 '18 at 8:45

Like David Carlisle wrote in the comments, it is possible by simply using the \color command inside of a block:

Some text ...

{
\color{red}
Red text ...
$$1+1=2$$
}

Some more text ...


The result looks like: