Je bent je ingevulde velden bij deze pagina aan het verwijderen. Ben je zeker dat je dit wilt doen?
You are erasing your filled-in fields on this page. Are you sure that is what you want?
Nieuwe Versie BeschikbaarNew Version Available
Er is een update van deze pagina. Als je update naar de meest recente versie, verlies je mogelijk je huidige antwoorden voor deze pagina. Hoe wil je verdergaan ?
There is an updated version of this page. If you update to the most recent version, then your current progress on this page will be erased. Regardless, your record of completion will remain. How would you like to proceed?
We discuss aspects of Sage we use, and provide some core sage functions we
use.
What is Sage?
Sage - officially “sagemath” now - is an offshoot of python - it is basically python for
mathematics. This means that, if you are at all familiar with python, writing sage is
basically the same - with some additional commands for math specific operations and
context.
In order to use sage locally you would want to download it (see above) and then
install the sagetex LaTeX package, which links the two systems together. This is
relatively straight forward - the sage installation comes with the relevant LaTeX
package automatically, so it’s largely a process of copy/pasting the .sty file to the
right location and making it available to your LaTeX installation. There are detailed
instructions here.
0.3 How to Compile LaTeX with Sage
Once you have LaTeX and Sage installed locally, you’ll want to setup your
LaTeX editor to compile using sage as well. If your LaTeX file is named
something like “foo.tex” then you’ll want to run the following commands to
compile:
Depending on your LaTeX editor, there is usually a way to automate this as a
command, but that is specific to your editor of choice.
1 Using Sage Non-Locally
If you don’t want to use sage locally, you can’t get sagetex working in any of
the typical online editor (for example, overleaf does not support sagetex).
Nonetheless you can still write the sage code and the LaTeX code and largely test
them independently - since sagetex really does run sage on a generated file
that is, more or less, equivalent to the sage content you included in your
file.
1.1 Testing Sage Code
You can test sage code in any public sage compiler - usually referred to
as “sage cells”. For example, you can use the official sage cell server and
copy/paste your code in with a little debug code to see if it compiles and what it
yields.
2 If you want to publish/edit locally
If you are publishing/editing content locally, you almost certainly want to have sage
installed locally so you can properly and fully debug the sage code before
trying to publish it. That being said, technically you don’t need to be able
to compile the sage code locally in order to publish sage code online via
Ximera, since the sage is handled in another way - although it might be
difficult to get the various sage LaTeX commands to compile during the “bake”
process.