Alon Altman wrote:
Hi,
  I've defined some of my own environments in the preamble of the document
(some theorem-like, some generic). I would like LyX to allow me to typeset
text in these environments without resorting to ERT to begin and end these
environments. How can I add my own environment types to the dropdown list?

You need to write a layout file. It's best to start by copying the layout file you normally use from /usr/sharew/lyx/layouts (or the equivalent directory on your system) to the .lyx/layouts directory in your home directory, renaming it to whatever you want.


Then add your new environments or modify existing ones. Here's a rather complicated example from one of my layout files:

# Box style definition
# Adapted from a style by Herbert Voss

Style Box
  Margin                Static
  LatexType             Environment
  LatexName             myBox
  NextNoIndent          1
  LeftMargin            m
  RightMargin           m
  TopSep                0.5
  ParSep                0.5
  BottomSep             0.5
  Align                 Block
  AlignPossible         Block, Left, Right, Center
  LabelType             No_Label
  Font
    color               blue
  EndFont

#define the environment myBox

  Preamble
    \newenvironment{myBox}{%
      \noindent%
      [EMAIL PROTECTED]
      \begin{minipage}[t]{0.5\columnwidth}%
    }{%
      \end{minipage}%
      \end{lrbox}%
      [EMAIL PROTECTED]
      \vspace{0.5ex}
    }%
EndPreamble

The kind of stuff LyX can handle, like margins and alignments, goes in the first part, but if you want complex LaTeX stuff, it needs to be defined in the Preamble section.

Run Edit->Reconfigure in LyX, and the next time you run LyX your new layout should show up.

Robin


-- "Certitude is possible for those who only own one encyclopedia." - Robert Anton Wilson

Robin Turner
IDMYO
Bilkent Univeritesi
Ankara 06533
Turkey

www.bilkent.edu.tr/~robin




Reply via email to