]> git.lyx.org Git - lyx.git/commitdiff
tex2lyx/preamble.cpp: fix bug #7861 and #7858
authorUwe Stöhr <uwestoehr@web.de>
Fri, 28 Oct 2011 12:37:59 +0000 (12:37 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Fri, 28 Oct 2011 12:37:59 +0000 (12:37 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40050 a592a061-630c-0410-9148-cb99ea01b6c8

src/tex2lyx/preamble.cpp

index e31a2a8252a497558d131848cbe6287568849fda..44822ba158f020885945e717abbdeb4e82e3658f 100644 (file)
@@ -552,8 +552,12 @@ void handle_package(Parser &p, string const & name, string const & opts,
 
        else if (name == "babel") {
                h_language_package = "default";
-               // we have to do nothing if babel is loaded without any options, otherwise
-               // we would pollute the preamble with this call in every roundtrip
+               // One might think we would have to do nothing if babel is loaded
+               // without any options to prevent pollution of the preamble with this
+               // babel call in every roundtrip.
+               // But the user could have defined babel-specific things afterwards. So
+               // we need to keep it in the preamble to prevent cases like bug #7861.
+               h_preamble << "\\usepackage{babel}\n";
                if (!opts.empty()) {
                        // check if more than one option was used - used later for inputenc
                        // in case inputenc is parsed before babel, set the encoding to auto
@@ -566,7 +570,7 @@ void handle_package(Parser &p, string const & name, string const & opts,
                        // last language in the documentclass options is used.
                        handle_opt(options, known_languages, h_language);
                        delete_opt(options, known_languages);
-               }
+               } 
        }
 
        else if (name == "fontenc") {
@@ -575,7 +579,7 @@ void handle_package(Parser &p, string const & name, string const & opts,
                 * but this makes the document less portable, so I skip it:
                if (h_fontencoding == lyxrc.fontenc)
                        h_fontencoding = "global";
-               */
+                */
                options.clear();
        }