]> www.ginac.de Git - ginac.git/blobdiff - ginac/utils.h
- symbols can have a LaTeX name, e.g. symbol s("s", "\\sigma");
[ginac.git] / ginac / utils.h
index 6e1d3ae8a55caa31987db800a2da7180fe712bba..79719feb9e2131ae166f05ce810f38253b657c2d 100644 (file)
@@ -292,10 +292,25 @@ int classname::compare_same_type(const basic & other) const \
 }
 
 #define DEFAULT_PRINT(classname, text) \
-void classname::print(std::ostream & os, unsigned upper_precedence) const \
+void classname::print(const print_context & c, unsigned level) const \
 { \
        debugmsg(#classname " print", LOGLEVEL_PRINT); \
-       os << text; \
+       if (is_of_type(c, print_tree)) \
+               inherited::print(c, level); \
+       else \
+               c.s << text; \
+}
+
+#define DEFAULT_PRINT_LATEX(classname, text, latex) \
+void classname::print(const print_context & c, unsigned level) const \
+{ \
+       debugmsg(#classname " print", LOGLEVEL_PRINT); \
+       if (is_of_type(c, print_tree)) \
+               inherited::print(c, level); \
+       else if (is_of_type(c, print_latex)) \
+               c.s << latex; \
+       else \
+               c.s << text; \
 }
 
 } // namespace GiNaC