2 * \file InsetMathEnv.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 "InsetMathEnv.h"
16 #include "MathStream.h"
18 #include "MetricsInfo.h"
20 #include "support/gettext.h"
21 #include "support/lstrings.h"
25 using namespace lyx::support;
29 InsetMathEnv::InsetMathEnv(Buffer * buf, docstring const & name)
30 : InsetMathNest(buf, 1), name_(name)
34 Inset * InsetMathEnv::clone() const
36 return new InsetMathEnv(*this);
40 void InsetMathEnv::metrics(MetricsInfo & mi, Dimension & dim) const
42 Changer dummy = mi.base.changeEnsureMath();
43 cell(0).metrics(mi, dim);
47 void InsetMathEnv::draw(PainterInfo & pi, int x, int y) const
49 Changer dummy = pi.base.changeEnsureMath();
50 cell(0).draw(pi, x, y);
54 void InsetMathEnv::write(TeXMathStream & os) const
56 MathEnsurer ensurer(os);
57 os << "\\begin{" << name_ << '}' << cell(0) << "\\end{" << name_ << '}';
61 void InsetMathEnv::normalize(NormalStream & os) const
63 os << "[env " << name_ << ' ' << cell(0) << ']';
67 void InsetMathEnv::infoize(odocstream & os) const
69 os << bformat(_("Environment: %1$s"), name_);