There's already a page on integrating Sage with the Kile IDE but I recently learned you can integrate Sage with a variety of IDEs. That is, there's a way to press one button, LaTeXmk, that will result compile your document, run the resulting .sage file through Sage, and then compile your document so that it includes the Sage output in it. The method works with TeXShop, TeXmaker, and TeXworks as well as Kile. Here are some more detailed instructions on getting things to work** in Linux**.

1. First, find the asymptote file of your local tex distribution. For example, maybe it's:

/usr/local/texlive/2012/texmf/tex/latex/asymptote

2. Open up the terminal and go to that directory by typing

cd /usr/local/texlive/2012/texmf/tex/latex/asymptote

3. That directory contains a file latexmkrc. We want to open that file for editing with a text editor installed on your system. You'll need to modify the file so you'll need administrator rights. If gedit is your text editor then in the terminal, type:

sudo gedit latexmkrc

4. Enter your password and then copy and paste the code from the 2nd link above

add_cus_dep('sage', 'sout', 0, 'makesout'); $hash_calc_ignore_pattern{'sage'} = '^( _st_.goboom|print .SageT)'; sub makesout { system("sage '$_[0].sage'"); }

at the bottom of the file.

5. Press save on the gedit text editor.

6. You're done! Open up a .tex document using sagetex with your IDE and choose to compile it with LaTeXmk. With TeXworks, you choose how to compile the document using the pulldown menu circled in red in the picture below. Note that compiling with LaTeXmk will take longer since that 1 push of the compile button has compiled your document twice and run Sage once.