.format in Python Latex String Error nested curly brakets

Viewed 30

I get a very similar problem to this question except it does not solve my problem or I dont understand the solution?

r"($\sqrt{{0}}$)".format(unit)

gives me '($\\sqrt{0}$)' and r"($\sqrt{ {0} }$)".format(unit), r"($\sqrt{in, {0} }$)".format(unit) throws me this error:

ValueError: unexpected '{' in field name

How to insert the unit into the latex string?

0 Answers
Related