From 09548338ce3f2b0937c67d3221fab4854ab1d6b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 28 Oct 2003 08:51:33 +0000 Subject: [PATCH] support for \textcolor git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7993 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_colorinset.C | 9 ++++++--- src/mathed/math_colorinset.h | 4 +++- src/mathed/math_factory.C | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/mathed/math_colorinset.C b/src/mathed/math_colorinset.C index b9737c5d93..3d5a68b398 100644 --- a/src/mathed/math_colorinset.C +++ b/src/mathed/math_colorinset.C @@ -23,8 +23,8 @@ using std::auto_ptr; -MathColorInset::MathColorInset() - : MathNestInset(2) +MathColorInset::MathColorInset(bool oldstyle) + : MathNestInset(2), oldstyle_(oldstyle) {} @@ -80,7 +80,10 @@ void MathColorInset::validate(LaTeXFeatures & features) const void MathColorInset::write(WriteStream & os) const { - os << "{\\color" << '{' << cell(0) << '}' << cell(1) << '}'; + if (oldstyle_) + os << "{\\color" << '{' << cell(0) << '}' << cell(1) << '}'; + else + os << "\\textcolor" << '{' << cell(0) << "}{" << cell(1) << '}'; } diff --git a/src/mathed/math_colorinset.h b/src/mathed/math_colorinset.h index 6cab921f5c..3f16f4e6d4 100644 --- a/src/mathed/math_colorinset.h +++ b/src/mathed/math_colorinset.h @@ -19,7 +19,7 @@ class MathColorInset : public MathNestInset { public: /// - MathColorInset(); + explicit MathColorInset(bool oldstyle); /// std::auto_ptr clone() const; /// @@ -39,6 +39,8 @@ public: private: /// width of '[' in current font mutable int w_; + /// + bool oldstyle_; }; #endif diff --git a/src/mathed/math_factory.C b/src/mathed/math_factory.C index 865736a523..dbf0223d3d 100644 --- a/src/mathed/math_factory.C +++ b/src/mathed/math_factory.C @@ -311,7 +311,9 @@ MathAtom createMathInset(string const & s) if (s == "boldsymbol") return MathAtom(new MathBoldsymbolInset); if (s == "color") - return MathAtom(new MathColorInset); + return MathAtom(new MathColorInset(true)); + if (s == "textcolor") + return MathAtom(new MathColorInset(false)); if (s == "dfrac") return MathAtom(new MathDfracInset); -- 2.39.2