Posted in Linux, Mathematics, Physics, Science, tagged Alias, C++, Calculation, chrome, chromium, Compilation, Compile, Computers, Configuration, Edit, Editor, Emacs, Free, Functions, Gedit, Graphics, How to, HowTo, Install, IRC, Karmic, Koala, LaTeX, Line, Linux, Maple, Mathematica, Mathematics, Matlab, Mktexlsr, Packages, Plot, Plotting, Programming, Pyhton, Sage, Sagemath, Symbolic, Terminal, Texhash, Tips and Tricks, Ubuntu on February 4, 2010|
6 Comments »
A few minuted ago I could install and use the sagetex package for Sage(math). I’d like to thank ElMonkey for helping me via the IRC channel #sage-devel.
It is assumed that you have installed
- A LaTeX compiler,
- A LaTeX editor,
- and Sage(math)
all of them configured and working properly.
Downloading the Package.
Get the last version of the package in http://www.sagemath.org/packages/optional/.
Installing the Package.
My Sage script is located in a sub/sub/sub/subfolder/Sage-4.3.1 (from my HOME folder), so when I want to running it, I should type
It isn’t nice to repeat this one and again, every day.
Thus, I created an alias.
Open the .bashrc file in your editor (gedit for example)
$ gedit .bashrc
add (at the end of the file) the line
which in my example would be,
Save and close the editor. Now in the terminal,
$ source .bashrc
and from now on I just type
for running the program.
The real installation.
Now, type in the terminal
$ sage -i sagetex-2.2.1.spkg
and that’s it.
After the installation, a new folder is placed into the Sage folder. Look into local/share/texmf. All files (and folders) inside it must be copied to the LaTeX tree.
In a Linux distribution the LaTeX tree should be placed in /usr/share/texmf/tex/latex
$ sudo cp -r /path/to/Sage-4.3.1/local/share/texmf \
$ sudo mktexlsr /usr/share/texmf/tex/latex
This should work. However, if it doesn’t… the desperate method is to copy the sagetex.sty from /path/to/Sage-4.3.1/local/share/texmf to the folder of the TEX file.
The TeX File.
It is time to create a file.tex, just as any other TEX file. Add the line
to the preable.
Compiling the TeX file.
When you run
$ pdflatex file.tex
the compilator exits with errors… but you get a file.sage, sage-compile it and run pdflatex again,
$ sage file.sage
$ pdflatex file.tex
There it is!!!
A resume compilation line could be
$ pdflatex file.tex && sage file.sage && pdflatex file.tex
Read Full Post »