]> git.lyx.org Git - features.git/commitdiff
tex2lyx/Preamble.cpp: fix bug #8525 temporarily
authorUwe Stöhr <uwestoehr@lyx.org>
Sun, 10 Feb 2013 22:31:38 +0000 (23:31 +0100)
committerUwe Stöhr <uwestoehr@lyx.org>
Sun, 10 Feb 2013 22:31:38 +0000 (23:31 +0100)
- this might break some tex2lyx features but tex2lyx was completely broken - not even the simplest TeX file could be imported and compiles

src/tex2lyx/Preamble.cpp

index 8d82f6c532fc63c316c707d651bef9b098552157..02469a20878c77f5b52bd45a6eee6d5a00183bab 100644 (file)
@@ -802,11 +802,20 @@ void Preamble::handle_package(Parser &p, string const & name,
                // Therefore check for the "," character.
                // It is also only set when there is not more than one babel
                // language option.
-               if (opts.find(",") == string::npos && one_language == true)
-                       h_inputencoding = opts;
-               if (!options.empty())
-                       p.setEncoding(options.back(), Encoding::inputenc);
-               options.clear();
+               if (!opts.empty()) {
+                       if (opts.find(",") == string::npos && one_language == true) {
+                               h_inputencoding = opts;
+                               // FIXME: if this line is used, tex2lyx swallows the next character
+                               // in the file behind "{inputenc}"
+                               //p.setEncoding(opts);
+                       } else {
+                               h_preamble << "\\usepackage[" << opts << "}{" << name << "}\n";
+                               // FIXME: enabling this introduces bug #8525
+                               //p.setEncoding(options.back(), Encoding::inputenc);
+                       }
+                       options.clear();
+               } else
+                       h_preamble << "\\usepackage{" << name << "}\n";         
        }
 
        else if (name == "srcltx") {