mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Refine fix for bug #1337.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35009 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
976307231d
commit
0d78b79311
@ -849,9 +849,16 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
Token const & n = getToken();
|
Token const & n = getToken();
|
||||||
if (n.cat() == catMath) {
|
if (n.cat() == catMath) {
|
||||||
// TeX's $$...$$ syntax for displayed math
|
// TeX's $$...$$ syntax for displayed math
|
||||||
cell->push_back(MathAtom(new InsetMathHull(buf, hullEquation)));
|
if (mode == InsetMath::UNDECIDED_MODE) {
|
||||||
parse2(cell->back(), FLAG_SIMPLE, InsetMath::MATH_MODE, false);
|
cell->push_back(MathAtom(new InsetMathHull(buf, hullEquation)));
|
||||||
getToken(); // skip the second '$' token
|
parse2(cell->back(), FLAG_SIMPLE, InsetMath::MATH_MODE, false);
|
||||||
|
getToken(); // skip the second '$' token
|
||||||
|
} else {
|
||||||
|
// This is not an outer hull and display math is
|
||||||
|
// not allowed inside text mode environments.
|
||||||
|
error("bad math environment");
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// simple $...$ stuff
|
// simple $...$ stuff
|
||||||
putback();
|
putback();
|
||||||
@ -872,8 +879,19 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
error("something strange in the parser");
|
Token const & n = getToken();
|
||||||
break;
|
if (n.cat() == catMath) {
|
||||||
|
error("something strange in the parser");
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
// This is inline math ($...$), but the parser thinks we are
|
||||||
|
// already in math mode and latex would issue an error, unless we
|
||||||
|
// are inside a text mode user macro. We have no way to tell, so
|
||||||
|
// let's play safe by using \ensuremath, as it will work in any case.
|
||||||
|
putback();
|
||||||
|
cell->push_back(MathAtom(new InsetMathEnsureMath(buf)));
|
||||||
|
parse(cell->back().nucleus()->cell(0), FLAG_SIMPLE, InsetMath::MATH_MODE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user