]> git.lyx.org Git - lyx.git/commitdiff
lyx2lyx/lyx_1_6.py: fix reversion of PDF properties
authorUwe Stöhr <uwestoehr@web.de>
Tue, 5 Aug 2008 22:37:28 +0000 (22:37 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Tue, 5 Aug 2008 22:37:28 +0000 (22:37 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26077 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/lyx_1_6.py

index 9bca72a5cd04d6a1a8173b1d420659722e61851a..f5ebaf880508cc571907137bd7c1132fd3f7d1fd 100644 (file)
@@ -64,6 +64,11 @@ def add_to_preamble(document, text):
 
     document.preamble.extend(text)
 
+def insert_to_preamble(index, document, text):
+    """ Insert text to the preamble at a given line"""
+
+    document.preamble.insert(index, text)
+
 # Convert a LyX length into a LaTeX length
 def convert_len(len):
     units = {"text%":"\\backslash\ntextwidth", "col%":"\\backslash\ncolumnwidth",
@@ -872,9 +877,12 @@ def revert_pdf_options(document):
                 setupstart = ""
                 setupend = ""
             # write the preamble
-            add_to_preamble(document,
-                                ['% Commands inserted by lyx2lyx for PDF properties',
-                                 '\\usepackage[unicode=true'
+            # babel must be loaded before hyperref and hyperref the first part
+            # of the preamble, like in LyX 1.6
+            insert_to_preamble(0, document,
+                                 '% Commands inserted by lyx2lyx for PDF properties\n'
+                                 + '\\usepackage{babel}\n'
+                                 + '\\usepackage[unicode=true'
                                  + bookmarks
                                  + breaklinks
                                  + pdfborder
@@ -883,14 +891,14 @@ def revert_pdf_options(document):
                                  + colorlinks
                                  + pagemode
                                  + ']\n'
-                                 ' {hyperref}\n'
+                                 ' {hyperref}\n'
                                  + setupstart
                                  + title
                                  + author
                                  + subject
                                  + keywords
                                  + otheroptions
-                                 + setupend])
+                                 + setupend)
 
 
 def remove_inzip_options(document):