Emacs question

Nov 17, 2006 12:02

Emacs users: how would you do this in Emacs? I've included a vi solution under the cut, but I suspect (based on the kind of thing we've been talking about recently) that, while the vi solution would work within Emacs, the most natural Emacs solution would look rather different.

You want to create a table of the Greek alphabet, in TeX, with lowercase and uppercase forms of the letters, their names, and similar symbols which they might be confused with. So you want a line of code to start the table and another to end it, and in the middle, you want lines like
$\alpha$ & A & Alpha & $\infinity$ \\
$\beta$ & $\Beta$ & Beta & \\
...
$\epsilon, \varepsilon$ & E & $\in$ \\
There are, as you can see, some irregularities - some Greek letters don't have uppercase equivalents in TeX (so there's no \Alpha or \Eta), some have alternate forms, and the "easily confused with" column has to be done by hand. But there's still a lot of redundancy in the table. What's the easiest way of creating this in Emacs?

Here's what I would have done in vi: type out the letters by hand, one to a line, uncapitalised. Select them all with $v{, then do the following substitution: :<,>s/\(.*\)/\\\1 \& \\\u\1 \& \u\1 \& \\\\ (with magic set), then fill in the alternate forms and "easily confused with" column by hand. Easy. Though if I'm being honest, I didn't know about the \u and \l modifiers (upper/lowercase next character) until I looked up the help while writing this.

Unfortunately, when I was actually doing this, I had access to neither vi nor Emacs - due to various annoyances, I had to create the document under Windows, using a ghastly excuse for an editor called WinEdt. If you are ever tempted to try using this "editor", resist. It will only cause pain.

computers, tex

Previous post Next post
Up