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-24 18:29:55 +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"
|
2002-01-03 12:02:54 +00:00
|
|
|
#include "math_sizeinset.h"
|
2001-08-13 14:19:16 +00:00
|
|
|
#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_stackrelinset.h"
|
2001-11-09 10:44:24 +00:00
|
|
|
#include "math_symbolinset.h"
|
2002-02-01 10:33:06 +00:00
|
|
|
#include "math_undersetinset.h"
|
2001-11-09 10:44:24 +00:00
|
|
|
#include "math_unknowninset.h"
|
2002-02-05 09:51:40 +00:00
|
|
|
#include "math_xarrowinset.h"
|
|
|
|
#include "math_xymatrixinset.h"
|
2001-08-13 14:19:16 +00:00
|
|
|
|
|
|
|
|
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-11-07 13:15:59 +00:00
|
|
|
return MathAtom(new MathFuncLimInset(l->name));
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_SPECIAL:
|
2002-01-08 11:03:34 +00:00
|
|
|
return MathAtom(new MathSpecialCharInset(static_cast<char>(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);
|
2002-02-01 10:33:06 +00:00
|
|
|
case LM_TK_UNDERSET:
|
|
|
|
return MathAtom(new MathUndersetInset);
|
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-24 18:29:55 +00:00
|
|
|
case LM_TK_BOX:
|
|
|
|
return MathAtom(new MathBoxInset(l->name));
|
2001-11-09 10:44:24 +00:00
|
|
|
case LM_TK_FUNC:
|
|
|
|
return MathAtom(new MathFuncInset(l->name));
|
2002-01-03 12:02:54 +00:00
|
|
|
case LM_TK_STY:
|
|
|
|
return MathAtom(new MathSizeInset(l));
|
2002-01-19 17:05:24 +00:00
|
|
|
default:
|
|
|
|
return MathAtom(new MathUnknownInset(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-23 09:03:07 +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
|
|
|
|
2002-02-04 18:44:51 +00:00
|
|
|
if (s == "xymatrix")
|
|
|
|
return MathAtom(new MathXYMatrixInset);
|
|
|
|
|
2002-02-05 09:51:40 +00:00
|
|
|
if (s == "xrightarrow")
|
|
|
|
return MathAtom(new MathXArrowInset(s));
|
|
|
|
|
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-23 09:03:07 +00:00
|
|
|
//cerr << "creating inset 2 with name: '" << s << "'\n";
|
2001-11-09 10:44:24 +00:00
|
|
|
return MathAtom(new MathUnknownInset(s));
|
2001-08-15 05:50:39 +00:00
|
|
|
}
|