On Wed, Mar 12, 2008 at 02:27:07PM +0100, Abdelrazak Younes wrote: > Enrico Forestieri wrote: > > On Mon, Mar 10, 2008 at 11:01:26PM +0100, Enrico Forestieri wrote: > >> On Mon, Mar 10, 2008 at 10:30:41AM +0100, Jean-Marc Lasgouttes wrote: > >> > >>> Enrico Forestieri <[EMAIL PROTECTED]> writes: > >>> > >>>> The attached patch is better, IMO. There's no reason to require > >>>> the \boldsymbol definition every time a math inset is used. > >>> Looks good IMO. > >> I think that this needs to be discussed some more. ATM, we have > >> support for bold math through two different ways: > >> > >> 1) Via InsetMathBoldSymbol.cpp and \boldsymbol > >> a) When amsmath is not loaded, LyX provides a custom definition. > >> b) Otherwise, the definition of \boldsymbol provided by amsmath > >> is used. > >> 2) Via InsetMathBM.cpp and \bm > >> > >> Method 1a) is flawed and should be ditched. Method 2) is better and > >> produces correct results whether or not amsmath is loaded. > >> > >> However, note that both 1) and 2) provide the same exact functionality, > >> so I don't understand why it was done in such a way. I think that the > >> two methods should be merged as done in the attached patch and > >> propose to do the same in 1.5.x, i.e., providing \boldsymbol through > >> the bm.sty package. > > > > It seems that nobody has an opinion, > > or maybe everybody trust your opinion on this ;-)
Well, you never know what you could have overlooked... BTW, here is a patch for 1.5. Jürgen, Ok to apply it? -- Enrico
Index: src/mathed/InsetMathHull.cpp =================================================================== --- src/mathed/InsetMathHull.cpp (revision 23686) +++ src/mathed/InsetMathHull.cpp (working copy) @@ -518,7 +518,6 @@ void InsetMathHull::validate(LaTeXFeatur //if (features.amsstyle) // return; - features.require("boldsymbol"); //features.binom = true; InsetMathGrid::validate(features); Index: src/mathed/MathFactory.cpp =================================================================== --- src/mathed/MathFactory.cpp (revision 23686) +++ src/mathed/MathFactory.cpp (working copy) @@ -379,8 +379,10 @@ MathAtom createInsetMath(docstring const return MathAtom(new InsetMathFrac(InsetMathFrac::ATOP)); if (s == "lefteqn") return MathAtom(new InsetMathLefteqn); - if (s == "boldsymbol") - return MathAtom(new InsetMathBoldSymbol); + if (s == "boldsymbol" || s == "bm") + return MathAtom(new InsetMathBoldSymbol(InsetMathBoldSymbol::BOLD)); + if (s == "heavysymbol" || s == "hm") + return MathAtom(new InsetMathBoldSymbol(InsetMathBoldSymbol::HEAVY)); if (s == "color" || s == "normalcolor") return MathAtom(new InsetMathColor(true)); if (s == "textcolor") Index: src/mathed/InsetMathBoldSymbol.h =================================================================== --- src/mathed/InsetMathBoldSymbol.h (revision 23686) +++ src/mathed/InsetMathBoldSymbol.h (working copy) @@ -22,7 +22,12 @@ namespace lyx { class InsetMathBoldSymbol : public InsetMathNest { public: /// - InsetMathBoldSymbol(); + enum Kind { + BOLD, + HEAVY + }; + /// + InsetMathBoldSymbol(Kind kind = BOLD); /// bool metrics(MetricsInfo & mi, Dimension & dim) const; /// @@ -37,6 +42,8 @@ public: void write(WriteStream & os) const; /// void infoize(odocstream & os) const; + /// + Kind kind_; private: virtual std::auto_ptr<Inset> doClone() const; }; Index: src/mathed/InsetMathBoldSymbol.cpp =================================================================== --- src/mathed/InsetMathBoldSymbol.cpp (revision 23686) +++ src/mathed/InsetMathBoldSymbol.cpp (working copy) @@ -22,8 +22,8 @@ namespace lyx { using std::auto_ptr; -InsetMathBoldSymbol::InsetMathBoldSymbol() - : InsetMathNest(1) +InsetMathBoldSymbol::InsetMathBoldSymbol(Kind kind) + : InsetMathNest(1), kind_(kind) {} @@ -70,19 +70,33 @@ void InsetMathBoldSymbol::drawT(TextPain void InsetMathBoldSymbol::validate(LaTeXFeatures & features) const { InsetMathNest::validate(features); - features.require("amssymb"); + features.require("bm"); } void InsetMathBoldSymbol::write(WriteStream & os) const { - os << "\\boldsymbol{" << cell(0) << "}"; + switch (kind_) { + case BOLD: + os << "\\boldsymbol{" << cell(0) << "}"; + break; + case HEAVY: + os << "\\heavysymbol{" << cell(0) << "}"; + break; + } } void InsetMathBoldSymbol::infoize(odocstream & os) const { - os << "Boldsymbol "; + switch (kind_) { + case BOLD: + os << "Boldsymbol "; + break; + case HEAVY: + os << "Heavysymbol "; + break; + } } Index: src/LaTeXFeatures.cpp =================================================================== --- src/LaTeXFeatures.cpp (revision 23686) +++ src/LaTeXFeatures.cpp (working copy) @@ -145,10 +145,6 @@ static string const floatingfootnote_def " \\expandafter\\noexpand\\csname [EMAIL PROTECTED]@opt \\endcsname}\n" "[EMAIL PROTECTED]@twobracket[#1]#2{}\n"; -static string const boldsymbol_def = - "%% Bold symbol macro for standard LaTeX users\n" - "\\providecommand{\\boldsymbol}[1]{\\mbox{\\boldmath $#1$}}\n"; - static string const binom_def = "%% Binom macro for standard LaTeX users\n" "\\newcommand{\\binom}[2]{{#1 \\choose #2}}\n"; @@ -441,6 +437,7 @@ char const * simplefeatures[] = { "mathrsfs", "ascii", "url", + "bm" }; int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *); @@ -666,8 +663,6 @@ string const LaTeXFeatures::getMacros() macros << guillemotright_def << '\n'; // Math mode - if (mustProvide("boldsymbol") && !isRequired("amsmath")) - macros << boldsymbol_def << '\n'; if (mustProvide("binom") && !isRequired("amsmath")) macros << binom_def << '\n'; if (mustProvide("mathcircumflex")) Index: status.15x =================================================================== --- status.15x (revision 23686) +++ status.15x (working copy) @@ -77,6 +77,8 @@ What's new and shaded notes, thus fixing a problem where documents couldn't be compiled anymore. +- Use package bm for bold math symbols, such that bold super and subscripts + have the correct size even when not using amsmath. * USER INTERFACE: