One approach would be to store all the variables in a nested
dictionary, eg n[1, 2][2, 2], and use var('n_1_2_2_2',
latex_name='n_{(1,2),(2,2)}') to create the variables.
Here's an example:
nn = dict( [ ((i, j), {}) for i in [1..2] for j in [1..2] ] )
nn[(1, 1)] = dict( [ ((i, j),
var('v_1_1_%d_%d' % (i, j),
latex_name='n_{(1,1),(%d,%d)}' % (i, j)) )
for i in [1..2] for j in [1..2] ] )
show(4*nn[1, 1][2, 1] + nn[1, 1][2, 2]^2)
Which nicely shows the vector subscripts in latex.
- Alex