Re: Redefine underscore in math mode

Nikolaj Fogh wrote:

Something like that, but it replaces all underscores, even those in labels. It is only underscores in the math environment which should be redefined.

Ok. Then "_" must be active only in math mode. That's that? In fact \mathcode`_="8000 (i.e. "active math") in plain TeX and LaTeX. To use this mathcode, the character must have catcode 11 or 12. So "_" can be use in text!


\section{A test}
$P_{with a text}$ in section~\ref{sec_test}. We can typeset
_. Strange, isn't it? In equation~\ref{eq_test}, label works too.

  P_{with a text}


  Jean-Côme Charpentier