[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-users
Subject:    Re: Automagically reduce the spacing between "++" in the word "C++"
From:       Andre Poenitz <andre.poenitz () mathematik ! tu-chemnitz ! de>
Date:       2008-10-22 20:21:15
Message-ID: 20081022202115.GB5391 () tu-chemnitz ! de
[Download RAW message or body]

On Wed, Oct 22, 2008 at 09:22:35PM +0200, Andre Poenitz wrote:
> > I think that I remember to have read about so-called  catcodes (or  
> > whatever?) in TeX, which apparently make it possible to declare certain 
> > characters as "active" so that further processing is possible whenever 
> > the TeX scanner reads such character. I wonder if it is possible this way 
> > to declare in the preamble that
> >     "C" followed by "+", followed by "+"
> > is "active" and should be inherently substituted with something like  
> > "\mbox{C+\hspace{-.5ex}+}}"
> 
> Quick shot: [...]

Somewhat improved version:

\def\plus{+}
\catcode`\+=\active

\def\smallplusplus#1{\raisebox{0.6ex}{\tiny\plus\kern-.3ex\plus}}
\def+{\futurelet\nextchar\pluss}
\def\pluss{%
  \ifx\nextchar+%
  \let\next\smallplusplus%
  \else%
  \let\next\plus%
  \fi%
\next}

And no, I can't explain it.

Andre'
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic