Hi,
Formatting indices as desired is important in Tensor Computer Algebra
and xAct is quite flexible in this respect. However, as Alessandro
says, the formatting has nothing to do with the (mathematical) type of
index. We always must know whether we are dealing with abstract
indices, or basis indices, or directional indices, or label indices,
etc, because the system reacts to them in different ways. But the
formatting is essentially free. xAct uses some default formattings
(like the colored basis indices), but this is just a default choice
and can be always changed. Let me explain this.
xAct works by declaring types of symbols. This is the job of the
DefTensor, DefCovD, DefBasis, ... commands. These commands have a
PrintAs option which allow you to tell the FrontEnd how the declared
symbol must be printed. (It is like a shortcut to Mathematica's
Format.). For indices the function is DefAbstractIndex, which declares
symbols as abstract indices. Users do not call this function directly,
and do it via DefManifold or DefVBundle. However it is possible to
choose how to format indices by setting the proper option in advance.
Imagine you want to add primes:
SetOptions[ DefAbstractIndex, PrintAs :> (StringJoint[ ToString[#],
"'"]&) ]
Then all indices you define later will have a primed formatting. As
has been already said, you can change the formatting of individual
indices (in general of individual symbols) by changing the upvalue of
the symbol for PrintAs:
PrintAs[ a ] ^= "a2"
Note that the right hand side must be a string.
All this is for symbols only. How can we format other (non-symbolic)
types of indices? We need to interact with the function IndexForm.
This function controls everything related to individual index
formatting. I use this frequently for example to color label indices.
It would take me too much to explain how it works in general. Anyway,
for those of you with enough Mathematica knowledge to change its
behaviour, it is much better to go to xTensor.m / xTensor.nb and read
the code. Be careful because if this function fails then the output
might be completely corrupted. Feel free to ask if you find problems
or don't know how to achieve a particular formatting.
Cheers,
Jose.