commit 10c8d51b9032ebc968c50c740c9cb883b3b3cfb9
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Tue Dec 6 16:29:38 2016 +0100

    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.
---
 src/mathed/InsetMathKern.cpp |    2 ++
 src/mathed/MathFactory.cpp   |    2 +-
 src/mathed/MathParser.cpp    |    2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mathed/InsetMathKern.cpp b/src/mathed/InsetMathKern.cpp
index 71723b9..8373b61 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 f000937..7e780d4 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 ffb8283..d4ecc72 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;

Reply via email to