From a69fcde0726450d696081ed5c21506d42a90b103 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Sun, 10 Feb 2013 23:31:38 +0100 Subject: [PATCH] tex2lyx/Preamble.cpp: fix bug #8525 temporarily - 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 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index 8d82f6c532..02469a2087 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -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") { -- 2.39.5