I'm writing a document where I had to change all instances of the variable i
to x
and the document is already considerably long. Is there a editor that will allow me to do this, or in general, replace text inside math environments?
[Tex/LaTex] Editor that replaces only text inside math environments
editors
Best Answer
emacs can do this sort of thing fairly easily
this looks for
$
\(
\[
\begin{equation}
\begin{align}
as math-start. Other environments can be added.Starting from a document such as
then executing
M-x change-mathvar
the editor will prompt for the old and new names then do a query-replace of the variable names to produce:Note it hasn't changed anything out of math and it only changes
i
where it appears as a complete word, notaib
. If you wantaib
to change as well change thet
in the code tonil
to make a non-delimited match.