X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;ds=sidebyside;f=ginac%2Fidx.cpp;h=578b2bf935da21b0f475a8d281df851739e6aba5;hb=ad7e72a894ece87cd67ee14ba4ed5fc16e59b140;hp=be1d9483cb2d93d3c10afa7faad3081fa6aa5a25;hpb=cfea748404dec5fb2f2e3310d36eeb6640f13824;p=ginac.git diff --git a/ginac/idx.cpp b/ginac/idx.cpp index be1d9483..578b2bf9 100644 --- a/ginac/idx.cpp +++ b/ginac/idx.cpp @@ -20,8 +20,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include -#include #include "idx.h" #include "symbol.h" @@ -156,7 +156,9 @@ void idx::print(const print_context & c, unsigned level) const } else { - if (!is_of_type(c, print_latex)) + if (is_a(c)) + c.s << "_{"; + else c.s << "."; bool need_parens = !(is_ex_exactly_of_type(value, numeric) || is_ex_of_type(value, symbol)); if (need_parens) @@ -164,6 +166,8 @@ void idx::print(const print_context & c, unsigned level) const value.print(c); if (need_parens) c.s << ")"; + if (is_a(c)) + c.s << "}"; } } @@ -180,8 +184,12 @@ void varidx::print(const print_context & c, unsigned level) const dim.print(c, level + delta_indent); } else { - - if (!is_of_type(c, print_latex)) { + if (is_a(c)) { + if (covariant) + c.s << "_{"; + else + c.s << "^{"; + } else { if (covariant) c.s << "."; else @@ -193,6 +201,8 @@ void varidx::print(const print_context & c, unsigned level) const value.print(c); if (need_parens) c.s << ")"; + if (is_a(c)) + c.s << "}"; } } @@ -212,7 +222,12 @@ void spinidx::print(const print_context & c, unsigned level) const } else { bool is_tex = is_of_type(c, print_latex); - if (!is_tex) { + if (is_tex) { + if (covariant) + c.s << "_{"; + else + c.s << "^{"; + } else { if (covariant) c.s << "."; else @@ -232,6 +247,8 @@ void spinidx::print(const print_context & c, unsigned level) const c.s << ")"; if (is_tex && dotted) c.s << "}"; + if (is_tex) + c.s << "}"; } }