#include "InsetMathSubstack.h"
-#include "LaTeXFeatures.h"
#include "MathData.h"
#include "MathStream.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "support/gettext.h"
+#include "LaTeXFeatures.h"
+#include "MetricsInfo.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include <ostream>
void InsetMathSubstack::metrics(MetricsInfo & mi, Dimension & dim) const
{
- if (mi.base.style == LM_ST_DISPLAY) {
- StyleChanger dummy(mi.base, LM_ST_TEXT);
- InsetMathGrid::metrics(mi, dim);
- } else {
- InsetMathGrid::metrics(mi, dim);
- }
+ Changer dummy2 = mi.base.changeEnsureMath();
+ Changer dummy = mi.base.changeArray();
+ InsetMathGrid::metrics(mi, dim);
}
void InsetMathSubstack::draw(PainterInfo & pi, int x, int y) const
{
+ Changer dummy2 = pi.base.changeEnsureMath();
+ Changer dummy = pi.base.changeArray();
InsetMathGrid::draw(pi, x + 1, y);
}
FuncStatus & flag) const
{
switch (cmd.action()) {
- case LFUN_INSET_MODIFY: {
- istringstream is(to_utf8(cmd.argument()));
- string s;
- is >> s;
- if (s != "tabular")
- break;
- is >> s;
- string const name = "substack";
+ case LFUN_TABULAR_FEATURE: {
+ string s = cmd.getArg(0);
if (s == "add-vline-left" || s == "add-vline-right") {
flag.message(bformat(
from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
- from_utf8(name)));
+ from_utf8("substack")));
flag.setEnabled(false);
return true;
}
- // in contrary to \subaray, the columns in \substack
+ // in contrary to \subarray, the columns in \substack
// are always centered and this cannot be changed
if (s == "align-left" || s == "align-right") {
flag.message(bformat(
from_utf8(N_("Can't change horizontal alignment in '%1$s'")),
- from_utf8(name)));
+ from_utf8("substack")));
flag.setEnabled(false);
return true;
}
{
MathEnsurer ensurer(os);
os << "\\substack{";
+ bool open = os.startOuterRow();
InsetMathGrid::write(os);
os << "}\n";
+ if (open)
+ os.startOuterRow();
}