Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
0

Iterate on a LatexExpr

asked 3 years ago

CyrilleP gravatar image

This is certainly a question I have already asked, but I don't find any source.

I have a list of indexed variables up to 2 digits (for example x13) and I want to loop on a `LatexExp()' of the sort :

show(LatexExpr(r"\text{blabla } p_i = ", some stuff)

The result should be

blabla p1=10

blabla p20=10

Hope my question is not too unclear

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 3 years ago

cav_rt gravatar image

Why not put the variables in a list?

some_variables = [var(f'p_{k}{l}') for k in range(5) for l in range(4,8)]
for v in some_variables:
    show(LatexExpr(r"\text{blabla } "), v, "\t = \t", "some stuff")
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 3 years ago

Seen: 191 times

Last updated: Dec 14 '21