On 8/22/23 10:14, ehud.be...@posteo.net wrote:
<pre>Suppose I create two styles.

When Style 1 is in use, I want the LyX editor to add to the preamble the 
following code:

\usepackage{x}
latex code for style 1

When style 2 is in use, I want to add to the preamble the following code:
\usepackage{x}
latex code for style 2

What I do now to achieve this is

Style Style1
LatexType             Environment
LatexName             style1
Preamble
\usepackage{x}
latex code for style 1
EndPreamble
End

and

Style Style2
LatexType             Environment
LatexName             style2
DependsOn           Style1  # &lt;&lt;&lt;
Preamble
latex code for style 2
EndPreamble
End

but this is somewhat inefficient.

There's not really a better way to do this. You could delete the "DependsOn" (unless you need it) and instead add "usepackage" to Style2. This may result in multiple loadings, but that's not a problem unless you specify different options.

Riki

-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users

Reply via email to