]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_mathmlstream.C
small up/down tweaking
[lyx.git] / src / mathed / math_mathmlstream.C
index 1c7f74ed4c9adedf49a57269856c3017158385d2..085228745b0b2f9ad14d0983b5e2bb0a99126e79 100644 (file)
@@ -1,3 +1,7 @@
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
 #include <config.h>
 
 #include "math_mathmlstream.h"
 using std::ostream;
 using std::strlen;
 
+namespace {
+
+       bool isAlpha(char c)
+       {
+               return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
+       }
+
+}
 
 WriteStream::WriteStream(ostream & os, bool fragile, bool latex)
        : os_(os), fragile_(fragile), firstitem_(false), latex_(latex),
@@ -59,6 +71,11 @@ WriteStream & operator<<(WriteStream & ws, MathArray const & ar)
 
 WriteStream & operator<<(WriteStream & ws, char const * s)
 {
+       if (ws.pendingSpace() && strlen(s) > 0) {
+               if (isAlpha(s[0]))
+                       ws.os() << ' ';
+               ws.pendingSpace(false);
+       }
        ws.os() << s;
        ws.addlines(int(lyx::count(s, s + strlen(s), '\n')));
        return ws;
@@ -68,7 +85,7 @@ WriteStream & operator<<(WriteStream & ws, char const * s)
 WriteStream & operator<<(WriteStream & ws, char c)
 {
        if (ws.pendingSpace()) {
-               if (isalpha(c))
+               if (isAlpha(c))
                        ws.os() << ' ';
                ws.pendingSpace(false);
        }
@@ -156,7 +173,6 @@ void MathMLStream::cr()
 }
 
 
-
 //////////////////////////////////////////////////////////////////////
 
 
@@ -198,6 +214,44 @@ MapleStream & operator<<(MapleStream & ms, int i)
 //////////////////////////////////////////////////////////////////////
 
 
+MaximaStream & operator<<(MaximaStream & ms, MathAtom const & at)
+{
+       at->maximize(ms);
+       return ms;
+}
+
+
+MaximaStream & operator<<(MaximaStream & ms, MathArray const & ar)
+{
+       maximize(ar, ms);
+       return ms;
+}
+
+
+MaximaStream & operator<<(MaximaStream & ms, char const * s)
+{
+       ms.os() << s;
+       return ms;
+}
+
+
+MaximaStream & operator<<(MaximaStream & ms, char c)
+{
+       ms.os() << c;
+       return ms;
+}
+
+
+MaximaStream & operator<<(MaximaStream & ms, int i)
+{
+       ms.os() << i;
+       return ms;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+
 MathematicaStream & operator<<(MathematicaStream & ms, MathAtom const & at)
 {
        at->mathematicize(ms);
@@ -312,4 +366,3 @@ NormalStream & operator<<(NormalStream & ns, int i)
 
 
 //////////////////////////////////////////////////////////////////////
-