find and replace in equations
Allow find and replace to work better with equations. I would like to highlight a part of an equation and press control f or control h to search for (or replace) to find the selection in other equations. It works for simple character sequences, but not for anything with formatting such as superscripts, division, etc. I have to change equations to Linear first, both the one I wish to find/copy/replace and the equations that need to be searched. Then after I'm done finding and replacing I need to change those formulas back to Professional.
As an additional frustration, if I copy the the selection first and paste it in the find or find/replace boxes, then it loses formatting and even simple characters can't be found in this way. Equation selections need to be highlighted and control F or control H pressed directly.
For example pressing control f while highlighting "C1" tries to find find "C1" if the highlighted "C1" was in professional format.
As an example of why copy/paste needed for find/replace, if I want to build an expression in the "replace with" field I would try to select the portion of the equation, copy, and then paste into the replace with field, but the formatting changes so it will be incorrect. But if I highlight, press control H to get it in the "find what" field, I can then highlight and copy what is in the "find what" field to paste in the "replace with" field, but it overwrites what was in the "find what" field before and I have to use the dropdown to get the right entry from the history.
Highlight and control h doesn't always work reliably either to put the text in the "find what" field, sometimes requiring control f then copying and pasting that field to the find/replace dialogue.
Find doesn't like equation elements with "^" either.
5 comments

Anonymous commented
How to replace a word with Nil, but without a line space ? Anyone can help ??

Nebula commented
update on previous post, you have to linearize all equations first, as follows, then it works in 365 as well:
There is, but with limitations, and it's clumsy.
Change all your equations to "Linear" (instead of "Professional").
For example, select all, go to the Equation tab, and click "Linear" on the left side.
Caution: Professional>Linear>Professional doesn't necessarily leave your equations unchanged. I have noticed that MathML imports from MathJaxnode often change when I roundtrip this way. Test your equations before you do a bulk conversion, or make backup copies!
Within one of your Linearmode equations, select the text you want to find (v^ for v^ in linear mode).
Hit Alt+F11 to get to the VBA editor
Hit Ctl+G to get to the Immediate pane
Type/paste in this line and hit Enter:Selection.Find.Text=Selection.Text
This copies the exact text you have selected in the equation into the "Find what" field of the Find dialog. A normal copy/paste won't work because you will get the normal text equivalents of the equation characters. Selecting text outside of an equation also won't work, for the same reason.Close the VBA editor and go back to Word.
Hit Ctl+F. You will see that the "Find" box is filled in with the equation symbols, e.g., v^. As long as you don't change that text, you can hit Find Next to go to the next equation that (1) contains exactly that text and (2) is in Linear mode. It doesn't work for me if the equations are built up ("Professional") mode.
When done searching, change your equations back to Professional mode.
A reason Find doesn't work in equations like it does in body text is that the symbols in newstyle equations are not the same as the corresponding symbols outside of equations. See Unicode Tech Note (UTN) #28 for the exact symbols and Unicode codepoints used for operators, and Charbase's list for the codepoints used for script characters.shareimprove this answer

Anonymous commented
I don't believe find and replace works at all with equations, other than after converting them entirely to text, does it? If I wanted to rename a variable occurring many times in many equations in a document, it would be nice to be able to do that just like we can with text. Equation Editor is long overdue an upgrade: I haven't noticed any that has corrected many of its bugs, such as the shortcut menu refusing to appear.

Marshall commented
Here's an example of something that works well, by capturing full expressions. It still couldn't distinguish between Z_p1 and Z+p or Z/p:
Find what:
(?)< 
Marshall commented
Please implement the find and search described here:
https://blogs.msdn.microsoft.com/murrays/2007/03/15/mathfindreplaceandrichtextsearches/With use from above I can now do the following as better partial work arounds:
Using wildcards helps to find more complex equations in find and replace. To find something like x_a, then "(?x?a?)" will allow "\1" to find and replace it correctly without destroying formatting as long as it is the full thing not x_a1.
Another note as to why just typing x?a in doesn't work is that in math equations different characters are used. Using the altx trick I find that x and a have codes 0078 and 0061, but in equations they are characters with codes 1D465 and 1D44E. Copy and paste into the advanced find changes them to standard characters. The highlight, find, then advanced find pulls them in correctly (most of the time). Typing in the character codes lets altx convert them to the right ones in the find or replace boxes (but it is hard to build up the right terms this way).