]> git.lyx.org Git - features.git/commitdiff
make '$' default delimiter for inline maths instead of \(...\)
authorAndré Pönitz <poenitz@gmx.net>
Thu, 26 Jul 2001 16:56:23 +0000 (16:56 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 26 Jul 2001 16:56:23 +0000 (16:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2363 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_hash.C
src/mathed/math_matrixinset.C
src/mathed/math_parser.C
src/mathed/math_parser.h

index 67139db71f2dc2026469b1a89ab29aa5da6c733e..df1f63ac25b92572ab2d3d376c0bc92afd9b2dbc 100644 (file)
@@ -206,6 +206,7 @@ latexkeys const wordlist[] =
        {"prime",  LM_TK_SYM, LM_prime, LMB_NONE},
        {"prod",  LM_TK_BIGSYM, LM_prod, LMB_NONE},
        {"propto",  LM_TK_SYM, LM_propto, LMB_RELATION},
+       {"protect",  LM_TK_PROTECT, 0, LMB_RELATION},
        {"psi",  LM_TK_SYM, LM_psi, LMB_NONE},
        {"qquad",  LM_TK_SPACE, LM_qquad, LMB_NONE},
        {"quad",  LM_TK_SPACE, LM_quad, LMB_NONE},
index d8a60c2bce76f4d92e414b2659f4c578a36b19bc..d23f64bcf1b7b098843dc67a883b1f4b19808aa3 100644 (file)
@@ -236,7 +236,7 @@ void MathMatrixInset::header_write(std::ostream & os) const
 
        switch (getType()) {
                case LM_OT_SIMPLE:
-                       os << "\\("; 
+                       os << ""; 
                        break;
 
                case LM_OT_EQUATION:
@@ -270,7 +270,7 @@ void MathMatrixInset::footer_write(std::ostream & os) const
 
        switch (getType()) {
                case LM_OT_SIMPLE:
-                       os << "\\)";
+                       os << "$";
                        break;
 
                case LM_OT_EQUATION:
index 8bc608ac66e3132fc1677f7b2004c297acba310e..42bbdda03343c4521357571bb4a03a12c0996005 100644 (file)
@@ -68,6 +68,7 @@ enum lexcode_enum {
        LexSpace,
        LexNewLine,
        LexOther,
+       LexMath,
        LexSelf
 };
 
@@ -171,6 +172,7 @@ void lexInit()
        lexcode['\n'] = LexNewLine;
        lexcode['%'] = LexComment;
        lexcode['#'] = LexArgument;
+       lexcode['$'] = LexMath;
        lexcode['+'] = lexcode['-'] = lexcode['*'] = lexcode['/']
                = lexcode['<'] = lexcode['>'] = lexcode['='] = LexBOP;
        
@@ -265,6 +267,9 @@ int yylex()
                } else if (lexcode[c] == LexBOP) {
                        yylval.i = c;
                        return LM_TK_BOP;
+               } else if (lexcode[c] == LexMath) {
+                       yylval.i = 0;
+                       return LM_TK_MATH;
                } else if (lexcode[c] == LexSelf) {
                        return c;
                } else if (lexcode[c] == LexArgument) {
@@ -429,10 +434,12 @@ MathInset * mathed_parse()
                        break;
                }
 
+               case LM_TK_MATH:
                case LM_TK_BEGIN: {
                        int i = yylval.i;
-                       //lyxerr[Debug::MATHED] << "reading math environment " << i << " "
-                       //      << latex_mathenv[i].name << "\n";
+                       lyxerr[Debug::MATHED]
+                               << "reading math environment " << i << " "
+                               << latex_mathenv[i].name << "\n";
 
                        MathInsetTypes typ = latex_mathenv[i].typ;
                        p = new MathMatrixInset(typ);
@@ -475,7 +482,8 @@ MathInset * mathed_parse()
                                }
 
                                default: 
-                                       lyxerr[Debug::MATHED] << "1: unknown math environment: " << typ << "\n";
+                                       lyxerr[Debug::MATHED]
+                                               << "1: unknown math environment: " << typ << "\n";
                        }
 
                        p->setName(latex_mathenv[i].basename);
@@ -484,7 +492,8 @@ MathInset * mathed_parse()
                }
                
                default:
-                       lyxerr[Debug::MATHED] << "2 unknown math environment: " << t << "\n";
+                       lyxerr[Debug::MATHED]
+                               << "2 unknown math environment: " << t << "\n";
        }
 
        return p;
@@ -628,6 +637,9 @@ void mathed_parse(MathArray & array, unsigned flags)
                                << "found newline unexpectedly, array: '" << array << "'\n";
                        break;
                
+               case LM_TK_PROTECT: 
+                       break;
+
                case LM_TK_BIGSYM:  
                case LM_TK_SYM:
                case LM_TK_FUNCLIM:
@@ -750,6 +762,7 @@ void mathed_parse(MathArray & array, unsigned flags)
                                array.push_back(new MathFuncInset(yytext));
                        break;
                
+               case LM_TK_MATH:
                case LM_TK_END:
                        --plevel;
                        return;
index 02e16a885457d1a889c9325c0e3584fcc493f89e..90b558fe88d5d53db69d815e2bf2048cbc3d8b90 100644 (file)
@@ -82,6 +82,8 @@ enum MathTokenEnum
        ///
        LM_TK_LIMIT,
        ///
+       LM_TK_PROTECT,
+       ///
        LM_TK_STY,
        ///
        LM_TK_MACRO,
@@ -92,6 +94,8 @@ enum MathTokenEnum
        ///
        LM_TK_NEWCOMMAND,
        ///
+       LM_TK_MATH,
+       ///
        LM_TK_STACK
 };