]> git.lyx.org Git - features.git/commitdiff
make \newcommand{\bb}[1]{\mathbf{#1}} work for read/write/display.
authorAndré Pönitz <poenitz@gmx.net>
Thu, 10 Jan 2002 14:02:37 +0000 (14:02 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 10 Jan 2002 14:02:37 +0000 (14:02 +0000)
No editing possible, though...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3328 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_macroarg.C
src/mathed/math_macroarg.h
src/mathed/math_parser.C

index f65510383290efca8decca4b827c065beb24313f..35d09d22d9463e4d351663c2e740f2a89123f266 100644 (file)
@@ -11,8 +11,8 @@
 
 
 
-MathMacroArgument::MathMacroArgument(int n)
-       : MathNestInset(1), number_(n), expanded_(false)
+MathMacroArgument::MathMacroArgument(int n, MathTextCodes code)
+       : MathNestInset(1), number_(n), expanded_(false), code_(code)
 {
        if (n < 1 || n > 9) {
                lyxerr << "MathMacroArgument::MathMacroArgument: wrong Argument id: "
@@ -32,7 +32,10 @@ MathInset * MathMacroArgument::clone() const
 
 void MathMacroArgument::write(WriteStream & os) const
 {
-       os << str_;
+       if (code_ == LM_TC_MIN)
+               os << str_;
+       else
+               os << '\\' << math_font_name(code_) << '{' << str_ << '}';
 }
 
 
@@ -67,6 +70,8 @@ void MathMacroArgument::normalize(NormalStream & os) const
 void MathMacroArgument::substitute(MathMacro const & m)
 {
        cell(0) = m.cell(number_ - 1);
+       for (MathArray::iterator it = cell(0).begin(); it != cell(0).end(); ++it)
+               it->nucleus()->handleFont(code_);
        expanded_ = true;
 }
 
index b200bcc5045fbf18d510c13b49fc3f7b9d46799e..b2bcbade9718ab6001f68391bf470dfb19c9ca45 100644 (file)
@@ -14,7 +14,7 @@
 class MathMacroArgument : public MathNestInset {
 public:
        ///
-       explicit MathMacroArgument(int);
+       explicit MathMacroArgument(int, MathTextCodes = LM_TC_MIN);
        ///
        MathInset * clone() const;
        ///
@@ -40,6 +40,8 @@ private:
        bool expanded_;
        ///
        mutable MathMetricsInfo mi_;
+       ///
+       MathTextCodes code_;
 };
 
 #endif
index de7fd974732c9d4f59bc369bd3bf848676ab8a5f..98940b4537ccd53da89cda5bb27680a899370b0e 100644 (file)
@@ -788,7 +788,7 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
 
                else if (t.cat() == catParameter) {
                        Token const & n = getToken();
-                       array.push_back(MathAtom(new MathMacroArgument(n.character() - '0')));
+                       array.push_back(MathAtom(new MathMacroArgument(n.character()-'0', code)));
                }
 
                else if (t.cat() == catBegin) {