]> git.lyx.org Git - features.git/commitdiff
input support for \mathcal, \mathbb etc.
authorAndré Pönitz <poenitz@gmx.net>
Tue, 11 Dec 2001 11:33:43 +0000 (11:33 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 11 Dec 2001 11:33:43 +0000 (11:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3186 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_cursor.C
src/mathed/math_macro.C
src/mathed/math_macro.h
src/mathed/math_macrotable.C
src/mathed/math_macrotemplate.C
src/mathed/math_mathmlstream.h

index 2d7747052c8f1326d15331c400951281e5cb7697..80cc2f918a331ead28edb2e203fd57d7547da33b 100644 (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;
 }
 
index 8f413d47bd672bba12323d998dd36092aef713d6..7ac130d2659aa729c60718d481bdca4dbfd63b8a 100644 (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);
+}
index 5c5f4bc60ee5590a7d0e57ac2df3778159894cd5..4847d358a6a8b6845948660ddcda14162dac9158 100644 (file)
@@ -86,6 +86,8 @@ private:
        bool editing() const;
        ///
        bool defining() const;
+       ///
+       void updateExpansion() const;
 
        ///
        MathAtom & tmplate_;
index 2b70aaa9e6481e93b04cf74a54f1d01a582e989a..a07cdb623e38fc2ae2765cc7a306b22b8ab7c1e2 100644 (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));
index a12714b4889dbf9cdd77a0337d3b957698cca7f8..3fe31bc7b7477df0fb072a87e6973c080ebf6d9b 100644 (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;
-       }
 }
 
 
index 7078efd82aea8ebef577e3871514a4341675395b..4efd2c95e85dfe5621552334cf6ac48c6df6dd32 100644 (file)
@@ -193,5 +193,4 @@ WriteStream & operator<<(WriteStream &, int);
 ///
 WriteStream & operator<<(WriteStream &, unsigned int);
 
-
 #endif