auctex
[Top][All Lists]

Re: [AUCTeX] Modify environments interactively

 From: Lars Madsen Subject: Re: [AUCTeX] Modify environments interactively Date: Mon, 16 Feb 2015 10:13:20 +0000

Bad formulation, meant to say

not as a first approximation to a macro.

Institut for Matematik / Department of Mathematics
Aarhus Universitet / Aarhus University

________________________________________
Sent: 16 February 2015 10:26
Subject: Re: [AUCTeX] Modify environments interactively

Not as a first env

I was thinking more on the lines of

\begin{foo}
\begin{bar}
cursor
\end{bar}
\end{foo}

then some macro would transform this into

\begin{foo}
cursor
\end{foo}

i.e. if the env to be deleted is on lines of their own, then those lines are
removed.

BTW: I haven't switched to 11.88 yet, was hooks added to
LaTeX-modify-environment? AFAIR we can add environment hooks to C-c C-e but not
to C-u C-c C-e (I think someone mentioned at one point that that should be

Why is this needed: I add cleanup hooks to certain envs, so if I mark a region
and insert an env around it, then it clean up the contents. But at least with
11.87 no such hook fires if you change an env.

An example of such a cleaner is for a hint env, used in exercises to make sure
all hints are formatted the same way. Authors often forget this, thus the text
is often

Hint: Blah blah...

My clean up hook here removes the 'Hint: '

Institut for Matematik / Department of Mathematics
Aarhus Universitet / Aarhus University

________________________________________
Sent: 16 February 2015 07:56
Subject: Re: [AUCTeX] Modify environments interactively

>> related, is there a build in feature for deleting a given env?
>>
>> This is sometimes handy when editing other peoples work. (some people
>> are very messy)
>
> this would be a good idea...

I guess doing C-u C-c C-e' and then deleting the environment name could
do that, i.e., modifying an environment so that is has an empty name.
But there's no good way to delete an environment.  I mean, deleting the
\begin/\end is easy, but you'd probably also want to delete its \items
in case its an enumerate/itemize, etc.

Bye,
Tassilo

_______________________________________________
auctex mailing list
`