DEV Community

emasp2001
emasp2001

Posted on

How to work with Sage locally

Although you can use Cocalc to create mathematical documents with LaTex this can be slow when working on big projects, for that reason you can do the following to use LaTex with SageMath from your local computer, and even working without internet. Follow the next steps:

Install LaTex

  • Download and install LaTex for you own system here.

Install SageMath

  • Download the SageMath here. I recommend to use the MIT, Cambridge, MA, USA version which has work perfect for me.
  • Install the program from the downloads folder.
  • If you are using MacOS do the following:
    • Move the uncompressed Sage folder into Applications/.
    • Start the Sage App, if you do not see it's in the following path: /Applications/SageMath/sage.
    • Run the command !sudo ln -sf $/Applications/SageMath/sage /usr/local/bin. You may be ask to write your password. This will allow Sage to be recognized as a terminal command which is very important in order to compile our work.
    • Quit Sage.

With that you are ready to go, keep in mind that each time you want to compile with pdflatex document.tex, instead of that you have to do the following in order for Sage to calculate your solutions:

pdflatex document.tex
sage document.sage
pdflatex document.tex
pdflatex document.tex
Enter fullscreen mode Exit fullscreen mode

Now you're ready to go and start creating documents with your favorite text editor or with the default installed with LaTex, a good recommendation could be use Visual Studio Code with the extension LaTeX Workshop.

Top comments (0)