]> www.ginac.de Git - ginac.git/blobdiff - ginac/add.cpp
* Still some std:: missing...
[ginac.git] / ginac / add.cpp
index cfcae9bc14640638a88531e149141a6ceec6aeb2..1b7b2719d3a57c63f104e9f684f62d1983c60f09 100644 (file)
@@ -166,15 +166,22 @@ void add::print(const print_context & c, unsigned level) const
 
        } else {
 
-               if (precedence <= level)
-                       c.s << "(";
+               if (precedence <= level) {
+                       if (is_of_type(c, print_latex))
+                               c.s << "{(";
+                       else
+                               c.s << "(";
+               }
 
                numeric coeff;
                bool first = true;
 
                // First print the overall numeric coefficient, if present
                if (!overall_coeff.is_zero()) {
-                       overall_coeff.print(c, precedence);
+                       if (!is_of_type(c, print_tree))
+                               overall_coeff.print(c, 0);
+                       else
+                               overall_coeff.print(c, precedence);
                        first = false;
                }
 
@@ -201,14 +208,21 @@ void add::print(const print_context & c, unsigned level) const
                                        else
                                                coeff.print(c, precedence);
                                }
-                               c.s << '*';
+                               if (is_of_type(c, print_latex))
+                                       c.s << ' ';
+                               else
+                                       c.s << '*';
                        }
                        it->rest.print(c, precedence);
                        it++;
                }
 
-               if (precedence <= level)
-                       c.s << ")";
+               if (precedence <= level) {
+                       if (is_of_type(c, print_latex))
+                               c.s << ")}";
+                       else
+                               c.s << ")";
+               }
        }
 }