15 #include <QtCore/QStringList>
16 #include <QtCore/QRegExp>
25 text.replace(
"·",
"\\cdot");
31 text.replace(
">=",
"\\ge");
32 text.replace(
">",
">");
33 text.replace(
"<=",
"\\le");
34 text.replace(
"<",
"\\lt");
35 text.replace(
"≠",
"\\ne");
36 text.replace(
"and",
"\\wedge");
38 text.replace(
" or ",
"\\vee");
44 text.replace(
"log",
"\\log");
45 text.replace(
"ln",
"\\ln");
46 text.replace(
"∞",
"\\infty");
47 text.replace(
"π",
"\\pi");
48 text.replace(
"%",
"\\%");
56 text.replace(
"arcsinh",
"arsoh");
57 text.replace(
"arcsin",
"arcso");
58 text.replace(
"sinh",
"sooh");
60 if (text.length() == 3)
61 text.replace(
"sin",
"\\sin");
63 text.replace(
"sooh",
"sinh");
64 text.replace(
"sinh",
"\\sinh");
66 text.replace(
"arcso",
"arcsin");
67 text.replace(
"arcsin",
"\\arcsin");
69 text.replace(
"arsoh",
"arcsinh");
73 text.replace(
"arccosh",
"arcoh");
74 text.replace(
"arccos",
"arcce");
75 text.replace(
"cosh",
"cooh");
77 if (text.length() == 3)
78 text.replace(
"cos",
"\\cos");
80 text.replace(
"cooh",
"cosh");
81 text.replace(
"cosh",
"\\cosh");
83 text.replace(
"arcce",
"arccos");
84 text.replace(
"arccos",
"\\arccos");
86 text.replace(
"arcoh",
"arccosh");
90 text.replace(
"arctanh",
"artoh");
91 text.replace(
"arctan",
"arcto");
92 text.replace(
"tanh",
"tooh");
94 if (text.length() == 3)
95 text.replace(
"tan",
"\\tan");
97 text.replace(
"tooh",
"tanh");
98 text.replace(
"tanh",
"\\tanh");
100 text.replace(
"arcto",
"arctan");
101 text.replace(
"arctan",
"\\arctan");
103 text.replace(
"artoh",
"arctanh");
107 text.replace(
"arcsech",
"arsoh");
108 text.replace(
"arcsec",
"arcso");
109 text.replace(
"sech",
"sooh");
111 if (text.length() == 3)
112 text.replace(
"sec",
"\\sec");
114 text.replace(
"sooh",
"sech");
115 text.replace(
"arcso",
"arcsec");
116 text.replace(
"arsoh",
"arcsech");
120 text.replace(
"arccsch",
"arcoh");
121 text.replace(
"arccsc",
"arcce");
122 text.replace(
"csch",
"cooh");
124 if (text.length() == 3)
125 text.replace(
"csc",
"\\csc");
127 text.replace(
"cooh",
"csch");
128 text.replace(
"arcce",
"arccsc");
129 text.replace(
"arcoh",
"arccsch");
133 text.replace(
"arccoth",
"arctoh");
134 text.replace(
"arccot",
"arcto");
135 text.replace(
"coth",
"tooh");
137 if (text.length() == 3)
138 text.replace(
"cot",
"\\cot");
140 text.replace(
"tooh",
"coth");
141 text.replace(
"coth",
"\\coth");
143 text.replace(
"arcto",
"arccot");
144 text.replace(
"arctoh",
"arccoth");
155 if (text.contains(
"mtable"))
159 if (text.count(
"<mtable>") > 1)
161 text =
"The MathML contains <mtable> more than one. Needs more handling.";
173 QXmlSimpleReader xmlReader;
175 xmlReader.setContentHandler(&xmlParser);
177 QXmlInputSource xmlSource;
178 xmlSource.setData(text);
180 xmlReader.parse(xmlSource);
182 text = xmlParser.
getTeX();
190 if (text.contains(
"<mtr>"))
192 int posA = text.indexOf(
"<mtr>");
193 int posB = text.indexOf(
"</mtr>");
194 QString mtrText = text.mid(posA, posB - posA + 6);
196 sumCols = mtrText.count(
"<mtd");
200 QXmlSimpleReader xmlReader;
202 xmlReader.setContentHandler(&xmlParser);
204 QXmlInputSource xmlSource;
205 xmlSource.setData(text);
207 xmlReader.parse(xmlSource);
209 text = xmlParser.
getTeX();
static void replaceTrigoOperators(QString &text)
replace trigonometrical operators (eg. inf, log)
static void mNode(QString &text)
normal equation node
static void replaceOtherOperators(QString &text)
replace other operators (eg. .)
static void mtableNode(QString &text)
converting <mtable> ... </mtable>
static void convert(QString &text)
convert to TeX
static void replaceMathOperators(QString &text)
replace mathematical operators (eg. inf, log)
static void replaceLogicOperators(QString &text)
replace logic operators (eg. <=, <, >=, >, and, or)