On Friday 21 January 2005 13:52, Matej Cepl wrote:
> Steve Litt wrote:
> > How do I derive a new LyX environment based on an existing one? For
> > instance, I'd like to derive a "superdefinition" environment based on the
> > existing "Description" environment.
> >
> > I know how to do it in LaTeX:
> >
> > \let\oldmystyle=\mystyle
> > \def\mystyle{
> >         \oldmystyle
> >         %%% Place LaTeX for modifications here
> >         }
>
> Two things needs to be distinguished (using LaTeX terminology) -- commands
> and environments. What you have shown here is redefinition of command,
> however description (used by "Description" layout) is an environment, where
> things are slightly more complicated. Try this:
>
>    \let\olddescription=\description
>    \let\endolddescription=\enddescription
>    \renewenvironment{description}{%
>            \begin{olddescription}%
>            %modifications in the beginning of the environment
>       }{%
>            %modifications in the end of the environment
>        \end{olddescription}}
>
> Does it work?

Hi Matej (and anyone else who can answer this question)

First, forgive my replying to a two year old post, but I need this information 
and knew that once upon a time Matej had posted it.

What I want to know is this: where does \enddescription come from? Does every 
environment named \foo also have an \endfoo that refers to the stuff that 
gets done after the last piece of text covered from the environment? If so, 
how does that happen? If not, how does Matej's code above work (I tried it 2 
years ago and indeed it did work).

I'm writing an article I think will greatly simplify explaining LaTeX and 
therefore greatly simplify creating or modifying environments (HOORAY), but 
in order to write the doc I not only need to describe the trick above, but I 
need to explain why it works?

Does LaTeX's \newenvironment{myenvironment} automatically create not only 
\myenvironment, but also \endmyenvironment?

Thanks

SteveT

Steve Litt
Author: Universal Troubleshooting Process books and courseware
http://www.troubleshooters.com/

Reply via email to