namespace {
-MathInset::mode_type asMode(string const & str)
+MathInset::mode_type asMode(MathInset::mode_type oldmode, string const & str)
{
if (str == "mathmode")
return MathInset::MATH_MODE;
if (str == "textmode" || str == "forcetext")
return MathInset::TEXT_MODE;
- return MathInset::UNDECIDED_MODE;
+ return oldmode;
}
ostream & operator<<(ostream & os, Token const & t)
{
if (t.cs().size())
- os << "\\" << t.cs();
+ os << '\\' << t.cs();
else
- os << "[" << t.character() << "," << t.cat() << "]";
+ os << '[' << t.character() << ',' << t.cat() << ']';
return os;
}
break;
}
}
+ // Remove the space after \end_inset
+ if (is.get(c) && c != ' ')
+ is.unget();
// tokenize buffer
tokenize(s);
if (t.cat() == catBegin) {
putback();
res += '{' + parse_verbatim_item() + '}';
- } else
+ } else
res += t.asString();
}
}
putback();
res += '{' + parse_verbatim_item() + '}';
}
- else
+ else
res += t.asString();
}
}
}
else if (t.cs() == "hline") {
- if (grid.asHullInset())
- grid.asHullInset()->rowinfo(cellrow + 1);
+ grid.rowinfo(cellrow).lines_ ++;
}
else if (t.cs() == "sqrt") {
}
}
+ else if (t.cs() == "xrightarrow" || t.cs() == "xleftarrow") {
+ cell->push_back(createMathInset(t.cs()));
+ parse(cell->back().nucleus()->cell(1), FLAG_OPTION, mode);
+ parse(cell->back().nucleus()->cell(0), FLAG_ITEM, mode);
+ }
+
else if (t.cs() == "ref") {
cell->push_back(MathAtom(new RefInset));
parse(cell->back().nucleus()->cell(1), FLAG_OPTION, mode);
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
}
+ else if (name == "flalign" || name == "flalign*") {
+ cell->push_back(MathAtom(new MathHullInset("flalign")));
+ parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
+ }
+
else if (name == "alignat" || name == "alignat*") {
// ignore this for a while
getArg('{', '}');
#warning A hack...
#endif
string s;
- while (1) {
+ while (true) {
Token const & t = getToken();
if (!good()) {
putback();
if (l) {
if (l->inset == "font") {
cell->push_back(createMathInset(t.cs()));
- parse(cell->back().nucleus()->cell(0), FLAG_ITEM, asMode(l->extra));
+ parse(cell->back().nucleus()->cell(0), FLAG_ITEM, asMode(mode, l->extra));
}
else if (l->inset == "oldfont") {
cell->push_back(createMathInset(t.cs()));
- parse(cell->back().nucleus()->cell(0), flags, asMode(l->extra));
+ parse(cell->back().nucleus()->cell(0), flags, asMode(mode, l->extra));
return;
}
else if (l->inset == "parbox") {
// read optional positioning and width
string pos = parse_verbatim_option();
- string width = parse_verbatim_item();
+ string width = parse_verbatim_item();
cell->push_back(createMathInset(t.cs()));
parse(cell->back().nucleus()->cell(0), FLAG_ITEM, MathInset::TEXT_MODE);
cell->back().nucleus()->asParboxInset()->setPosition(pos);
else {
MathAtom at = createMathInset(t.cs());
for (MathInset::idx_type i = 0; i < at->nargs(); ++i)
- parse(at.nucleus()->cell(i), FLAG_ITEM, asMode(l->extra));
+ parse(at.nucleus()->cell(i), FLAG_ITEM, asMode(mode, l->extra));
cell->push_back(at);
}
}
istringstream is(str.c_str());
Parser(is).parse1(grid, 0, MathInset::MATH_MODE, false);
}
-