Ask Your Question
0

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

asked 2018-10-01 09:59:43 +0200

ortollj gravatar image

updated 2018-10-01 14:35:04 +0200

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
3

answered 2018-10-01 15:09:01 +0200

eric_g gravatar image

updated 2018-10-01 15:09:42 +0200

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 15:46:45 +0200 )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

2 followers

Stats

Asked: 2018-10-01 09:59:43 +0200

Seen: 616 times

Last updated: Oct 01 '18