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

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

Re: regexp to strip off LaTeX command


From: Plamen Tanovski
Subject: Re: regexp to strip off LaTeX command
Date: Mon, 22 Dec 2008 03:47:07 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

henry atting <address@hidden> 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


reply via email to

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