unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: rvclayton@verizon.net (R. Clayton)
To: help-gnu-emacs@gnu.org
Subject: Re: How to create a function to italicize in latex in emacs?
Date: Wed, 27 Jul 2011 23:54:22 -0400	[thread overview]
Message-ID: <874o2712mp.fsf@UlanBator.myhome.westell.com> (raw)
In-Reply-To: CAJ8VZfVdOuZiC_GGi7we_Hf-sPZWURQbU02nXFqtGBMU6BLpiQ@mail.gmail.com

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?

  This is how I do it:

    (defun latex-surround-word (before after)

    "Add the given prefix and suffix to the word at point."

      (or (looking-at "\\<") (search-backward-regexp "\\<"))
      (insert before)
      (search-forward-regexp "\\>")
      (insert after))


    (defun latex-ital-word ()

    "Set the word at point in italics."

      (interactive)
      (latex-surround-word "{\\it " "\\/}"))


    (define-key latex-mode-map "\C-cfi" 'latex-ital-word)

  Put those and similar in a file and load the file as part of the latex mode
  hook.






      parent reply	other threads:[~2011-07-28  3:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-26 10:58 How to create a function to italicize in latex in emacs? Pedro Costa
2011-07-27 19:31 ` dejfson
2011-07-27 19:50 ` Andreas Röhler
2011-07-27 19:53 ` suvayu ali
2011-07-27 21:16 ` Eric Abrahamsen
2011-07-28  3:54 ` R. Clayton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874o2712mp.fsf@UlanBator.myhome.westell.com \
    --to=rvclayton@verizon.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).