ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 01 Oct 2018 08:46:45 -0500show(LatexExpr(" \frac{x}{\cos(x)}")) need 2 \\http://ask.sagemath.org/question/43800/showlatexexpr-fracxcosx-need-2/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.Mon, 01 Oct 2018 02:59:43 -0500http://ask.sagemath.org/question/43800/showlatexexpr-fracxcosx-need-2/Answer by eric_g for <p>Hi</p>
<p>to be displayed ok , i need to double anti-slash
is it normal ? </p>
<pre><code>show(LatexExpr(" \\frac{x}{\cos(x)}"))
</code></pre>
<p>Sorry I forgot to precise !:
notebook jupyter , Sagemath 8.3 in W10 OS.</p>
http://ask.sagemath.org/question/43800/showlatexexpr-fracxcosx-need-2/?answer=43801#post-id-43801Yes, 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)}"))Mon, 01 Oct 2018 08:09:01 -0500http://ask.sagemath.org/question/43800/showlatexexpr-fracxcosx-need-2/?answer=43801#post-id-43801Comment by ortollj for <p>Yes, that's normal: the backslash character in a string is interpreted as an escape character for special commands; for instance <code>\f</code> in <code>\frac</code> 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 <code>r</code> (for "raw" string):</p>
<pre><code>show(LatexExpr(r"\frac{x}{\cos(x)}"))
</code></pre>
http://ask.sagemath.org/question/43800/showlatexexpr-fracxcosx-need-2/?comment=43803#post-id-43803thanks eric_gMon, 01 Oct 2018 08:46:45 -0500http://ask.sagemath.org/question/43800/showlatexexpr-fracxcosx-need-2/?comment=43803#post-id-43803