]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_hash.C
use stream-like syntax for LaTeX output
[lyx.git] / src / mathed / math_hash.C
index 8004a2680e6b3190c933ec49a59489d146ad4cc7..888ff8748a1cc128df5f4bf987050475162dc6f6 100644 (file)
@@ -4,10 +4,8 @@
 #include "lyxlex.h"
 #include "debug.h"
 #include "support/filetools.h" // LibFileSearch
-#include "support/lyxfunctional.h"
 
 #include <map>
-#include <algorithm>
 
 
 namespace {
@@ -39,46 +37,46 @@ latexkeys_a wordlist_array[] =
        {"\\",  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, LM_acute},
+       {"acute",  LM_TK_DECORATION, 0},
        {"arccos",  LM_TK_FUNC, 0},
        {"arcsin",  LM_TK_FUNC, 0},
        {"arctan",  LM_TK_FUNC, 0},
        {"arg",  LM_TK_FUNC, 0},
        {"atop",  LM_TK_ATOP, 0},
-       {"backslash",  LM_TK_SPECIAL, '\\'},
-       {"bar",  LM_TK_DECORATION, LM_bar},
+       {"bar",  LM_TK_DECORATION, 0},
        {"begin",  LM_TK_BEGIN, 0},
        {"binom",  LM_TK_BINOM, 0},
        {"bmod",  LM_TK_FUNC, 0},
-       {"breve",  LM_TK_DECORATION, LM_breve},
+       {"breve",  LM_TK_DECORATION, 0},
        {"cal",  LM_TK_OLDFONT, LM_TC_CAL},
-       {"cdots",  LM_TK_DOTS, LM_cdots},
-       {"check",  LM_TK_DECORATION, LM_check},
+       {"cdots",  LM_TK_DOTS, 0},
+       {"check",  LM_TK_DECORATION, 0},
        {"choose",  LM_TK_CHOOSE, 0},
        {"cos",  LM_TK_FUNC, 0},
        {"cosh",  LM_TK_FUNC, 0},
        {"cot",  LM_TK_FUNC, 0},
        {"coth",  LM_TK_FUNC, 0},
        {"csc",  LM_TK_FUNC, 0},
-       {"ddot",  LM_TK_DECORATION, LM_ddot},
-       {"ddots",  LM_TK_DOTS, LM_ddots},
+       {"ddot",  LM_TK_DECORATION, 0},
+       {"ddots",  LM_TK_DOTS, 0},
        {"deg",  LM_TK_FUNC, 0},
        {"det",  LM_TK_FUNCLIM, 0},
        {"dim",  LM_TK_FUNC, 0},
        //{"displaystyle",  LM_TK_STY, LM_ST_DISPLAY},
-       {"dot",  LM_TK_DECORATION, LM_dot},
+       {"dot",  LM_TK_DECORATION, 0},
        {"end",  LM_TK_END, 0},
        {"exp",  LM_TK_FUNC, 0},
        {"frac",  LM_TK_FRAC, 0},
        {"gcd",  LM_TK_FUNCLIM, 0},
-       {"grave",  LM_TK_DECORATION, LM_grave},
-       {"hat",  LM_TK_DECORATION, LM_hat},
+       {"grave",  LM_TK_DECORATION, 0},
+       {"hat",  LM_TK_DECORATION, 0},
        {"hom",  LM_TK_FUNC, 0},
        {"inf",  LM_TK_FUNCLIM, 0},
        {"ker",  LM_TK_FUNC, 0},
        {"kern",  LM_TK_KERN, 0},
        {"label",  LM_TK_LABEL, 0},
-       {"ldots",  LM_TK_DOTS, LM_ldots},
+       {"lefteqn",  LM_TK_LEFTEQN, 1},
+       {"ldots",  LM_TK_DOTS, 0},
        {"left",  LM_TK_LEFT, 0},
        {"lg",  LM_TK_FUNC, 0},
        {"lim",  LM_TK_FUNCLIM, 0},
@@ -96,16 +94,17 @@ latexkeys_a wordlist_array[] =
        {"mathsf",  LM_TK_FONT, LM_TC_SF},
        {"mathtt",  LM_TK_FONT, LM_TC_TT},
        {"max",  LM_TK_FUNCLIM, 0},
+       //{"mbox",  LM_TK_BOX, 0},
        {"min",  LM_TK_FUNCLIM, 0},
        {"newcommand",  LM_TK_NEWCOMMAND, 0 },
        {"nolimits",  LM_TK_LIMIT, static_cast<unsigned>(-1)},
        {"nonumber",  LM_TK_NONUM, 0},
-       {"not",  LM_TK_NOT, LM_not},
+       {"not",  LM_TK_NOT, 0},
        {"over",  LM_TK_OVER, 0},
-       {"overbrace",  LM_TK_DECORATION, LM_overbrace},
-       {"overleftarrow",  LM_TK_DECORATION, LM_overleftarrow},
-       {"overline",  LM_TK_DECORATION, LM_overline},
-       {"overrightarrow",  LM_TK_DECORATION, LM_overightarrow},
+       {"overbrace",  LM_TK_DECORATION, 0},
+       {"overleftarrow",  LM_TK_DECORATION, 0},
+       {"overline",  LM_TK_DECORATION, 0},
+       {"overrightarrow",  LM_TK_DECORATION, 0},
        {"protect",  LM_TK_PROTECT, 0},
        {"qquad",  LM_TK_SPACE, 5},
        {"quad",  LM_TK_SPACE, 4},
@@ -123,16 +122,15 @@ latexkeys_a wordlist_array[] =
        {"tanh",  LM_TK_FUNC, 0},
        {"textrm",  LM_TK_FONT, LM_TC_TEXTRM},
        //{"textstyle",  LM_TK_STY, LM_ST_TEXT},
-       {"tilde",  LM_TK_DECORATION, LM_tilde},
-       {"underbrace",  LM_TK_DECORATION, LM_underbrace},
-       {"underline",  LM_TK_DECORATION, LM_underline},
-       {"vdots",  LM_TK_DOTS, LM_vdots},
-       {"vec",  LM_TK_DECORATION, LM_vec},
-       {"widehat",  LM_TK_DECORATION, LM_widehat},
-       {"widetilde",  LM_TK_DECORATION, LM_widetilde},
+       {"tilde",  LM_TK_DECORATION, 0},
+       {"underbrace",  LM_TK_DECORATION, 0},
+       {"underline",  LM_TK_DECORATION, 0},
+       {"vdots",  LM_TK_DOTS, 0},
+       {"vec",  LM_TK_DECORATION, 0},
+       {"widehat",  LM_TK_DECORATION, 0},
+       {"widetilde",  LM_TK_DECORATION, 0},
        {"{",  LM_TK_SPECIAL, '{'},
-       {"|",  LM_TK_UNDEF, '|'},
-       {"}",  LM_TK_SPECIAL, '}'},
+       {"}",  LM_TK_SPECIAL, '}'}
 };
 
 
@@ -157,6 +155,7 @@ MathTokenEnum tokenEnum(const string & font)
        return LM_TK_SYM;
 }
 
+
 MathSymbolTypes symbolType(const string & type)
 {
        if (type == "mathrel")
@@ -185,7 +184,11 @@ void ReadSymbols(string const & filename)
                        tmp.id = lex.getInteger();
                if (lex.next())
                        tmp.type = symbolType(lex.getString());
-               wordlist[tmp.name] = tmp;
+               if (wordlist.find(tmp.name) != wordlist.end())
+                       lyxerr << "ReadSymbols: token " << tmp.name
+                              << " already exists.\n";
+               else
+                       wordlist[tmp.name] = tmp;
        }
 }