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
0 votes
0 answers
20 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. \...
0 votes
0 answers
16 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 ...
3 votes
1 answer
99 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): ...
2 votes
2 answers
50 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 ...
0 votes
0 answers
43 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 ...
  • 611
0 votes
0 answers
23 views

How to make minted code block skip the first and last line

I'm using sagetex which we put codes inside \begin{sageblock}...\end{sageblock}, but the problem is sagetex itself doesn't highlight code. So I thought let's just wrap minted around it. Which yes it ...
0 votes
2 answers
138 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} \...
  • 611
0 votes
0 answers
32 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?
  • 201
0 votes
1 answer
44 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): ...
  • 153
0 votes
2 answers
44 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&...
  • 153
2 votes
0 answers
296 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 ...
  • 165
1 vote
0 answers
67 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 ...
  • 11
1 vote
0 answers
85 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, ...
  • 11
3 votes
2 answers
246 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 ...
1 vote
1 answer
105 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} \...
  • 8,879
2 votes
1 answer
147 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",&...
  • 239
0 votes
0 answers
170 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 ...
  • 41
1 vote
0 answers
46 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} % ...
0 votes
1 answer
127 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), ...
1 vote
1 answer
284 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 ...
  • 8,879
3 votes
0 answers
147 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 ...
1 vote
1 answer
289 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,...
  • 933
1 vote
0 answers
85 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?
0 votes
0 answers
254 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. ...
1 vote
1 answer
139 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 ...
1 vote
0 answers
132 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 ...
1 vote
1 answer
55 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 ...
0 votes
2 answers
157 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 ...
0 votes
1 answer
78 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 ...
0 votes
1 answer
286 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 ...
  • 11
0 votes
0 answers
40 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 ...
  • 11
0 votes
1 answer
135 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 ...
  • 151
1 vote
2 answers
76 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 += ...
  • 115
1 vote
2 answers
179 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 ...
  • 239
2 votes
1 answer
240 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} \...
  • 939
4 votes
2 answers
193 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{...
  • 6,461
3 votes
1 answer
834 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....
  • 6,461
7 votes
1 answer
335 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 ...
  • 6,461
2 votes
2 answers
234 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 ...
  • 1,534
2 votes
1 answer
170 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): ....: ...
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 ...
  • 939
0 votes
0 answers
43 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 ...
  • 8,707
6 votes
3 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} ...
0 votes
1 answer
182 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 ...
  • 13.1k
0 votes
0 answers
128 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 ...
  • 601
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 ...
  • 491
1 vote
1 answer
184 views

VimLatex-suite SageTex compile shortcut

I am using LaTeX in Vim with VimLaTeX-Suite and i just started using Sage and i want to implement SageTex in my documents, but everytime i want to compile a have to follow this process in the terminal ...
1 vote
0 answers
137 views

Simplifying fractions in SageTEX

I'm new to SageTex. Here's my code: \documentclass[10pt]{article} \usepackage{sagetex} \begin{document} \begin{sageblock} var('a,b') a = 3 \end{sageblock}\\ $\sage{(a-6)/(b-1)}$ \end{...
  • 111
2 votes
1 answer
688 views

How do i use SageTex in TexStudio

I just recently found the CAS-application SageMath. SageMath has a TeX plugin called SageTex, and I would like to use this with the TeX editor TeXstudio, however I am quite a noob, so I don't know ...
1 vote
0 answers
410 views

Change the output of the sage function latex() on a string

Currently if you run the sage command latex('a string') using sage (or sagetex) the latex output looks like: \text{\texttt{a{ }string}}. I would like to eliminate either of these (preferably the \...
  • 939