Change color of certain symbols

I’m working on a model that requires laborious calculations. For example, the following one:


Is it there a way to change the color of each occurrence of, e.g. x_t-\mu_x all at once, so that I will make less mistake in combining the terms?

2 Likes

The structured search-and-replace tool (manual: Search and replace) almost worked in the test I just did.
It replaced all occurrences but the first one (is that a bug?) and I did not find the way to exclude the expressions which were already blue.
With a Scheme expression I expect one will do it, but if it works with the search and replace tool in my opinion it is better.
If I do some progress I will post again.

Thank you! A quick question. When I try the Search tool, it doesn’t find symbols in equations. It only finds matches in the text environment. Is there something I need to add in order to search in math environments? In addition, how do I search for Greek letters and symbols with super/sub-scripts?

Thanks again!

1 Like

You have to expand the tool first, with the rectangular icon on the bottom right (on the right of the funnel icon). “Expanding” the tool changes it into the structured search and replace tool.
The “Search and replace” section of the manual has several explanations on structured search and replace, I think it is helpul to read it, but I did not find the explanation on how to exclude matches which are inside a given tag (i.e. “blue” in your case).

Thank you! It works!

1 Like

To apply changes one first needs to highlight a single occurrence of the search term with the arrows at the left of the lower bar of the search and replace tool.
I do not know how to avoid matching again a term that has already matched and has been turned blue.

The matching, seems to me, works imperfectly. For example I have first searched for a non-existing blue string and now I cannot match the same string (without color).

It seems to work well for me:


After this replacement over the whole file, I can still search for the top one.