2001-08-13 14:19:16 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "math_parser.h"
|
2001-08-13 15:26:41 +00:00
|
|
|
#include "math_binominset.h"
|
2001-10-19 11:25:48 +00:00
|
|
|
//#include "math_boxinset.h"
|
2001-08-13 14:19:16 +00:00
|
|
|
#include "math_decorationinset.h"
|
|
|
|
#include "math_dotsinset.h"
|
|
|
|
#include "math_funcinset.h"
|
|
|
|
#include "math_funcliminset.h"
|
|
|
|
#include "math_fracinset.h"
|
2001-08-21 14:20:50 +00:00
|
|
|
#include "math_kerninset.h"
|
2001-10-18 13:21:21 +00:00
|
|
|
#include "math_lefteqninset.h"
|
2001-08-13 14:19:16 +00:00
|
|
|
#include "math_macro.h"
|
|
|
|
#include "math_macrotable.h"
|
2001-09-12 14:31:18 +00:00
|
|
|
#include "math_macroarg.h"
|
2001-08-17 09:48:24 +00:00
|
|
|
#include "math_notinset.h"
|
2001-08-13 14:19:16 +00:00
|
|
|
#include "math_rootinset.h"
|
|
|
|
#include "math_spaceinset.h"
|
2001-08-30 08:55:13 +00:00
|
|
|
#include "math_specialcharinset.h"
|
2001-08-13 14:19:16 +00:00
|
|
|
#include "math_sqrtinset.h"
|
|
|
|
#include "math_symbolinset.h"
|
|
|
|
#include "math_stackrelinset.h"
|
|
|
|
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
MathAtom createMathInset(latexkeys const * l)
|
2001-08-13 14:19:16 +00:00
|
|
|
{
|
|
|
|
switch (l->token) {
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_FUNCLIM:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathFuncLimInset(l));
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_SPECIAL:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathSpecialCharInset(l->id));
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_SYM:
|
2001-08-31 21:15:57 +00:00
|
|
|
case LM_TK_CMR:
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_CMSY:
|
|
|
|
case LM_TK_CMM:
|
|
|
|
case LM_TK_CMEX:
|
|
|
|
case LM_TK_MSA:
|
|
|
|
case LM_TK_MSB:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathSymbolInset(l));
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_STACK:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathStackrelInset);
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_KERN:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathKernInset);
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_BINOM:
|
|
|
|
case LM_TK_CHOOSE:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathBinomInset);
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_OVER:
|
|
|
|
case LM_TK_FRAC:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathFracInset);
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_ATOP:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathFracInset(true));
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_NOT:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathNotInset);
|
2001-10-18 13:21:21 +00:00
|
|
|
case LM_TK_LEFTEQN:
|
|
|
|
return MathAtom(new MathLefteqnInset);
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_SQRT:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathSqrtInset);
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_ROOT:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathRootInset);
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_DECORATION:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathDecorationInset(l->name));
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_SPACE:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathSpaceInset(l->id));
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_DOTS:
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathDotsInset(l->name));
|
2001-10-19 11:25:48 +00:00
|
|
|
//case LM_TK_BOX:
|
|
|
|
// return MathAtom(new MathBoxInset(l->name));
|
2001-08-13 14:19:16 +00:00
|
|
|
}
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathFuncInset(l->name));
|
2001-08-13 14:19:16 +00:00
|
|
|
}
|
2001-08-15 05:50:39 +00:00
|
|
|
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
MathAtom createMathInset(string const & s)
|
2001-08-15 05:50:39 +00:00
|
|
|
{
|
2001-09-11 10:58:17 +00:00
|
|
|
//cerr << "creating inset with name: '" << s << "'\n";
|
2001-09-12 14:31:18 +00:00
|
|
|
if (s.size() == 2 && s[0] == '#' && s[1] >= '1' && s[1] <= '9')
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathMacroArgument(s[1] - '0'));
|
2001-09-12 14:31:18 +00:00
|
|
|
|
2001-10-10 16:35:18 +00:00
|
|
|
if (s.size() == 3 && s[0] == '\\' && s[1] == '#' && s[2] >= '1' && s[2] <= '9')
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathMacroArgument(s[2] - '0'));
|
2001-10-10 16:35:18 +00:00
|
|
|
|
2001-08-15 05:50:39 +00:00
|
|
|
latexkeys const * l = in_word_set(s);
|
2001-09-11 10:58:17 +00:00
|
|
|
if (l)
|
2001-08-15 05:50:39 +00:00
|
|
|
return createMathInset(l);
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
if (MathMacroTable::has(s))
|
|
|
|
return MathAtom(new MathMacro(s));
|
2001-08-15 05:50:39 +00:00
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
return MathAtom(new MathFuncInset(s));
|
2001-08-15 05:50:39 +00:00
|
|
|
}
|