]> git.lyx.org Git - features.git/commitdiff
re-enable support for TeX-style {\it..} (\rm, \bf, \tt...)
authorAndré Pönitz <poenitz@gmx.net>
Wed, 24 Oct 2001 17:14:05 +0000 (17:14 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 24 Oct 2001 17:14:05 +0000 (17:14 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2936 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_hash.C
src/mathed/math_parser.C

index cf729e23320b9360401b3dcfa2bfe9317fe91abc..df468ddb2986d102af38e33802305a3d584e3218 100644 (file)
@@ -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},
index ba706459302a2ca2d962958d2382851a35d72ab9..c2e4c31392366346eec8b207ef1d197ac766fabb 100644 (file)
@@ -18,6 +18,7 @@
 #include <config.h>
 
 #include <cctype>
+#include <stack>
 
 #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<MathTextCodes> 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<MathTextCodes>(l->id);
+                               else if (l->token == LM_TK_OLDFONT) {
+                                       fontcodes.pop();
+                                       fontcodes.push(static_cast<MathTextCodes>(l->id));
+                               }
 
                                else {
                                        MathAtom p = createMathInset(t.cs());