]> www.ginac.de Git - ginac.git/blobdiff - ginac/add.cpp
* basic::collec() never worked correctly on non-polynomials till now.
[ginac.git] / ginac / add.cpp
index 802c23721d0c04beda4533527d6d819615eeb6b0..1b7b2719d3a57c63f104e9f684f62d1983c60f09 100644 (file)
@@ -166,8 +166,12 @@ void add::print(const print_context & c, unsigned level) const
 
        } else {
 
 
        } 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;
 
                numeric coeff;
                bool first = true;
@@ -204,14 +208,21 @@ void add::print(const print_context & c, unsigned level) const
                                        else
                                                coeff.print(c, precedence);
                                }
                                        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++;
                }
 
                        }
                        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 << ")";
+               }
        }
 }
 
        }
 }