Using quotes inside sageplot environment in SageTeX

i like this post (click again to cancel)
0
i dont like this post (click again to cancel)

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 if you want to answer it in both places for more visibility.)

asked Apr 06 '12

kcrisman gravatar image kcrisman
6614 13 66 149

updated Apr 06 '12

And yes, I do get the deprecation warning in Sage itself. That is not the point; 'legend_label' has the same problem.

kcrisman (Apr 06 '12)
i like this answer (click again to cancel)
1
i dont like this answer (click again to cancel) kcrisman has selected this answer as correct

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:

\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 for a more complete answer. And yes, the code above could be cleaned up (simplified) as well.

link

posted Apr 06 '12

dazedANDconfused gravatar image dazedANDconfused
79 3 5

As 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 ;-)

kcrisman (Apr 10 '12)

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

Tags:

Stats:

Asked: Apr 06 '12

Seen: 76 times

Last updated: Apr 06 '12

powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.