0

This is regarding what's mentioned in the title itself. I'm writing a report now about 30 pages long. I noticed that for a particular notation, for eg. say R would be better instead r. The letter r appeared quite often throughout the report. Is there a way to avoid going line by line to make the change ? I mean, is there an option in .tex that makes an initial notation change, that'll affect in rest of the file. I hope the question is clear enough. Thank you in advance.

Eureka
  • 1,013
  • 4
    Find/replace tool from your editor? – Sigur Mar 07 '18 at 20:17
  • 4
    If the letter is created by a command, for example \rho for the greek letter 'ρ', then you can redefine this command to denote something else throughout the document. But still it would be just as easy (and less confusing) to find and replace in your editor. – Marijn Mar 07 '18 at 20:26

1 Answers1

5

You probably do not want LaTeX to replace every r by a R, because then for example report would be displayed as RepoRt. This can also something you have to keep in mind when doing a find/replace with your editor.

If you write

\mathcode`r=`R

LaTeX will replace every r by an R in math-mode, so $r$ is displayed like $R$, while normal text is unaffected. But this comes with quite some risks: It is very confusing, because in your tex file r and R look like different variables while they produce the same output, so you can't assign different meanings to them. Also you have to make sure that there is no place in your document where you use a R which would conflict with an r, so at the beginning you have to go through your entire document and check it. But then, you can also just replace the letters by hand. So there is no significant advantage in using this command.

But even if you decide to do a manual conversion \mathcode can be useful: If you write

\mathcode`r="8000

TeX will print an error for every usage of r in math-mode, so depending on your editor this could mark every spot you might want to change and make sure that no r is missed. After the conversion is done, you can just delete this line again.