# Defining an indexed list of variable with Latex_name

The answer of this question Creating a vector of indexed variables asked two years ago, is deprecated for the Latex_name part which seems natural since from that time one must use either \\ or r'' in place of only \. I have tried many thing but none works.

Here is the incriminated command

x = var("x", n=8, latex_name='\overline{x}')
show(x)


PS Deprecation apart, doesn't work in Jupyter with Sagemath 9.2 but works in Sagecell.

edit retag close merge delete

Sort by » oldest newest most voted

This may work for you.

sage: x = [SR.var(f'x{i}', latex_name=fr'\overline{{x}}_{{{i}}}') for i in range(8)]

more