2 * \file InsetMathXYMatrix.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "InsetMathXYMatrix.h"
15 #include "LaTeXFeatures.h"
16 #include "MathStream.h"
23 InsetMathXYMatrix::InsetMathXYMatrix(Length const & s, char c)
24 : InsetMathGrid(1, 1), spacing_(s), spacing_code_(c)
28 Inset * InsetMathXYMatrix::clone() const
30 return new InsetMathXYMatrix(*this);
34 int InsetMathXYMatrix::colsep() const
40 int InsetMathXYMatrix::rowsep() const
46 void InsetMathXYMatrix::metrics(MetricsInfo & mi, Dimension & dim) const
48 if (mi.base.style == LM_ST_DISPLAY)
49 mi.base.style = LM_ST_TEXT;
50 InsetMathGrid::metrics(mi, dim);
54 void InsetMathXYMatrix::write(WriteStream & os) const
56 bool brace = os.pendingBrace();
57 os.pendingBrace(false);
58 if (os.latex() && os.textMode()) {
59 os << "\\ensuremath{";
64 switch (spacing_code_) {
71 os << '@' << spacing_code_ << '='
72 << from_ascii(spacing_.asLatexString());
75 if (!spacing_.empty())
76 os << "@=" << from_ascii(spacing_.asLatexString());
79 InsetMathGrid::write(os);
81 os.pendingBrace(brace);
85 void InsetMathXYMatrix::infoize(odocstream & os) const
88 switch (spacing_code_) {
95 os << spacing_code_ << ' '
96 << from_ascii(spacing_.asLatexString()) << ' ';
99 if (!spacing_.empty())
100 os << from_ascii(spacing_.asLatexString()) << ' ';
102 InsetMathGrid::infoize(os);
106 void InsetMathXYMatrix::normalize(NormalStream & os) const
109 InsetMathGrid::normalize(os);
114 void InsetMathXYMatrix::maple(MapleStream & os) const
117 InsetMathGrid::maple(os);
122 void InsetMathXYMatrix::validate(LaTeXFeatures & features) const
124 features.require("xy");
125 InsetMathGrid::validate(features);