]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
Replace the hardcoded TEXT_TO_INSET_OFFSET by tunable values
[lyx.git] / src / LaTeXFeatures.cpp
index 9f65ed40eada01c5d73fc3cb91cc0d34ef208918..fd16b2803554c3406dd1a20341fd7749e9440d7d 100644 (file)
@@ -235,29 +235,6 @@ static docstring const lyxdot_def = from_ascii(
        "%% A simple dot to overcome graphicx limitations\n"
        "\\newcommand{\\lyxdot}{.}\n");
 
-static docstring const changetracking_dvipost_def = from_ascii(
-       "%% Change tracking with dvipost\n"
-       "\\dvipostlayout\n"
-       "\\dvipost{osstart color push Red}\n"
-       "\\dvipost{osend color pop}\n"
-       "\\dvipost{cbstart color push Blue}\n"
-       "\\dvipost{cbrule 0pt}\n"
-       "\\dvipost{cbend color pop}\n"
-       "\\DeclareRobustCommand{\\lyxadded}[4][]{\\changestart#4\\changeend}\n"
-       "\\DeclareRobustCommand{\\lyxdeleted}[4][]{%\n"
-       "\\changestart\\overstrikeon#4\\overstrikeoff\\changeend}\n");
-
-static docstring const changetracking_dvipost_cb_def = from_ascii(
-       "%% Change tracking with dvipost\n"
-       "\\dvipostlayout\n"
-       "\\dvipost{osstart color push Red}\n"
-       "\\dvipost{osend color pop}\n"
-       "\\dvipost{cbstart color push Blue}\n"
-       "\\dvipost{cbend color pop}\n"
-       "\\DeclareRobustCommand{\\lyxadded}[4][]{\\changestart#4\\changeend}\n"
-       "\\DeclareRobustCommand{\\lyxdeleted}[4][]{%\n"
-       "\\changestart\\overstrikeon#4\\overstrikeoff\\changeend}\n");
-
 static docstring const changetracking_xcolor_ulem_base_def = from_ascii(
        "%% Change tracking with ulem and xcolor: base macros\n"
        "\\DeclareRobustCommand{\\mklyxadded}[1]{\\bgroup\\color{lyxadded}{}#1\\egroup}\n"
@@ -313,13 +290,18 @@ static docstring const changetracking_xcolor_ulem_object_def = from_ascii(
        "%% Change tracking with ulem and xcolor: ct markup for complex objects\n"
        "\\DeclareRobustCommand{\\lyxobjdeleted}[4][]{\\lyxobjectsout{#4}}\n"
        "\\DeclareRobustCommand{\\lyxdisplayobjdeleted}[4][]{%\n"
+       "  \\ifx#4\\empty\\else%\n"
        "     \\leavevmode\\\\%\n"
        "     \\lyxobjectsout{\\parbox{\\linewidth}{#4}}%\n"
+       "  \\fi%\n"
        "}\n"
        "\\DeclareRobustCommand{\\lyxudisplayobjdeleted}[4][]{%\n"
+       "  \\ifx#4\\empty\\else%\n"
        "     \\leavevmode\\\\%\n"
        "     \\raisebox{-\\belowdisplayshortskip}{%\n"
        "                \\lyxobjectsout{\\parbox[b]{\\linewidth}{#4}}}%\n"
+       "     \\leavevmode\\\\%\n"
+       "  \\fi%\n"
        "}\n");
 
 static docstring const changetracking_xcolor_ulem_cb_object_def = from_ascii(
@@ -329,28 +311,38 @@ static docstring const changetracking_xcolor_ulem_cb_object_def = from_ascii(
        "    \\protect\\cbend%\n"
        "}\n"
        "\\DeclareRobustCommand{\\lyxdisplayobjdeleted}[4][]{%\n"
+       "  \\ifx#4\\empty\\else%\n"
        "    \\leavevmode\\\\%\n"
        "    \\protect\\cbstart%\n"
        "    \\lyxobjectsout{\\parbox{\\linewidth}{#4}}%\n"
        "    \\protect\\cbend%\n"
+       "  \\fi%\n"
        "}\n"
        "\\DeclareRobustCommand{\\lyxudisplayobjdeleted}[4][]{%\n"
+       "  \\ifx#4\\empty\\else%\n"
        "    \\leavevmode\\\\%\n"
        "    \\raisebox{-\\belowdisplayshortskip}{%\n"
        "               \\protect\\cbstart%\n"
        "               \\lyxobjectsout{\\parbox[b]{\\linewidth}{#4}}}%\n"
        "               \\protect\\cbend%\n"
+       "     \\leavevmode\\\\%\n"
+       "  \\fi%\n"
        "}\n");
 
 static docstring const changetracking_xcolor_ulem_hyperref_object_def = from_ascii(
        "%% Change tracking with ulem, xcolor, and hyperref: ct markup for complex objects\n"
        "\\DeclareRobustCommand{\\lyxobjdeleted}[4][]{\\texorpdfstring{\\lyxobjectsout{#4}}{}}\n"
        "\\DeclareRobustCommand{\\lyxdisplayobjdeleted}[4][]{%\n"
+       "  \\ifx#4\\empty\\else%\n"
        "     \\texorpdfstring{\\leavevmode\\\\\\lyxobjectsout{\\parbox{\\linewidth}{#4}}}{}%\n"
+       "  \\fi%\n"
        "}\n"
        "\\DeclareRobustCommand{\\lyxudisplayobjdeleted}[4][]{%\n"
+       "  \\ifx#4\\empty\\else%\n"
        "     \\texorpdfstring{\\leavevmode\\\\\\raisebox{-\\belowdisplayshortskip}{%\n"
        "                \\lyxobjectsout{\\parbox[b]{\\linewidth}{#4}}}}{}%\n"
+       "     \\leavevmode\\\\%\n"
+       "  \\fi%\n"
        "}\n");
 
 static docstring const changetracking_xcolor_ulem_hyperref_cb_object_def = from_ascii(
@@ -361,17 +353,22 @@ static docstring const changetracking_xcolor_ulem_hyperref_cb_object_def = from_
        "    \\protect\\cbend}{}%\n"
        "}\n"
        "\\DeclareRobustCommand{\\lyxdisplayobjdeleted}[4][]{%\n"
+       "  \\ifx#4\\empty\\else%\n"
        "     \\texorpdfstring{\\leavevmode\\\\\\protect\\cbstart%\n"
        "        \\lyxobjectsout{\\parbox{\\linewidth}{#4}}%\n"
        "        \\protect\\cbend%\n"
        "      }{}%\n"
+       "  \\fi%\n"
        "}\n"
        "\\DeclareRobustCommand{\\lyxudisplayobjdeleted}[4][]{%\n"
+       "  \\ifx#4\\empty\\else%\n"
        "     \\texorpdfstring{\\leavevmode\\\\\\protect\\cbstart%\n"
        "        \\raisebox{-\\belowdisplayshortskip}{%\n"
        "                   \\lyxobjectsout{\\parbox[b]{\\linewidth}{#4}}%\n"
        "        }%\n"
+       "      \\leavevmode\\\\%\n"
        "     }{}%\n"
+       "  \\fi%\n"
        "}\n");
 
 static docstring const changetracking_none_def = from_ascii(
@@ -1111,7 +1108,6 @@ char const * simplefeatures[] = {
        "float",
        "wrapfig",
        "booktabs",
-       "dvipost",
        "fancybox",
        "calc",
        "units",
@@ -1286,8 +1282,12 @@ string const LaTeXFeatures::getPackages() const
        // The rest of these packages are somewhat more complicated
        // than those above.
 
-       if (mustProvide("changebar") && !mustProvide("ct-dvipost")) {
-               packages << "\\usepackage{changebar}\n";
+       if (mustProvide("changebar")) {
+               packages << "\\usepackage";
+               if (runparams_.flavor == OutputParams::LATEX
+                   || runparams_.flavor == OutputParams::DVILUATEX)
+                       packages << "[dvips]";
+               packages << "{changebar}\n";
        }
 
        if (mustProvide("footnote")) {
@@ -1729,13 +1729,6 @@ TexString LaTeXFeatures::getMacros() const
                macros << lyxref_def << '\n';
 
        // change tracking
-       if (mustProvide("ct-dvipost")) {
-               if (isRequired("changebar"))
-                       macros << changetracking_dvipost_cb_def;
-               else
-                       macros << changetracking_dvipost_def;
-       }
-
        if (mustProvide("ct-xcolor-ulem")) {
                streamsize const prec = macros.os().precision(2);