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

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

Re: regexp/emacs selective replace


From: harven
Subject: Re: regexp/emacs selective replace
Date: Wed, 25 Nov 2009 09:15:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

m121212 <m121212@mailinator.com> writes:

> 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?   Also, is there a way Emacs can just wrap any selection with
> custom, predefined tags?

Anchor to the beginning and end of line.

M-x replace-regexp RET
^ *\\includegraphics{[^}]*} *$ RET
\\begin{center} \& \\end{center} RET



reply via email to

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