From 842587a1a688adb1df8606e7a72a9ec6a77fe231 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Tue, 13 May 2008 01:23:50 +0000 Subject: [PATCH] BufferParams.cpp: load the subfig package conditionally to make it work with the caption package git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24746 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferParams.cpp | 13 +++++++++++++ src/LaTeXFeatures.cpp | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index b444a2b4a9..19eebccf5b 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1296,6 +1296,19 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, "User specified LaTeX commands.\n" + 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. + // 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")) { + atlyxpreamble += "\\usepackage{subfig}\n"; + atlyxpreamble += "\\@ifundefined{showcaptionsetup}{}{%\n" + " \\PassOptionsToPackage{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 diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 1e80938017..4f52fd411f 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -415,7 +415,7 @@ char const * simplefeatures[] = { "rotating", "latexsym", "pifont", - "subfig", + // subfig is handled in BufferParams.cpp "varioref", "prettyref", /*For a successful cooperation of the `wrapfig' package with the -- 2.39.2