fix broken ^ stuff; break delimiters...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2466 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-08-09 15:19:31 +00:00
parent eacae6cb46
commit d6f2a2313a
22 changed files with 307 additions and 343 deletions

View File

@ -62,6 +62,8 @@ libmathed_la_SOURCES = \
math_matrixinset.h \ math_matrixinset.h \
math_nestinset.C \ math_nestinset.C \
math_nestinset.h \ math_nestinset.h \
math_noglyphinset.C \
math_noglyphinset.h \
math_parser.C \ math_parser.C \
math_parser.h \ math_parser.h \
math_rootinset.C \ math_rootinset.C \

View File

@ -16,7 +16,7 @@ Inset hierarchy:
/ \ / \
Nest Dots Func Space Symbol Nest Dots Func Space Symbol Bigop Noglyph
(for thing with (for thing with
nested content) nested content)

View File

@ -74,17 +74,13 @@ void handleFont(BufferView * bv, MathTextCodes t)
mathcursor->handleFont(t); mathcursor->handleFont(t);
} }
void handleAccent(BufferView * bv, string const & name) void handleAccent(BufferView * bv, string const & name)
{ {
bv->lockedInsetStoreUndo(Undo::EDIT); bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->handleAccent(name); mathcursor->handleAccent(name);
} }
void handleDelim(BufferView * bv, int l, int r)
{
bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->handleDelim(l, r);
}
bool openNewInset(BufferView * bv, UpdatableInset * new_inset) bool openNewInset(BufferView * bv, UpdatableInset * new_inset)
{ {
@ -590,45 +586,19 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
case LFUN_MATH_DELIM: case LFUN_MATH_DELIM:
{ {
bv->lockedInsetStoreUndo(Undo::INSERT); bv->lockedInsetStoreUndo(Undo::INSERT);
static const string vdelim("(){}[]./|");
//lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n"; //lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n";
string ls;
if (arg.empty()) string rs;
istringstream is(arg.c_str());
is >> ls >> rs;
latexkeys const * l = in_word_set(ls);
latexkeys const * r = in_word_set(rs);
if (!is || !l || !r) {
lyxerr << "can't parse delimeters from '" << arg << "'\n";
break; break;
// try to read integers first
int ilt = '(';
int irt = '.';
istringstream is(arg.c_str());
is >> ilt >> irt;
if (!is) { // ok, the beasties are no integers... try something else
ilt = '(';
irt = '.';
istringstream is(arg.c_str());
string lt;
string rt;
is >> lt >> rt;
//lyxerr << "formulabase::LFUN_MATH_DELIM, lt: '" << lt << "'\n";
//lyxerr << "formulabase::LFUN_MATH_DELIM, rt: '" << rt << "'\n";
if (lt.size() > 1) {
latexkeys const * l = in_word_set(lt);
if (l)
ilt = l->id;
} else if (vdelim.find(lt[0]) != string::npos)
ilt = lt[0];
if (rt.size() > 1) {
latexkeys const * l = in_word_set(rt);
if (l)
irt = l->id;
} else if (vdelim.find(rt[0]) != string::npos)
irt = rt[0];
} }
bv->lockedInsetStoreUndo(Undo::EDIT);
handleDelim(bv, ilt, irt); mathcursor->handleDelim(l, r);
updateLocal(bv, true); updateLocal(bv, true);
break; break;
} }
@ -804,7 +774,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
if (code != LM_TC_TEXTRM) if (code != LM_TC_TEXTRM)
code = LM_TC_BOP; code = LM_TC_BOP;
mathcursor->insert(c, code); mathcursor->insert(c, code);
} else if (strchr("#$%^{|}", c)) { } else if (strchr("#$%{|}", c)) {
MathTextCodes code = mathcursor->getLastCode(); MathTextCodes code = mathcursor->getLastCode();
if (code != LM_TC_TEXTRM) if (code != LM_TC_TEXTRM)
code = LM_TC_SPECIAL; code = LM_TC_SPECIAL;

View File

@ -32,17 +32,7 @@ void MathBigopInset::writeNormal(ostream & os) const
void MathBigopInset::metrics(MathStyles st) const void MathBigopInset::metrics(MathStyles st) const
{ {
size_ = st; size_ = st;
mathed_char_dim(LM_TC_BSYM, st, sym_->id, ascent_, descent_, width_);
if (sym_->id > 0 && sym_->id < 256) {
ssym_ = string();
ssym_ += sym_->id;
code_ = (sym_->token == LM_TK_BIGSYM) ? LM_TC_BSYM : LM_TC_SYMB;
} else {
ssym_ = sym_->name;
code_ = LM_TC_TEXTRM;
}
mathed_string_dim(code_, size(), ssym_, ascent_, descent_, width_);
} }
@ -50,6 +40,5 @@ void MathBigopInset::draw(Painter & pain, int x, int y) const
{ {
xo(x); xo(x);
yo(y); yo(y);
drawChar(pain, LM_TC_BSYM, size_, x, y, sym_->id);
drawStr(pain, code_, size_, x, y, ssym_);
} }

View File

@ -6,7 +6,6 @@
// larger in displayed formulae and take limits // larger in displayed formulae and take limits
#include "math_diminset.h" #include "math_diminset.h"
#include "LString.h"
struct latexkeys; struct latexkeys;
@ -31,7 +30,5 @@ public:
private: private:
/// ///
latexkeys const * sym_; latexkeys const * sym_;
///
mutable string ssym_;
}; };
#endif #endif

View File

@ -45,6 +45,7 @@
#include "math_macrotable.h" #include "math_macrotable.h"
#include "math_macrotemplate.h" #include "math_macrotemplate.h"
#include "math_matrixinset.h" #include "math_matrixinset.h"
#include "math_noglyphinset.h"
#include "math_rootinset.h" #include "math_rootinset.h"
#include "math_spaceinset.h" #include "math_spaceinset.h"
#include "math_sqrtinset.h" #include "math_sqrtinset.h"
@ -675,6 +676,11 @@ void MathCursor::interpret(string const & s)
p = new MathFuncInset(s); p = new MathFuncInset(s);
} else { } else {
switch (l->token) { switch (l->token) {
case LM_TK_NOGLYPH:
case LM_TK_NOGLYPHB:
p = new MathNoglyphInset(l);
break;
case LM_TK_BIGSYM: case LM_TK_BIGSYM:
p = new MathBigopInset(l); p = new MathBigopInset(l);
break; break;
@ -897,7 +903,7 @@ void MathCursor::handleAccent(string const & name)
} }
void MathCursor::handleDelim(int l, int r) void MathCursor::handleDelim(latexkeys const * l, latexkeys const * r)
{ {
handleNest(new MathDelimInset(l, r)); handleNest(new MathDelimInset(l, r));
} }

View File

@ -33,6 +33,7 @@ class InsetFormulaBase;
class MathArray; class MathArray;
class MathXArray; class MathXArray;
class Painter; class Painter;
class latexkeys;
/// Description of a position /// Description of a position
struct MathCursorPos { struct MathCursorPos {
@ -171,7 +172,7 @@ public:
/// ///
void handleAccent(string const & name); void handleAccent(string const & name);
/// ///
void handleDelim(int l, int r); void handleDelim(latexkeys const * l, latexkeys const * r);
/// ///
void handleNest(MathInset * p); void handleNest(MathInset * p);
/// Splits cells and shifts right part to the next cell /// Splits cells and shifts right part to the next cell

View File

@ -56,7 +56,7 @@ void MathDecorationInset::draw(Painter & pain, int x, int y) const
xo(x); xo(x);
yo(x); yo(x);
xcell(0).draw(pain, x, y); xcell(0).draw(pain, x, y);
mathed_draw_deco(pain, x, y + dy_, width_, dh_, key_->id); mathed_draw_deco(pain, x, y + dy_, width_, dh_, key_);
} }

View File

@ -9,7 +9,7 @@
#include "support/LOstream.h" #include "support/LOstream.h"
MathDelimInset::MathDelimInset(int l, int r) MathDelimInset::MathDelimInset(latexkeys const * l, latexkeys const * r)
: MathNestInset(1), left_(l), right_(r) : MathNestInset(1), left_(l), right_(r)
{} {}
@ -20,34 +20,33 @@ MathInset * MathDelimInset::clone() const
} }
string MathDelimInset::latexName(latexkeys const * l)
{
//static const string vdelim("(){}[]./|");
string name = l->name;
if (name == "(")
return name;
if (name == "[")
return name;
if (name == ".")
return name;
if (name == ")")
return name;
if (name == "]")
return name;
if (name == "/")
return name;
if (name == "|")
return name;
return "\\" + name + " ";
}
void MathDelimInset::write(std::ostream & os, bool fragile) const void MathDelimInset::write(std::ostream & os, bool fragile) const
{ {
latexkeys const * l = (left_ != '|') ? os << "\\left" << latexName(left_);
lm_get_key_by_id(left_, LM_TK_SYM) : 0;
latexkeys const * r = (right_ != '|') ?
lm_get_key_by_id(right_, LM_TK_SYM) : 0;
os << "\\left";
if (l)
os << '\\' << l->name << ' ';
else {
if (left_ == '{' || left_ == '}')
os << '\\' << char(left_) << ' ';
else
os << char(left_) << ' ';
}
cell(0).write(os, fragile); cell(0).write(os, fragile);
os << "\\right" << latexName(right_);
os << "\\right";
if (r)
os << '\\' << r->name << ' ';
else {
if (right_ == '{' || right_ == '}')
os << '\\' << char(right_) << ' ';
else
os << char(right_) << ' ';
}
} }
@ -59,7 +58,7 @@ void MathDelimInset::draw(Painter & pain, int x, int y) const
int w = dw(); int w = dw();
xcell(0).draw(pain, x + w, y); xcell(0).draw(pain, x + w, y);
if (left_ == '.') { if (latexName(left_) == ".") {
pain.line(x + 4, yo() - ascent_, x + 4, yo() + descent_, pain.line(x + 4, yo() - ascent_, x + 4, yo() + descent_,
LColor::mathcursor, Painter::line_onoffdash); LColor::mathcursor, Painter::line_onoffdash);
} else } else
@ -67,7 +66,7 @@ void MathDelimInset::draw(Painter & pain, int x, int y) const
x += width() - w - 2; x += width() - w - 2;
if (right_ == '.') { if (latexName(right_) == ".") {
pain.line(x + 4, yo() - ascent_, x + 4, yo() + descent_, pain.line(x + 4, yo() - ascent_, x + 4, yo() + descent_,
LColor::mathcursor, Painter::line_onoffdash); LColor::mathcursor, Painter::line_onoffdash);
} else } else

View File

@ -3,6 +3,7 @@
#define MATH_DELIMINSET_H #define MATH_DELIMINSET_H
#include "math_nestinset.h" #include "math_nestinset.h"
#include "LString.h"
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
@ -11,10 +12,18 @@
/** A delimiter /** A delimiter
\author Alejandro Aguilar Sierra \author Alejandro Aguilar Sierra
*/ */
class latexkeys;
class MathDelimInset : public MathNestInset { class MathDelimInset : public MathNestInset {
public: public:
/// ///
MathDelimInset(int, int); MathDelimInset(latexkeys const *, latexkeys const *);
#warning Remove this ass soon the Math panel patch is applied
///
///MathDelimInset(int, int) : MathNestInset(2) {}
/// ///
MathInset * clone() const; MathInset * clone() const;
/// ///
@ -24,10 +33,13 @@ public:
/// ///
void metrics(MathStyles st) const; void metrics(MathStyles st) const;
private: private:
///
static string latexName(latexkeys const *);
///
int dw() const; int dw() const;
/// ///
int left_; latexkeys const * left_;
/// ///
int right_; latexkeys const * right_;
}; };
#endif #endif

View File

@ -23,12 +23,12 @@ MathInset * MathDotsInset::clone() const
void MathDotsInset::draw(Painter & pain, int x, int y) const void MathDotsInset::draw(Painter & pain, int x, int y) const
{ {
mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, key_->id); mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, key_);
if (key_->id == LM_vdots || key_->id == LM_ddots) if (key_->id == LM_vdots || key_->id == LM_ddots)
++x; ++x;
if (key_->id != LM_vdots) if (key_->id != LM_vdots)
--y; --y;
mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, key_->id); mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, key_);
} }

View File

@ -24,6 +24,7 @@ latexkeys const wordlist[] =
{"(", LM_TK_BEGIN, LM_OT_SIMPLE, LMB_NONE}, {"(", LM_TK_BEGIN, LM_OT_SIMPLE, LMB_NONE},
{")", LM_TK_END, LM_OT_SIMPLE, LMB_NONE}, {")", LM_TK_END, LM_OT_SIMPLE, LMB_NONE},
{",", LM_TK_SPACE, 1, LMB_NONE}, {",", LM_TK_SPACE, 1, LMB_NONE},
{".", LM_TK_SPECIAL, '.', LMB_NONE},
{":", LM_TK_SPACE, 2, LMB_NONE}, {":", LM_TK_SPACE, 2, LMB_NONE},
{";", LM_TK_SPACE, 3, LMB_NONE}, {";", LM_TK_SPACE, 3, LMB_NONE},
{"Delta", LM_TK_SYM, LM_Delta, LMB_NONE}, {"Delta", LM_TK_SYM, LM_Delta, LMB_NONE},
@ -33,9 +34,9 @@ latexkeys const wordlist[] =
{"Lambda", LM_TK_SYM, LM_Lambda, LMB_NONE}, {"Lambda", LM_TK_SYM, LM_Lambda, LMB_NONE},
{"Leftarrow", LM_TK_SYM, LM_Leftarrow, LMB_NONE}, {"Leftarrow", LM_TK_SYM, LM_Leftarrow, LMB_NONE},
{"Leftrightarrow", LM_TK_SYM, LM_Leftrightarrow, LMB_NONE}, {"Leftrightarrow", LM_TK_SYM, LM_Leftrightarrow, LMB_NONE},
{"Longleftarrow", LM_TK_SYM, LM_Longleftarrow, LMB_NONE}, {"Longleftarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
{"Longleftrightarrow", LM_TK_SYM, LM_Longleftrightarrow, LMB_NONE}, {"Longleftrightarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
{"Longrightarrow", LM_TK_SYM, LM_Longrightarrow, LMB_NONE}, {"Longrightarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
{"Omega", LM_TK_SYM, LM_Omega, LMB_NONE}, {"Omega", LM_TK_SYM, LM_Omega, LMB_NONE},
{"Phi", LM_TK_SYM, LM_Phi, LMB_NONE}, {"Phi", LM_TK_SYM, LM_Phi, LMB_NONE},
{"Pi", LM_TK_SYM, LM_Pi, LMB_NONE}, {"Pi", LM_TK_SYM, LM_Pi, LMB_NONE},
@ -46,9 +47,9 @@ latexkeys const wordlist[] =
{"Sigma", LM_TK_SYM, LM_Sigma, LMB_NONE}, {"Sigma", LM_TK_SYM, LM_Sigma, LMB_NONE},
{"Theta", LM_TK_SYM, LM_Theta, LMB_NONE}, {"Theta", LM_TK_SYM, LM_Theta, LMB_NONE},
{"Uparrow", LM_TK_SYM, LM_Uparrow, LMB_NONE}, {"Uparrow", LM_TK_SYM, LM_Uparrow, LMB_NONE},
{"Updownarrow", LM_TK_SYM, LM_Updownarrow, LMB_NONE}, {"Updownarrow", LM_TK_NOGLYPH, LM_Updownarrow, LMB_NONE},
{"Upsilon", LM_TK_SYM, LM_Upsilon, LMB_NONE}, {"Upsilon", LM_TK_SYM, LM_Upsilon, LMB_NONE},
{"Vert", LM_TK_SYM, LM_Vert, LMB_NONE}, {"Vert", LM_TK_NOGLYPH, LM_Vert, LMB_NONE},
{"Xi", LM_TK_SYM, LM_Xi, LMB_NONE}, {"Xi", LM_TK_SYM, LM_Xi, LMB_NONE},
{"[", LM_TK_BEGIN, LM_OT_EQUATION, LMB_NONE}, {"[", LM_TK_BEGIN, LM_OT_EQUATION, LMB_NONE},
{"\\", LM_TK_NEWLINE, static_cast<unsigned>(-1), LMB_NONE}, {"\\", LM_TK_NEWLINE, static_cast<unsigned>(-1), LMB_NONE},
@ -57,33 +58,33 @@ latexkeys const wordlist[] =
{"acute", LM_TK_DECORATION, LM_acute, LMB_NONE}, {"acute", LM_TK_DECORATION, LM_acute, LMB_NONE},
{"aleph", LM_TK_SYM, LM_aleph, LMB_NONE}, {"aleph", LM_TK_SYM, LM_aleph, LMB_NONE},
{"alpha", LM_TK_SYM, LM_alpha, LMB_NONE}, {"alpha", LM_TK_SYM, LM_alpha, LMB_NONE},
{"amalg", LM_TK_SYM, LM_amalg, LMB_OPERATOR}, {"amalg", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"angle", LM_TK_SYM, LM_angle, LMB_NONE}, {"angle", LM_TK_SYM, LM_angle, LMB_NONE},
{"approx", LM_TK_SYM, LM_approx, LMB_RELATION}, {"approx", LM_TK_SYM, LM_approx, LMB_RELATION},
{"arccos", LM_TK_FUNC, 0, LMB_NONE}, {"arccos", LM_TK_FUNC, 0, LMB_NONE},
{"arcsin", LM_TK_FUNC, 0, LMB_NONE}, {"arcsin", LM_TK_FUNC, 0, LMB_NONE},
{"arctan", LM_TK_FUNC, 0, LMB_NONE}, {"arctan", LM_TK_FUNC, 0, LMB_NONE},
{"arg", LM_TK_FUNC, 0, LMB_NONE}, {"arg", LM_TK_FUNC, 0, LMB_NONE},
{"asymp", LM_TK_SYM, LM_asymp, LMB_RELATION}, {"asymp", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"backslash", LM_TK_SYM, LM_backslash, LMB_NONE}, {"backslash", LM_TK_SPECIAL, '\\', LMB_NONE},
{"bar", LM_TK_DECORATION, LM_bar, LMB_NONE}, {"bar", LM_TK_DECORATION, LM_bar, LMB_NONE},
{"begin", LM_TK_BEGIN, 0, LMB_NONE}, {"begin", LM_TK_BEGIN, 0, LMB_NONE},
{"beta", LM_TK_SYM, LM_beta, LMB_NONE}, {"beta", LM_TK_SYM, LM_beta, LMB_NONE},
{"bigcap", LM_TK_BIGSYM, LM_cap, LMB_NONE}, {"bigcap", LM_TK_NOGLYPHB, 0, LMB_NONE},
{"bigcirc", LM_TK_SYM, LM_bigcirc, LMB_OPERATOR}, {"bigcirc", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"bigcup", LM_TK_BIGSYM, LM_cup, LMB_NONE}, {"bigcup", LM_TK_NOGLYPHB, 0, LMB_NONE},
{"bigodot", LM_TK_BIGSYM, LM_bigodot, LMB_NONE}, {"bigodot", LM_TK_NOGLYPHB, 0, LMB_NONE},
{"bigoplus", LM_TK_BIGSYM, LM_oplus, LMB_NONE}, {"bigoplus", LM_TK_NOGLYPHB, 0, LMB_NONE},
{"bigotimes", LM_TK_BIGSYM, LM_otimes, LMB_NONE}, {"bigotimes", LM_TK_NOGLYPHB, 0, LMB_NONE},
{"bigsqcup", LM_TK_BIGSYM, LM_bigsqcup, LMB_NONE}, {"bigsqcup", LM_TK_NOGLYPHB, 0, LMB_NONE},
{"bigtriangledown", LM_TK_SYM, LM_bigtriangledown, LMB_OPERATOR}, {"bigtriangledown", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"bigtriangleup", LM_TK_SYM, LM_bigtriangleup, LMB_OPERATOR}, {"bigtriangleup", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"biguplus", LM_TK_BIGSYM, LM_biguplus, LMB_NONE}, {"biguplus", LM_TK_NOGLYPHB, 0, LMB_NONE},
{"bigvee", LM_TK_BIGSYM, LM_vee, LMB_NONE}, {"bigvee", LM_TK_NOGLYPHB, 0, LMB_NONE},
{"bigwedge", LM_TK_BIGSYM, LM_wedge, LMB_NONE}, {"bigwedge", LM_TK_NOGLYPHB, 0, LMB_NONE},
{"bmod", LM_TK_FUNC, 0, LMB_NONE}, {"bmod", LM_TK_FUNC, 0, LMB_NONE},
{"bot", LM_TK_SYM, LM_bot, LMB_NONE}, {"bot", LM_TK_SYM, LM_bot, LMB_NONE},
{"bowtie", LM_TK_SYM, LM_bowtie, LMB_RELATION}, {"bowtie", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"breve", LM_TK_DECORATION, LM_breve, LMB_NONE}, {"breve", LM_TK_DECORATION, LM_breve, LMB_NONE},
{"bullet", LM_TK_SYM, LM_bullet, LMB_OPERATOR}, {"bullet", LM_TK_SYM, LM_bullet, LMB_OPERATOR},
{"cap", LM_TK_SYM, LM_cap, LMB_OPERATOR}, {"cap", LM_TK_SYM, LM_cap, LMB_OPERATOR},
@ -91,19 +92,19 @@ latexkeys const wordlist[] =
{"cdots", LM_TK_DOTS, LM_cdots, LMB_NONE}, {"cdots", LM_TK_DOTS, LM_cdots, LMB_NONE},
{"check", LM_TK_DECORATION, LM_check, LMB_NONE}, {"check", LM_TK_DECORATION, LM_check, LMB_NONE},
{"chi", LM_TK_SYM, LM_chi, LMB_NONE}, {"chi", LM_TK_SYM, LM_chi, LMB_NONE},
{"circ", LM_TK_SYM, LM_circ, LMB_OPERATOR}, {"circ", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"clubsuit", LM_TK_SYM, LM_clubsuit, LMB_NONE}, {"clubsuit", LM_TK_SYM, LM_clubsuit, LMB_NONE},
{"cong", LM_TK_SYM, LM_cong, LMB_RELATION}, {"cong", LM_TK_SYM, LM_cong, LMB_RELATION},
{"coprod", LM_TK_BIGSYM, LM_coprod, LMB_NONE}, {"coprod", LM_TK_NOGLYPHB, 0, LMB_NONE},
{"cos", LM_TK_FUNC, 0, LMB_NONE}, {"cos", LM_TK_FUNC, 0, LMB_NONE},
{"cosh", LM_TK_FUNC, 0, LMB_NONE}, {"cosh", LM_TK_FUNC, 0, LMB_NONE},
{"cot", LM_TK_FUNC, 0, LMB_NONE}, {"cot", LM_TK_FUNC, 0, LMB_NONE},
{"coth", LM_TK_FUNC, 0, LMB_NONE}, {"coth", LM_TK_FUNC, 0, LMB_NONE},
{"csc", LM_TK_FUNC, 0, LMB_NONE}, {"csc", LM_TK_FUNC, 0, LMB_NONE},
{"cup", LM_TK_SYM, LM_cup, LMB_OPERATOR}, {"cup", LM_TK_SYM, LM_cup, LMB_OPERATOR},
{"dagger", LM_TK_SYM, LM_dagger, LMB_OPERATOR}, {"dagger", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"dashv", LM_TK_SYM, LM_dashv, LMB_RELATION}, {"dashv", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"ddagger", LM_TK_SYM, LM_ddagger, LMB_OPERATOR}, {"ddagger", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"ddot", LM_TK_DECORATION, LM_ddot, LMB_NONE}, {"ddot", LM_TK_DECORATION, LM_ddot, LMB_NONE},
{"ddots", LM_TK_DOTS, LM_ddots, LMB_NONE}, {"ddots", LM_TK_DOTS, LM_ddots, LMB_NONE},
{"deg", LM_TK_FUNC, 0, LMB_NONE}, {"deg", LM_TK_FUNC, 0, LMB_NONE},
@ -114,38 +115,38 @@ latexkeys const wordlist[] =
{"dim", LM_TK_FUNC, 0, LMB_NONE}, {"dim", LM_TK_FUNC, 0, LMB_NONE},
{"div", LM_TK_SYM, LM_div, LMB_OPERATOR}, {"div", LM_TK_SYM, LM_div, LMB_OPERATOR},
{"dot", LM_TK_DECORATION, LM_dot, LMB_NONE}, {"dot", LM_TK_DECORATION, LM_dot, LMB_NONE},
{"doteq", LM_TK_SYM, LM_doteq, LMB_RELATION}, {"doteq", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"downarrow", LM_TK_SYM, LM_downarrow, LMB_NONE}, {"downarrow", LM_TK_SYM, LM_downarrow, LMB_NONE},
{"ell", LM_TK_SYM, LM_ell, LMB_NONE}, {"ell", LM_TK_NOGLYPH, 0, LMB_NONE},
{"emptyset", LM_TK_MACRO, LM_emptyset, LMB_NONE}, {"emptyset", LM_TK_MACRO, LM_emptyset, LMB_NONE},
{"end", LM_TK_END, 0, LMB_NONE}, {"end", LM_TK_END, 0, LMB_NONE},
{"epsilon", LM_TK_SYM, LM_epsilon, LMB_NONE}, {"epsilon", LM_TK_NOGLYPH, 0, LMB_NONE},
{"equiv", LM_TK_SYM, LM_equiv, LMB_RELATION}, {"equiv", LM_TK_SYM, LM_equiv, LMB_RELATION},
{"eta", LM_TK_SYM, LM_eta, LMB_NONE}, {"eta", LM_TK_SYM, LM_eta, LMB_NONE},
{"exists", LM_TK_SYM, LM_exists, LMB_NONE}, {"exists", LM_TK_SYM, LM_exists, LMB_NONE},
{"exp", LM_TK_FUNC, 0, LMB_NONE}, {"exp", LM_TK_FUNC, 0, LMB_NONE},
{"flat", LM_TK_SYM, LM_flat, LMB_NONE}, {"flat", LM_TK_NOGLYPH, 0, LMB_NONE},
{"forall", LM_TK_SYM, LM_forall, LMB_NONE}, {"forall", LM_TK_SYM, LM_forall, LMB_NONE},
{"frac", LM_TK_FRAC, 0, LMB_NONE}, {"frac", LM_TK_FRAC, 0, LMB_NONE},
{"frown", LM_TK_SYM, LM_frown, LMB_RELATION}, {"frown", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"gamma", LM_TK_SYM, LM_gamma, LMB_NONE}, {"gamma", LM_TK_SYM, LM_gamma, LMB_NONE},
{"gcd", LM_TK_FUNCLIM, 0, LMB_NONE}, {"gcd", LM_TK_FUNCLIM, 0, LMB_NONE},
{"geq", LM_TK_SYM, LM_geq, LMB_RELATION}, {"geq", LM_TK_SYM, LM_geq, LMB_RELATION},
{"gg", LM_TK_SYM, LM_gg, LMB_RELATION}, {"gg", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"grave", LM_TK_DECORATION, LM_grave, LMB_NONE}, {"grave", LM_TK_DECORATION, LM_grave, LMB_NONE},
{"hat", LM_TK_DECORATION, LM_hat, LMB_NONE}, {"hat", LM_TK_DECORATION, LM_hat, LMB_NONE},
{"hbar", LM_TK_SYM, LM_hbar, LMB_NONE}, {"hbar", LM_TK_NOGLYPH, 0, LMB_NONE},
{"heartsuit", LM_TK_SYM, LM_heartsuit, LMB_NONE}, {"heartsuit", LM_TK_SYM, LM_heartsuit, LMB_NONE},
{"hom", LM_TK_FUNC, 0, LMB_NONE}, {"hom", LM_TK_FUNC, 0, LMB_NONE},
{"hookleftarrow", LM_TK_SYM, LM_hookleftarrow, LMB_NONE}, {"hookleftarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
{"hookrightarrow", LM_TK_SYM, LM_hookrightarrow, LMB_NONE}, {"hookrightarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
{"imath", LM_TK_SYM, LM_imath, LMB_NONE}, {"imath", LM_TK_NOGLYPH, 0, LMB_NONE},
{"in", LM_TK_SYM, LM_in, LMB_RELATION}, {"in", LM_TK_SYM, LM_in, LMB_RELATION},
{"inf", LM_TK_FUNCLIM, 0, LMB_NONE}, {"inf", LM_TK_FUNCLIM, 0, LMB_NONE},
{"infty", LM_TK_SYM, LM_infty, LMB_NONE}, {"infty", LM_TK_SYM, LM_infty, LMB_NONE},
{"int", LM_TK_BIGSYM, LM_int, LMB_NONE}, {"int", LM_TK_BIGSYM, LM_int, LMB_NONE},
{"iota", LM_TK_SYM, LM_iota, LMB_NONE}, {"iota", LM_TK_SYM, LM_iota, LMB_NONE},
{"jmath", LM_TK_SYM, LM_jmath, LMB_NONE}, {"jmath", LM_TK_NOGLYPH, 0, LMB_NONE},
{"kappa", LM_TK_SYM, LM_kappa, LMB_NONE}, {"kappa", LM_TK_SYM, LM_kappa, LMB_NONE},
{"ker", LM_TK_FUNC, 0, LMB_NONE}, {"ker", LM_TK_FUNC, 0, LMB_NONE},
{"label", LM_TK_LABEL, 0, LMB_NONE}, {"label", LM_TK_LABEL, 0, LMB_NONE},
@ -155,8 +156,8 @@ latexkeys const wordlist[] =
{"ldots", LM_TK_DOTS, LM_ldots, LMB_NONE}, {"ldots", LM_TK_DOTS, LM_ldots, LMB_NONE},
{"left", LM_TK_LEFT, 0, LMB_NONE}, {"left", LM_TK_LEFT, 0, LMB_NONE},
{"leftarrow", LM_TK_SYM, LM_leftarrow, LMB_NONE}, {"leftarrow", LM_TK_SYM, LM_leftarrow, LMB_NONE},
{"leftharpoondown", LM_TK_SYM, LM_leftharpoondown, LMB_NONE}, {"leftharpoondown", LM_TK_NOGLYPH, 0, LMB_NONE},
{"leftharpoonup", LM_TK_SYM, LM_leftharpoonup, LMB_NONE}, {"leftharpoonup", LM_TK_NOGLYPH, 0, LMB_NONE},
{"leftrightarrow", LM_TK_SYM, LM_leftrightarrow, LMB_NONE}, {"leftrightarrow", LM_TK_SYM, LM_leftrightarrow, LMB_NONE},
{"leq", LM_TK_SYM, LM_leq, LMB_RELATION}, {"leq", LM_TK_SYM, LM_leq, LMB_RELATION},
{"lfloor", LM_TK_SYM, LM_lfloor, LMB_NONE}, {"lfloor", LM_TK_SYM, LM_lfloor, LMB_NONE},
@ -165,14 +166,14 @@ latexkeys const wordlist[] =
{"liminf", LM_TK_FUNCLIM, 0, LMB_NONE}, {"liminf", LM_TK_FUNCLIM, 0, LMB_NONE},
{"limits", LM_TK_LIMIT, 1 , LMB_NONE}, {"limits", LM_TK_LIMIT, 1 , LMB_NONE},
{"limsup", LM_TK_FUNCLIM, 0, LMB_NONE}, {"limsup", LM_TK_FUNCLIM, 0, LMB_NONE},
{"ll", LM_TK_SYM, LM_ll, LMB_RELATION}, {"ll", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"ln", LM_TK_FUNC, 0, LMB_NONE}, {"ln", LM_TK_FUNC, 0, LMB_NONE},
{"log", LM_TK_FUNC, 0, LMB_NONE}, {"log", LM_TK_FUNC, 0, LMB_NONE},
{"longleftarrow", LM_TK_SYM, LM_longleftarrow, LMB_NONE}, {"longleftarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
{"longleftrightarrow", LM_TK_SYM, LM_longleftrightarrow, LMB_NONE}, {"longleftrightarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
{"longmapsto", LM_TK_SYM, LM_longmapsto, LMB_NONE}, {"longmapsto", LM_TK_NOGLYPH, 0, LMB_NONE},
{"longrightarrow", LM_TK_SYM, LM_longrightarrow, LMB_NONE}, {"longrightarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
{"mapsto", LM_TK_SYM, LM_mapsto, LMB_NONE}, {"mapsto", LM_TK_NOGLYPH, 0, LMB_NONE},
{"mathbf", LM_TK_FONT, LM_TC_BF, LMB_NONE}, {"mathbf", LM_TK_FONT, LM_TC_BF, LMB_NONE},
{"mathcal", LM_TK_FONT, LM_TC_CAL, LMB_NONE}, {"mathcal", LM_TK_FONT, LM_TC_CAL, LMB_NONE},
{"mathit", LM_TK_FONT, LM_TC_IT, LMB_NONE}, {"mathit", LM_TK_FONT, LM_TC_IT, LMB_NONE},
@ -183,25 +184,25 @@ latexkeys const wordlist[] =
{"max", LM_TK_FUNCLIM, 0, LMB_NONE}, {"max", LM_TK_FUNCLIM, 0, LMB_NONE},
{"mid", LM_TK_SYM, LM_mid, LMB_RELATION}, {"mid", LM_TK_SYM, LM_mid, LMB_RELATION},
{"min", LM_TK_FUNCLIM, 0, LMB_NONE}, {"min", LM_TK_FUNCLIM, 0, LMB_NONE},
{"models", LM_TK_SYM, LM_models, LMB_RELATION}, {"models", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"mp", LM_TK_SYM, LM_mp, LMB_OPERATOR}, {"mp", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"mu", LM_TK_SYM, LM_mu, LMB_NONE}, {"mu", LM_TK_SYM, LM_mu, LMB_NONE},
{"nabla", LM_TK_SYM, LM_nabla, LMB_NONE}, {"nabla", LM_TK_SYM, LM_nabla, LMB_NONE},
{"natural", LM_TK_SYM, LM_natural, LMB_NONE}, {"natural", LM_TK_NOGLYPH, 0, LMB_NONE},
{"nearrow", LM_TK_SYM, LM_nearrow, LMB_NONE}, {"nearrow", LM_TK_NOGLYPH, 0, LMB_NONE},
{"neg", LM_TK_SYM, LM_neg, LMB_NONE}, {"neg", LM_TK_SYM, LM_neg, LMB_NONE},
{"neq", LM_TK_SYM, LM_neq, LMB_RELATION}, {"neq", LM_TK_SYM, LM_neq, LMB_RELATION},
{"newcommand", LM_TK_NEWCOMMAND, 0 , LMB_NONE}, {"newcommand", LM_TK_NEWCOMMAND, 0 , LMB_NONE},
{"ni", LM_TK_SYM, LM_ni, LMB_RELATION}, {"ni", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"nolimits", LM_TK_LIMIT, static_cast<unsigned>(-1), LMB_NONE}, {"nolimits", LM_TK_LIMIT, static_cast<unsigned>(-1), LMB_NONE},
{"nonumber", LM_TK_NONUM, 0, LMB_NONE}, {"nonumber", LM_TK_NONUM, 0, LMB_NONE},
{"not", LM_TK_DECORATION, LM_not, LMB_NONE}, {"not", LM_TK_DECORATION, LM_not, LMB_NONE},
{"notin", LM_TK_MACRO, LM_notin, LMB_RELATION}, {"notin", LM_TK_MACRO, LM_notin, LMB_RELATION},
{"nu", LM_TK_SYM, LM_nu, LMB_NONE}, {"nu", LM_TK_SYM, LM_nu, LMB_NONE},
{"nwarrow", LM_TK_SYM, LM_nwarrow, LMB_NONE}, {"nwarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
{"odot", LM_TK_SYM, LM_odot, LMB_OPERATOR}, {"odot", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"omega", LM_TK_SYM, LM_omega, LMB_NONE}, {"omega", LM_TK_SYM, LM_omega, LMB_NONE},
{"ominus", LM_TK_SYM, LM_ominus, LMB_OPERATOR}, {"ominus", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"oplus", LM_TK_SYM, LM_oplus, LMB_OPERATOR}, {"oplus", LM_TK_SYM, LM_oplus, LMB_OPERATOR},
{"oslash", LM_TK_SYM, LM_oslash, LMB_OPERATOR}, {"oslash", LM_TK_SYM, LM_oslash, LMB_OPERATOR},
{"otimes", LM_TK_SYM, LM_otimes, LMB_OPERATOR}, {"otimes", LM_TK_SYM, LM_otimes, LMB_OPERATOR},
@ -209,14 +210,14 @@ latexkeys const wordlist[] =
{"overleftarrow", LM_TK_DECORATION, LM_overleftarrow, LMB_NONE}, {"overleftarrow", LM_TK_DECORATION, LM_overleftarrow, LMB_NONE},
{"overline", LM_TK_DECORATION, LM_overline, LMB_NONE}, {"overline", LM_TK_DECORATION, LM_overline, LMB_NONE},
{"overrightarrow", LM_TK_DECORATION, LM_overightarrow, LMB_NONE}, {"overrightarrow", LM_TK_DECORATION, LM_overightarrow, LMB_NONE},
{"parallel", LM_TK_SYM, LM_parallel, LMB_RELATION}, {"parallel", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"partial", LM_TK_SYM, LM_partial, LMB_NONE}, {"partial", LM_TK_SYM, LM_partial, LMB_NONE},
{"perp", LM_TK_MACRO, LM_perp, LMB_RELATION}, {"perp", LM_TK_MACRO, LM_perp, LMB_RELATION},
{"phi", LM_TK_SYM, LM_phi, LMB_NONE}, {"phi", LM_TK_SYM, LM_phi, LMB_NONE},
{"pi", LM_TK_SYM, LM_pi, LMB_NONE}, {"pi", LM_TK_SYM, LM_pi, LMB_NONE},
{"pm", LM_TK_SYM, LM_pm, LMB_OPERATOR}, {"pm", LM_TK_SYM, LM_pm, LMB_OPERATOR},
{"prec", LM_TK_SYM, LM_prec, LMB_RELATION}, {"prec", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"preceq", LM_TK_SYM, LM_preceq, LMB_RELATION}, {"preceq", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"prime", LM_TK_SYM, LM_prime, LMB_NONE}, {"prime", LM_TK_SYM, LM_prime, LMB_NONE},
{"prod", LM_TK_BIGSYM, LM_prod, LMB_NONE}, {"prod", LM_TK_BIGSYM, LM_prod, LMB_NONE},
{"propto", LM_TK_SYM, LM_propto, LMB_RELATION}, {"propto", LM_TK_SYM, LM_propto, LMB_RELATION},
@ -230,37 +231,37 @@ latexkeys const wordlist[] =
{"rho", LM_TK_SYM, LM_rho, LMB_NONE}, {"rho", LM_TK_SYM, LM_rho, LMB_NONE},
{"right", LM_TK_RIGHT, 0, LMB_NONE}, {"right", LM_TK_RIGHT, 0, LMB_NONE},
{"rightarrow", LM_TK_SYM, LM_rightarrow, LMB_NONE}, {"rightarrow", LM_TK_SYM, LM_rightarrow, LMB_NONE},
{"rightharpoondown", LM_TK_SYM, LM_rightharpoondown, LMB_NONE}, {"rightharpoondown", LM_TK_NOGLYPH, 0, LMB_NONE},
{"rightharpoonup", LM_TK_SYM, LM_rightharpoonup, LMB_NONE}, {"rightharpoonup", LM_TK_NOGLYPH, 0, LMB_NONE},
{"rightleftharpoons", LM_TK_SYM, LM_rightleftharpoons, LMB_NONE}, {"rightleftharpoons", LM_TK_NOGLYPH, 0, LMB_NONE},
{"searrow", LM_TK_SYM, LM_searrow, LMB_NONE}, {"searrow", LM_TK_NOGLYPH, 0, LMB_NONE},
{"sec", LM_TK_FUNC, 0, LMB_NONE}, {"sec", LM_TK_FUNC, 0, LMB_NONE},
{"setminus", LM_TK_SYM, LM_setminus, LMB_OPERATOR}, {"setminus", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"sharp", LM_TK_SYM, LM_sharp, LMB_NONE}, {"sharp", LM_TK_SYM, LM_sharp, LMB_NONE},
{"sigma", LM_TK_SYM, LM_sigma, LMB_NONE}, {"sigma", LM_TK_SYM, LM_sigma, LMB_NONE},
{"sim", LM_TK_SYM, LM_sim, LMB_RELATION}, {"sim", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"simeq", LM_TK_SYM, LM_simeq, LMB_RELATION}, {"simeq", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"sin", LM_TK_FUNC, 0, LMB_NONE}, {"sin", LM_TK_FUNC, 0, LMB_NONE},
{"sinh", LM_TK_FUNC, 0, LMB_NONE}, {"sinh", LM_TK_FUNC, 0, LMB_NONE},
{"smile", LM_TK_SYM, LM_smile, LMB_RELATION}, {"smile", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"spadesuit", LM_TK_SYM, LM_spadesuit, LMB_NONE}, {"spadesuit", LM_TK_SYM, LM_spadesuit, LMB_NONE},
{"sqcap", LM_TK_SYM, LM_sqcap, LMB_OPERATOR}, {"sqcap", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"sqcup", LM_TK_SYM, LM_sqcup, LMB_OPERATOR}, {"sqcup", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"sqrt", LM_TK_SQRT, 0, LMB_NONE}, {"sqrt", LM_TK_SQRT, 0, LMB_NONE},
{"sqsubseteq", LM_TK_SYM, LM_sqsubseteq, LMB_RELATION}, {"sqsubseteq", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"sqsupseteq", LM_TK_SYM, LM_sqsupseteq, LMB_RELATION}, {"sqsupseteq", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"stackrel", LM_TK_STACK, 0, LMB_NONE}, {"stackrel", LM_TK_STACK, 0, LMB_NONE},
{"star", LM_TK_SYM, LM_star, LMB_OPERATOR}, {"star", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"subset", LM_TK_SYM, LM_subset, LMB_RELATION}, {"subset", LM_TK_SYM, LM_subset, LMB_RELATION},
{"subseteq", LM_TK_SYM, LM_subseteq, LMB_RELATION}, {"subseteq", LM_TK_SYM, LM_subseteq, LMB_RELATION},
{"succ", LM_TK_SYM, LM_succ, LMB_RELATION}, {"succ", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"succeq", LM_TK_SYM, LM_succeq, LMB_RELATION}, {"succeq", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"sum", LM_TK_BIGSYM, LM_sum, LMB_NONE}, {"sum", LM_TK_BIGSYM, LM_sum, LMB_NONE},
{"sup", LM_TK_FUNCLIM, 0, LMB_NONE}, {"sup", LM_TK_FUNCLIM, 0, LMB_NONE},
{"supset", LM_TK_SYM, LM_supset, LMB_RELATION}, {"supset", LM_TK_SYM, LM_supset, LMB_RELATION},
{"supseteq", LM_TK_SYM, LM_supseteq, LMB_RELATION}, {"supseteq", LM_TK_SYM, LM_supseteq, LMB_RELATION},
{"surd", LM_TK_SYM, LM_surd, LMB_NONE}, {"surd", LM_TK_SYM, LM_surd, LMB_NONE},
{"swarrow", LM_TK_SYM, LM_swarrow, LMB_NONE}, {"swarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
{"tan", LM_TK_FUNC, 0, LMB_NONE}, {"tan", LM_TK_FUNC, 0, LMB_NONE},
{"tanh", LM_TK_FUNC, 0, LMB_NONE}, {"tanh", LM_TK_FUNC, 0, LMB_NONE},
{"tau", LM_TK_SYM, LM_tau, LMB_NONE}, {"tau", LM_TK_SYM, LM_tau, LMB_NONE},
@ -268,22 +269,22 @@ latexkeys const wordlist[] =
{"theta", LM_TK_SYM, LM_theta, LMB_NONE}, {"theta", LM_TK_SYM, LM_theta, LMB_NONE},
{"tilde", LM_TK_DECORATION, LM_tilde, LMB_NONE}, {"tilde", LM_TK_DECORATION, LM_tilde, LMB_NONE},
{"times", LM_TK_SYM, LM_times, LMB_OPERATOR}, {"times", LM_TK_SYM, LM_times, LMB_OPERATOR},
{"top", LM_TK_SYM, LM_top, LMB_NONE}, {"top", LM_TK_NOGLYPH, 0, LMB_NONE},
{"triangle", LM_TK_SYM, LM_triangle, LMB_NONE}, {"triangle", LM_TK_NOGLYPH, 0, LMB_NONE},
{"triangleleft", LM_TK_SYM, LM_triangleleft, LMB_OPERATOR}, {"triangleleft", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"triangleright", LM_TK_SYM, LM_triangleright, LMB_OPERATOR}, {"triangleright", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"underbrace", LM_TK_DECORATION, LM_underbrace, LMB_NONE}, {"underbrace", LM_TK_DECORATION, LM_underbrace, LMB_NONE},
{"underline", LM_TK_DECORATION, LM_underline, LMB_NONE}, {"underline", LM_TK_DECORATION, LM_underline, LMB_NONE},
{"uparrow", LM_TK_SYM, LM_uparrow, LMB_NONE}, {"uparrow", LM_TK_SYM, LM_uparrow, LMB_NONE},
{"updownarrow", LM_TK_SYM, LM_updownarrow, LMB_NONE}, {"updownarrow", LM_TK_NOGLYPH, LM_updownarrow, LMB_NONE},
{"uplus", LM_TK_SYM, LM_uplus, LMB_OPERATOR}, {"uplus", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"upsilon", LM_TK_SYM, LM_upsilon, LMB_NONE}, {"upsilon", LM_TK_SYM, LM_upsilon, LMB_NONE},
{"varepsilon", LM_TK_SYM, LM_varepsilon, LMB_NONE}, {"varepsilon", LM_TK_SYM, LM_varepsilon, LMB_NONE},
{"varphi", LM_TK_SYM, LM_varphi, LMB_NONE}, {"varphi", LM_TK_SYM, LM_varphi, LMB_NONE},
{"varpi", LM_TK_SYM, LM_varpi, LMB_NONE}, {"varpi", LM_TK_SYM, LM_varpi, LMB_NONE},
{"varsigma", LM_TK_SYM, LM_varsigma, LMB_NONE}, {"varsigma", LM_TK_SYM, LM_varsigma, LMB_NONE},
{"vartheta", LM_TK_SYM, LM_vartheta, LMB_NONE}, {"vartheta", LM_TK_SYM, LM_vartheta, LMB_NONE},
{"vdash", LM_TK_SYM, LM_vdash, LMB_RELATION}, {"vdash", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"vdots", LM_TK_DOTS, LM_vdots, LMB_NONE}, {"vdots", LM_TK_DOTS, LM_vdots, LMB_NONE},
{"vec", LM_TK_DECORATION, LM_vec, LMB_NONE}, {"vec", LM_TK_DECORATION, LM_vec, LMB_NONE},
{"vee", LM_TK_SYM, LM_vee, LMB_OPERATOR}, {"vee", LM_TK_SYM, LM_vee, LMB_OPERATOR},
@ -291,7 +292,7 @@ latexkeys const wordlist[] =
{"widehat", LM_TK_DECORATION, LM_widehat, LMB_NONE}, {"widehat", LM_TK_DECORATION, LM_widehat, LMB_NONE},
{"widetilde", LM_TK_DECORATION, LM_widetilde, LMB_NONE}, {"widetilde", LM_TK_DECORATION, LM_widetilde, LMB_NONE},
{"wp", LM_TK_SYM, LM_wp, LMB_NONE}, {"wp", LM_TK_SYM, LM_wp, LMB_NONE},
{"wr", LM_TK_SYM, LM_wr, LMB_OPERATOR}, {"wr", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
{"xi", LM_TK_SYM, LM_xi, LMB_NONE}, {"xi", LM_TK_SYM, LM_xi, LMB_NONE},
{"zeta", LM_TK_SYM, LM_zeta, LMB_NONE}, {"zeta", LM_TK_SYM, LM_zeta, LMB_NONE},
{"{", LM_TK_SPECIAL, '{', LMB_NONE}, {"{", LM_TK_SPECIAL, '{', LMB_NONE},

View File

@ -10,7 +10,6 @@
#include "math_macro.h" #include "math_macro.h"
#include "math_macrotemplate.h" #include "math_macrotemplate.h"
#include "math_parser.h" #include "math_parser.h"
#include "math_deliminset.h"
#include "math_fracinset.h" #include "math_fracinset.h"
#include "debug.h" #include "debug.h"
@ -98,32 +97,5 @@ void MathMacroTable::builtinMacros()
createTemplate("to", 0, "\\rightarrow"); createTemplate("to", 0, "\\rightarrow");
//createTemplate("lint", 4, "\\int_{#1}^{#2}#3 d#4"); //createTemplate("lint", 4, "\\int_{#1}^{#2}#3 d#4");
//createTemplate("silentmult", 0, "\\cdot"); //createTemplate("silentmult", 0, "\\cdot");
//createTemplate("binomi", 2, "\\left(\\frac{#1}{#2}\\right)"); createTemplate("binom", 2, "\\left(\\frac{#1}{#2}\\right)");
// binom has two arguments
{
MathFracInset * frac = new MathFracInset;
frac->cell(0).push_back(new MathMacroArgument(1));
frac->cell(1).push_back(new MathMacroArgument(2));
MathInset * inset = new MathDelimInset('(', ')');
inset->push_back(frac);
MathMacroTemplate t("binom", 2);
t.push_back(inset);
insertTemplate(t);
}
/*
{
MathFracInset * frac = new MathFracInset(LM_OT_ATOP);
frac->cell(0)->push_back(new MathMacroArgument(1));
frac->cell(1)->push_back(new MathMacroArgument(2));
MathMacroTemplate * t = new MathMacroTemplate("choose", 2);
t->push_back(frac);
insertTemplate(t);
}
*/
} }

View File

@ -0,0 +1,44 @@
#include "math_noglyphinset.h"
#include "math_parser.h"
#include "support.h"
#include "support/LOstream.h"
using std::ostream;
MathNoglyphInset::MathNoglyphInset(const latexkeys * l)
: sym_(l)
{}
MathInset * MathNoglyphInset::clone() const
{
return new MathNoglyphInset(*this);
}
void MathNoglyphInset::write(ostream & os, bool /* fragile */) const
{
os << '\\' << sym_->name << ' ';
}
void MathNoglyphInset::writeNormal(ostream & os) const
{
os << "[bigop " << sym_->name << "] ";
}
void MathNoglyphInset::metrics(MathStyles st) const
{
size(st);
mathed_string_dim(LM_TC_TEX, st, sym_->name, ascent_, descent_, width_);
}
void MathNoglyphInset::draw(Painter & pain, int x, int y) const
{
xo(x);
yo(y);
drawStr(pain, LM_TC_TEX, size_, x, y, sym_->name);
}

View File

@ -0,0 +1,31 @@
// -*- C++ -*-
#ifndef MATH_NOGLYPHINSET_H
#define MATH_NOGLYPHINSET_H
#include "math_diminset.h"
struct latexkeys;
// "normal" symbols for which we don't have a glyph aailable to display
// them properly
class MathNoglyphInset : public MathDimInset {
public:
///
explicit MathNoglyphInset(latexkeys const *);
///
MathInset * clone() const;
///
void write(std::ostream &, bool fragile) const;
///
void writeNormal(std::ostream &) const;
///
void metrics(MathStyles st) const;
///
void draw(Painter &, int x, int y) const;
private:
///
latexkeys const * sym_;
};
#endif

View File

@ -41,6 +41,7 @@
#include "math_macrotable.h" #include "math_macrotable.h"
#include "math_macrotemplate.h" #include "math_macrotemplate.h"
#include "math_matrixinset.h" #include "math_matrixinset.h"
#include "math_noglyphinset.h"
#include "math_rootinset.h" #include "math_rootinset.h"
#include "math_scriptinset.h" #include "math_scriptinset.h"
#include "math_sizeinset.h" #include "math_sizeinset.h"
@ -65,7 +66,6 @@ enum lexcode_enum {
LexAlpha, LexAlpha,
LexDigit, LexDigit,
LexBOP, // Binary operators or relations LexBOP, // Binary operators or relations
LexMathSpace,
LexOpen, LexOpen,
LexClose, LexClose,
LexComment, LexComment,
@ -112,7 +112,7 @@ enum {
}; };
/// ///
union { struct {
/// ///
int i; int i;
/// ///
@ -180,9 +180,6 @@ void lexInit()
lexcode['+'] = lexcode['-'] = lexcode['*'] = lexcode['/'] lexcode['+'] = lexcode['-'] = lexcode['*'] = lexcode['/']
= lexcode['<'] = lexcode['>'] = lexcode['='] = LexBOP; = lexcode['<'] = lexcode['>'] = lexcode['='] = LexBOP;
lexcode['!'] = lexcode[','] = lexcode[':']
= lexcode[';'] = LexMathSpace;
lexcode['('] = lexcode[')'] = lexcode['|'] = lexcode['.'] = lexcode['('] = lexcode[')'] = lexcode['|'] = lexcode['.'] =
lexcode['?'] = LexOther; lexcode['?'] = LexOther;
@ -257,9 +254,7 @@ int yylex()
do { do {
c = getuchar(yyis); c = getuchar(yyis);
} while (c != '\n' && yyis->good()); // eat comments } while (c != '\n' && yyis->good()); // eat comments
} else if (lexcode[c] == LexDigit } else if (lexcode[c] == LexDigit || lexcode[c] == LexOther) {
|| lexcode[c] == LexOther
|| lexcode[c] == LexMathSpace) {
yylval.i = c; yylval.i = c;
return LM_TK_STR; return LM_TK_STR;
} else if (lexcode[c] == LexAlpha || lexcode[c] == LexSpace) { } else if (lexcode[c] == LexAlpha || lexcode[c] == LexSpace) {
@ -283,12 +278,15 @@ int yylex()
return LM_TK_CLOSE; return LM_TK_CLOSE;
} else if (lexcode[c] == LexESC) { } else if (lexcode[c] == LexESC) {
c = getuchar(yyis); c = getuchar(yyis);
//lyxerr << "reading second byte: '" << c << "' code: " << lexcode[c] << endl;
string s; string s;
s += c; s += c;
latexkeys const * l = in_word_set(s); latexkeys const * l = in_word_set(s);
if (l) { if (l) {
//lyxerr << "found special token for '" << l->name //lyxerr << "found key: " << l << endl;
// << "' : " << l->id << " \n"; //lyxerr << "found key name: " << l->name << endl;
//lyxerr << "found key token: " << l->token << endl;
yylval.l = l;
yylval.i = l->id; yylval.i = l->id;
return l->token; return l->token;
} }
@ -304,6 +302,7 @@ int yylex()
yyis->putback(c); yyis->putback(c);
//lyxerr[Debug::MATHED] << "reading: text '" << yytext << "'\n"; //lyxerr[Debug::MATHED] << "reading: text '" << yytext << "'\n";
//lyxerr << "reading: text '" << yytext << "'\n";
latexkeys const * l = in_word_set(yytext); latexkeys const * l = in_word_set(yytext);
if (!l) if (!l)
return LM_TK_UNDEF; return LM_TK_UNDEF;
@ -484,6 +483,30 @@ MathMatrixInset * mathed_parse_normal()
} }
latexkeys const * read_delim()
{
int ld = yylex();
lyxerr << "found symbol: " << ld << "\n";
latexkeys const * l = in_word_set(".");
switch (ld) {
case LM_TK_SYM:
case LM_TK_NOGLYPH:
case LM_TK_SPECIAL:
case LM_TK_BEGIN:
l = yylval.l;
lyxerr << "found key 1: '" << l << "'\n";
lyxerr << "found key 1: '" << l->name << "'\n";
break;
case LM_TK_STR:
string s;
s += yylval.i;
l = in_word_set(s);
lyxerr << "found key 2: '" << l->name << "'\n";
}
return l;
}
void mathed_parse_into(MathArray & array, unsigned flags) void mathed_parse_into(MathArray & array, unsigned flags)
{ {
static int plevel = -1; static int plevel = -1;
@ -620,6 +643,12 @@ void mathed_parse_into(MathArray & array, unsigned flags)
case LM_TK_PROTECT: case LM_TK_PROTECT:
break; break;
case LM_TK_NOGLYPH:
case LM_TK_NOGLYPHB:
limits = 0;
array.push_back(new MathNoglyphInset(yylval.l));
break;
case LM_TK_BIGSYM: case LM_TK_BIGSYM:
limits = 0; limits = 0;
array.push_back(new MathBigopInset(yylval.l)); array.push_back(new MathBigopInset(yylval.l));
@ -683,22 +712,11 @@ void mathed_parse_into(MathArray & array, unsigned flags)
case LM_TK_LEFT: case LM_TK_LEFT:
{ {
int ld = yylex(); latexkeys const * l = read_delim();
if (ld == LM_TK_SYM)
ld = yylval.l->id;
else if (ld == LM_TK_STR || ld == LM_TK_BOP || ld == LM_TK_SPECIAL)
ld = yylval.i;
MathArray ar; MathArray ar;
mathed_parse_into(ar, FLAG_RIGHT); mathed_parse_into(ar, FLAG_RIGHT);
latexkeys const * r = read_delim();
int rd = yylex(); MathDelimInset * dl = new MathDelimInset(l, r);
if (rd == LM_TK_SYM)
rd = yylval.l->id;
else if (rd == LM_TK_STR || rd == LM_TK_BOP || rd == LM_TK_SPECIAL)
rd = yylval.i;
MathDelimInset * dl = new MathDelimInset(ld, rd);
dl->cell(0) = ar; dl->cell(0) = ar;
array.push_back(dl); array.push_back(dl);
break; break;

View File

@ -71,6 +71,10 @@ enum MathTokenEnum
/// ///
LM_TK_BIGSYM, LM_TK_BIGSYM,
/// ///
LM_TK_NOGLYPH,
///
LM_TK_NOGLYPHB,
///
LM_TK_LABEL, LM_TK_LABEL,
/// ///
LM_TK_NONUM, LM_TK_NONUM,

View File

@ -32,17 +32,7 @@ void MathSymbolInset::writeNormal(ostream & os) const
void MathSymbolInset::metrics(MathStyles st) const void MathSymbolInset::metrics(MathStyles st) const
{ {
size(st); size(st);
mathed_char_dim(LM_TC_SYMB, size_, sym_->id, ascent_, descent_, width_);
if (sym_->id > 0 && sym_->id < 256) {
ssym_ = string();
ssym_ += sym_->id;
code_ = (sym_->token == LM_TK_BIGSYM) ? LM_TC_BSYM : LM_TC_SYMB;
} else {
ssym_ = sym_->name;
code_ = LM_TC_TEX;
}
mathed_string_dim(code_, size(), ssym_, ascent_, descent_, width_);
} }
@ -51,7 +41,7 @@ void MathSymbolInset::draw(Painter & pain, int x, int y) const
xo(x); xo(x);
yo(y); yo(y);
drawStr(pain, code_, size_, x, y, ssym_); drawChar(pain, LM_TC_SYMB, size_, x, y, sym_->id);
} }

View File

@ -3,7 +3,6 @@
#define MATH_SYMBOLINSET_H #define MATH_SYMBOLINSET_H
#include "math_diminset.h" #include "math_diminset.h"
#include "LString.h"
struct latexkeys; struct latexkeys;
@ -30,7 +29,5 @@ public:
private: private:
/// ///
latexkeys const * sym_; latexkeys const * sym_;
/// cache for the symbol's onscreen string representation
mutable string ssym_;
}; };
#endif #endif

View File

@ -28,13 +28,6 @@ bool MathIsBinary(MathTextCodes x)
} }
bool MathIsSymbol(MathTextCodes x)
{
return x == LM_TC_SYMB || x == LM_TC_BSYM;
}
/// ///
class Matrix { class Matrix {
public: public:
@ -433,7 +426,7 @@ math_deco_struct math_deco_table[] = {
{ '|', &vert[0], 0 }, { '|', &vert[0], 0 },
{ '/', &slash[0], 0 }, { '/', &slash[0], 0 },
{ LM_Vert, &Vert[0], 0 }, { LM_Vert, &Vert[0], 0 },
{ LM_backslash, &slash[0], 1 }, { '\\', &slash[0], 1 },
{ LM_langle, &angle[0], 0 }, { LM_langle, &angle[0], 0 },
{ LM_lceil, &corner[0], 0 }, { LM_lceil, &corner[0], 0 },
{ LM_lfloor, &corner[0], 1 }, { LM_lfloor, &corner[0], 1 },
@ -608,20 +601,19 @@ math_deco_struct const * search_deco(int code)
} }
void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code) void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
latexkeys const * l)
{ {
Matrix mt; Matrix mt;
Matrix sqmt; Matrix sqmt;
float xx;
float yy;
float x2;
float y2;
int i = 0; int i = 0;
string name = l->name;
int code = (name.size() > 1) ? l->id : name[0];
math_deco_struct const * mds = search_deco(code); math_deco_struct const * mds = search_deco(code);
if (!mds) { if (!mds) {
// Should this ever happen? lyxerr << "Deco was not found. Programming error?\n";
lyxerr << "Deco was not found. Programming error?" << endl; lyxerr << "name: '" << l->name << "', code: " << code << "\n";
return; return;
} }
@ -635,11 +627,22 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code)
mt.escalate(w, h); mt.escalate(w, h);
int const n = (w < h) ? w : h; int const n = (w < h) ? w : h;
sqmt.rotate(r); sqmt.rotate(r);
sqmt.escalate(n, n); sqmt.escalate(n, n);
if (r > 0 && r < 3) y += h;
if (r >= 2) x += w; if (r > 0 && r < 3)
y += h;
if (r >= 2)
x += w;
do { do {
float xx;
float yy;
float x2;
float y2;
code = int(d[i++]); code = int(d[i++]);
switch (code) { switch (code) {
case 0: break; case 0: break;

View File

@ -7,6 +7,7 @@
#include "LString.h" #include "LString.h"
class Painter; class Painter;
class latexkeys;
extern char const * math_font_name[]; extern char const * math_font_name[];
extern char const * latex_mathspace[]; extern char const * latex_mathspace[];
@ -19,7 +20,8 @@ int mathed_char_width(MathTextCodes type, MathStyles size, unsigned char c);
int mathed_char_ascent(MathTextCodes type, MathStyles size, unsigned char c); int mathed_char_ascent(MathTextCodes type, MathStyles size, unsigned char c);
int mathed_char_descent(MathTextCodes type, MathStyles size, unsigned char c); int mathed_char_descent(MathTextCodes type, MathStyles size, unsigned char c);
void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code); void mathed_draw_deco
(Painter & pain, int x, int y, int w, int h, latexkeys const * l);
void mathed_string_dim(MathTextCodes type, MathStyles size, string const & s, void mathed_string_dim(MathTextCodes type, MathStyles size, string const & s,
int & asc, int & des, int & wid); int & asc, int & des, int & wid);
@ -31,7 +33,6 @@ int mathed_string_ascent(MathTextCodes type, MathStyles size, string const & s);
int mathed_string_descent(MathTextCodes type, MathStyles size, string const & s); int mathed_string_descent(MathTextCodes type, MathStyles size, string const & s);
bool MathIsAlphaFont(MathTextCodes x); bool MathIsAlphaFont(MathTextCodes x);
bool MathIsSymbol(MathTextCodes x);
void drawStr(Painter & pain, MathTextCodes type, MathStyles siz, void drawStr(Painter & pain, MathTextCodes type, MathStyles siz,
int x, int y, string const & s); int x, int y, string const & s);

View File

@ -122,92 +122,18 @@ enum Math_Symbols_enum {
LM_mid = 0x7c, LM_mid = 0x7c,
LM_angle = 0xd0, LM_angle = 0xd0,
LM_vee = 0xda, LM_vee = 0xda,
//LM_backslash '\\'
/// Symbols that don't exist in X11 symbol font /// Symbols that don't exist in X11 symbol font
LM_NoFont = 256, LM_NoFont = 256,
LM_epsilon,
LM_hookleftarrow,
LM_hookrightarrow,
LM_updownarrow,
LM_leftharpoonup,
LM_rightharpoonup,
LM_rightleftharpoons,
LM_Updownarrow,
LM_leftharpoondown,
LM_rightharpoondown,
LM_mapsto,
LM_Longleftarrow,
LM_Longrightarrow,
LM_Longleftrightarrow,
LM_longleftrightarrow,
LM_longleftarrow,
LM_longrightarrow,
LM_longmapsto,
LM_nwarrow,
LM_nearrow,
LM_swarrow,
LM_searrow,
LM_models,
LM_prec,
LM_succ,
LM_sim,
LM_perp, LM_perp,
LM_preceq,
LM_succeq,
LM_simeq,
LM_ll,
LM_gg,
LM_asymp,
LM_parallel,
LM_smile,
LM_frown,
LM_sqsubseteq,
LM_sqsupseteq,
LM_doteq,
LM_ni,
LM_notin, LM_notin,
LM_vdash,
LM_dashv, /// needed as decoration
LM_bowtie,
LM_mp,
LM_bigtriangleup,
LM_ominus,
LM_uplus,
LM_bigtriangledown,
LM_sqcap,
LM_triangleright,
LM_sqcup,
LM_triangleleft,
LM_odot,
LM_star,
LM_amalg,
LM_bigcirc,
LM_setminus,
LM_dagger,
LM_circ,
LM_wr,
LM_ddagger,
LM_oint,
LM_coprod,
LM_bigsqcup,
LM_bigotimes,
LM_bigodot,
LM_bigoplus,
LM_bigcap,
LM_bigcup,
LM_biguplus,
LM_bigvee,
LM_bigwedge,
LM_ell,
LM_imath,
LM_jmath,
LM_hbar,
LM_top,
LM_Vert, LM_Vert,
LM_flat, LM_updownarrow,
LM_natural, LM_Updownarrow,
LM_triangle,
/// decorations
LM_widehat, LM_widehat,
LM_widetilde, LM_widetilde,
LM_underline, LM_underline,
@ -216,11 +142,12 @@ enum Math_Symbols_enum {
LM_overbrace, LM_overbrace,
LM_overleftarrow, LM_overleftarrow,
LM_overightarrow, LM_overightarrow,
/// dots
LM_ldots, LM_ldots,
LM_cdots, LM_cdots,
LM_vdots, LM_vdots,
LM_ddots, LM_ddots,
LM_backslash,
LM_emptyset, LM_emptyset,
/// Accents that don't exist in X11 symbol font /// Accents that don't exist in X11 symbol font