]> git.lyx.org Git - features.git/commitdiff
Restructure ct LaTeX markup
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 28 Dec 2019 12:41:19 +0000 (13:41 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:49 +0000 (15:48 +0200)
This makes it easier to redefine the markup only.

src/LaTeXFeatures.cpp

index 88e3ef8eb512f40c2a2d069e98dea70598fdb2ec..d13c35d891f5447d605cc308f48344cdd9cb0152 100644 (file)
@@ -258,41 +258,43 @@ static docstring const changetracking_dvipost_cb_def = from_ascii(
        "\\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"
+       "\\DeclareRobustCommand{\\mklyxdeleted}[1]{\\bgroup\\color{lyxdeleted}\\mklyxsout{#1}\\egroup}\n"
+       "\\DeclareRobustCommand{\\mklyxsout}[1]{\\ifx\\\\#1\\else\\sout{#1}\\fi}\n");
+
 static docstring const changetracking_xcolor_ulem_def = from_ascii(
-       "%% Change tracking with ulem\n"
-       "\\DeclareRobustCommand{\\lyxadded}[4][]{{\\color{lyxadded}{}#4}}\n"
-       "\\DeclareRobustCommand{\\lyxdeleted}[4][]{{\\color{lyxdeleted}\\lyxsout{#4}}}\n"
-       "\\DeclareRobustCommand{\\lyxsout}[1]{\\ifx\\\\#1\\else\\sout{#1}\\fi}\n");
+       "%% Change tracking with ulem and xcolor: ct markup\n"
+       "\\DeclareRobustCommand{\\lyxadded}[4][]{\\mklyxadded{#4}}\n"
+       "\\DeclareRobustCommand{\\lyxdeleted}[4][]{\\mklyxdeleted{#4}}\n");
 
 static docstring const changetracking_xcolor_ulem_cb_def = from_ascii(
-       "%% Change tracking with ulem and changebars\n"
-       "\\DeclareRobustCommand{\\lyxadded}[4][]{{%\n"
-       "    \\protect\\cbstart\\color{lyxadded}{}#4%\n"
+       "%% Change tracking with ulem, xcolor and changebars: ct markup\n"
+       "\\DeclareRobustCommand{\\lyxadded}[4][]{%\n"
+       "    \\protect\\cbstart\\mklyxadded{#4}%\n"
        "    \\protect\\cbend%\n"
-       "}}\n"
-       "\\DeclareRobustCommand{\\lyxdeleted}[4][]{{%\n"
-       "    \\protect\\cbstart\\color{lyxdeleted}\\lyxsout{#4}%\n"
+       "}\n"
+       "\\DeclareRobustCommand{\\lyxdeleted}[4][]{%\n"
+       "    \\protect\\cbstart\\mklyxdeleted{#4}%\n"
        "    \\protect\\cbend%\n"
-       "}}\n"
-       "\\DeclareRobustCommand{\\lyxsout}[1]{\\ifx\\\\#1\\else\\sout{#1}\\fi}\n");
+       "}\n");
 
 static docstring const changetracking_xcolor_ulem_hyperref_def = from_ascii(
-       "%% Change tracking with ulem and hyperref\n"
-       "\\DeclareRobustCommand{\\lyxadded}[4][]{{\\texorpdfstring{\\color{lyxadded}{}}{}#4}}\n"
-       "\\DeclareRobustCommand{\\lyxdeleted}[4][]{{\\texorpdfstring{\\color{lyxdeleted}\\lyxsout{#4}}{}}}\n"
-       "\\DeclareRobustCommand{\\lyxsout}[1]{\\ifx\\\\#1\\else\\sout{#1}\\fi}\n");
+       "%% Change tracking with ulem, xcolor, and hyperref: ct markup\n"
+       "\\DeclareRobustCommand{\\lyxadded}[4][]{\\texorpdfstring{\\mklyxadded{#4}}{#4}}\n"
+       "\\DeclareRobustCommand{\\lyxdeleted}[4][]{\\texorpdfstring{\\mklyxdeleted{#4}}{}}\n");
 
 static docstring const changetracking_xcolor_ulem_hyperref_cb_def = from_ascii(
-       "%% Change tracking with ulem, hyperref and changebars\n"
-       "\\DeclareRobustCommand{\\lyxadded}[4][]{{%\n"
-       "    \\texorpdfstring{\\protect\\cbstart\\color{lyxadded}{}}{}#4%\n"
-       "    \\texorpdfstring{\\protect\\cbend}{}%\n"
-       "}}\n"
-       "\\DeclareRobustCommand{\\lyxdeleted}[4][]{{%\n"
-       "    \\texorpdfstring{\\protect\\cbstart\\color{lyxdeleted}\\lyxsout{#4}%\n"
+       "%% Change tracking with ulem, xcolor, hyperref and changebars: ct markup\n"
+       "\\DeclareRobustCommand{\\lyxadded}[4][]{%\n"
+       "    \\texorpdfstring{\\protect\\cbstart\\mklyxadded{#4}%\n"
+       "    \\protect\\cbend}{#4}%\n"
+       "}\n"
+       "\\DeclareRobustCommand{\\lyxdeleted}[4][]{%\n"
+       "    \\texorpdfstring{\\protect\\cbstart\\mklyxdeleted{#4}%\n"
        "    \\protect\\cbend}{}%\n"
-       "}}\n"
-       "\\DeclareRobustCommand{\\lyxsout}[1]{\\ifx\\\\#1\\else\\sout{#1}\\fi}\n");
+       "}\n");
 
 static docstring const changetracking_tikz_object_sout_def = from_ascii(
        "%% Strike out display math and text objects with tikz\n"
@@ -1678,6 +1680,8 @@ TexString LaTeXFeatures::getMacros() const
 
                macros.os().precision(prec);
 
+               macros << changetracking_xcolor_ulem_base_def;
+
                if (isRequired("changebar")) {
                        if (isRequired("hyperref"))
                                macros << changetracking_xcolor_ulem_hyperref_cb_def;