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 ( Read more... )

computers, tex

Leave a comment

Comments 11

totherme November 17 2006, 14:18:12 UTC
My first thought (without having read your vim solution, and without thinking about it too much, because this is the sort of thing you usually want to do on the spur of the moment):

Using AUCTeX LaTeX/M mode (M means with the additional maths keybindings that all compski emacsers should be using by default), enter some $ signs to get into a math region. Then enter the whole greek alphabet in lowercase, using two keystrokes for each letter ("`a" becomes "\alpha", etc). All on one line saves keystrokes.

Once you've done that, use a keyboard macro ("C-x (" to start the macro and "C-x )" to finish. "C-x e" to execute, which may be given a numerical argument, to execute 20 times or whatever... How many greek letters are there anyway?) along with the search function (searching for "\" takes one simple chord and one press) to add most of the rest of the template (newlines and other such gumph).

Hopefully you can see how that could give us something like:

$\alpha$ & & & \\
$\beta$ & & & \\
...
without any trouble ( ... )

Reply


totherme November 17 2006, 14:55:40 UTC
Having read the vim solution ( ... )

Reply

totherme November 17 2006, 15:06:17 UTC


> let upper xs = (toUpper $ head xs):(tail xs) in unlines $ map (\x ->
"$\\"++x++"$ & $\\"++(upper x)++"$ & "++(upper x)++" & //") ["alpha",
"beta", "gamma", "delta"]
"$\\alpha$ & $\\Alpha$ & Alpha & //\n$\\beta$ & $\\Beta$ & Beta &
//\n$\\gamma$ & $\\Gamma$ & Gamma & //\n$\\delta$ & $\\Delta$ &
Delta & //\n"

Reply

totherme November 17 2006, 15:23:30 UTC
Just because I enjoy flooding your LJ:

* gds wonders how useful it'd be to have lambdabot hooks in a text editor...
gds: already has hooks :)
you can call it from vim, anyway. i do
Ah...
Might be time for my regular emacs/vim switch then, I guess...
:)

Reply

totherme November 19 2006, 08:09:52 UTC
I'd be very surprised if someone hasn't done it already

Yup - the latex suite (apt-get install vim-latexsuite in ubuntu) does it.

Reply


half_of_monty November 17 2006, 15:30:48 UTC
Still teaching your dozy students the Greek alphabet, then?

Lazy answer: if you know how to do it in vi, do it in vi!! (Maybe this attitude is the reason why I will never be a coder).

Honest answer: I've never bothered to learn either; though they could be useful in this sort of situation, it's one I'm seldom (never?) in. I prefer an editor like nedit where you can get going straight off without spending time learning anything. Colourful highlighting, and lets you define lovely macros and all too. Actually, maybe I could define a macro to do that in nedit. If I could be arsed.

Reply

pozorvlak November 19 2006, 17:51:18 UTC
Given the amount of time I spend using vi (TeX, code, email...), learning to use it was almost as good an investment of time as learning to type. You don't actually have to learn that much to get started, mind.

I only had one lesson on the Greek alphabet, for which I produced this handout, but it's only just occurred to me to ask.

Reply

pozorvlak November 19 2006, 17:54:24 UTC
And the other reason that I'm asking, is because I'm considering giving Emacs another go - preview-latex mode looks way sexy. And I think it would be easier to use a Dvorak keyboard if I wasn't using vi, whose command-set is very strongly tied to the keyboard layout.

Reply

totherme November 19 2006, 19:22:45 UTC

Leave a comment

Up