[AUCTeX] Replace something in math mode only

2007-01-28 Thread Alexey Romanov
I find that I often need, when editing papers, to change notation. Let's say I
need to rename k to f. Obviously, simply using query-replace is not a good idea
-- it will find all appearances of the letter k in the text.  Is there any way
to do the same as query-replace -- but only within math and displaymath modes?



___
auctex mailing list
auctex@gnu.org
http://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Replace something in math mode only

2007-01-28 Thread Ralf Angeli
* Alexey Romanov (2007-01-28) writes:

 I find that I often need, when editing papers, to change
 notation. Let's say I need to rename k to f. Obviously, simply using
 query-replace is not a good idea -- it will find all appearances of
 the letter k in the text.  Is there any way to do the same as
 query-replace -- but only within math and displaymath modes?

M-x query-replace-regexp-eval RET k RET (if (texmathp) f k) RET

This will still find all appearances of k but only replace those
which are in math constructs (unless `texmathp', the function to check
that, fails).

-- 
Ralf


___
auctex mailing list
auctex@gnu.org
http://lists.gnu.org/mailman/listinfo/auctex