Author: uwestoehr
Date: Fri Oct 28 14:37:59 2011
New Revision: 40050
URL: http://www.lyx.org/trac/changeset/40050

Log:
tex2lyx/preamble.cpp: fix bug #7861 and #7858

Modified:
   lyx-devel/trunk/src/tex2lyx/preamble.cpp

Modified: lyx-devel/trunk/src/tex2lyx/preamble.cpp
==============================================================================
--- lyx-devel/trunk/src/tex2lyx/preamble.cpp    Fri Oct 28 13:51:48 2011        
(r40049)
+++ lyx-devel/trunk/src/tex2lyx/preamble.cpp    Fri Oct 28 14:37:59 2011        
(r40050)
@@ -552,8 +552,12 @@
 
        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 @@
                        // 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 @@
                 * but this makes the document less portable, so I skip it:
                if (h_fontencoding == lyxrc.fontenc)
                        h_fontencoding = "global";
-               */
+                */
                options.clear();
        }
 

Reply via email to