From 32253ab4d12680e8587dc8123e82ecb98da670e1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 10 Jan 2002 14:02:37 +0000 Subject: [PATCH] make \newcommand{\bb}[1]{\mathbf{#1}} work for read/write/display. 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 | 11 ++++++++--- src/mathed/math_macroarg.h | 4 +++- src/mathed/math_parser.C | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/mathed/math_macroarg.C b/src/mathed/math_macroarg.C index f655103832..35d09d22d9 100644 --- a/src/mathed/math_macroarg.C +++ b/src/mathed/math_macroarg.C @@ -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; } diff --git a/src/mathed/math_macroarg.h b/src/mathed/math_macroarg.h index b200bcc504..b2bcbade97 100644 --- a/src/mathed/math_macroarg.h +++ b/src/mathed/math_macroarg.h @@ -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 diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index de7fd97473..98940b4537 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -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) { -- 2.39.2