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

## Re: regexp to strip off LaTeX command

 From: Arnaldo Mandel Subject: Re: regexp to strip off LaTeX command Date: Thu, 18 Dec 2008 11:27:23 -0200

On Thu, Dec 18, 2008 at 7:19 AM, Andreas Politz wrote:
henry atting wrote:
Hi,

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?

henry

\\textit{$$[^}]*$$} -> \1

If you need to handle escaped brackets the regexp gets a little longer.

They can get impossibly longer.  There is no way to get regexps to do this job in full.
Your best bet is to use an utility called detex together with shell-command-on-region.
detex is in the Debian package texlive-extra-utils, but can certainly be obtained directly.

am