Attached is a better patch:

subfig is now loaded behind the user-defined preamble for the reasons described in the patch and we check if caption was loaded or not.
OK now?

regards Uwe
Index: BufferParams.cpp
===================================================================
--- BufferParams.cpp	(revision 24703)
+++ BufferParams.cpp	(working copy)
@@ -1311,6 +1311,19 @@
 			+ from_utf8(preamble) + '\n';
 	}
 
+	// subfig loads internally the LaTeX package "caption". As caption is a very
+	// popular package, users will load it in the preamble. Therefore we must load
+	// subfig behind the user-defined preamble and check if the caption package
+	// was loaded or not. When subfig is loaded before caption, a package option
+	// clash would appear.
+	// For the case that caption is loaded before subfig, there is the subfig
+	// option "caption=false". This option also works when a koma-script class is
+	// used and koma's own caption commands are used instead of caption.
+	if (features.isRequired("subfig"))
+		lyxpreamble += "[EMAIL PROTECTED]"
+			"\\usepackage{subfig}}{%\n"
+			"\\usepackage[caption=false]{subfig}}\n";
+
 	// Itemize bullet settings need to be last in case the user
 	// defines their own bullets that use a package included
 	// in the user-defined preamble -- ARRae
Index: LaTeXFeatures.cpp
===================================================================
--- LaTeXFeatures.cpp	(revision 24703)
+++ LaTeXFeatures.cpp	(working copy)
@@ -415,7 +415,7 @@
 	"rotating",
 	"latexsym",
 	"pifont",
-	"subfig",
+	// subfig is handled in BufferParams.cpp
 	"varioref",
 	"prettyref",
 	/*For a successful cooperation of the `wrapfig' package with the

Reply via email to