commit 1c2d056cfc2dc3287658a60553708c8f095ad462
Author: Uwe Stöhr <uwesto...@lyx.org>
Date:   Sat Apr 8 04:55:22 2017 +0200

    tex2lyx: fix the preamble output
    
    - LyX has new preamble tags. Although that they are not relevant for LaTeX 
they must be created by tex2lyx nevertheless
    - also fix an issue that the formula indentation was always output
    - update the tex2lyx tests accordingly
---
 src/tex2lyx/Preamble.cpp                           |   17 +++++++++++------
 src/tex2lyx/Preamble.h                             |    4 +++-
 src/tex2lyx/test/CJK.lyx.lyx                       |    5 +++--
 src/tex2lyx/test/CJKutf8.lyx.lyx                   |    5 +++--
 src/tex2lyx/test/DummyDocument.lyx.lyx             |    5 +++--
 src/tex2lyx/test/Dummy~Document.lyx.lyx            |    5 +++--
 src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx         |    5 +++--
 src/tex2lyx/test/algo2e.lyx.lyx                    |    5 +++--
 .../test/box-color-size-space-align.lyx.lyx        |    5 +++--
 src/tex2lyx/test/test-insets-basic.lyx.lyx         |    5 +++--
 src/tex2lyx/test/test-insets.lyx.lyx               |    5 +++--
 src/tex2lyx/test/test-memoir.lyx.lyx               |    5 +++--
 src/tex2lyx/test/test-modules.lyx.lyx              |    5 +++--
 src/tex2lyx/test/test-refstyle-theorems.lyx.lyx    |    5 +++--
 src/tex2lyx/test/test-scr.lyx.lyx                  |    5 +++--
 src/tex2lyx/test/test-structure.lyx.lyx            |    5 +++--
 src/tex2lyx/test/test.lyx.lyx                      |    5 +++--
 src/tex2lyx/test/verbatim.lyx.lyx                  |    5 +++--
 18 files changed, 62 insertions(+), 39 deletions(-)

diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index 93ddedf..894e29e 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -462,7 +462,7 @@ string remove_braces(string const & value)
 
 Preamble::Preamble() : one_language(true), explicit_babel(false),
        title_layout_found(false), index_number(0), h_font_cjk_set(false),
