Author: uwestoehr
Date: Sat Oct 29 22:34:31 2011
New Revision: 40072
URL: http://www.lyx.org/trac/changeset/40072

Log:
backporting tex2lyx: fix bug #7862

Modified:
   lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/preamble.cpp
   lyx-devel/branches/BRANCH_2_0_X/status.20x

Modified: lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/preamble.cpp
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/preamble.cpp    Sat Oct 29 
22:30:10 2011        (r40071)
+++ lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/preamble.cpp    Sat Oct 29 
22:34:31 2011        (r40072)
@@ -59,7 +59,6 @@
 //"chinese-simplified", "chinese-traditional", "japanese", "korean"
 // Both changes require first that support for non-babel languages (CJK,
 // armtex) is added.
-// add turkmen for lyxformat 383
 /**
  * known babel language names (including synonyms)
  * not in standard babel: arabic, arabtex, armenian, belarusian, 
serbian-latin, thai
@@ -549,7 +548,6 @@
                // 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
@@ -561,8 +559,17 @@
                        // call as document language. If there is no such 
language option, the
                        // last language in the documentclass options is used.
                        handle_opt(options, known_languages, h_language);
+                       // If babel is called with options, LyX puts them by 
default into the
+                       // document class options. This works for most 
languages, except
+                       // for Latvian, Lithuanian, Mongolian, Turkmen and 
Vietnamese and
+                       // perhaps in future others.
+                       // Therefore keep the babel call as it is as the user 
might have
+                       // reasons for it.
+                       h_preamble << "\\usepackage[" << opts << "]{babel}\n";
                        delete_opt(options, known_languages);
                }
+               else
+                       h_preamble << "\\usepackage{babel}\n";                  
                        
        }
 
        else if (name == "fontenc") {

Modified: lyx-devel/branches/BRANCH_2_0_X/status.20x
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/status.20x  Sat Oct 29 22:30:10 2011        
(r40071)
+++ lyx-devel/branches/BRANCH_2_0_X/status.20x  Sat Oct 29 22:34:31 2011        
(r40072)
@@ -142,6 +142,9 @@
 
 - Fix tex2lyx handling babel-specific preamble commands (bug 7861).
 
+- Fix (La)TeX import for files using Latvian, Lithuanian, Mongolian,
+  Turkmen and/or Vietnamese (bug 7862).
+
 - Store the autosave files of unnamed buffers in the correct directory
   and make sure they are not left behind after saving (bug 7793).
 

Reply via email to