Ask Your Question

implementing sagetex in latex

asked 2011-05-01 13:22:00 +0100

pechoc gravatar image

updated 2011-05-12 16:14:16 +0100

Kelvin Li gravatar image

For calling SAGE from within LATEX-file there must be following entry in line 1:

% !TEX TS-program = sage // (this creates undersome conditions I dont know a syntax error)


and \usepackage{sagetex}

But I get in one tex-file a syntax error in Line 1. Does anyone know a work around or how it really works?

Many thanks in advance for your hints. Gerald

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-05-01 21:13:07 +0100

benjaminfjones gravatar image

updated 2011-05-01 21:14:31 +0100

The line starting with % is required only for TeXShop. If you are using TeXShop as your editor, check and make sure that your installation is up to date. SageTeX functionality was included with TeXShop a while ago, but it's good to make sure you are up to date.

If you are using LaTeX from the command line or using some other editor, you should make sure that the SageTeX .spkg is installed in your Sage distribution (see the SageTeX documentation section 2 for this). Also, make sure the sagetex.sty file is either in your local directory with the TeX file you are typesetting or else make sure it has been copied to your local TeXMF directory (again, see the documentation for SageTeX).

edit flag offensive delete link more

answered 2013-10-14 08:55:31 +0100

Hoed gravatar image


I'm new to the forum, and basically, I know it's bad style to put a question into the answers line, but I don't want to open another thread, because my problem is somewhat linked to the thread here.

I'm new to Sage, so maybe that's just peanuts for most of you. However, I am using Sage under VM VirtualBox and LaTeX MiKTEx 2.9 under Win 7. Now, I want Sage and TeX to be good friends, and I followed all the steps in the installation guide of Sage.

Thing is: I have a versions mismatch of the sagetex.sty and files, that shouldn't be there. I updated the sagetex.sty to the version, I use under Sage for by:

  1. Giving MiKTeX a new root to look at
  2. deleting the old sagetex.sty and providing the new one
  3. deleting the whole sagetex package with MiKTeX, only providing a new root where to find the sagetex.sty
  4. copying the sagetex.sty into the directory I work in with my TeX-File

All I get is: Version mismatch. The version of your sagetex.sty is "none", the version of your is "2012/01/16 v2.3.3-69dc..." However, looking into sagetex.sty with any editor, I get:

"\ProvidesPackage{sagetex} [2012/01/16 v2.3.3-69dcb0eb93de embedding Sage into LaTeX documents] \newcommand{\ST@ver}{2012/01/16 v2.3.3-69dcb0eb93de}"

So, the versions of and sagetex.sty are the same.

What am I missing. I appreciate any help.

Regards, H.

edit flag offensive delete link more

Comments seems more relevant to your needs. I haven't used MikTeX, only Mac, so I can't be sure for you, but in nearly 100% of cases there really is a mismatch and the sty file you are looking at isn't really the one you need. It surprises me that #4 doesn't work. Anyway, you may really want to open a new question so that you attract more attention on this one.

kcrisman gravatar imagekcrisman ( 2013-10-14 11:42:24 +0100 )edit

A little off topic but if you're new to Sage, but you might be interested in [Sagemath Cloud]( Free account and none of the problems of getting Sage and Latex to work together. You'll need an internet connection, which isn't a big deal for most people.

dazedANDconfused gravatar imagedazedANDconfused ( 2013-10-14 22:04:10 +0100 )edit

Thanks both of you. The .sty file is adapted. Took a while. Problem changed, though. I posted it as another question. Thing is, Sage finds the example.sagetex.sage file, processes it, and then says, it can't find it (Errno 2, no such file). Regards.

Hoed gravatar imageHoed ( 2013-10-23 06:14:35 +0100 )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


Asked: 2011-05-01 13:22:00 +0100

Seen: 1,114 times

Last updated: Oct 14 '13