Questions tagged [sagetex]

SageTeX is a package enabling Sage mathematics software to be used from within LaTeX documents in a wide variety of ways, similar to Sweave in R.

Filter by
Sorted by
Tagged with
1 vote
1 answer
70 views

Nesting sagetex in animate for tikz (and asymptote) gif - possible or impossible?

I am running Windows 10 or 11 (I don't know), have WSL2 running on my system - Ubuntu distribution, and have SageMath downloaded on my computer. I have successfully established contact between all ...
user avatar
1 vote
1 answer
38 views

Issue in sagetex with \sagestr

I'm trying to create some maths exercises with SageTeX. Here's my code: \documentclass{article} \usepackage{sagetex} \begin{document} \begin{sagesilent} x=var("x") A(x)=(x-2)^2-36 B(x)=1-(2*...
Valère Bonnet's user avatar
1 vote
3 answers
128 views

Why does \hfill work in math mode but not \vfill?

This example writes three lines, each of which have four numbers separated by an equal length of space. \documentclass{article} \begin{document} \noindent \thispagestyle{empty}% 1\hfill2\hfill3\hfill4\...
zhsm54983's user avatar
0 votes
0 answers
29 views

SageTeX does not work when TABs are used as indents

I wrote two practically identical files that use SageTeX to determine whether a positive integer is odd or even. The first example uses tabs for indentation. \documentclass{article} \usepackage{...
vp2523's user avatar
  • 1
1 vote
0 answers
115 views

I installed vanilla TeX Live on Debian but apt still tries to install "texlive-" packages although I tricked packages

I had TeX Live 2022 installed and upgraded to TeX Live 2023. I followed this wonderful guide: Remove old installation sudo apt-get purge texlive* sudo rm -rf /usr/local/texlive/* sudo rm -rf ~/....
vby374792's user avatar
0 votes
0 answers
47 views

Sagetex ignores indents if they are done in tabs insteads of spaces - how to make it recognize tabs?

The following examples are visually identical code. The only difference is that the indents were done differently. Four spaces were used in the first and a tab was used in the second. 1. \...
uate2934's user avatar
0 votes
0 answers
20 views

How to customize behavior of typeset button in GUI editor?

I use TeXworks to turn tex into pdf. There are some cases where I need to compile twice in order to get a complete document, such as referencing a labeled section. Also there are even more complex ...
tery29579's user avatar
3 votes
1 answer
162 views

Sage is unable to process .sagetex.sage file created from sagetex

This is a simple .tex file that defines a sage function p(n) that returns 2 raised to the power of n. \documentclass{article} \usepackage{sagetex} \begin{document} \begin{sagesilent} def p(n): ...
brae37432's user avatar
2 votes
2 answers
62 views

Defining and calling a function in sagetex not working as expected

In the code below I use sagetex to define a function f(n) that returns the nth fibonacci number. I used sagesilent so that the contents of the function are not typeset. Then I call and print the value ...
ging82798's user avatar
0 votes
0 answers
64 views

Having trouble with sage

I don't seem to be able to produce a .sty file following the instructions from links given to me in a previous post, my log file gives me this: This is pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX ...
Paul A's user avatar
  • 1,095
1 vote
2 answers
224 views

Trouble using Cocalc with Latex

I am having trouble running the following code, which works in CoCalc but will not work in Latex, even though it is the tex. output not sure what I am doing wrong. \documentclass[border=1cm]{article} \...
Paul A's user avatar
  • 1,095
0 votes
0 answers
75 views

Can print SageMath logo as text in LaTeX?

I know we could use \LaTeX{} to print its logo in text in LaTeX. I wonder whether we can do the same thing for SageMath?
Easy's user avatar
  • 201
0 votes
1 answer
63 views

Use foreach (pgf) in an itemize environment with sagetex

I want to generate calculations randomly using sagetex, trying to have the simplest code possible. I ended up testing this, with pgf : \begin{sagesilent} from random import sample def alea(n, max): ...
Stan's user avatar
  • 173
0 votes
2 answers
74 views

Write the result (a fraction) of a calculation with sagetex

I made this code to add two random fractions, and calculate the result with sage, but I don't know how to make the result appear with the form \displaystyle\dfrac{}{} \begin{sagesilent} output = r&...
Stan's user avatar
  • 173
3 votes
0 answers
756 views

How to use sagetex on Overleaf

I know I can download sagetex package from their website and after taking few steps: installing Sagemath, routing sagetex files to Tex, and etc, I can directly run Sage while writing on my tex (or ...
Andrew's user avatar
  • 175
1 vote
0 answers
160 views

LyX and Sagemath: Can't update/export from file using Sage module

I have started to use LyX recently and enjoyed it very much. I became very interested in the possibility of integrating Sage(math) commands into the document. But then I became stuck, unable to export ...
Max's user avatar
  • 11
1 vote
0 answers
141 views

Workflow for automatically running sagetex in VSCode

Notes This is my first post here; however, I have used the answers from here countless times. I am definitely a beginner with command line/terminal stuff. I would say I am pretty literate with LaTeX, ...
Andy's user avatar
  • 11
4 votes
2 answers
402 views

How to Plot General Form of a Linear Regression

I attempted to use both Mathcha which is an online website that assists in constructing topological diagrams and plots and I also tried to use Sage, in order to plot this linear regression figure ...
user232914's user avatar
1 vote
1 answer
125 views

Handling the numerical output of SageTeX with siunitx

Which one of the three methods below is correct to handle the numerical output of sagetex with siunitx? and how to do it correctly? \documentclass{article} \usepackage{sagetex,siunitx,mathtools} \...
Diaa's user avatar
  • 9,599
2 votes
1 answer
178 views

Automatically obtaining QPA quivers in tikz via Sage

I use the GAP-package QPA to obtain quivers (which are just directed graphs) and the QPA-output of a quiver looks for example as follows: ["v1","v2","v3","v4",&...
Mare's user avatar
  • 291
0 votes
0 answers
204 views

Impossible to run the command: sage "Sage-example".sagetex.sage (Windows 10)

Good evening guys. I've a big problem, as to simplify my school report, and don't do stupid mistakes while copy pasting some equations, I decided to try SageTex, and I've been struggling to make it ...
Fr3d's user avatar
  • 141
1 vote
0 answers
54 views

%time inside sagecommandline environment

I want to show how to measure time with sage, sagetex and the environment sagecommandline. Here is a minimal example: \documentclass[a6paper,DIV=16]{scrartcl} \pagestyle{empty} \usepackage{sagetex} % ...
dantetante's user avatar
0 votes
1 answer
214 views

sagetex linebreak

When using the environment sagecommandline of sagetex with long number output, how can I get automatic line breaks? I already tried to change sagetex.sty (putting breaklines=true at several places), ...
dantetante's user avatar
1 vote
1 answer
353 views

sagetex/arara: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

Following up this answer, I have the following error in the arara's log file SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape when ...
Diaa's user avatar
  • 9,599
3 votes
0 answers
203 views

Texmaker configuration and SageTex

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 ...
mark haokip's user avatar
1 vote
1 answer
403 views

How to automatically ask tikz to produce the coordinates and plot the graph from adjacency matrix

I am curious about the following: I have an adjacency matrix of a graph of order 36. It is given by [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], [1,0,1,0,1,0,1,0,1,0,1,0,...
Charlotte's user avatar
  • 963
1 vote
0 answers
126 views

How to plot graphs in Latex using sagetex

Now I have got the file sage-plots-for-example.tex in sage that contains all the plots. Do I also have to put all these .eps and .png into the same folder as the tex file?
AnabolicHorse's user avatar
0 votes
0 answers
368 views

How to use sagetex?

I am trying to use sagetex. Now in the console in sage it is written:"Sage processing complete. Run LaTeX on Beiapiel5.tex again." But when I compile the latex code again nothing happens. ...
AnabolicHorse's user avatar
1 vote
1 answer
168 views

\sagestr does not produce plots and sabotages others

For the sake of illustration, I want to plot three functions: linear with direct \sageplot invocation, quadratic with \sagestr and sinusoidal with \sageplot However, it seems that the \sagestr does ...
Display Name's user avatar
1 vote
0 answers
195 views

Eigenvalue in Sagemath [closed]

I tried to obtained the eigenvalues of the matrix below using sagemath; sage: var('a b c d e f g h i j k l m n p q r s t u v') (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u, v) sage: m ...
Ebrima Kanyi's user avatar
1 vote
1 answer
74 views

sagetex not drawing pictures

Maybe someone aldready asked this, but I have the following problem. I tried to compile an example I found here https://tex.stackexchange.com/a/483113/217249. I don't get any errors. I have sage ...
Grisha Taroyan's user avatar
0 votes
2 answers
191 views

How to execute SageTeX code multiple times with \loop?

I got the following errors when compiling the following MWE. How to fix it? Paragraph ended before \verbatim@ was complete. ... First MWE \documentclass{article} \usepackage{sagetex} \newcount\i ...
Display Name's user avatar
0 votes
1 answer
104 views

How to setup TeXnicCenter for compiling SageTeX-based input files?

Having found the solution through a dramatic struggle, I think I need to rephrase the question. Hopefully it is very useful for others with the same issue, nameely: "How to setup TeXnicCenter for ...
Display Name's user avatar
0 votes
1 answer
352 views

sagetex in texstudio : define a new build tool

I am using latex and Sage (and sagetex) through TeXstudio and the terminal. I would like to have a build sequence that would do all the compilations with one signle button. Something like wha tis ...
DC75's user avatar
  • 31
0 votes
0 answers
50 views

sagetex and mcexam

I would like to use mcexam and sagetex together. I managed to make things almost work. Well, I have the expected output, but I have too many errors, and don't see where do they come from. Here is my ...
DC75's user avatar
  • 31
0 votes
1 answer
208 views

How do I show Sage results computation in my LaTeX file? [closed]

I am new to SageMath so I apologize in advance if this question is not exactly appropriate for this site but since I don't really have any other way to know the answers, I 'll ask it anyway. (I am ...
Shreya's user avatar
  • 151
1 vote
2 answers
93 views

passing mathematical function to sage function in sagetex

Would some body please help me in getting the plots, I have tried many things, like creating function('f') and then passing it like Q1 = question(1, f(x+1)) but the thing that only works is: output += ...
Sohail's user avatar
  • 115
1 vote
2 answers
258 views

SageTeX for posets

One can use SAGE to get a LaTeX output for posets. For example entering u=posets.BooleanLattice(4) print(display(u),print(latex(u))) in the sage cell (https://sagecell.sagemath.org/) will display ...
Mare's user avatar
  • 291
2 votes
1 answer
329 views

latex(VAR) command converts other concatenated strings into mathemode when latex displays it

Using sagetex in latex; it appears that using the latex() command converts any concatenated strings to that term into math-mode, rather than strings. See the MWE below: \documentclass{article} \...
Jason's user avatar
  • 939
4 votes
2 answers
209 views

SageTeX: 1000sep for sage-calculated number (siunitx?)

How to add a '1000 sep' on i.e. \sage{2^333}? \documentclass{report} \usepackage{sagetex} \usepackage{siunitx} \sisetup{group-separator = \text{\,}} \begin{document} Works: \num{9000123} \begin{...
cis's user avatar
  • 8,105
4 votes
1 answer
1k views

SageTeX: How to run Sage in the command line

The normal run of a tex-file which contains sagetex, say \documentclass{report} \usepackage{sagetex} \begin{document} \sage{2^1234} \end{document} is pfdlatex example.tex sage example.sagetex....
cis's user avatar
  • 8,105
7 votes
1 answer
367 views

arara: sage - A Sage(math)-rule for arara

Completely edited! The normal run of a tex-file which contains sagetex, say \documentclass{report} \usepackage{sagetex} \begin{document} \sage{2^1234} \end{document} is pfdlatex example.tex ...
cis's user avatar
  • 8,105
2 votes
2 answers
273 views

Number formatting in PythonTeX with `sage` family

I am trying to get a special number formatting in pythontex with sage family but it doesn't work. Here is an example which shows how it should look like and what I tried so far. How can I make it ...
Julia's user avatar
  • 1,658
2 votes
1 answer
228 views

How to display the output of a loop in SageTex

I am preparing a class on Sage, and i want the following code on my document. \documentclass{article} \usepackage{sagetex} \begin{document} \begin{sagecommandline} sage: for i in range(0,4): ....: ...
Alex Abreu's user avatar
1 vote
0 answers
98 views

String check against a sage command, issue of expansion order? [closed]

I am trying to write a macro to do a conditional check against two strings. The problem I'm having is that I want to check the output of a \sage command and do a string comparison without expanding ...
Jason's user avatar
  • 939
0 votes
0 answers
62 views

SageTex on PC MikTeX issue

I am trying to run the LaTeX/SageTeX code presented in John Palmieri answer. The file compiles, but the output PDF is missing all mathematical Sage answers and yet there are no error messages (e.g, no ...
Maesumi's user avatar
  • 9,059
7 votes
4 answers
2k views

How to use sagetex package

I'm trying to use sagetex package, but then I found this kind of problem when running the code, may anyone help? Here is the code: \documentclass{article} \usepackage{sagetex} \begin{document} ...
Mohammad Agung's user avatar
0 votes
1 answer
220 views

Directly input a sage file in a sagetex block

Is there a command similar to \lstinputlisting with sagetex, which would import directly a .sage file in the relevant block, and have it evaluated by sagetex? If not, how would one write such a ...
T. Verron's user avatar
  • 13.6k
0 votes
0 answers
144 views

SageTex installed, but not compiling

I've installed SageTex in my texmf tree. Latex is running using WinEdt and appears to see the style file, as I have the output files example.sagetex.sage from example.tex. My issue is the second ...
bbujeya's user avatar
  • 611
6 votes
1 answer
1k views

Call Sage in TeXstudio (Windows)

I have installed and tried SageTeX (using pdflatex, opening the sage console and using pdflatex again). This works fine. I want to get a user command in TeXstudio that calls sage without the need to ...
Martin's user avatar
  • 511