[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:       rgheck <rgheck () bobjweil ! com>
Date:       2008-10-23 0:15:10
Message-ID: 48FFC20E.8070501 () bobjweil ! com
[Download RAW message or body]

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.
>
>   
That's actually quite elegant, in fact. Well done!

> Incidentally, I stumbled across  htlatex  and start to wonder whether 
> this would be a good start for  tex2lyx.  It is able to process the
> macros above...
>
>   
Yes, I'd considered that, too. It obviously has a decent TeX parser in 
there. That said, have you look at plastex? It's python, but it also 
seems to have a good parser, and it gives you a DOM-like structure that 
can be manipulated all kinds of ways.

rh

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

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