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

List:       vim
Subject:    Re: tex-utf8 table (was Re: unicode & latex)
From:       Jos van den Oever <oever () FenK ! wau ! nl>
Date:       2002-04-18 8:12:41
[Download RAW message or body]

On Thursday 18 April 2002 09:30, Jos van den Oever wrote:
<snip>

> > > I once wrote a qt app, that did the ascii to unicode on reading and
> > > unicode to ascii on writing. I worked wonderfully, albeit slow at
> > > reading and writeing the file with QString and other slow classes.
> > > Unfortunately, I deleted it by accident and only have an older version
> > > left. I didn't have the heart to restart. The conversion did require
> > > some special attention, but I got it working flawlessly. Now that I'm
> > > accustumed to vim, I think customizing vim is an easier solution than
> > > writing a qt app.
> > >
> > > You are right to be on the safe side. Keeping the code in utf8 is the
> > > way to go. Once I finish the script for utf8 to latex, I'll post it.
> > > Don't hold your breath though: I need to dig deep.
> > >

Three s///g's per symbol suffice to convert from unicode to latex:

The last character in a line is easy:
	s/α$/\\alpha/g

When the unicode symbol precedes a letter, the command must be separated from 
the rest of the text with a space. The space is only used as a delimiter and 
ignored for spacing.
	s/α([A-Za-z])/\\alpha $1/g

If there's no letter after the symbol, no need for a space.
	s/α([^A-Za-z])/\\alpha$1/g

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

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