\catcode`\_=13 {\catcode`*=8 \gdef_{\ifmmode\let\next=*\else\let\next=\_\fi\next} } %This makes _ into a normal underscore when used in normal text, but %when you use it in mathmode it is still the underscore character. So %you can write % some_identifier $= x_0$ %but not % $$some_identifier = x_0$$ % %Which solution is most suitable depends on your application. % % Marcel van der Goot % marcel@vlsi.cs.caltech.edu