]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/preamble.cpp
tex2lyx: support for subfloats
[lyx.git] / src / tex2lyx / preamble.cpp
index e988f1af52dd0093d9bdaa414a2cc4a8b77642b5..e31a2a8252a497558d131848cbe6287568849fda 100644 (file)
@@ -571,9 +571,11 @@ void handle_package(Parser &p, string const & name, string const & opts,
 
        else if (name == "fontenc") {
                h_fontencoding = getStringFromVector(options, ",");
-               // as of version LyX 2.0 "T1" is equal to the setting "global"
-               if (h_fontencoding == "T1")
+               /* We could do the following for better round trip support,
+                * but this makes the document less portable, so I skip it:
+               if (h_fontencoding == lyxrc.fontenc)
                        h_fontencoding = "global";
+               */
                options.clear();
        }
 
@@ -646,6 +648,15 @@ void handle_package(Parser &p, string const & name, string const & opts,
                ; // Ignore this, the geometry settings are made by the \geometry
                  // command. This command is handled below.
 
+       else if (name == "rotfloat")
+               ; // ignore this
+
+       else if (name == "wrapfig")
+               ; // ignore this
+
+       else if (name == "subfig")
+               ; // ignore this
+
        else if (is_known(name, known_languages))
                h_language = name;
 
@@ -917,8 +928,11 @@ void parse_preamble(Parser & p, ostream & os,
                        h_paperpagestyle = p.verbatim_item();
 
                else if (t.cs() == "date") {
-                       if (p.verbatim_item().empty())
+                       string argument = p.getArg('{', '}');
+                       if (argument.empty())
                                h_suppress_date = "true";
+                       else
+                               h_preamble << t.asInput() << '{' << argument << '}';
                }
 
                else if (t.cs() == "color") {
@@ -1269,6 +1283,13 @@ void parse_preamble(Parser & p, ostream & os,
                        } else if (arg1 == "definecolor" && arg2 == "\\usepackage{color}"
                                && arg3.empty()) {
                                ifundefined_color_set = true;
+                       // test for case
+                       //\@ifundefined{showcaptionsetup}{}{%
+                       // \PassOptionsToPackage{caption=false}{subfig}}
+                       // that LyX uses for subfloats
+                       } else if (arg1 == "showcaptionsetup" && arg2.empty()
+                               && arg3 == "%\n \\PassOptionsToPackage{caption=false}{subfig}") {
+                               ; // do nothing
                        } else if (!in_lyx_preamble) {
                                h_preamble << t.asInput()
                                           << '{' << arg1 << '}'