Ask Your Question
1

Use LaTeX symbols (like \prime) in variables

asked 2021-09-30 14:30:26 +0100

andrewyg gravatar image

So as we know declarations such as theta=var("theta") when output as LaTeX, they're automatically converted to corresponding LaTeX symbols ($\theta$ in this case), but it makes me wonder is it possible for us to use more complicated symbols? Like thetaprime=var("\\theta\\prime") (which obviously doesn't work, I've tried), but I would like to achieve something like this, so when I call latex(eq), all thetaprime variables are converted to $\theta\prime$.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-09-30 15:39:23 +0100

cav_rt gravatar image

Try

thetaprime = var("thetaprime", latex_name="\\theta^\\prime")
edit flag offensive delete link more

Comments

5

An alternative, avoiding the use of repeated backslashes, is to prefix the latex string with r, for "raw", so that each backslash is interpreted as an ordinary character to be passed to LaTeX:

thetaprime = var("thetaprime", latex_name=r"\theta\prime")
eric_g gravatar imageeric_g ( 2021-09-30 16:55:33 +0100 )edit

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-09-30 14:30:26 +0100

Seen: 76 times

Last updated: Sep 30