From: Jean-Marc Lasgouttes Date: Tue, 6 Dec 2016 15:29:38 +0000 (+0100) Subject: Accept \kern and \mkern for math kerning X-Git-Tag: 2.3.0alpha1~654 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=10c8d51b9032ebc968c50c740c9cb883b3b3cfb9;p=features.git Accept \kern and \mkern for math kerning Also output the right one depending on whether the unit is "mu" or not. Indeed, the two macros are identical, except that \mkern only accepts unit mu, and kern does not accept it. With this patch, both macros accept all units, but on writing beck, the right one is used. --- diff --git a/src/mathed/InsetMathKern.cpp b/src/mathed/InsetMathKern.cpp index 71723b9956..8373b61fbf 100644 --- a/src/mathed/InsetMathKern.cpp +++ b/src/mathed/InsetMathKern.cpp @@ -61,6 +61,8 @@ void InsetMathKern::write(WriteStream & os) const { if (wid_.empty()) os << "\\kern" << ' '; + else if (wid_.unit() == Length::MU) + os << "\\mkern" << from_utf8(wid_.asLatexString()) << ' '; else os << "\\kern" << from_utf8(wid_.asLatexString()) << ' '; } diff --git a/src/mathed/MathFactory.cpp b/src/mathed/MathFactory.cpp index f00093746f..7e780d4737 100644 --- a/src/mathed/MathFactory.cpp +++ b/src/mathed/MathFactory.cpp @@ -495,7 +495,7 @@ MathAtom createInsetMath(docstring const & s, Buffer * buf) return MathAtom(new InsetMathMakebox(buf, true)); if (s == "makebox") return MathAtom(new InsetMathMakebox(buf, false)); - if (s == "kern") + if (s == "kern" || s == "mkern") return MathAtom(new InsetMathKern); if (s.substr(0, 8) == "xymatrix") { char spacing_code = '\0'; diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp index ffb828361c..d4ecc72f22 100644 --- a/src/mathed/MathParser.cpp +++ b/src/mathed/MathParser.cpp @@ -1763,7 +1763,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags, } } - else if (t.cs() == "kern") { + else if (t.cs() == "kern" || t.cs() == "mkern") { // FIXME: A hack... docstring s; int num_tokens = 0;