I am having some trouble understanding how to implement a new environment in an existing .layout file. The documentation covers the principle, but not the detail, especially about how to enable other environments (like lists) *inside* the one I am implementing, and how to get LyX to prompt for any arguments required in my environment.

I have defined and tested the environment in LaTeX, and I then add to the .layout file:

Style Foo
  LatexType     Environment
  LatexName     foo
  ParSep        0.5

  Font
    Size        Small
>     Series      Normal
  EndFont

  Preamble
    \newenvironment{foo}
      {\begin{quotation}\small\raggedright\noindent\ignorespaces}
>       {\par\end{quotation}}
  EndPreamble
End

When I open a .lyx file, the entry for a Foo is there in the menu, and I can add a few words and paragraphs and it correctly exports:

\begin{foo}
a few words

and paragraphs\end{foo}

All well so far.

But an environment should be able to contain all kinds of other environment, like lists. If I try to add an itemized list between the two paragraphs above, the exported LaTeX shows that LyX has terminated the foo environment prematurely, inserted the list *outside* the environment, and then created a new instance of the foo environment to hold the second paragraph:

> \begin{foo}
> a few words\end{panel}
> \begin{itemize}
> \item blort\end{itemize}
> \begin{panel}
> and paragraphs\end{foo}

How do I tell LyX that lists (for example; and much other stuff) is permitted inside a Foo environment? Is there a setting or switch that tells LyX to allow nested environments globally, or does it have to be done on an environment by environment basis?

Bonus question: I will eventually want to extend the environment to add a box and shaded background, allowing the user to specify width and color in mandatory arguments to the Foo environment. Writing the LaTeX definition for the Preamble is easy; but how do I tell LyX that the environment has two arguments? I can see that an Inset affords the option to add tokens or values, but I can't see how to make one compulsory, so that it pops up the moment you add a Foo from the menu.

Final plea: I have been unable to find a formal list of all the keywords for a .layout file, with their syntax and application. Does such a list exist yet?

///Peter

Reply via email to