+
+
+static
+int mathed_write(MathParInset * p, ostream & os,
+ bool fragile, string const & label)
+{
+ number_of_newlines = 0;
+ short mathed_env = p->GetType();
+
+ if (mathed_env == LM_OT_MIN) {
+ if (fragile) os << "\\protect";
+ os << "\\( "; // changed from " \\( " (Albrecht Dress)
+ } else {
+ if (mathed_env == LM_OT_PAR){
+ os << "\\[\n";
+ } else {
+ os << "\\begin{"
+ << latex_mathenv[mathed_env]
+ << "}";
+ if (is_multicolumn(mathed_env)) {
+ if (mathed_env != LM_OT_ALIGNAT
+ && mathed_env != LM_OT_ALIGNATN)
+ os << "%";
+ os << "{" << p->GetColumns()/2 << "}";
+ }
+ os << "\n";
+ }
+ ++number_of_newlines;
+ }
+
+ if (!label.empty() && label[0] > ' '
+ && is_singlely_numbered(mathed_env)) {
+ os << "\\label{"
+ << label
+ << "}\n";
+ ++number_of_newlines;
+ }
+
+ p->Write(os, fragile);
+
+ if (mathed_env == LM_OT_MIN){
+ if (fragile) os << "\\protect";
+ os << " \\)";
+ } else if (mathed_env == LM_OT_PAR) {
+ os << "\\]\n";
+ ++number_of_newlines;
+ } else {
+ os << "\n\\end{"
+ << latex_mathenv[mathed_env]
+ << "}\n";
+ number_of_newlines += 2;
+ }
+ return number_of_newlines;
+}