help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to create a function to italicize in latex in emacs?


From: Andreas Röhler
Subject: Re: How to create a function to italicize in latex in emacs?
Date: Wed, 27 Jul 2011 21:50:56 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11

Am 26.07.2011 12:58, schrieb Pedro Costa:
Hi,

I would like to italicize a word in latex in emacs automatically.
Instead of write \textit{word}, I would like to select the "word" and
then write M-x<my command>  and it's added textit around the word. Do
I have to create a lisp function in .emacs? How do I do that?

Thanks,



Hi,

running the code below
you need a package thing-at-point-utils.el

from

http://launchpad.net/s-x-emacs-werkstatt/thing-at-point-utils/1.2/+download/thing-at-point-utils-1.2.tgz

otherwise

replace (ar-bounds-of-word-atpt) by a function delivering the borders of the word, a cons

(defun textit ()
  (interactive "*")
  (let* ((bounds (ar-bounds-of-word-atpt))
        (beg (car bounds))
        (end (copy-marker (cdr bounds))))
    (goto-char beg)
    (insert "\\textit{")
    (goto-char end)
    (insert "}")))


HTH,


Andreas

--
https://launchpad.net/python-mode
https://launchpad.net/s-x-emacs-werkstatt/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]