From: André Pönitz Date: Thu, 26 Jul 2001 16:56:23 +0000 (+0000) Subject: make '$' default delimiter for inline maths instead of \(...\) X-Git-Tag: 1.6.10~20982 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=43d1fd25627436527f01726cd05f9f1b40455b25;p=features.git make '$' default delimiter for inline maths instead of \(...\) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2363 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/math_hash.C b/src/mathed/math_hash.C index 67139db71f..df1f63ac25 100644 --- a/src/mathed/math_hash.C +++ b/src/mathed/math_hash.C @@ -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}, diff --git a/src/mathed/math_matrixinset.C b/src/mathed/math_matrixinset.C index d8a60c2bce..d23f64bcf1 100644 --- a/src/mathed/math_matrixinset.C +++ b/src/mathed/math_matrixinset.C @@ -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: diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 8bc608ac66..42bbdda033 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -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; diff --git a/src/mathed/math_parser.h b/src/mathed/math_parser.h index 02e16a8854..90b558fe88 100644 --- a/src/mathed/math_parser.h +++ b/src/mathed/math_parser.h @@ -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 };