Ask Your Question
1

Problems with sagetex

asked 2020-06-13 17:27:22 +0100

Moondoggy gravatar image

updated 2021-04-04 09:44:29 +0100

slelievre gravatar image

Texmaker does not give me the required PDF file although in Sage it is written:

Sage processing complete. Run LaTeX on st_example.tex again.
  1. I took the example at https://doc.sagemath.org/html/en/tuto..., pasted this code into Texmaker and saved it under the file name st_example.tex. At this link http://www.cecm.sfu.ca/sage/spkg/upst... I chose sagetex-3.3.tar.gz. I put st_example.tex into the file sagetex3.3. There I compiled it using pdflatex. After this a new file appeared, st_example.sagetex.

  2. I uploaded st_example.sagetex on CoCalc. Then another code appeared, I clicked on Terminal wherein I wrote sage st_example.sagetex.sage. After this there was written:

    Sage processing complete. Run LaTeX on st_example.tex again.
    

    Especially new files appeared e.g st_example.sagetex.sout.

  3. After again compiling st_example.tex in LaTeX with pdflatex there were still these question marks and nothing changed.

This is the source file:

\documentclass{article}
\usepackage{sagetex}
\begin{document}

Using Sage\TeX, one can use Sage to compute things and put them into
your \LaTeX{} document. For example, there are
$\sage{number_of_partitions(1269)}$ integer partitions of $1269$.
You don't need to compute the number yourself, or even cut and paste
it from somewhere.

Here's some Sage code:

\begin{sageblock}
  f(x) = exp(x) * sin(2*x)
\end{sageblock}

The second derivative of $f$ is

\[
  \frac{\mathrm{d}^{2}}{\mathrm{d}x^{2}} \sage{f(x)} =
     \sage{diff(f, x, 2)(x)}.
\]

Here's a plot of $f$ from $-1$ to $1$:

\sageplot{plot(f, -1, 1)}

\end{document}

This is the log file:

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7250 64-bit) (preloaded format=pdflatex 2020.1.11)  14 JUN 2020 17:36
entering extended mode
**./st_example.tex
(st_example.tex
LaTeX2e <2019-10-01> patch level 3
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\article.cls"
Document Class: article 2019/10/25 v1.4k Standard LaTeX document class
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\size10.clo"
File: size10.clo 2019/10/25 v1.4k Standard LaTeX file (size option)
)
\c@part=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
) (sagetex.sty
Package: sagetex 2019/01/09 v3.3 embedding Sage into LaTeX documents

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/tools\verbatim.sty
"
Package: verbatim 2019/11/10 v1.5r LaTeX2e package for verbatim enhancements
\every@verbatim=\toks14
\verbatim@line=\toks15
\verbatim@in@stream=\read1
)
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/fancyvrb\fancyvrb.
sty"
Package: fancyvrb 2020/01/13 v3.5 verbatim text (tvz,hv)

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\keyval.st
y"
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks16
)
\FV@CodeLineNo=\count88
\FV@InFile=\read2
\FV@TabBox=\box27
\c@FancyVerbLine=\count89
\FV@StepNumber=\count90
\FV@OutFile=\write3
)
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/listings\listings.
sty"
\lst@mode=\count91
\lst@gtempboxa=\box28
\lst@token=\toks17
\lst@length=\count92
\lst@currlwidth=\dimen103
\lst@column=\count93
\lst@pos=\count94
\lst@lostspace=\dimen104
\lst@width=\dimen105
\lst@newlines=\count95
\lst@lineno=\count96
\lst@maxwidth=\dimen106

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/listings\lstmisc.s
ty"
File: lstmisc.sty 2020/03/24 1.8d (Carsten Heinz)
\c@lstnumber=\count97
\lst@skipnumbers=\count98
\lst@framebox=\box29
)
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/listings\listings.
cfg"
File: listings.cfg 2020/03/24 1.8d listings configuration
))
Package: listings 2020/03/24 1.8d (Carsten Heinz)

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\color.sty
"
Package: color 2016/07/10 v1.1e Standard LaTeX Color (DPC)

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics-cfg\color
.cfg"
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package color Info: Driver file: pdftex.def on input line 147.

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics-def\pdfte
x.def"
File: pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
))
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\graphicx.
sty"
Package: graphicx 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\graphics.
sty"
Package: graphics 2019/11/01 v1.3d Standard LaTeX Graphics (DPC,SPQR)

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\trig.sty"
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics-cfg\graph
ics.cfg"
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 105.
)
\Gin@req@height=\dimen107
\Gin@req@width=\dimen108
)
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/makecmds\makecmds.
sty"
Package: makecmds 2009/09/03 v1.0a extra command making commands
)
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/generic/iftex\ifpdf.sty"
Package: ifpdf 2019/10/25 v3.4 ifpdf legacy package. Use iftex instead.
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/generic/iftex\iftex.sty"
Package: iftex 2019/11/07 v1.0c TeX engine tests
)) ("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\ifthen.sty
"
Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
)
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/generic/iftex\ifxetex.st
y"
Package: ifxetex 2019/10/25 v0.7 ifxetex legacy package. Use iftex instead.
)
\c@ST@inline=\count99
\c@ST@plot=\count100
\c@ST@cmdline=\count101
\sagetexindent=\skip43