-       h_use_microtype(false)
+       h_use_microtype("false")
 {
        //h_backgroundcolor;
        //h_boxbgcolor;
@@ -472,6 +472,7 @@ Preamble::Preamble() : one_language(true), 
explicit_babel(false),
        h_cite_engine_type        = "default";
        h_color                   = "#008000";
        h_defskip                 = "medskip";
+       h_dynamic_quotes          = false;
        //h_float_placement;
        //h_fontcolor;
        h_fontencoding            = "default";
@@ -545,11 +546,12 @@ Preamble::Preamble() : one_language(true), 
explicit_babel(false),
        h_tocdepth                = "3";
        h_tracking_changes        = "false";
        h_use_bibtopic            = "false";
+       h_use_dash_ligatures      = "true";
        h_use_indices             = "false";
        h_use_geometry            = "false";
        h_use_default_options     = "false";
        h_use_hyperref            = "false";
-       h_use_microtype           = false;
+       h_use_microtype           = "false";
        h_use_refstyle            = false;
        h_use_packages["amsmath"]    = "1";
        h_use_packages["amssymb"]    = "0";
@@ -1055,7 +1057,7 @@ void Preamble::handle_package(Parser &p, string const & 
name,
        else if (name == "microtype") {
                //we internally support only microtype without params
                if (options.empty())
-                       h_use_microtype = true;
+                       h_use_microtype = "true";
                else
                        h_preamble << "\\usepackage[" << opts << "]{microtype}";
        }
@@ -1209,6 +1211,7 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, 
string const & outfiled
        if (!h_font_cjk.empty())
                os << "\\font_cjk " << h_font_cjk << '\n';
        os << "\\use_microtype " << h_use_microtype << '\n'
+          << "\\use_dash_ligatures " << h_use_dash_ligatures << '\n'
           << "\\graphics " << h_graphics << '\n'
           << "\\default_output_format " << h_default_output_format << "\n"
           << "\\output_sync " << h_output_sync << "\n";
@@ -1287,9 +1290,11 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, 
string const & outfiled
                os << "\\defskip " << h_defskip << "\n";
        else
                os << "\\paragraph_indentation " << h_paragraph_indentation << 
"\n";
-       os << "\\is_formula_indent " << h_is_formulaindent << "\n"
-          << "\\formula_indentation " << h_formulaindentation << "\n"
-          << "\\quotes_style " << h_quotes_style << "\n"
+       os << "\\is_formula_indent " << h_is_formulaindent << "\n";
+       if (!h_formulaindentation.empty())
+               os << "\\formula_indentation " << h_formulaindentation << "\n";
+       os << "\\quotes_style " << h_quotes_style << "\n"
+          << "\\dynamic_quotes " << h_dynamic_quotes << "\n"
           << "\\papercolumns " << h_papercolumns << "\n"
           << "\\papersides " << h_papersides << "\n"
           << "\\paperpagestyle " << h_paperpagestyle << "\n";
diff --git a/src/tex2lyx/Preamble.h b/src/tex2lyx/Preamble.h
index 8b39c36..567a97d 100644
--- a/src/tex2lyx/Preamble.h
+++ b/src/tex2lyx/Preamble.h
@@ -136,6 +136,7 @@ private:
        std::string h_cite_engine_type;
        std::string h_color;
        std::string h_defskip;
+       bool h_dynamic_quotes;
        std::string h_float_placement;
        std::string h_fontcolor;
        std::string h_fontencoding;
@@ -151,7 +152,7 @@ private:
        std::string h_font_tt_scale[2];
        bool h_font_cjk_set;
        std::string h_font_cjk;
-       bool h_use_microtype;
+       std::string h_use_microtype;
        std::string h_is_formulaindent;
        std::string h_formulaindentation;
        std::string h_graphics;
@@ -207,6 +208,7 @@ private:
        std::string h_tocdepth;
        std::string h_tracking_changes;
        std::string h_use_bibtopic;
+       std::string h_use_dash_ligatures;
        std::string h_use_indices;
        std::string h_use_geometry;
        std::map<std::string, std::string> h_use_packages;
diff --git a/src/tex2lyx/test/CJK.lyx.lyx b/src/tex2lyx/test/CJK.lyx.lyx
index b574057..919f894 100644
--- a/src/tex2lyx/test/CJK.lyx.lyx
+++ b/src/tex2lyx/test/CJK.lyx.lyx
@@ -32,7 +32,8 @@
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -71,8 +72,8 @@
 \paragraph_separation indent
 \paragraph_indentation default
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
diff --git a/src/tex2lyx/test/CJKutf8.lyx.lyx b/src/tex2lyx/test/CJKutf8.lyx.lyx
index c844760..adb1628 100644
--- a/src/tex2lyx/test/CJKutf8.lyx.lyx
+++ b/src/tex2lyx/test/CJKutf8.lyx.lyx
@@ -32,7 +32,8 @@
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -71,8 +72,8 @@
 \paragraph_separation indent
 \paragraph_indentation default
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
diff --git a/src/tex2lyx/test/DummyDocument.lyx.lyx 
b/src/tex2lyx/test/DummyDocument.lyx.lyx
index de15cc1..e27caa8 100644
--- a/src/tex2lyx/test/DummyDocument.lyx.lyx
+++ b/src/tex2lyx/test/DummyDocument.lyx.lyx
@@ -21,7 +21,8 @@
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -77,8 +78,8 @@
 \paragraph_separation indent
 \paragraph_indentation 3mm
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
diff --git a/src/tex2lyx/test/Dummy~Document.lyx.lyx 
b/src/tex2lyx/test/Dummy~Document.lyx.lyx
index 052dfd5..ccb6d40 100644
--- a/src/tex2lyx/test/Dummy~Document.lyx.lyx
+++ b/src/tex2lyx/test/Dummy~Document.lyx.lyx
@@ -21,7 +21,8 @@
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -77,8 +78,8 @@
 \paragraph_separation indent
 \paragraph_indentation 3mm
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
diff --git a/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx 
b/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx
index c857640..e49d74e 100644
--- a/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx
+++ b/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx
@@ -31,7 +31,8 @@
 \font_osf false
 \font_sf_scale 100 75
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format pdf4
 \output_sync 0
@@ -70,8 +71,8 @@
 \paragraph_separation indent
 \paragraph_indentation default
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
diff --git a/src/tex2lyx/test/algo2e.lyx.lyx b/src/tex2lyx/test/algo2e.lyx.lyx
index 2ab963b..30358f4 100644
--- a/src/tex2lyx/test/algo2e.lyx.lyx
+++ b/src/tex2lyx/test/algo2e.lyx.lyx
@@ -30,7 +30,8 @@ algorithm2e
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -69,8 +70,8 @@ algorithm2e
 \paragraph_separation indent
 \paragraph_indentation default
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
diff --git a/src/tex2lyx/test/box-color-size-space-align.lyx.lyx 
b/src/tex2lyx/test/box-color-size-space-align.lyx.lyx
index 0438b29..bdbfd2e 100644
--- a/src/tex2lyx/test/box-color-size-space-align.lyx.lyx
+++ b/src/tex2lyx/test/box-color-size-space-align.lyx.lyx
@@ -56,7 +56,8 @@
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -106,8 +107,8 @@
 \paragraph_separation skip
 \defskip 3mm
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 2
 \papersides 2
 \paperpagestyle default
diff --git a/src/tex2lyx/test/test-insets-basic.lyx.lyx 
b/src/tex2lyx/test/test-insets-basic.lyx.lyx
index 208a6a8..12ffb05 100644
--- a/src/tex2lyx/test/test-insets-basic.lyx.lyx
+++ b/src/tex2lyx/test/test-insets-basic.lyx.lyx
@@ -57,7 +57,8 @@
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -113,8 +114,8 @@
 \paragraph_separation indent
 \paragraph_indentation 3mm
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
diff --git a/src/tex2lyx/test/test-insets.lyx.lyx 
b/src/tex2lyx/test/test-insets.lyx.lyx
index 5b5a22a..6344e4c 100644
--- a/src/tex2lyx/test/test-insets.lyx.lyx
+++ b/src/tex2lyx/test/test-insets.lyx.lyx
@@ -33,7 +33,8 @@
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -89,8 +90,8 @@
 \paragraph_separation indent
 \paragraph_indentation 3mm
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
diff --git a/src/tex2lyx/test/test-memoir.lyx.lyx 
b/src/tex2lyx/test/test-memoir.lyx.lyx
index 62e7def..b153a78 100644
--- a/src/tex2lyx/test/test-memoir.lyx.lyx
+++ b/src/tex2lyx/test/test-memoir.lyx.lyx
@@ -28,7 +28,8 @@
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -67,8 +68,8 @@
 \paragraph_separation indent
 \paragraph_indentation default
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
diff --git a/src/tex2lyx/test/test-modules.lyx.lyx 
b/src/tex2lyx/test/test-modules.lyx.lyx
index 94210d9..50ac722 100644
--- a/src/tex2lyx/test/test-modules.lyx.lyx
+++ b/src/tex2lyx/test/test-modules.lyx.lyx
@@ -28,7 +28,8 @@ theorems-ams
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -67,8 +68,8 @@ theorems-ams
 \paragraph_separation indent
 \paragraph_indentation default
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
diff --git a/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx 
b/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx
index 42dc89c..b3e95c8 100644
--- a/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx
+++ b/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx
@@ -28,7 +28,8 @@ theorems-ams
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -67,8 +68,8 @@ theorems-ams
 \paragraph_separation indent
 \paragraph_indentation default
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 2
 \paperpagestyle default
diff --git a/src/tex2lyx/test/test-scr.lyx.lyx 
b/src/tex2lyx/test/test-scr.lyx.lyx
index df551a7..73945fb 100644
--- a/src/tex2lyx/test/test-scr.lyx.lyx
+++ b/src/tex2lyx/test/test-scr.lyx.lyx
@@ -25,7 +25,8 @@
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -64,8 +65,8 @@
 \paragraph_separation indent
 \paragraph_indentation default
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 2
 \paperpagestyle default
diff --git a/src/tex2lyx/test/test-structure.lyx.lyx 
b/src/tex2lyx/test/test-structure.lyx.lyx
index 4823aa8..68e15e2 100644
--- a/src/tex2lyx/test/test-structure.lyx.lyx
+++ b/src/tex2lyx/test/test-structure.lyx.lyx
@@ -60,7 +60,8 @@ logicalmkup
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 1
@@ -100,8 +101,8 @@ logicalmkup
 \paragraph_separation indent
 \paragraph_indentation default
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
diff --git a/src/tex2lyx/test/test.lyx.lyx b/src/tex2lyx/test/test.lyx.lyx
index 67f46f7..03afa64 100644
--- a/src/tex2lyx/test/test.lyx.lyx
+++ b/src/tex2lyx/test/test.lyx.lyx
@@ -32,7 +32,8 @@
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -71,8 +72,8 @@
 \paragraph_separation indent
 \paragraph_indentation default
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
diff --git a/src/tex2lyx/test/verbatim.lyx.lyx 
b/src/tex2lyx/test/verbatim.lyx.lyx
index 7fbe6fd..1ba37bd 100644
--- a/src/tex2lyx/test/verbatim.lyx.lyx
+++ b/src/tex2lyx/test/verbatim.lyx.lyx
@@ -21,7 +21,8 @@
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
-\use_microtype 0
+\use_microtype false
+\use_dash_ligatures true
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -60,8 +61,8 @@
 \paragraph_separation indent
 \paragraph_indentation default
 \is_formula_indent 0
-\formula_indentation 
 \quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default

Reply via email to