rgheck wrote:
> Can you explain exactly what you want here?

A "Requires" tag, as a counterpart of the "Provides" tag. See the attached 
patch for how I think the Linguistics module should look like.

This would take care that a certain package is loaded only when it's needed 
(f. ex., in the Linguistics module, only one Char Style needs csquotes), and 
that it is loaded only once, even if another module or LyX itself requires it 
as well (which is not the case if you load the package in the Preamble tag).

I think this would be trivial to implement, using LaTeXFeatures::requires().

> I'm confused about why we're seeing this problem with modules. Modules
> aren't loaded any differently from included files. The only difference
> is that they're dynamically associated with documents rather than
> statically associated with layout files. So I'm inclined to think that
> the bug is elsewhere.

The problem is that we are not yet flexible enough.

> So try this: Take the stuff from the linguistics module and paste it
> into a custom layout file. Do we get the same problem?

Yes. Layouts could probably use the Requires tag as well (albeit the feature 
is probably not as crucial there).

Jürgen
Index: lib/layouts/linguistics.module
===================================================================
--- lib/layouts/linguistics.module	(Revision 22335)
+++ lib/layouts/linguistics.module	(Arbeitskopie)
@@ -24,9 +24,7 @@
 		Shape         Italic
 		Color         Blue
 	EndFont
-	Preamble
-		\usepackage{covington}
-	EndPreamble
+	Requires	      covington
 End
 
 
@@ -49,9 +47,8 @@
 	LatexName             subexample
 	LeftMargin            XSubexample:
 	LabelString           "Subexample:"
+	Requires	      covington, enumitem
 	Preamble
-		\usepackage{covington}
-		\usepackage{enumitem}
 		\newenvironment{subexample}{%
 			\begin{example}\begin{enumerate}[leftmargin=1.7em]
 			\renewcommand\theenumi{\alph{enumi}}
@@ -76,8 +73,8 @@
 	MultiPar              true
 	PassThru              true
 	FreeSpacing           true
+	Requires	      covington
 	Preamble
-		\usepackage{covington}
 		[EMAIL PROTECTED]
 		\newenvironment{linggloss}[1]{%
 			\gll #1}
@@ -100,8 +97,8 @@
 	MultiPar              true
 	PassThru              true
 	FreeSpacing           true
+	Requires	      covington
 	Preamble
-		\usepackage{covington}
 		[EMAIL PROTECTED]
 		\newenvironment{lingglosss}[1]{%
 			\glll #1}
@@ -143,8 +140,8 @@
 	LabelString           meaning
 	LatexType             command
 	LatexName             lingmeaning
+	Requires	      csquotes
 	Preamble
-		\usepackage{csquotes}
 		\newcommand{\lingmeaning}[1]{\enquote*{#1}}
 	EndPreamble
 End

Reply via email to