input support for \mathcal, \mathbb etc.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3186 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-12-11 11:33:43 +00:00
parent b1f98665f5
commit 49710a766f
6 changed files with 22 additions and 10 deletions

View File

@ -1266,6 +1266,12 @@ bool MathCursor::interpret(string const & s)
return true;
}
latexkeys const * l = in_word_set(s.substr(1));
if (l && (l->token == LM_TK_FONT || l->token == LM_TK_OLDFONT)) {
lastcode_ = static_cast<MathTextCodes>(l->id);
return true;
}
niceInsert(createMathInset(s.substr(1)));
return true;
}
@ -1403,7 +1409,8 @@ bool MathCursor::interpret(char c)
}
// no special circumstances, so insert the character without any fuss
insert(c, LM_TC_MIN);
insert(c, lastcode_);
lastcode_ = LM_TC_MIN;
return true;
}

View File

@ -196,24 +196,21 @@ void MathMacro::validate(LaTeXFeatures & features) const
void MathMacro::maplize(MapleStream & os) const
{
expanded_ = tmplate_->xcell(0);
expanded_.data_.substitute(*this);
updateExpansion();
::maplize(expanded_.data_, os);
}
void MathMacro::mathmlize(MathMLStream & os) const
{
expanded_ = tmplate_->xcell(0);
expanded_.data_.substitute(*this);
updateExpansion();
::mathmlize(expanded_.data_, os);
}
void MathMacro::octavize(OctaveStream & os) const
{
expanded_ = tmplate_->xcell(0);
expanded_.data_.substitute(*this);
updateExpansion();
::octavize(expanded_.data_, os);
}
@ -235,3 +232,10 @@ void MathMacro::write(WriteStream & os) const
if (nargs() == 0)
os << ' ';
}
void MathMacro::updateExpansion() const
{
expanded_ = tmplate_->xcell(0);
expanded_.data_.substitute(*this);
}

View File

@ -86,6 +86,8 @@ private:
bool editing() const;
///
bool defining() const;
///
void updateExpansion() const;
///
MathAtom & tmplate_;

View File

@ -55,6 +55,7 @@ void MathMacroTable::create(string const & name, int na, string const & text)
}
void MathMacroTable::create(string const & name, int na, MathArray const & ar)
{
MathAtom t(new MathMacroTemplate(name, na));

View File

@ -16,10 +16,9 @@ MathMacroTemplate::MathMacroTemplate()
MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs)
: MathNestInset(1), numargs_(numargs), name_(nm)
{
if (numargs_ > 9) {
if (numargs_ > 9)
lyxerr << "MathMacroTemplate::MathMacroTemplate: wrong # of arguments: "
<< numargs_ << std::endl;
}
}

View File

@ -193,5 +193,4 @@ WriteStream & operator<<(WriteStream &, int);
///
WriteStream & operator<<(WriteStream &, unsigned int);
#endif