No file st_example.sagetex.sout.
\sagecommandlineskip=\skip44
) (st_example.aux)
\openout1 = `st_example.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
\c@lstlisting=\count102

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/context/base/mkii\supp-p
df.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count103
\scratchdimen=\dimen109
\scratchbox=\box30
\nofMPsegments=\count104
\nofMParguments=\count105
\everyMPshowfont=\toks18
\MPscratchCnt=\count106
\MPscratchDim=\dimen110
\MPnumerator=\count107
\makeMPintoPDFobject=\count108
\everyMPtoPDFconversion=\toks19
)
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/epstopdf-pkg\epsto
pdf-base.sty"
Package: epstopdf-base 2019/11/24 v2.7 Base part for package epstopdf

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/generic/oberdiek\infware
rr.sty"
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO)
)
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/oberdiek\grfext.st
y"
Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO)

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/generic/oberdiek\kvdefin
ekeys.sty"
Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO)

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/generic/oberdiek\ltxcmds
.sty"
Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
)))
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/oberdiek\kvoptions
.sty"
Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO)

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/generic/oberdiek\kvsetke
ys.sty"
Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO)

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/generic/oberdiek\etexcmd
s.sty"
Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)

("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/generic/iftex\ifluatex.s
ty"
Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.
))))
("C:\Users\tdami\AppData\Local\Programs\MiKTeX 2.9\tex/latex/pdftexcmds\pdftexc
mds.sty"
Package: pdftexcmds 2019/11/24 v0.31 Utility functions of pdfTeX for LuaTeX (HO
)
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
)
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
42.
Package grfext Info: Graphics extension search list:
(grfext)             [.pdf,.png,.jpg,.mps,.jpeg,.jbig2,.jb2,.PDF,.PNG,.JPG,.JPE
G,.JBIG2,.JB2,.eps]
(grfext)             \AppendGraphicsExtensions on input line 460.
)
\ST@sf=\write4
\openout4 = `st_example.sagetex.sage'.

LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <7> on input line 7.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <5> on input line 7.

LaTeX Warning: Reference `@sageinline0' on page 1 undefined on input line 8.

LaTeX Warning: Reference `@sageinline1' on page 1 undefined on input line 21.

