# implementing sagetex in latex

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?

edit retag close merge delete

Sort by » oldest newest most voted

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).

more

Hi,

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 sagetex.py files, that shouldn't be there. I updated the sagetex.sty to the version, I use under Sage for sagetex.py 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 sagetex.py 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 sagetex.py and sagetex.sty are the same.

What am I missing. I appreciate any help.

Regards, H.

more

http://ask.sagemath.org/question/2118/sagetex-doesnt-work 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.

( 2013-10-14 11:42:24 +0200 )edit

A little off topic but if you're new to Sage, but you might be interested in [Sagemath Cloud](https://cloud.sagemath.com/). 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.

( 2013-10-14 22:04:10 +0200 )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.

( 2013-10-23 06:14:35 +0200 )edit