Can sagetex generate tex files?
I'm writing a latex document that will eventually need to be compiled on a machine that does not have sage on it. However, right now I'm using sagetex to write this document. I'm curious if it is somehow possible to generate a latex document with all of the \sage invocations replaced with the corresponding latex code.
Yes, I did it just to convince myself it's possible. It's extremely tedious and I would discourage it. It involved creating a string that will be the contents of the tex file. So in the
sagesilent
part of the tex document I'd have:f = open(r"Answers.tex",'w') f.write(r"\documentclass[a4paper,addpoints,12point]{exam}") f.write("\n") f.write(r"\usepackage{amsmath, amsfonts, amssymb}") f.write("\n") f.write(r"\usepackage{xcolor}")
and so on.