]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
Fix bug #11716
[lyx.git] / src / LaTeXFeatures.cpp
index e80fcbf3339ae68c6a92c0ea5ebe5127229cf845..c1e259748b974dc3258fd4155252887d5eec81e1 100644 (file)
@@ -312,10 +312,19 @@ static docstring const changetracking_tikz_object_sout_def = from_ascii(
 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][]{\\lyxobjectsout{\\parbox{\\linewidth}{#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(
@@ -325,26 +334,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"
-       "     \\texorpdfstring{\\lyxobjectsout{\\parbox{\\linewidth}{#4}}}{}%\n"
+       "  \\ifx#4\\empty\\else%\n"
+       "     \\texorpdfstring{\\leavevmode\\\\\\lyxobjectsout{\\parbox{\\linewidth}{#4}}}{}%\n"
+       "  \\fi%\n"
        "}\n"
        "\\DeclareRobustCommand{\\lyxudisplayobjdeleted}[4][]{%\n"
-       "     \\texorpdfstring{\\raisebox{-\\belowdisplayshortskip}{%\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(
@@ -355,17 +376,22 @@ static docstring const changetracking_xcolor_ulem_hyperref_cb_object_def = from_
        "    \\protect\\cbend}{}%\n"
        "}\n"
        "\\DeclareRobustCommand{\\lyxdisplayobjdeleted}[4][]{%\n"
-       "     \\texorpdfstring{\\protect\\cbstart%\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"
-       "     \\texorpdfstring{\\protect\\cbstart%\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(
@@ -1281,7 +1307,11 @@ string const LaTeXFeatures::getPackages() const
        // than those above.
 
        if (mustProvide("changebar") && !mustProvide("ct-dvipost")) {
-               packages << "\\usepackage{changebar}\n";
+               packages << "\\usepackage";
+               if (runparams_.flavor == OutputParams::LATEX
+                   || runparams_.flavor == OutputParams::DVILUATEX)
+                       packages << "[dvips]";
+               packages << "{changebar}\n";
        }
 
        if (mustProvide("footnote")) {