# Changing a greek letter control sequence

I have a TeX document with many occurrences of a Greek letter, say \kappa. Is there a command to change all \kappas to another letter, say \omega all at once, without changing each \kappa to \omega manually?

• Welcome to the TeX.SE community. Mar 16, 2022 at 21:05
• as the posted answer shows you could easily do his but I'd strongly advise against it. Even if there are a few hundreds, or few thousand \kappa in your document, changing them to \omega in your editor should only take a few seconds to type the replacement text. If you redefine the command then any fragments of the document that you move later to a new document or any fragmnts you copy from elsewhere won't get errors but will silently produce the wrong symbols. the document will be "an accident waiting to happen" Mar 16, 2022 at 21:10

Something as simple as this:

\renewcommand{\kappa}{\omega}


in the preamble?

The only caveat is that it'll no longer be possible to use \kappa for κ, so if you want to map something else to κ, it won't work. If needed, you can use \let to “save” the old \kappa with a different name. E.g., if you wanted to switch \omega and \kappa you could do:

\let\oldkappa=\kappa
\let\oldomega=\omega
\renewcommand{\kappa}{\oldomega}
\renewcommand{\omega}{\oldkappa}


Don't just use renewcommand with both the old names, or you'll at best end up with two commands the same, and at worst with circular definitions and neverending compilation process.

• Great! That works. Mar 16, 2022 at 21:10
• It might be better to issue \AtBeginDocument{\renewcommand{\kappa}{\omega}} if there are packages loaded that (re)define \kappa. Doubt it, but still.
– Werner
Mar 16, 2022 at 21:11