Make a custom IndexedBase which instructs the Latex printer to place the 2nd index in the superscript:
from scipy import Indexed, IndexedBase
class CustomIndexed(Indexed):
def _latex(self, printer):
return '%s_{%s}^{(%s)}' % (
self.base, *self.indices
)
class CustomIndexedBase(IndexedBase):
def __getitem__(self, indices, **kwargs):
return CustomIndexed(self.name,
*indices)
c = CustomIndexedBase('c')
c[i,j]
Output:
(Sorry for the messed up output, I don't know how to embed latex in the answer so I just screenshot it :D).