ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 10 Apr 2012 12:16:56 +0200Using quotes inside sageplot environment in SageTeXhttps://ask.sagemath.org/question/8864/using-quotes-inside-sageplot-environment-in-sagetex/Here's the question: how do I get the following to work in SageTeX? The quotes always lead to an error.
\sageplot{plot(cos(x),(x,0,pi),label='$\cos(x)$')}
Double quotes, escaping them, ... nothing seems to work. Thanks!
(See also [this tex.SX.com question](http://tex.stackexchange.com/questions/50998/using-quotes-inside-sageplot-environment-in-sagetex) if you want to answer it in both places for more visibility.)Fri, 06 Apr 2012 13:54:34 +0200https://ask.sagemath.org/question/8864/using-quotes-inside-sageplot-environment-in-sagetex/Comment by kcrisman for <p>Here's the question: how do I get the following to work in SageTeX? The quotes always lead to an error.</p>
<pre><code>\sageplot{plot(cos(x),(x,0,pi),label='$\cos(x)$')}
</code></pre>
<p>Double quotes, escaping them, ... nothing seems to work. Thanks!</p>
<p>(See also <a href="http://tex.stackexchange.com/questions/50998/using-quotes-inside-sageplot-environment-in-sagetex">this tex.SX.com question</a> if you want to answer it in both places for more visibility.)</p>
https://ask.sagemath.org/question/8864/using-quotes-inside-sageplot-environment-in-sagetex/?comment=19974#post-id-19974And yes, I do get the deprecation warning in Sage itself. That is not the point; `'legend_label'` has the same problem.Fri, 06 Apr 2012 13:58:19 +0200https://ask.sagemath.org/question/8864/using-quotes-inside-sageplot-environment-in-sagetex/?comment=19974#post-id-19974Answer by dazedANDconfused for <p>Here's the question: how do I get the following to work in SageTeX? The quotes always lead to an error.</p>
<pre><code>\sageplot{plot(cos(x),(x,0,pi),label='$\cos(x)$')}
</code></pre>
<p>Double quotes, escaping them, ... nothing seems to work. Thanks!</p>
<p>(See also <a href="http://tex.stackexchange.com/questions/50998/using-quotes-inside-sageplot-environment-in-sagetex">this tex.SX.com question</a> if you want to answer it in both places for more visibility.)</p>
https://ask.sagemath.org/question/8864/using-quotes-inside-sageplot-environment-in-sagetex/?answer=13432#post-id-13432I'll post just so people don't have to jump to Tex Stack Exchange. Here's a method that will give you some freedom on your text label:
\documentclass{article}
\usepackage{sagetex}
\begin{document}
\pagestyle{empty}
\begin{sagesilent}
G=Graphics()
H=Graphics()
var('x')
G+=plot(cos(x),(x,0,pi))
H+= text("$\cos(x)$", (3, 1), fontsize=16, color='black')
\end{sagesilent}
\[ \sageplot{G+H}\]
\end{document}
See the [Stack Exchange post](http://tex.stackexchange.com/questions/50998/using-quotes-inside-sageplot-environment-in-sagetex) for a more complete answer. And yes, the code above could be cleaned up (simplified) as well.Fri, 06 Apr 2012 14:44:19 +0200https://ask.sagemath.org/question/8864/using-quotes-inside-sageplot-environment-in-sagetex/?answer=13432#post-id-13432Comment by kcrisman for <p>I'll post just so people don't have to jump to Tex Stack Exchange. Here's a method that will give you some freedom on your text label:</p>
<pre><code>\documentclass{article}
\usepackage{sagetex}
\begin{document}
\pagestyle{empty}
\begin{sagesilent}
G=Graphics()
H=Graphics()
var('x')
G+=plot(cos(x),(x,0,pi))
H+= text("$\cos(x)$", (3, 1), fontsize=16, color='black')
\end{sagesilent}
\[ \sageplot{G+H}\]
\end{document}
</code></pre>
<p>See the <a href="http://tex.stackexchange.com/questions/50998/using-quotes-inside-sageplot-environment-in-sagetex">Stack Exchange post</a> for a more complete answer. And yes, the code above could be cleaned up (simplified) as well.</p>
https://ask.sagemath.org/question/8864/using-quotes-inside-sageplot-environment-in-sagetex/?comment=19961#post-id-19961As I pointed out on SX, this works, and you could probably just get rid of everything except the last two lines, where you'd just do `G = ...` etc. There must be something wrong with the sageplot parser, I'm going to email the SageTeX author about this. He owes me a few anyway ;-)Tue, 10 Apr 2012 12:16:56 +0200https://ask.sagemath.org/question/8864/using-quotes-inside-sageplot-environment-in-sagetex/?comment=19961#post-id-19961