]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetSpace.cpp
Recent LaTeX includes all math and text spaces
[features.git] / src / insets / InsetSpace.cpp
index 5a4f46801af73c89eac00a2085716cf82db3518f..1b1193d63bd966953bec977e9c400a9b769bf7f3 100644 (file)
@@ -24,7 +24,6 @@
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
-#include "OutputParams.h"
 #include "texstream.h"
 #include "xml.h"
 
@@ -45,7 +44,7 @@ namespace lyx {
 
 
 InsetSpace::InsetSpace(InsetSpaceParams const & params)
-       : Inset(0), params_(params)
+       : Inset(nullptr), params_(params)
 {}
 
 
@@ -390,18 +389,18 @@ void InsetSpace::draw(PainterInfo & pi, int x, int y) const
        int const h = theFontMetrics(pi.base.font).xHeight();
        int xp[4], yp[4];
 
-       xp[0] = x + 1;
+       xp[0] = x;
        yp[0] = y - max(h / 4, 1);
        if (params_.kind == InsetSpaceParams::NORMAL ||
            params_.kind == InsetSpaceParams::PROTECTED ||
            params_.kind == InsetSpaceParams::VISIBLE) {
-               xp[1] = x + 1;     yp[1] = y;
-               xp[2] = x + w - 2; yp[2] = y;
+               xp[1] = x;         yp[1] = y;
+               xp[2] = x + w - 1; yp[2] = y;
        } else {
-               xp[1] = x + 1;     yp[1] = y + max(h / 4, 1);
-               xp[2] = x + w - 2; yp[2] = y + max(h / 4, 1);
+               xp[1] = x;         yp[1] = y + max(h / 4, 1);
+               xp[2] = x + w - 1; yp[2] = y + max(h / 4, 1);
        }
-       xp[3] = x + w - 2;
+       xp[3] = x + w - 1;
        yp[3] = y - max(h / 4, 1);
 
        Color col = Color_special;
@@ -862,6 +861,13 @@ docstring InsetSpace::xhtml(XMLStream & xs, OutputParams const &) const
 
 void InsetSpace::validate(LaTeXFeatures & features) const
 {
+       if (features.isAvailable("LaTeX-2020/10/01"))
+               // As of this version, the LaTeX kernel
+               // includes all spaces.
+               return;
+
+       // In earlier versions, we require amsmath
+       // for some text and math spaces
        if ((params_.kind == InsetSpaceParams::NEGMEDIUM
             || params_.kind == InsetSpaceParams::NEGTHICK)
            || (!params_.math