all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Plamen Tanovski <pgt@arcor.de>
To: help-gnu-emacs@gnu.org
Subject: Re: regexp to strip off LaTeX command
Date: Mon, 22 Dec 2008 03:47:07 +0100	[thread overview]
Message-ID: <emb326-gi6.ln1@tanovski.de> (raw)
In-Reply-To: 87r645u9ya.fsf@literaturlatenight.de

henry atting <nspm_01@literaturlatenight.de> writes:

> I am searching a regexp for `replace-regexp' to remove only one LaTeX
> command. Let's say I want to remove all \textit{} commands but not the
> text within the braces, how can I do this?

This is what I use:

(defun remove-LaTeX-command  (befehl)
"removes simple LaTeX command (not starred and without opt. args)
  and the surrounding braces"
(interactive "scommand (without the backslash): ")
(save-excursion
  (goto-char (point-min))
  (while
      (re-search-forward (concat "\\\\" befehl "{") nil t)
    (replace-match "{")
    (save-excursion
      (goto-char (TeX-find-balanced-brace))
      (delete-char -1))
    (delete-char -1))))

best regards


  parent reply	other threads:[~2008-12-22  2:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-18  9:08 regexp to strip off LaTeX command henry atting
2008-12-18  9:19 ` Andreas Politz
2008-12-18  9:47   ` henry atting
2008-12-18 15:15     ` Andreas Politz
2008-12-18 13:27   ` Arnaldo Mandel
2008-12-22  2:47 ` Plamen Tanovski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-12-19  9:47 Bourgneuf Francois
     [not found] <mailman.3104.1229680078.26697.help-gnu-emacs@gnu.org>
2008-12-20 14:11 ` henry atting

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

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

  git send-email \
    --in-reply-to=emb326-gi6.ln1@tanovski.de \
    --to=pgt@arcor.de \
    --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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.