[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX] Re: is it possible to insert such a symbol?
From: |
Leo |
Subject: |
[AUCTeX] Re: is it possible to insert such a symbol? |
Date: |
Fri, 24 Apr 2009 10:27:10 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (darwin) |
On 2009-04-23 23:49 +0100, peng shao wrote:
> I am still a very newbie on emacs/auctex, and recently I was trying to
> learn lisp languange since I could even hardly understand how to
> customize a "user option" mentioned in the manual... so to realize
> this kind of function is definitely more than impossible for me at
> present. Anyway, if my question is too trivial, or too weired as a
> request, I beg your apologize for taking up your time.... Thank you
> Ralf and everyone....
That's a common question and requires a general solution i.e. not one
specific to AUCTeX. You need a templating engine. There are a few of
them out there.
But the best known is snippet.el by Pete Kazmier. I fixed all bugs
listed by Pete and cleaned it up such as making it work seamlessly with
abbrev-mode. I love this integration so much that I use it everyday.
All you need to do is put the file in the load-path and add the
following one-liner to your `user-init-file':
(add-hook 'abbrev-expand-functions 'snippet-expand-abbrev)
Now you can define abbrevs with snippet features. Let me give you an
example:
Let's say I want to have '()^2 + ()^2 = ()^2' where () is something I
want to edit when I insert this formula. Now let's define an abbrev.
| represents the cursor.
1. Type xyz|
2. 'C-x a i g' to add it to global abbreviation
3. Alternatively you may use 'C-x a i l' to add to your mode
4. When asked for expansion type in '$${x}^2+$${y}^2=$${z}^2' without the
single quotes.
After the definition, each time you want the expansion just type xyz
followed by C-x '. You don't need to turn on abbrev-mode. You will be
able to use TAB or Shift+TAB to move from the three () places in the
forumla.
binciWyIEoPwx.bin
Description: snippet.el
txtpSyHNvWYSF.txt
Description: snippet doc
Best wishes,
--
.: Leo :. [ sdl.web AT gmail.com ] .: I use Emacs :.