...
\[\begin{array}{ccc}
- 1 & 2\b & 3^2\\
- 4 & 5\e & 6\\
- 7 & 8 & 9
+1
+&
+
\end{array}\]
*/
#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
#include "math_parser.h"
#include "math_inset.h"
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();
}
}
MathScriptInset * p = cell->back().nucleus()->asScriptInset();
// special handling of {}-bases
// is this always correct?
- if (p->nuc().size() == 1 && p->nuc().back()->asNestInset() &&
- p->nuc().back()->extraBraces())
- p->nuc() = p->nuc().back()->asNestInset()->cell(0);
+ // It appears that this is wrong (Dekel)
+ //if (p->nuc().size() == 1 && p->nuc().back()->asNestInset() &&
+ // p->nuc().back()->extraBraces())
+ // p->nuc() = p->nuc().back()->asNestInset()->cell(0);
parse(p->cell(up), FLAG_ITEM, mode);
if (limits) {
p->limits(limits);
}
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);
#warning A hack...
#endif
string s;
- while (1) {
+ while (true) {
Token const & t = getToken();
if (!good()) {
putback();
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);
istringstream is(str.c_str());
Parser(is).parse1(grid, 0, MathInset::MATH_MODE, false);
}
-