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

## Re: regexp/emacs selective replace

 From: Barry Margolin Subject: Re: regexp/emacs selective replace Date: Tue, 24 Nov 2009 20:30:25 -0500 User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <address@hidden>,

> Hi,
>
> I have a tricky problem that I'm not sure how to solve.  I have a latex
> document with several figure environments that look like this:
>
> \begin{figure}
>  \includegraphics{blah.ps}
> \end{figure}
>
> but need to look like this:
>
> \begin{figure}
>   \begin{center} \includegraphics{blah.ps} \end{center}
> \end{figure}
>
> Some of the figure environments already have this however, and I don't want
> to end up with something like this:
>
> \begin{figure}
>   \begin{center}\begin{center} \includegraphics{blah.ps}
> \end{center}\end{center}
> \end{figure}
>
> Any ideas?

Does query-replace-regexp do what you want?  It will prompt you before
each possible replacement, and you can say whether to replace that
instance.

--
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***