]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/lyx_2_1.py
Update tex2lyx test files
[lyx.git] / lib / lyx2lyx / lyx_2_1.py
index b1c82f5c06bd9bf314da4c6b9344e2eb2263e01f..a4da821742ea29e3a6bc24d4e97c41ad2f0e9e1c 100644 (file)
@@ -837,9 +837,10 @@ def revert_libertine(document):
                 osf = True
             preamble = "\\usepackage"
             if osf:
-                preamble += "[osf]"
                 document.header[j] = "\\font_osf false"
-            preamble += "{libertine}"
+            else:
+                preamble += "[lining]"
+            preamble += "{libertine-type1}"
             add_to_preamble(document, [preamble])
             document.header[i] = "\\font_roman default"
 
@@ -1082,6 +1083,53 @@ def convert_mdnomath(document):
              document.header[i] = "\\font_roman %s" % mathdesign_dict[val]
 
 
+def revert_newtxmath(document):
+    " Revert native newtxmath definitions to LaTeX " 
+
+    i = find_token(document.header, "\\font_math", 0)
+    if i == -1:
+       return
+    if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1: 
+        val = get_value(document.header, "\\font_math", i)
+        mathfont_dict = {
+        "libertine-ntxm":  "\\usepackage[libertine]{newtxmath}",
+        "minion-ntxm":  "\\usepackage[minion]{newtxmath}",
+        "newtxmath":  "\\usepackage{newtxmath}",
+        }
+        if val in mathfont_dict.keys():
+            add_to_preamble(document, mathfont_dict[val])
+            document.header[i] = "\\font_math auto"
+
+
+def revert_biolinum(document):
+    " Revert native biolinum font definition to LaTeX " 
+
+    if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1: 
+        i = find_token(document.header, "\\font_sans biolinum", 0)
+        if i != -1:
+            osf = False
+            j = find_token(document.header, "\\font_osf true", 0)
+            if j != -1:
+                osf = True
+            preamble = "\\usepackage"
+            if not osf:
+                preamble += "[lf]"
+            preamble += "{biolinum-type1}"
+            add_to_preamble(document, [preamble])
+            document.header[i] = "\\font_sans default"
+
+
+def revert_uop(document):
+    " Revert native URW Classico (Optima) font definition to LaTeX "
+
+    if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
+        i = find_token(document.header, "\\font_sans uop", 0)
+        if i != -1:
+                preamble = "\\renewcommand{\\sfdefault}{uop}"
+                add_to_preamble(document, [preamble])
+                document.header[i] = "\\font_sans default"
+
+
 ##
 # Conversion hub
 #
@@ -1115,10 +1163,18 @@ convert = [
            [438, []],
            [439, []],
            [440, []],
-           [441, [convert_mdnomath]]
+           [441, [convert_mdnomath]],
+           [442, []],
+           [443, []],
+           [444, []],
+           [445, []]
           ]
 
 revert =  [
+           [444, [revert_uop]],
+           [443, [revert_biolinum]],
+           [442, []],
+           [441, [revert_newtxmath]],
            [440, [revert_mdnomath]],
            [439, [revert_mathfonts]],
            [438, [revert_minionpro]],