On 23.10.2008, at 00:00, Andre Poenitz wrote:
Since I started to waste the evening with TeX, the final version:
\def\plus{+}
\def\gobble#1{}
\catcode`\+=\active
\def\checknextchar{%
\ifx\nextchar+%
\raisebox{0.6ex}{\tiny\plus\kern-.3ex\plus}%
\let\next\gobble%
\else%
\plus%
\let\next\relax%
\fi%
\next%
}
\def+{\futurelet\nextchar\checknextchar}
It starts getting readable, so I better stop now.
Andre', thanks a lot!
*That* is quite impressive -- and actually readable. I think I even
understand it!
I applied it immediately to my thesis document -- and had to learn
quickly that my clever-to-be idea wasn't actually that clever.
Apparently, I use "C++" in quite some label texts. Well, that would be
easy to fix, wouldn't it? However, not so easy to fix would be the
listings package. You cannot imagine how many times the string "C++"
is used internally when you apply lstlisting to typeset C++ listings...
Turning characters into active characters is a really good way to shot
oneself into the knee :-)
I nevertheless kept this code as a comment in my preamble, just to
keep the reference. It really is the most readable application of
catcodes I have ever seen and I have learned a lot from it!
Daniel