#include "LaTeXFeatures.h"
#include "MathStream.h"
+
+#include "MetricsInfo.h"
+
#include "frontends/Painter.h"
+#include <algorithm>
#include <ostream>
namespace lyx {
pi.pain.line(x1, y2, x3, y2, Color_added_space);
}
- else if (kind_ == smash) {
+ else if (kind_ == smash || kind_ == smasht || kind_ == smashb) {
// y1---------
// |
// y2----- \ | /
int const y4 = std::min(y5, y3 + arrow_size);
// top arrow
- pi.pain.line(x1, y2, x2, y3, Color_added_space);
- pi.pain.line(x3, y2, x2, y3, Color_added_space);
+ if (kind_ != smashb) {
+ pi.pain.line(x1, y2, x2, y3, Color_added_space);
+ pi.pain.line(x3, y2, x2, y3, Color_added_space);
+ }
// bottom arrow
- pi.pain.line(x1, y4, x2, y3, Color_added_space);
- pi.pain.line(x3, y4, x2, y3, Color_added_space);
+ if (kind_ != smasht) {
+ pi.pain.line(x1, y4, x2, y3, Color_added_space);
+ pi.pain.line(x3, y4, x2, y3, Color_added_space);
+ }
// joining line
- pi.pain.line(x2, y1, x2, y5, Color_added_space);
+ if (kind_ == smasht)
+ pi.pain.line(x2, y1, x2, y3, Color_added_space);
+ else if (kind_ == smashb)
+ pi.pain.line(x2, y3, x2, y5, Color_added_space);
+ else
+ pi.pain.line(x2, y1, x2, y5, Color_added_space);
}
drawMarkers(pi, x, y);
void InsetMathPhantom::write(WriteStream & os) const
{
MathEnsurer ensurer(os);
+ if (os.fragile())
+ os << "\\protect";
switch (kind_) {
case phantom:
os << "\\phantom{";
case smash:
os << "\\smash{";
break;
+ case smasht:
+ os << "\\smash[t]{";
+ break;
+ case smashb:
+ os << "\\smash[b]{";
+ break;
case mathclap:
os << "\\mathclap{";
break;
case smash:
os << "[smash ";
break;
+ case smasht:
+ os << "[smasht ";
+ break;
+ case smashb:
+ os << "[smashb ";
+ break;
case mathclap:
os << "[mathclap ";
break;
case smash:
os << "Smash";
break;
+ case smasht:
+ os << "Smashtop";
+ break;
+ case smashb:
+ os << "Smashbottom";
+ break;
case mathllap:
os << "Mathllap";
break;
case hphantom:
case smash:
break;
+ case smasht:
+ case smashb:
+ features.require("amsmath");
+ break;
case mathclap:
case mathllap:
case mathrlap:
bool InsetMathPhantom::visibleContents() const
{
- return kind_ == phantom || kind_ == vphantom || kind_ == vphantom;
+ return kind_ == phantom || kind_ == vphantom || kind_ == hphantom;
}