Ask Your Question
0

Keep getting ?? as output instead of the desried sage output in sageexample

asked 2020-04-13 19:27:52 +0200

Shreya gravatar image

updated 2020-04-13 19:29:52 +0200

Hi!

So a total beginner in sage here so please try to refrain from suggesting too technical things here.

I'm trying to have some sage code results show in my tex file. After reading some parts of sage tutorial in example.pdf, I made another small tex file with

\documentclass{article}

\usepackage{sagetex} \begin{document} \begin{sageexample} sage : E = EllipticCurve([0,3]) sage : E.discriminant() \end{sageexample} \end{document}

Ran this tex file, then associated example.sagetex.sage file in terminal, then ran tex file again but all I keep getting is ?? Instead of the desired output.

What am I missing or doing wrong?

The first eror latex suggested is - Reference '@sageinline0' on page 1 undefined on input line 6.

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

But what should I do?

Thanks you.

Edit: Sorry for not embedding the minimal working example right, I'm on mobile and new to this site so don't know exactly how to do that yet. Would appreciate pointers on that as well if possible.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-04-13 20:46:01 +0200

dsejas gravatar image

Hello, @Shreya!

When you compile your LaTeX document, SageTeX extracts all the Sage code in a separate file. This file contains all the information of what should be computed, how to compute it, and where to write it. However, the file is not automatically executed. I think this is a security measure, since it would be unwise to automatically execute Sage code from a LaTeX file from an unknown or untrusted source. If that were the case, you would have all the code extracted, you can read it and then execute it if you trust it.

What you have to do is to manually execute that file (if you are using a TeX IDE, like TeXstudio, you can make that process automatic or configure it for a shortcut). For example, if your LaTeX document is called "hello_world.tex", after you run latex or pdflatex or lualatex, you will see a file called "hello_world.sagetex.sage". Go to your terminal and execute

sage hello_world.sagetex.sage

You will see a quite verbose output printed in your screen. If everything goes right, you will now have a file called "hello_world.sagetex.py" and another called "heel_world.sagetex.out" (and perhaps other similar). That's it! Re-compile your LaTeX document, and you will see the output you needed automatically typeset in your file.

I hope this helps! Feel free to ask any doubt you have.

And welcome to the marvelous world of SageMath!

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-04-13 19:27:52 +0200

Seen: 375 times

Last updated: Apr 13 '20