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
This commit is contained in:
André Pönitz 2002-01-10 14:02:37 +00:00
parent 5a8177491d
commit 32253ab4d1
3 changed files with 12 additions and 5 deletions

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

View 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

View 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) {