easy LyX styles
The official way to introduce custom styles to LyX is:
* the layout-file should be located in a special directory,
* after the layout file is changed, the user should:
. - execute re-configure and
. - restart LyX.
This way is too cumbersome for experimenting and developing styles. Fortunately, there is a solution.
It is possible to embed styles into a document. The following small example is a good starting point.
1) Create, save, close a simple LyX document.
2) Open the file in a text editor.
3) Between the lines
\use_geometry false
and
\use_amsmath 1
put the code:
\begin_local_layout
InsetLayout Flex:MyEmph
LyxType Charstyle
LatexType Command
LatexName MyEmph
LabelString MyEmph
Font
Shape Italic
EndFont
Preamble
\newcommand{\MyEmph}[1]{\emph{#1}}
EndPreamble
End
Style MyPara
LatexType Environment
LatexName MyPara
LeftMargin "MyPara: "
LabelType Static
LabelString "MyPara: "
Preamble
\newenvironment{MyPara}{\par MyPara: }{\par}
EndPreamble
End
\end_local_layout
4) Save the file and open in LyX. Now you have access to the paragraph style "MyPara" and the character style "MyEmph".