GeneralRedefine reserved character

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Andy32
Posts: 2
Joined: Wed Nov 30, 2011 6:17 pm

Redefine reserved character

Post by Andy32 »

Is it possible to do an equivalent of \renewcommand{\command}[args]{text}
for a reserved character such as the caret (^)? For example, if I want to reduce the space after every superscript, i.e. i would want a^b to be replaced by a^b\! systematically?

Many thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Redefine reserved character

Post by Stefan Kottwitz »

Hi Andy,

welcome to the board!

You could make ^ to an active character and then define a macro for it:

Code: Select all

\catcode`^=\active
\newcommand{^}[1]{{\sp{#1}\!}}
Stefan
LaTeX.org admin
Andy32
Posts: 2
Joined: Wed Nov 30, 2011 6:17 pm

Re: Redefine reserved character

Post by Andy32 »

Hey thanks glad to be here and that looks perfect!
Post Reply