First time here? Check out the FAQ!

Ask Your Question
0

show(LatexExpr(" \frac{x}{\cos(x)}")) need 2 \\

asked 6 years ago

ortollj gravatar image

updated 6 years ago

Hi

to be displayed ok , i need to double anti-slash is it normal ?

show(LatexExpr(" \\frac{x}{\cos(x)}"))

Sorry I forgot to precise !: notebook jupyter , Sagemath 8.3 in W10 OS.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
3

answered 6 years ago

eric_g gravatar image

updated 6 years ago

Yes, that's normal: the backslash character in a string is interpreted as an escape character for special commands; for instance \f in \frac stands for an ASCII formfeed. To avoid this and restore the standard LaTeX interpretation one has to type a double backslash, as you did. An alternative is to prefix the string with r (for "raw" string):

show(LatexExpr(r"\frac{x}{\cos(x)}"))
Preview: (hide)
link

Comments

thanks eric_g

ortollj gravatar imageortollj ( 6 years ago )

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 6 years ago

Seen: 985 times

Last updated: Oct 01 '18