]> git.lyx.org Git - features.git/commitdiff
Fix missing \bigg variants for \llbracket
authorGuillaume Munch <gm@lyx.org>
Mon, 19 Dec 2016 23:15:59 +0000 (00:15 +0100)
committerGuillaume Munch <gm@lyx.org>
Mon, 19 Dec 2016 23:15:59 +0000 (00:15 +0100)
src/mathed/InsetMathBig.cpp
src/mathed/InsetMathBig.h
src/mathed/InsetMathDelim.cpp
src/mathed/MathSupport.cpp
src/mathed/MathSupport.h

index 76efc571dbf853dcc03a56e10cc2568a1346a8da..eeaf96514bd97fdd32d6c9d79585f9fc4e294785 100644 (file)
@@ -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"
index e42582c53124d72a968c4bcb38af920d32362a77..996a30a39d27ecf3946553ad3c88446c3e424ae5 100644 (file)
@@ -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_;
index e039e64a19170c9b507f725808c24d8b78002ca5..2680ad090d20f17cb517cf74969ebb68968c28c7 100644 (file)
@@ -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_);
 }
 
 
index 5df8a0673e76bde13a416722de542f0832fd1fc5..daf437fc67fe5003a868ccac45e6d2a093cb1508 100644 (file)
 #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
index 2b3e48f68f7233fa278384248a9a9f8c7494c4dd..3e5f67d5cff38942fe5163db1951a5eeb0b2ba60 100644 (file)
@@ -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