# Re: How to make a clone of the Enumerate environment?

Steve Litt wrote:

Gunter -- your solution is exactly right. I confirmed it, and even changed the font of the Question environment without affecting Enumerate, which is why I wanted a clone in the first place.


Like you said, I have no idea why the TeX based idiom (using \let) didn't work, but it didn't. Your LaTeX based solution works perfectly.


\let clones COMMANDS, whereas you were trying to clone environments. There are, of course, commands that correspond to the environments, and you could probably use \let to do it that way. But Gunter's version is definitely preferable.

rh

Thanks very much.

SteveT

On Wednesday 16 July 2008 07:34, G. Milde wrote:

On 14.07.08, Steve Litt wrote:

Hi all,

I'm trying to make a simple clone of the Enumerate environment. Once I
can do that, I'll make a few changes. But I've not been able to clone
it.

You need to clone both, LyX layout::

Style Questions
CopyStyle   Enumeration

and LaTeX environment::

\newenvironment{questions}{\begin{enumerate}}{\end{enumerate}}


Here's my layout file:

#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[book]{quizbook}

Input stdclass.inc

Preamble
\let\questions = \enumerate
\let\oldquestions = \oldenumerate
EndPreamble

I am not sure if this works well, as enumerate is an environment, not a
command. Use the latex \newenvironment instead.


Style Questions

...


End

With CopyStyle, you get all the definitions of the copied style and
need to change only thing that should differ.


The preceding layout produces the output shown in the attached
screenshot_questions.gif. However, if I change the LatexName in the LyX
environment from "questions" to "enumerate", it outputs as shown in the
attached screenshot_enumerate.gif.

Describing the difference in words helps (while pics might augment
this, they cannot always replace a description, e.g. while browsing
this mail to see if I can help at all, I do not see the attachments.)


Can somebody explain to me why the two don't output the same?

no.


Can somebody explain how I can truly clone the Enumerate environment?

see above.


NOTE: In order to toggle the output when switching between LatexType
questions and LatexType enumerate, you must Tools->reconfigure and then
terminate and restart LyX. Trust me on this -- I tried without
reconfiguring and the output didn't toggle.

You could define 2 Styles in your layout file (one QuestionsTest, say)
and switch between them in the document.

Günter