[OS X TeX] math replace

Michael Sharpe msharpe at ucsd.edu
Thu Jun 27 17:13:50 EDT 2013


On Jun 27, 2013, at 7:12 AM, George Gratzer <gratzer at me.com> wrote:

> I would like to replace a large number of i-s to k-s in math. 
> 
> Is there any intelligent way to do it?
> 
> GG

I'm not sure there is a sure-fire way to do this because there are so many things that can go wrong with any simple algorithm. I made a few small modifications to my dedollar python script so that it will find all i contained in math delimited by either $...$ or $$...$$ and replace by k as long as they are not part of a control sequence. You are probably best off handling other display math environments manually, as you could end up modifying environment names and text embedded within the displays on a wholesale basis.

The script is named mathsubki, located on my site:

http://dl.dropboxusercontent.com/u/3825336/TeX/index.html

Place it in a the same folder as your tex file. Then open a Terminal window, cd to that folder and type, assuming you file is named xx.tex,

./mathsubki xx.tex

which should make a file named

xx-subki.tex

with the substitutions. I haven't tested this extensively, of course, but is does not write to your original file and cannot damage it.

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://email.esm.psu.edu/pipermail/macosx-tex/attachments/20130627/4d205947/attachment.html>


More information about the MacOSX-TeX mailing list