Fix greyedout with RTL languages (#8647)

This commit is contained in:
Udi Fogiel 2024-06-10 15:03:05 +03:00
parent c92b481a44
commit ee43584140
2 changed files with 10 additions and 44 deletions

View File

@ -546,38 +546,10 @@ static docstring const lyxmintcaption_def = from_ascii(
"}\n"); "}\n");
docstring const lyxgreyedoutDef(bool const rtl, bool const ct, bool const lua, bool const babel) docstring const lyxgreyedoutDef(bool const ct)
{ {
odocstringstream ods; odocstringstream ods;
if (rtl) {
ods << "%% The greyedout annotation environment (with RTL support)\n"
<< "\\NewEnviron{lyxgreyedout}{%\n";
if (lua && !babel)
// luabidi uses this switch
ods << " \\if@RTL%\n";
else
ods << " \\if@rl%\n";
ods << " \\everypar{%\n";
if (lua)
ods << " \\pardir TRT \\textdir TRT\\normalfont\\normalsize\\textcolor{note_fontcolor}\\ignorespaces%\n";
else
ods << " \\normalfont\\normalsize\\textcolor{note_fontcolor}\\beginL\\ignorespaces%\n";
ods << " }%\n";
if (ct)
ods << " \\colorlet{lyxadded}{lyxadded!30}\\colorlet{lyxdeleted}{lyxdeleted!30}%\n";
if (lua)
ods << " \\BODY\\everypar{\\ignorespacesafterend}%\n";
else
ods << " \\BODY\\everypar{\\ignorespacesafterend\\endL}%\n";
ods << " \\else%\n";
if (ct)
ods << " \\colorlet{lyxadded}{lyxadded!30}\\colorlet{lyxdeleted}{lyxdeleted!30}%\n";
ods << " \\normalfont\\normalsize\\textcolor{note_fontcolor}\\bgroup\\ignorespaces%\n"
<< " \\BODY\\ignorespacesafterend\\egroup%\n"
<< " \\fi%\n"
<< "}\n";
} else {
ods << "%% The greyedout annotation environment\n" ods << "%% The greyedout annotation environment\n"
<< "\\newenvironment{lyxgreyedout}\n" << "\\newenvironment{lyxgreyedout}\n"
<< "{"; << "{";
@ -585,7 +557,6 @@ docstring const lyxgreyedoutDef(bool const rtl, bool const ct, bool const lua, b
ods << "\\colorlet{lyxadded}{lyxadded!30}\\colorlet{lyxdeleted}{lyxdeleted!30}%\n "; ods << "\\colorlet{lyxadded}{lyxadded!30}\\colorlet{lyxdeleted}{lyxdeleted!30}%\n ";
ods << "\\normalfont\\normalsize\\textcolor{note_fontcolor}\\bgroup\\ignorespaces}\n" ods << "\\normalfont\\normalsize\\textcolor{note_fontcolor}\\bgroup\\ignorespaces}\n"
<< "{\\ignorespacesafterend\\egroup}\n"; << "{\\ignorespacesafterend\\egroup}\n";
}
return ods.str(); return ods.str();
} }
@ -1166,7 +1137,6 @@ char const * simplefeatures[] = {
"xskak", "xskak",
"pict2e", "pict2e",
"drs", "drs",
"environ",
"dsfont", "dsfont",
"hepparticles", "hepparticles",
"hepnames" "hepnames"
@ -1740,10 +1710,8 @@ TexString LaTeXFeatures::getMacros() const
// the color is specified in the routine // the color is specified in the routine
// getColorOptions() to avoid LaTeX-package clashes // getColorOptions() to avoid LaTeX-package clashes
if (mustProvide("lyxgreyedout")) if (mustProvide("lyxgreyedout"))
// We need different version for RTL (#8647), with change tracking (#12025) // We need different version with change tracking (#12025)
// and for some specific engine/language package combinations macros << lyxgreyedoutDef(mustProvide("ct-xcolor-ulem"));
macros << lyxgreyedoutDef(hasRTLLanguage(), mustProvide("ct-xcolor-ulem"),
(runparams_.flavor == Flavor::LuaTeX), useBabel());
if (mustProvide("lyxdot")) if (mustProvide("lyxdot"))
macros << lyxdot_def << '\n'; macros << lyxdot_def << '\n';

View File

@ -336,8 +336,6 @@ void InsetNote::validate(LaTeXFeatures & features) const
features.useInsetLayout(getLayout()); features.useInsetLayout(getLayout());
break; break;
case InsetNoteParams::Greyedout: case InsetNoteParams::Greyedout:
if (features.hasRTLLanguage())
features.require("environ");
InsetCollapsible::validate(features); InsetCollapsible::validate(features);
break; break;
case InsetNoteParams::Note: case InsetNoteParams::Note: