From: André Pönitz Date: Wed, 24 Oct 2001 17:14:05 +0000 (+0000) Subject: re-enable support for TeX-style {\it..} (\rm, \bf, \tt...) X-Git-Tag: 1.6.10~20429 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1b8991ea00d202843254cd9a3f505f071f903e1e;p=features.git re-enable support for TeX-style {\it..} (\rm, \bf, \tt...) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2936 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/math_hash.C b/src/mathed/math_hash.C index cf729e2332..df468ddb29 100644 --- a/src/mathed/math_hash.C +++ b/src/mathed/math_hash.C @@ -48,6 +48,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}, @@ -75,6 +76,7 @@ key_type wordlist_array[] = {"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}, @@ -112,6 +114,7 @@ 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}, @@ -126,6 +129,7 @@ key_type wordlist_array[] = {"textrm", LM_TK_FONT, LM_TC_TEXTRM}, //{"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}, diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index ba70645930..c2e4c31392 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -18,6 +18,7 @@ #include #include +#include #ifdef __GNUG__ #pragma implementation @@ -51,6 +52,7 @@ using std::istream; using std::ostream; using std::ios; using std::endl; +using std::stack; namespace { @@ -640,7 +642,8 @@ bool Parser::parse_normal(MathAtom & matrix) void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code) { - MathTextCodes yyvarcode = LM_TC_MIN; + stack fontcodes; + fontcodes.push(LM_TC_MIN); bool panic = false; int limits = 0; @@ -692,11 +695,11 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code) break; else if (t.cat() == catLetter) - add(array, t.character(), yyvarcode); + add(array, t.character(), fontcodes.top()); else if (t.cat() == catSpace && - (yyvarcode == LM_TC_TEXTRM || code == LM_TC_TEXTRM)) - add(array, ' ', yyvarcode); + (fontcodes.top() == LM_TC_TEXTRM || code == LM_TC_TEXTRM)) + add(array, ' ', fontcodes.top()); else if (t.cat() == catParameter) { Token const & n = getToken(); @@ -705,12 +708,14 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code) else if (t.cat() == catBegin) { add(array, '{', LM_TC_TEX); + fontcodes.push(LM_TC_MIN); } else if (t.cat() == catEnd) { if (flags & FLAG_BRACE_LAST) return; add(array, '}', LM_TC_TEX); + fontcodes.pop(); } else if (t.cat() == catAlign) { @@ -737,7 +742,7 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code) return; else if (t.cat() == catOther) - add(array, t.character(), yyvarcode); + add(array, t.character(), fontcodes.top()); // // codesequences @@ -924,8 +929,10 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code) //lyxerr << "ending font\n"; } - else if (l->token == LM_TK_OLDFONT) - yyvarcode = static_cast(l->id); + else if (l->token == LM_TK_OLDFONT) { + fontcodes.pop(); + fontcodes.push(static_cast(l->id)); + } else { MathAtom p = createMathInset(t.cs());