On 21.05.04, Gunnar wrote:
> Hello.
> I would like to use an exercise environment in LyX without using ERT.
>
> The ERT looks like this
> \begin{ex}
> What is not Foo?
> \begin{sol}
> Bar is the answer.
> \end{sol}
> \end{ex}
>
> So I started to edit the article.layout (code below)
> but how can I make the solution to appear inside the exercise?
This is quite straightforward: nest the sol in the ex. For me it would be
write ex, Enter (new paragraph) write the answer and set to sol. Press
Alt-A Left to nest (this might vary depending on emulation mode and
language...) (see the chapter on nesting in the userguide).
BTW: Things start to get nasty if you want to have
\begin{ex}
What is not Foo?
\begin{sol} Bar is the answer. \end{sol}
\end{ex}
\begin{ex}
What is Foo?
\begin{sol} Foo is the answer. \end{sol}
\end{ex}
as without an empty paragraph inbetween (with ERT or a special layout)
LyX will merge this to
\begin{ex}
What is not Foo?
\begin{sol} Bar is the answer. \end{sol}
What is Foo?
\begin{sol} Foo is the answer. \end{sol}
\end{ex}
and this might fail if you have autonumbering on your exercises :-(
(This is a problem with seminar slides as well...)
G�nter
--
G.Milde at web.de