how can I speed up latexmk (sagetex) on a Mac?

asked 2016-08-07 05:18:23 +0100

crucalculus gravatar image

I'm running latexmk on a Mac with sage 7.2 installed.

I'm confused about why the compilation process with tex files that use sagetex seem to take either 15-20 seconds or less than a second. I understand that there may be previously-generated files (plots, etc), but I have controlled for that by removing those files before each compilation.

Is there any way I can get consistent (and hopefully fast) compile times for my sagetex documents?

edit retag flag offensive close merge delete


I think in this case we would really need to see a minimal example that is "too long". I will say that from my experience using SageTeX, if Sage needs to start fresh, it takes quite a while, and then following ones much less time (which is true of anything you do with Sage). Can you give more details about your exact workflow? (E.g., do you use the Sage engine in TeXShop - I guess not, if you use a different maker?)

kcrisman gravatar imagekcrisman ( 2016-08-08 17:40:20 +0100 )edit

My workflow comes in two cases:

FIRST: I use Sublime text editor on my Mac to write LaTeX code with embedded sage (\sage, \sagesilent, \sageplot, etc.) The build system in Sublime allows me to run the following latexmk command: "command": ["latexmk", "-cd", "-e", "$pdflatex = '%E -shell-escape -interaction=nonstopmode -synctex=1 %S %O'", "-f", "-pdf"]

I also have a latexmkrc file with this: add_cus_dep('sage', 'sout', 0, 'makesout'); $hash_calc_ignore_pattern{'sage'} = '^( _st_.goboom|print .SageT)'; sub makesout { system("/Applications/sage_72/sage '$_[0].sage'"); }

SECOND: I have a Mongo database with many individual latex snippets that are sorted by keyword. I have a python script that pulls each of these snippets out, builds a small tex file, then runs latexmk.

crucalculus gravatar imagecrucalculus ( 2016-08-10 15:12:36 +0100 )edit

I apologize for the reference to "too long"

In reality, it really isn't that big of a deal. I'm just a little confused about why sage can take such varied amounts of time to do essentially the same task. I've done some research, but can't figure out exactly what's happening.

crucalculus gravatar imagecrucalculus ( 2016-08-10 15:14:09 +0100 )edit

Hmm, that workflow is not part of my experience, so I don't know if that would have something to do with it. My only comment is my first one (if you haven't used Sage in a bit then it takes longer to load up) and that usually, in a tex-sage-tex flow the second tex call takes much less time - but consistently, presumably because some aux file is happy?

kcrisman gravatar imagekcrisman ( 2016-08-10 17:16:42 +0100 )edit