From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Plamen Tanovski Newsgroups: gmane.emacs.help Subject: Re: regexp to strip off LaTeX command Date: Mon, 22 Dec 2008 03:47:07 +0100 Organization: T-Online Message-ID: References: <87r645u9ya.fsf@literaturlatenight.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1229917250 13717 80.91.229.12 (22 Dec 2008 03:40:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Dec 2008 03:40:50 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 22 04:41:56 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LEbg3-0006Re-H9 for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Dec 2008 04:41:55 +0100 Original-Received: from localhost ([127.0.0.1]:47082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LEbeq-0001v1-Sz for geh-help-gnu-emacs@m.gmane.org; Sun, 21 Dec 2008 22:40:40 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!goblin1!goblin.stu.neva.ru!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 23 Original-X-Trace: news.t-online.com 1229914055 02 n32012 3pahlGJJ17OeeEY 081222 02:47:35 Original-X-Complaints-To: usenet-abuse@t-online.de X-ID: VIIxSTZbQeLxX0yFUPvMFC-6ZwwdS4WELmTPtr6vlZOBMCryvGUWQC User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) Original-Xref: news.stanford.edu gnu.emacs.help:165565 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:60896 Archived-At: henry atting 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