From: Guillaume Munch Date: Mon, 19 Dec 2016 23:15:59 +0000 (+0100) Subject: Fix missing \bigg variants for \llbracket X-Git-Tag: 2.3.0alpha1~597 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=4a85a28ea504c9b16e711686f196ac9433d16710;p=features.git Fix missing \bigg variants for \llbracket --- diff --git a/src/mathed/InsetMathBig.cpp b/src/mathed/InsetMathBig.cpp index 76efc571db..eeaf96514b 100644 --- a/src/mathed/InsetMathBig.cpp +++ b/src/mathed/InsetMathBig.cpp @@ -78,18 +78,26 @@ void InsetMathBig::metrics(MetricsInfo & mi, Dimension & dim) const } -void InsetMathBig::draw(PainterInfo & pi, int x, int y) const +docstring InsetMathBig::word() const { - Changer dummy = pi.base.changeEnsureMath(); - Dimension const dim = dimension(*pi.base.bv); // mathed_draw_deco does not use the leading backslash, so remove it // (but don't use ltrim if this is the backslash delimiter). // Replace \| by \Vert (equivalent in LaTeX), since mathed_draw_deco // would treat it as |. - docstring const delim = (delim_ == "\\|") ? from_ascii("Vert") : - (delim_ == "\\\\") ? from_ascii("\\") : support::ltrim(delim_, "\\"); + if (delim_ == "\\|") + return from_ascii("Vert"); + if (delim_ == "\\\\") + return from_ascii("\\"); + return support::ltrim(delim_, "\\"); +} + + +void InsetMathBig::draw(PainterInfo & pi, int x, int y) const +{ + Changer dummy = pi.base.changeEnsureMath(); + Dimension const dim = dimension(*pi.base.bv); mathed_draw_deco(pi, x + 1, y - dim.ascent(), 4, dim.height(), - delim); + word()); } @@ -146,6 +154,7 @@ bool InsetMathBig::isBigInsetDelim(docstring const & delim) "<", ">", "\\\\", "\\backslash", "\\langle", "\\lceil", "\\lfloor", "\\rangle", "\\rceil", "\\rfloor", + "\\llbracket", "\\rrbracket", "\\downarrow", "\\Downarrow", "\\uparrow", "\\Uparrow", "\\updownarrow", "\\Updownarrow", "" @@ -156,6 +165,7 @@ bool InsetMathBig::isBigInsetDelim(docstring const & delim) void InsetMathBig::validate(LaTeXFeatures & features) const { + validate_math_word(features, word()); if (features.runparams().math_flavor == OutputParams::MathAsHTML) features.addCSSSnippet( "span.bigsymbol{font-size: 150%;}\n" diff --git a/src/mathed/InsetMathBig.h b/src/mathed/InsetMathBig.h index e42582c531..996a30a39d 100644 --- a/src/mathed/InsetMathBig.h +++ b/src/mathed/InsetMathBig.h @@ -50,6 +50,8 @@ private: size_type size() const; /// double increase() const; + /// name with leading backslash stripped + docstring word() const; /// \\bigl or what? docstring const name_; diff --git a/src/mathed/InsetMathDelim.cpp b/src/mathed/InsetMathDelim.cpp index e039e64a19..2680ad090d 100644 --- a/src/mathed/InsetMathDelim.cpp +++ b/src/mathed/InsetMathDelim.cpp @@ -69,21 +69,8 @@ void InsetMathDelim::validate(LaTeXFeatures & features) const // The delimiters may be used without \left or \right as well. // Therefore they are listed in lib/symbols, and if they have // requirements, we need to add them here. - MathWordList const & words = mathedWordList(); - MathWordList::const_iterator it = words.find(left_); - if (it != words.end()) - { - string const req = it->second.requires; - if (!req.empty()) - features.require(req); - } - it = words.find(right_); - if (it != words.end()) - { - string const req = it->second.requires; - if (!req.empty()) - features.require(req); - } + validate_math_word(features, left_); + validate_math_word(features, right_); } diff --git a/src/mathed/MathSupport.cpp b/src/mathed/MathSupport.cpp index 5df8a0673e..daf437fc67 100644 --- a/src/mathed/MathSupport.cpp +++ b/src/mathed/MathSupport.cpp @@ -17,9 +17,11 @@ #include "InsetMathSymbol.h" #include "Length.h" #include "MathData.h" +#include "MathFactory.h" #include "MathParser.h" #include "MathStream.h" +#include "LaTeXFeatures.h" #include "MetricsInfo.h" #include "frontends/FontLoader.h" @@ -992,4 +994,16 @@ int axis_height(MetricsBase & mb) } +void validate_math_word(LaTeXFeatures & features, docstring const & word) +{ + MathWordList const & words = mathedWordList(); + MathWordList::const_iterator it = words.find(word); + if (it != words.end()) { + string const req = it->second.requires; + if (!req.empty()) + features.require(req); + } +} + + } // namespace lyx diff --git a/src/mathed/MathSupport.h b/src/mathed/MathSupport.h index 2b3e48f68f..3e5f67d5cf 100644 --- a/src/mathed/MathSupport.h +++ b/src/mathed/MathSupport.h @@ -27,6 +27,7 @@ class MathData; class MathAtom; class InsetMath; class latexkeys; +class LaTeXFeatures; int mathed_font_em(FontInfo const &); @@ -84,6 +85,8 @@ void asArray(docstring const &, MathData &, Parse::flags f = Parse::NORMAL); // simulate axis height (font dimension sigma 22) int axis_height(MetricsBase & mb); +void validate_math_word(LaTeXFeatures & features, docstring const & word); + } // namespace lyx #endif