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
This commit is contained in:
André Pönitz 2001-10-24 17:14:05 +00:00
parent d1633491db
commit 1b8991ea00
2 changed files with 18 additions and 7 deletions

View 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},

View 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());