]> git.lyx.org Git - features.git/commitdiff
Accept \kern and \mkern for math kerning
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 6 Dec 2016 15:29:38 +0000 (16:29 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 6 Dec 2016 15:29:38 +0000 (16:29 +0100)
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
src/mathed/MathFactory.cpp
src/mathed/MathParser.cpp

index 71723b99561f2369340dfee1f35b38c208d944e3..8373b61fbf425988ff15afecaa9b0cd98cb0b97f 100644 (file)
@@ -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()) << ' ';
 }
index f00093746f8ca73f37b3ac80d9cc4cff473cb690..7e780d4737f250d855952052ad3f9172a0af2eda 100644 (file)
@@ -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';
index ffb828361cd24d48e404ec9594dba35c14e45f72..d4ecc72f22ac82376fa689f22e583bb52bfd3e84 100644 (file)
@@ -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;