[OS X TeX] sagetex and TeXShop

Ralph Martin Ralph.Martin at cs.cardiff.ac.uk
Tue May 28 10:17:27 CEST 2013


On 26 May 2013, at 6:54:57PM, Sette Diop <settediop at gmail.com> wrote:

> Hello there!
> There seems to be something broken in the automation of sagetex in TeXShop in recent updates.
> Can someone out there help with this?
> 

I had to modify the sage.engine file so that it says the following, but note carefully you will need to edit the line 5 lines from the bottom to give the exact path of where sage is installed on YOUR system. It will need revising every time you upgrade sage, unfortunately.

---------------------------

#!/bin/bash

PATH=$PATH:/usr/texbin:/usr/local/bin
filename=$1
sagename=${filename/%tex/sagetex.sage}
soutname=${filename/%tex/sout}

pdflatex "$filename"

# do we need to run Sage?
if [ -f "$soutname" ]
then
    new_sum=$(egrep -v '^( _st_.goboom|print .SageT)' "$sagename" | md5)
    old_sum=$(egrep -o ^%[0-9a-f]{32}% "$soutname" | cut -b 2-33)
    if [ "$new_sum" != "$old_sum" ]
    then
        run_sage=yes
    fi
else
    # no .sout file, so run Sage
    run_sage=yes
fi

if [ "$run_sage" = "yes" ]
then
    echo Running Sage, please wait a moment...
    /Applications/MathSystems/Sage-5.9-OSX-64bit-10.8.app/Contents/Resources/sage/sage "$sagename"
    pdflatex "$filename"
else
    echo No Sage commands have changed, so running Sage is unnecessary.
fi


-------------------------------

Best wishes

Ralph
--
Prof. Ralph Martin                     Phone: +44(0)29 2087 5536
Computer Science & Informatics         Fax:   +44(0)29 2087 4598
Cardiff University               Email: mailto:ralph at cs.cf.ac.uk
5 The Parade, Roath              WWW:  http://ralph.cs.cf.ac.uk/
Cardiff, CF24 3AA, UK         VOIP: sip:ralphmartin at sip2sip.info




More information about the macostex-archives mailing list