# How to change the maths symbols in preamble?

I have already finished writing my work and now I decided to change notation. How can I do it in preamble? More precisely I use $\mathcal{R}([a,b])$ in all my work and I would prefer to get $\mathcal{R}[a,b]$.

-
Had you used something like \newcommand\myexp[3]{\mathcal{#1}([#2,#3])}, the only thing to do would be to delete the parentheses. –  Gonzalo Medina Jul 30 '12 at 16:27

You could redefine \mathcal to do the replacement on the fly but it would be fragile and make your tex fragments hard to use in any other context. Better to use a regular expression replace and just edit the source.

For example starting from a file reg.tex

$\mathcal{R}([a,b])$


then a sed command line such as

$sed -e 's/\\mathcal{R}($$[^()]*$$)/\\mathcal{R}\1/g' reg.tex  would output $\mathcal{R}[a,b]$ with the round brackets gone. sed is standard in some operating systems but similar regular expression edits could be made in any reasonable text editor. - Define a command: \newcommand{\myR}[2]{\mathcal{R}[#1,#2]}  and change all the instances of $\mathcal{R}([a,b])$ into $\myR{a}{b}$. It won't help you much this time, because you'll still have to manually (or semi-automatically, with regexp) the source. But when you change your mind and decide that $\mathcal{R}([a,b])\$ was better after all, you'll have it easier.

I realize this is probably not the answer you were expecting, but I guess other solutions are going to be a headache (now and later).

-