I recently installed SageMath on my linux and tried SageTex on Texmaker as follows:
run pdflatex on Texmaker, run load("example.sagetex.sage") from the build folder with Sage,
and run pdflatex on Texmaker again.
The only catch is that I have to move the sage-plot-for-example.tex folder (generated plot figures by Sage) in the same directory/folder of the example.tex file. Otherwise, error occurs.
This would not be needed if the option for use a build subdirectory for output files is not checked in the Texmaker configuration. But I like the subdirectory as I feel the files are more neatly arranged. For similar problems with Bib(la)tex and Makeindex, this can be resolved by replacing the directory options bibtex %.aux with bibtex build\%.aux and makeindex %.idx with makeindex build\%.idx in the Texmaker configuration under 'Commands'.
I was wondering if there is a way to configure this in texmaker?
Any help or suggestion? Thanks!
Edits Sagetex works just fine with use a build subdirectory for output files option if the sage codes have nothing to do with figures.
load()? – Dima Pasechnik Jul 21 '20 at 02:36sage example.sagetex.sagereturns the error ---File "
example.sagetex.sage- and the full error message, if possible? – Dima Pasechnik Jul 22 '20 at 06:21This file (example.sagetex.sage) was autogenerated from example.tex with sagetex.sty version 2019/11/14 v3.4.
import sagetex st = sagetex.SageTeXProcessor('example', version='2019/11/14 v3.4', version_check=True) try: st.current_tex_line = 35 st.inline(0, latex(2+2)) except: st.goboom(35)`
– mark haokip Jul 22 '20 at 15:43sage: sage example.sagetex.sage File "<ipython-input-1-555918340150>", line 1 sage example.sagetex.sage ^ SyntaxError: invalid syntax– mark haokip Jul 22 '20 at 15:44(I don't know anything about texmaker, sorry - feel free to tell the details)
– Dima Pasechnik Jul 26 '20 at 11:05By the way, is your Sage Python 2 or Python 3? (cf. the 2nd line of the Sage banner)
– Dima Pasechnik Jul 26 '20 at 11:12sage:is the prompt. The text to type isimport sagetexsagetex.pyversion'2019/11/14 v3.4'– mark haokip Jul 26 '20 at 12:04example.tex, could you rungrep "Package: sagetex" example.logand post the output (this should tell the TeX files version) – Dima Pasechnik Jul 26 '20 at 12:28sageonexample.sagetex.sage. The shell command to run issage example.sagetex.sage.(Trying this at
– Dima Pasechnik Jul 26 '20 at 12:31sage:ptompt will produce the error you showed above - apologies for mis-reading - I was a.f.k. then)shell prompt, a.k.a.bash prompt– Dima Pasechnik Jul 26 '20 at 12:33grep "Package: sagetex" example.logreturnsPackage: sagetex 2019/11/14 v3.4 embedding Sage into LaTeX documents– mark haokip Jul 26 '20 at 12:41example.logis as follows:This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2020.7.17) 21 JUL 2020 23:50 entering extended mode restricted \write18 enabled. %&-line parsing enabled. **example.tex (./example.tex LaTeX2e <2020-02-02> patch level 2 L3 programming layer <2020-02-14>– mark haokip Jul 26 '20 at 12:43sage example.sagetex.sage– Dima Pasechnik Jul 26 '20 at 13:55sage example.sagetex.sageon sage, which was the reason for the problem, perhaps onsageit should beexample.sagetex.sage. @DimaPasechnik Thanks! But I am still stuck with having to move the sage output folder (for sage generated figures) in the same directory with myexample.texfile. – mark haokip Jul 26 '20 at 14:55use a build subdirectory for output filesin texmaker option keeps the output files neat which i liked. without this option, everything works just fine. my problem istexmakerspecific but thanks to you, some of my auxiliary problems have been resolved @DimaPasechnik. Ps I am new tolinuxas well assagemath– mark haokip Jul 26 '20 at 19:05