On 08/21/2009 06:08 AM, Sam Liddicott wrote:
* Olivier Ripoll wrote, On 21/08/09 10:29:
Sam Liddicott wrote:
(I wish Lyx supported adding per-document layouts and elements in the
same way that it supports adding Latex commands in the preamble)
Isn't that what layout modules are for ?
Sure, but as you can't embed a layout module in the lyx document, ERT
can sometimes be easier and more portable, and for small chunks of text
is already clearly delineated in the Lyx document by the red box.
Actually, LyX does support embedded layout. But it's an Advanced Feature
because it is somewhat dangerous, so it is not widely advertised. There
is also, at the moment, no GUI for it.
Have a look at the file Customization.lyx in your favorite text editor.
Some way down you will find these lines:
\begin_local_layout
Format 7
InsetLayout CharStyle:MenuItem
LyxType charstyle
LabelString menu
LatexType command
LatexName menuitem
Font
Family Sans
EndFont
Preamble
\newcommand*{\menuitem}[1]{{\sffamily #1}}
EndPreamble
End
\end_local_layout
If you want to include local layout in your document, you can open it in
a text editor and add similar lines. Make sure they are well tested
first, and be real careful about the first and last line. Unpredictable
things might happen otherwise.
I hope to add a GUI for this in the next LyX release (now looking like
1.7). I'd be really, really happy if someone else wanted to jump in and
do it. It should actually be quite easy. (More or less just copy the GUI
for the preamble.)
Richard