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.
This commit is contained in:
Jean-Marc Lasgouttes 2016-12-06 16:29:38 +01:00
parent c8a829d273
commit 10c8d51b90
3 changed files with 4 additions and 2 deletions

View File

@ -61,6 +61,8 @@ void InsetMathKern::write(WriteStream & os) const
{ {
if (wid_.empty()) if (wid_.empty())
os << "\\kern" << ' '; os << "\\kern" << ' ';
else if (wid_.unit() == Length::MU)
os << "\\mkern" << from_utf8(wid_.asLatexString()) << ' ';
else else
os << "\\kern" << from_utf8(wid_.asLatexString()) << ' '; os << "\\kern" << from_utf8(wid_.asLatexString()) << ' ';
} }

View File

@ -495,7 +495,7 @@ MathAtom createInsetMath(docstring const & s, Buffer * buf)
return MathAtom(new InsetMathMakebox(buf, true)); return MathAtom(new InsetMathMakebox(buf, true));
if (s == "makebox") if (s == "makebox")
return MathAtom(new InsetMathMakebox(buf, false)); return MathAtom(new InsetMathMakebox(buf, false));
if (s == "kern") if (s == "kern" || s == "mkern")
return MathAtom(new InsetMathKern); return MathAtom(new InsetMathKern);
if (s.substr(0, 8) == "xymatrix") { if (s.substr(0, 8) == "xymatrix") {
char spacing_code = '\0'; char spacing_code = '\0';

View 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... // FIXME: A hack...
docstring s; docstring s;
int num_tokens = 0; int num_tokens = 0;