I'd like to use in math mode instead the only letter g the \mbox{g} (with another tail). How possible to redefine it globally? I found example to redefine letter z:

\catcode`\z=\active \def z{Yawn, I'm tired}

But it does not work for letter g! The code

\catcode`\g=\active \def g{\mbox{g}}

returns errors.


1 Answer 1


Making letters into active characters is definitely not a good idea.

For instance, after


you are not allowed to use \begin any more.

For math mode there's a different solution:

\begingroup\lccode`~=`g \lowercase{\endgroup\def~}{\mbox{g}}

This makes g into a math active character; since \mbox switches to text mode, the g will not cause problems.

With \catcode`\g=\active \def g{\mbox{g}} you're basically doing the same as


which starts an infinite loop as soon as \foo is expanded.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .