Ask Your Question
0

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

asked 2018-10-01 02:59:43 -0500

ortollj gravatar image

updated 2018-10-01 07:35:04 -0500

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2018-10-01 08:09:01 -0500

eric_g gravatar image

updated 2018-10-01 08:09:42 -0500

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

Comments

thanks eric_g

ortollj gravatar imageortollj ( 2018-10-01 08:46:45 -0500 )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: 2018-10-01 02:59:43 -0500

Seen: 40 times

Last updated: Oct 01