I was trying to use the Sagetex code below. However when I generate the graph inside latex, I'd like to avoid the code being printed out before the graph. How could I go about doing that?

f = open("DATA", "r").readlines()
f = [i.strip() for i in f]
f = map(int, f)
g = [i+1 for i in f]
aes = f
rsa = f
vals = [1,2,3,4,5,6,7,8,9,10,11]
p = list_plot(zip(vals, aes), color='red', plotjoined=True) + list_plot(zip(vals, rsa), plotjoined=True)
  • 3
    As Samuel indicates in his answer, sagesilent will do it. I'd just add there are 4 environments depending on whether you want the material typeset or in your .sage file and you can find them on page 9 of the documentation at CTAN. – DJP Jun 11 '15 at 18:44
  • The version of sagetex on CTAN is horribly outdated and should never be used. Always use the documentation included with Sage. That said, sagesilent is exactly the correct environment to use. – Dan Drake Aug 24 '15 at 3:07

You can use the sagesilent environment instead of the sageblock environment for those parts you don't want printed in the document.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy