Is there an editor or IDE (or a script) for substituting the TeX-Commands $ and $$ for opening and closing math regions into the corresponding LaTeX-Commands \(,\) and \[,\]?
I'm sure there is a tool - and I'm searching for. I think, this will result in better readable code. A simple search and replace wont do that - but with regular expressions, that should not be problem. I simply do not want to invent the wheel a second time.
|
|
|||
| show 3 more comments |
|
Although I like Andrew's answer since that script apparently handles a little more than (my invocation of) good old
Basically, it replaces each occurence of |
|||
|
|
|
A search led me to this website where I found:
I also found an explanation of the name buried in an obscure answer on this site. |
|||||||
|
sed -r 's/\$\$([^\$]+)\$\$/\\[\1\\]/g' | sed -r 's/\$([^\$]+)\$/\\(\1\\)/g'It can probably be done more compactly. But that should work for most cases. – Roelof Spijker Feb 28 '12 at 8:28$and$$s. – Bastian Ebeling Feb 28 '12 at 9:13sedscript might break if you do funny stuff like$x=y\ \text{and of course also $z$}$– Seamus Feb 28 '12 at 10:23$a$$b$(I think the sed script would be okay on this one) and$\$a$(which I don't think it would get). – Andrew Stacey Feb 28 '12 at 10:56