commit f686a97fd8b1aa8d5b223508898837c5df96eeac
Author: Juergen Spitzmueller <[email protected]>
Date:   Sat Dec 28 13:41:19 2019 +0100

    Restructure ct LaTeX markup
    
    This makes it easier to redefine the markup only.
---
 src/LaTeXFeatures.cpp |   54 ++++++++++++++++++++++++++----------------------
 1 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 88e3ef8..d13c35d 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -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;
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to