fixed LaTeX output of indexed objects
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Tue, 5 Mar 2002 20:32:16 +0000 (20:32 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Tue, 5 Mar 2002 20:32:16 +0000 (20:32 +0000)
ginac/idx.cpp
ginac/indexed.cpp

index 160bc37..a3767fe 100644 (file)
@@ -157,7 +157,7 @@ void idx::print(const print_context & c, unsigned level) const
        } else {
 
                if (is_a<print_latex>(c))
-                       c.s << "_{";
+                       c.s << "{";
                else
                        c.s << ".";
                bool need_parens = !(is_ex_exactly_of_type(value, numeric) || is_ex_of_type(value, symbol));
@@ -184,12 +184,9 @@ void varidx::print(const print_context & c, unsigned level) const
                dim.print(c, level + delta_indent);
 
        } else {
-               if (is_a<print_latex>(c)) {
-                       if (covariant)
-                               c.s << "_{";
-                       else
-                               c.s << "^{";
-               } else {
+               if (is_a<print_latex>(c))
+                       c.s << "{";
+               else {
                        if (covariant)
                                c.s << ".";
                        else
index 6c2683c..765a07c 100644 (file)
@@ -328,9 +328,10 @@ void indexed::printindices(const print_context & c, unsigned level) const
 
                        while (it != itend) {
                                bool cur_covariant = (is_ex_of_type(*it, varidx) ? ex_to<varidx>(*it).is_covariant() : true);
-                               if (first || cur_covariant != covariant) {
+                               if (first || cur_covariant != covariant) { // Variance changed
+                                       // The empty {} prevents indices from ending up on top of each other
                                        if (!first)
-                                               c.s << "}";
+                                               c.s << "}{}";
                                        covariant = cur_covariant;
                                        if (covariant)
                                                c.s << "_{";