void InsetMath::write(WriteStream & os) const
{
- bool brace = ensureMath(os);
+ MathEnsurer ensurer(os);
docstring const s = name();
os << "\\" << s;
// We need an extra ' ' unless this is a single-char-non-ASCII name
// or anything non-ASCII follows
if (s.size() != 1 || isAlphaASCII(s[0]))
os.pendingSpace(true);
- os.pendingBrace(brace);
-}
-
-
-bool InsetMath::ensureMath(WriteStream & os, bool needs_math_mode) const
-{
- bool brace = os.pendingBrace();
- os.pendingBrace(false);
- if (os.latex() && os.textMode() && needs_math_mode) {
- os << "\\ensuremath{";
- os.textMode(false);
- brace = true;
- }
- return brace;
}