Ask Your Question
0

Iterate on a LatexExpr

asked 2021-12-14 17:07:23 +0100

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 $x_{13}$) and I want to loop on a `LatexExp()' of the sort :

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

The result should be

$\text{blabla } p_1 = 10$

$\text{blabla } p_{20} = 10$

Hope my question is not too unclear

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-12-14 21:09:19 +0100

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")
edit flag offensive delete link more

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: 2021-12-14 17:07:23 +0100

Seen: 31 times

Last updated: Dec 14 '21