From 2ad48f204b2a2a6aba7f845cb43819d07dbece98 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Tue, 1 Apr 2008 02:29:41 +0000 Subject: [PATCH] Fix bug 4668 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24080 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/doc/LaTeXConfig.lyx | 28 ++++++++++++++++++---------- src/LaTeXFeatures.cpp | 12 +++++------- src/mathed/InsetMathBoldSymbol.cpp | 23 ++++++++++++++++------- src/mathed/InsetMathBoldSymbol.h | 7 ++++--- src/mathed/MathFactory.cpp | 8 +++++--- 5 files changed, 48 insertions(+), 30 deletions(-) diff --git a/lib/doc/LaTeXConfig.lyx b/lib/doc/LaTeXConfig.lyx index 08e752c3a5..0ee0abf001 100644 --- a/lib/doc/LaTeXConfig.lyx +++ b/lib/doc/LaTeXConfig.lyx @@ -3293,13 +3293,7 @@ bm \backslash bm \family default - (aliased to -\family typewriter - -\backslash -boldsymbol -\family default -) which makes its argument bold. + which makes its argument bold. The argument may be any math object from a single symbol to an expression. If available, ultra bold fonts can be accesed through the \family typewriter @@ -3318,17 +3312,31 @@ heavysymbol \family typewriter \backslash -boldsymbol +bm \family default command is similar to the \family sans -amsmath +amsmath +\family typewriter + +\backslash +boldsymbol \family default - command with same name, but the + command, but the \family sans bm \family default version is rather more careful in the way it does things. + Be aware that this package allocates symbol fonts for bold fonts into the + normal math version, such that, when using other packages that allocate + many symbol fonts, they can be exhausted. + In this case, one can make do with the +\family typewriter + +\backslash +boldsymbol +\family default + command. \end_layout \begin_layout Subsection diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 46caa8671c..641e99eb7d 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -449,7 +449,8 @@ char const * simplefeatures[] = { "endnotes", "ifthen", "amsthm", - "listings" + "listings", + "bm" }; int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *); @@ -489,6 +490,9 @@ string const LaTeXFeatures::getPackages() const (mustProvide("esintoramsmath") && params_.use_esint == BufferParams::package_off)) { packages << "\\usepackage{amsmath}\n"; + } else if (mustProvide("amsbsy")) { + // amsbsy is already provided by amsmath + packages << "\\usepackage{amsbsy}\n"; } // wasysym is a simple feature, but it must be after amsmath if both @@ -606,12 +610,6 @@ string const LaTeXFeatures::getPackages() const "\\makenomenclature\n"; } - // bm -- this package interrogates the font allocations to determine - // which bold fonts are available, so it is best loaded as the last one, - // and, in any case, after amsmath. - if (mustProvide("bm")) - packages << "\\usepackage{bm}\n"; - return packages.str(); } diff --git a/src/mathed/InsetMathBoldSymbol.cpp b/src/mathed/InsetMathBoldSymbol.cpp index 7a7e5ece76..f5bb350a01 100644 --- a/src/mathed/InsetMathBoldSymbol.cpp +++ b/src/mathed/InsetMathBoldSymbol.cpp @@ -67,18 +67,24 @@ void InsetMathBoldSymbol::drawT(TextPainter & pain, int x, int y) const void InsetMathBoldSymbol::validate(LaTeXFeatures & features) const { InsetMathNest::validate(features); - features.require("bm"); + if (kind_ == AMS_BOLD) + features.require("amsbsy"); + else + features.require("bm"); } void InsetMathBoldSymbol::write(WriteStream & os) const { switch (kind_) { - case BOLD: + case AMS_BOLD: os << "\\boldsymbol{" << cell(0) << "}"; break; - case HEAVY: - os << "\\heavysymbol{" << cell(0) << "}"; + case BM_BOLD: + os << "\\bm{" << cell(0) << "}"; + break; + case BM_HEAVY: + os << "\\hm{" << cell(0) << "}"; break; } } @@ -87,11 +93,14 @@ void InsetMathBoldSymbol::write(WriteStream & os) const void InsetMathBoldSymbol::infoize(odocstream & os) const { switch (kind_) { - case BOLD: + case AMS_BOLD: os << "Boldsymbol "; break; - case HEAVY: - os << "Heavysymbol "; + case BM_BOLD: + os << "Boldsymbol (bm)"; + break; + case BM_HEAVY: + os << "Heavysymbol (bm)"; break; } } diff --git a/src/mathed/InsetMathBoldSymbol.h b/src/mathed/InsetMathBoldSymbol.h index 0a998b149e..e0ba049d14 100644 --- a/src/mathed/InsetMathBoldSymbol.h +++ b/src/mathed/InsetMathBoldSymbol.h @@ -22,11 +22,12 @@ namespace lyx { class InsetMathBoldSymbol : public InsetMathNest { public: enum Kind { - BOLD, - HEAVY + AMS_BOLD, + BM_BOLD, + BM_HEAVY }; /// - InsetMathBoldSymbol(Kind kind = BOLD); + InsetMathBoldSymbol(Kind kind = AMS_BOLD); /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/MathFactory.cpp b/src/mathed/MathFactory.cpp index 7c9debba72..284faadaaf 100644 --- a/src/mathed/MathFactory.cpp +++ b/src/mathed/MathFactory.cpp @@ -381,10 +381,12 @@ MathAtom createInsetMath(docstring const & s) return MathAtom(new InsetMathFrac(InsetMathFrac::ATOP)); if (s == "lefteqn") return MathAtom(new InsetMathLefteqn); - if (s == "boldsymbol" || s == "bm") - return MathAtom(new InsetMathBoldSymbol(InsetMathBoldSymbol::BOLD)); + if (s == "boldsymbol") + return MathAtom(new InsetMathBoldSymbol(InsetMathBoldSymbol::AMS_BOLD)); + if (s == "bm") + return MathAtom(new InsetMathBoldSymbol(InsetMathBoldSymbol::BM_BOLD)); if (s == "heavysymbol" || s == "hm") - return MathAtom(new InsetMathBoldSymbol(InsetMathBoldSymbol::HEAVY)); + return MathAtom(new InsetMathBoldSymbol(InsetMathBoldSymbol::BM_HEAVY)); if (s == "color" || s == "normalcolor") return MathAtom(new InsetMathColor(true)); if (s == "textcolor") -- 2.39.2