]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_hash.C
make \newcommand{\bb}[1]{\mathbf{#1}} work for read/write/display.
[lyx.git] / src / mathed / math_hash.C
index cf729e23320b9360401b3dcfa2bfe9317fe91abc..46927b920b0e46672d20a9c88642f335a59b45ae 100644 (file)
@@ -1,6 +1,7 @@
 #include <config.h>
 
 #include "math_parser.h"
+#include "math_metricsinfo.h"
 #include "lyxlex.h"
 #include "debug.h"
 #include "support/filetools.h" // LibFileSearch
@@ -10,6 +11,7 @@
 
 namespace {
 
+// global
 std::map<string, latexkeys> theWordList;
 
 
@@ -17,11 +19,12 @@ struct key_type {
        ///
        char const * name;
        ///
-       short token;
+       MathTokenEnum token;
        ///
        unsigned int id;
 };
 
+
 key_type wordlist_array[] = 
 {
        {"!",  LM_TK_SPACE, 0},
@@ -37,7 +40,6 @@ key_type wordlist_array[] =
        {";",  LM_TK_SPACE, 3},
        {"Pr",  LM_TK_FUNCLIM, 0},
        {"[",  LM_TK_BEGIN, LM_OT_EQUATION},
-       {"\\",  LM_TK_NEWLINE, static_cast<unsigned>(-1)}, // -1 needed in mathed_parse_lines!
        {"]",  LM_TK_END, LM_OT_EQUATION},
        {"_",  LM_TK_SPECIAL, '_'},
        {"acute",  LM_TK_DECORATION, 0},
@@ -48,6 +50,7 @@ key_type wordlist_array[] =
        {"atop",  LM_TK_ATOP, 0},
        {"bar",  LM_TK_DECORATION, 0},
        {"begin",  LM_TK_BEGIN, 0},
+       {"bf",  LM_TK_OLDFONT, LM_TC_BF},
        {"binom",  LM_TK_BINOM, 0},
        {"bmod",  LM_TK_FUNC, 0},
        {"breve",  LM_TK_DECORATION, 0},
@@ -65,16 +68,18 @@ key_type wordlist_array[] =
        {"deg",  LM_TK_FUNC, 0},
        {"det",  LM_TK_FUNCLIM, 0},
        {"dim",  LM_TK_FUNC, 0},
-       //{"displaystyle",  LM_TK_STY, LM_ST_DISPLAY},
+       {"displaystyle",  LM_TK_STY, LM_ST_DISPLAY},
        {"dot",  LM_TK_DECORATION, 0},
        {"end",  LM_TK_END, 0},
        {"exp",  LM_TK_FUNC, 0},
        {"frac",  LM_TK_FRAC, 0},
+       {"frak",  LM_TK_FONT, LM_TC_EUFRAK},
        {"gcd",  LM_TK_FUNCLIM, 0},
        {"grave",  LM_TK_DECORATION, 0},
        {"hat",  LM_TK_DECORATION, 0},
        {"hom",  LM_TK_FUNC, 0},
        {"inf",  LM_TK_FUNCLIM, 0},
+       {"it",  LM_TK_OLDFONT, LM_TC_IT},
        {"ker",  LM_TK_FUNC, 0},
        {"kern",  LM_TK_KERN, 0},
        {"label",  LM_TK_LABEL, 0},
@@ -88,9 +93,11 @@ key_type wordlist_array[] =
        {"limsup",  LM_TK_FUNCLIM, 0},
        {"ln",  LM_TK_FUNC, 0},
        {"log",  LM_TK_FUNC, 0},
+       {"lyxbox",  LM_TK_BOX, 0},
        {"mathbb",  LM_TK_FONT, LM_TC_BB},
        {"mathbf",  LM_TK_FONT, LM_TC_BF},
        {"mathcal",  LM_TK_FONT, LM_TC_CAL},
+       {"mathfrak",  LM_TK_FONT, LM_TC_EUFRAK},
        {"mathit",  LM_TK_FONT, LM_TC_IT},
        {"mathnormal",  LM_TK_FONT, LM_TC_VAR},
        {"mathrm",  LM_TK_FONT, LM_TC_RM},
@@ -112,9 +119,10 @@ key_type wordlist_array[] =
        {"qquad",  LM_TK_SPACE, 5},
        {"quad",  LM_TK_SPACE, 4},
        {"right",  LM_TK_RIGHT, 0},
+       {"rm",  LM_TK_OLDFONT, LM_TC_RM},
        {"root",  LM_TK_ROOT, 0},
-       //{"scriptscriptstyle",  LM_TK_STY, LM_ST_SCRIPTSCRIPT},
-       //{"scriptstyle",  LM_TK_STY, LM_ST_SCRIPT},
+       {"scriptscriptstyle",  LM_TK_STY, LM_ST_SCRIPTSCRIPT},
+       {"scriptstyle",  LM_TK_STY, LM_ST_SCRIPT},
        {"sec",  LM_TK_FUNC, 0},
        {"sin",  LM_TK_FUNC, 0},
        {"sinh",  LM_TK_FUNC, 0},
@@ -124,8 +132,9 @@ key_type wordlist_array[] =
        {"tan",  LM_TK_FUNC, 0},
        {"tanh",  LM_TK_FUNC, 0},
        {"textrm",  LM_TK_FONT, LM_TC_TEXTRM},
-       //{"textstyle",  LM_TK_STY, LM_ST_TEXT},
+       {"textstyle",  LM_TK_STY, LM_ST_TEXT},
        {"tilde",  LM_TK_DECORATION, 0},
+       {"tt",  LM_TK_OLDFONT, LM_TC_TT},
        {"underbrace",  LM_TK_DECORATION, 0},
        {"underline",  LM_TK_DECORATION, 0},
        {"vdots",  LM_TK_DOTS, 0},
@@ -156,16 +165,6 @@ MathTokenEnum tokenEnum(const string & font)
 }
 
 
-MathSymbolTypes symbolType(const string & type)
-{
-       if (type == "mathrel")
-               return LMB_RELATION;
-       if (type == "mathbin")
-               return LMB_OPERATOR;    
-       return LMB_NONE;
-}
-
-
 void readSymbols(string const & filename)
 {
        LyXLex lex(0, 0);
@@ -180,7 +179,9 @@ void readSymbols(string const & filename)
                if (lex.next())
                        tmp.id = lex.getInteger();
                if (lex.next())
-                       tmp.type = symbolType(lex.getString());
+                       tmp.type = lex.getString();
+               if (lex.next())
+                       tmp.xmlname = lex.getString();
                if (theWordList.find(tmp.name) != theWordList.end())
                        lyxerr << "readSymbols: token " << tmp.name
                               << " already exists.\n";
@@ -197,7 +198,6 @@ void initSymbols()
                tmp.name          = p->name;
                tmp.token         = p->token;
                tmp.id            = p->id;
-               tmp.type          = LMB_NONE;
                tmp.latex_font_id = 0;
                theWordList[p->name] = tmp;
        }