LaTeX Warning: Reference `@sageinline2' on page 1 undefined on input line 22.

Package sagetex Warning: Graphics file sage-plots-for-st_example.tex/plot-0.pdf
 on page 1 does not exist. Plot command is on input line 27.

*********************************************************************

Package sagetex Warning: there were undefined Sage formulas and/or plots.
Run Sage on st_example.sagetex.sage, and then run LaTeX on st_example.tex again
.

*********************************************************************

[1

{C:/Users/tdami/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]
(st_example.aux)

LaTeX Warning: There were undefined references.

 ) 
Here is how much of TeX's memory you used:
 3452 strings out of 492484
 51317 string characters out of 3121601
 119239 words of memory out of 3000000
 7772 multiletter control sequences out of 15000+200000
 4116 words of font info for 16 fonts, out of 3000000 for 9000
 1141 hyphenation exceptions out of 8191
 51i,5n,40p,302b,217s stack positions out of 5000i,500n,10000p,200000b,50000s
<C:/Users/tdami/AppData/Local/Programs/MiKTeX 2.9/fonts/type1/public/amsfonts
/cm/cmbx10.pfb><C:/Users/tdami/AppData/Local/Programs/MiKTeX 2.9/fonts/type1/pu
blic/amsfonts/cm/cmmi10.pfb><C:/Users/tdami/AppData/Local/Programs/MiKTeX 2.9/f
onts/type1/public/amsfonts/cm/cmr10.pfb><C:/Users/tdami/AppData/Local/Programs/
MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr7.pfb><C:/Users/tdami/AppData/Loca
l/Programs/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmsy10.pfb><C:/Users/tdami
/AppData/Local/Programs/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmtt10.pfb>
Output written on st_example.pdf (1 page, 63456 bytes).
PDF statistics:
 30 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)
edit retag flag offensive close merge delete

Comments

I don't know texmaker.

Did you try to run pdflatex by hand ?

Can you describe precisely and in detail :

  • what you did

  • what was the expected tresult

  • what was the effective result ?

Can you post st_example.tex ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2020-06-14 00:49:05 +0100 )edit

You aren't giving enough information for anyone to help. If you've processed the document properly and you aren't getting a pdf/dvi file then there is an error. This should show up in your .log file. The easiest way to get comfortable with sagetex is using a free Cocalc account. Pressing one button will take care of all the steps for you.

dazedANDconfused gravatar imagedazedANDconfused ( 2020-06-14 02:00:36 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-06-14 14:56:46 +0100

dazedANDconfused gravatar image

updated 2020-06-14 14:57:38 +0100

Go to Cocalc and create a new latex file. In it, copy/paste the following code that you seem to be using from here:

\documentclass{article}
\usepackage{sagetex}
\begin{document}
Using Sage\TeX, one can use Sage to compute things and put them into
your \LaTeX{} document. For example, there are
$\sage{number_of_partitions(1269)}$ integer partitions of $1269$.
You don't need to compute the number yourself, or even cut and paste
it from somewhere.

Here's some Sage code:

\begin{sageblock}
    f(x) = exp(x) * sin(2*x)
\end{sageblock}

The second derivative of $f$ is

\[
  \frac{\mathrm{d}^{2}}{\mathrm{d}x^{2}} \sage{f(x)} =
  \sage{diff(f, x, 2)(x)}.
\]

Here's a plot of $f$ from $-1$ to $1$:

\sageplot{plot(f, -1, 1)}
\end{document}

Save the document and press the Build button. This will run latex on the document, then Sage, then latex so you will have to wait a few seconds. At the end the document comes out but some places have ?? in them where Sage output should go. This shouldn't happen. I have reported the issue to Cocalc. Now change \sageplot{plot(f, -1, 1)} to \sageplot[width=3in]{plot(f, -1, 1)}. Save and Build. You should now get the result and there are no ?? to be found. However, your plot is much to big. This is the result that we should have gotten the first time we pressed Build and got ??. Now change \sageplot[width=3in]{plot(f, -1, 1)} to \sageplot{plot(f, -1, 1)}. Save and Build. The document should now look okay. The plot is smaller. This is the output we should have gotten from our previous Build. Hopefully Cocalc will fix the issue quickly.

With respect to running sagetex without using Cocalc, it's not clear to me what you're doing. First, sagetex should be part of your Latex distribution so I don't think you need to download sagetex-3.3.tar.gz. When you process using latex use TexMaker make sure it's running pdflatex rather than latex. The instructions here will explain how to proceed. You should end up with a .pdf file. If you don't check the .log file for an error as to what went wrong.

edit flag offensive delete link more

Comments

the log file says: Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO)

Moondoggy gravatar imageMoondoggy ( 2020-06-14 16:44:41 +0100 )edit

To be clear, you should be using the code above that we know works. The error message is not Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO). infwarerr is a package that "provides a complete set of macros for information, warning and error messages". Your error message will be later. See, for example, this post where someone had a similar problem. The .log file is big and the error is near the end before the stats get displayed. For that post, it was *** (job aborted, no legal \end found). What is the error message for your log file?

dazedANDconfused gravatar imagedazedANDconfused ( 2020-06-14 18:09:18 +0100 )edit

I edited my log file in my post.

Moondoggy gravatar imageMoondoggy ( 2020-06-14 18:24:26 +0100 )edit

I'm not an expert at reading .log files. What stands out from it is No file st_example.sagetex.sout. \sagecommandlineskip=\skip44 ) (st_example.aux) \openout1 = st_example.aux'. followed near the end by Package sagetex Warning: Graphics file sage-plots-for-st_example.tex/plot-0.pdf on page 1 does not exist.. This would indicate, to me, a problem when you ran Sage because you should have a .sout file (the result of running Sage on the .sage file). But you indicated Sage ran without problems. Maybe someone else can weigh in on this?

dazedANDconfused gravatar imagedazedANDconfused ( 2020-06-14 18:43:52 +0100 )edit

Just noticing your post indicates you processing files outside of cocalc (eg the .tex file) and inside cocalc (where you have a .sout file). Make sure you copy all files in Cocalc to the directory where you are processing the .tex file with TeXmaker. When you run TeXmaker I know it needs .sout to put build the pdf.

dazedANDconfused gravatar imagedazedANDconfused ( 2020-06-14 19:03:15 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-06-13 17:27:22 +0100

Seen: 1,442 times

Last updated: Apr 04 '21