I have experienced a very frustrating feature of LaTeX.
I have used bnf.tex to be able to write a BNF grammar definition. As I found the notation <some text> very convenient, I decided to use it through the entire document. This might be a bad idea, but now I would rather not change the whole source.
Here are my macros:
{\catcode`\ =\active{\global\let =\ }}
\gdef<{\ensuremath{\langle}%
\ifmmode\catcode`\ =\active\relax\fi%
\begingroup\sf}
\gdef>{\/\endgroup\ensuremath{\rangle}%
\ifmmode\catcode`\ =10\relax\fi%
\relax}
It works very well, except when argument to complex math commands.
So
<cou cou>
$<cou cou>$
and $\sqrt{<cou cou>}$
will keep their inner space, but
$$\frac{<cou cou>}{E}$$
and $\Instr{<cou cou>}{E}$
will lose their's, looking like <coucou>.
In fact, any solution formatting the text between < and > as normal (\sf) text in both math and normal mode would be very useful here :-)
Here is a full file containing the examples:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8x]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\DeclareMathOperator{\instr}{Instr}
\newcommand{\Instr}[2]{\instr(#1,#2)}
\catcode`\>\active
\catcode`\<\active
{\catcode`\ =\active{\global\let =\ }}
\begingroup
\gdef<{\ensuremath{\langle}%
\ifmmode\catcode`\ =\active\relax\fi%
\begingroup\sf}
\gdef>{\/\endgroup\ensuremath{\rangle}%
\ifmmode\catcode`\ =10\relax\fi%
\relax}
\endgroup
\begin{document}
<cou cou>
$<cou cou>$
$$\frac{<cou cou>}{E}$$
$\Instr{<cou cou>}{E}$
\end{document}
