3 #include "math_parser.h"
4 #include "math_arrayinset.h"
5 #include "math_amsarrayinset.h"
6 #include "math_binominset.h"
7 #include "math_boxinset.h"
8 #include "math_casesinset.h"
9 #include "math_decorationinset.h"
10 #include "math_dotsinset.h"
11 #include "math_funcinset.h"
12 #include "math_funcliminset.h"
13 #include "math_fracinset.h"
14 #include "math_kerninset.h"
15 #include "math_lefteqninset.h"
16 #include "math_macro.h"
17 #include "math_macrotable.h"
18 #include "math_macroarg.h"
19 #include "math_notinset.h"
20 #include "math_rootinset.h"
21 #include "math_sizeinset.h"
22 #include "math_spaceinset.h"
23 #include "math_splitinset.h"
24 #include "math_specialcharinset.h"
25 #include "math_sqrtinset.h"
26 #include "math_stackrelinset.h"
27 #include "math_substackinset.h"
28 #include "math_symbolinset.h"
29 #include "math_undersetinset.h"
30 #include "math_unknowninset.h"
31 #include "math_xarrowinset.h"
32 #include "math_xymatrixinset.h"
33 #include "math_xyarrowinset.h"
36 MathAtom createMathInset(latexkeys const * l)
40 return MathAtom(new MathFuncLimInset(l->name));
42 return MathAtom(new MathSpecialCharInset(static_cast<char>(l->id)));
50 return MathAtom(new MathSymbolInset(l));
52 return MathAtom(new MathStackrelInset);
54 return MathAtom(new MathUndersetInset);
57 return MathAtom(new MathBinomInset);
60 return MathAtom(new MathFracInset);
62 return MathAtom(new MathFracInset(true));
64 return MathAtom(new MathNotInset);
66 return MathAtom(new MathLefteqnInset);
68 return MathAtom(new MathSqrtInset);
70 return MathAtom(new MathRootInset);
71 case LM_TK_DECORATION:
72 return MathAtom(new MathDecorationInset(l->name));
74 return MathAtom(new MathSpaceInset(l->id));
76 return MathAtom(new MathDotsInset(l->name));
78 return MathAtom(new MathBoxInset(l->name));
80 return MathAtom(new MathFuncInset(l->name));
82 return MathAtom(new MathSizeInset(l));
84 return MathAtom(new MathUnknownInset(l->name));
89 MathAtom createMathInset(string const & s)
91 //cerr << "creating inset with name: '" << s << "'\n";
92 if (s.size() == 2 && s[0] == '#' && s[1] >= '1' && s[1] <= '9')
93 return MathAtom(new MathMacroArgument(s[1] - '0'));
95 if (s.size() == 3 && s[0] == '\\' && s[1] == '#'
96 && s[2] >= '1' && s[2] <= '9')
97 return MathAtom(new MathMacroArgument(s[2] - '0'));
100 return MathAtom(new MathKernInset);
103 return MathAtom(new MathXYMatrixInset);
105 if (s == "xrightarrow" || s == "xleftarrow")
106 return MathAtom(new MathXArrowInset(s));
108 if (s == "split" || s == "gathered" || s == "aligned")
109 return MathAtom(new MathSplitInset(s));
112 return MathAtom(new MathCasesInset);
115 return MathAtom(new MathSubstackInset);
117 if (s == "subarray" || s == "array")
118 return MathAtom(new MathArrayInset(s, 1, 1));
120 if (s == "pmatrix" || s == "bmatrix" || s == "vmatrix" || s == "Vmatrix" ||
122 return MathAtom(new MathAMSArrayInset(s));
124 latexkeys const * l = in_word_set(s);
126 return createMathInset(l);
128 if (MathMacroTable::has(s))
129 return MathAtom(new MathMacro(s));
131 //cerr << "creating inset 2 with name: '" << s << "'\n";
132 return MathAtom(new MathUnknownInset(s));