3 * Purpose: Write math paragraphs in LaTeX
4 * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
5 * Created: January 1996
8 * Dependencies: Xlib, XForms
10 * Copyright: 1996, 1997 Alejandro Aguilar Sierra
12 * Version: 0.8beta, Mathed & Lyx project.
14 * You are free to use and modify this code under the terms of
15 * the GNU General Public Licence version 2 or later.
21 #include "math_inset.h"
22 #include "math_iter.h"
23 #include "math_parser.h"
24 #include "math_parinset.h"
25 #include "support/lstrings.h"
31 extern char const * latex_mathenv[];
32 extern char * latex_mathspace[];
34 // quite a hack i know. Should be done with return values...
35 int number_of_newlines = 0;
38 void mathed_write(MathParInset * p, ostream & os, int * newlines,
39 bool fragile, string const & label)
41 number_of_newlines = 0;
42 short mathed_env = p->GetType();
44 if (mathed_env == LM_OT_MIN) {
45 if (fragile) os << "\\protect";
46 os << "\\( "; // changed from " \\( " (Albrecht Dress)
49 if (mathed_env == LM_OT_PAR){
53 << latex_mathenv[mathed_env]
55 if (is_multicolumn(mathed_env)) {
56 if (mathed_env != LM_OT_ALIGNAT
57 && mathed_env != LM_OT_ALIGNATN)
59 os << "{" << p->GetColumns()/2 << "}";
66 if (!label.empty() && label[0] > ' ' && is_singlely_numbered(mathed_env)) {
73 p->Write(os, fragile);
75 if (mathed_env == LM_OT_MIN){
76 if (fragile) os << "\\protect";
79 else if (mathed_env == LM_OT_PAR) {
85 << latex_mathenv[mathed_env]
87 number_of_newlines += 2;
89 *newlines = number_of_newlines;