I have a question: Is there any way to have math (everything between
$s) in different colour than text (for example,
Beamer has this functionality already built in. The beamer colours
An alternative method which is more robust but interacts less well with beamer's internal colour stuff is to use the
This is a snippet in LuaTeX using regular expressions. We activate and deactivate searching manually by two TeX commands and in that selected part we search for
If you don't use LuaTeX, we could extract those selected parts, modify them and return them to the main TeX engine on-the-fly or after the run of TeX (the same method use external tools like MakeIndex, Xindy, ...).
I enclose the code (we run