Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
0 answers
105 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 ...
user avatar
  • 155
1 vote
0 answers
38 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 ...
user avatar
  • 11
0 votes
0 answers
48 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, ...
user avatar
  • 1
3 votes
2 answers
154 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 ...
user avatar
1 vote
1 answer
91 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} \...
user avatar
  • 8,759
2 votes
1 answer
131 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",&...
user avatar
  • 239
0 votes
0 answers
147 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 ...
user avatar
  • 41
1 vote
0 answers
36 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} % ...
user avatar
0 votes
1 answer
103 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), ...
user avatar
1 vote
1 answer
269 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 ...
user avatar
  • 8,759
3 votes
0 answers
118 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 ...
user avatar
1 vote
1 answer
245 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,...
user avatar
  • 933
1 vote
0 answers
69 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?
user avatar
0 votes
0 answers
186 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. ...
user avatar
1 vote
1 answer
126 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 ...
user avatar
  • 2,383
1 vote
0 answers
100 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 ...
user avatar
1 vote
1 answer
47 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 ...
user avatar
0 votes
2 answers
146 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 ...
user avatar
  • 2,383
0 votes
1 answer
76 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 ...
user avatar
  • 2,383
0 votes
1 answer
244 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 ...
user avatar
  • 11
0 votes
0 answers
37 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 ...
user avatar
  • 11
0 votes
1 answer
82 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 ...
user avatar
  • 151
1 vote
2 answers
61 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 += ...
user avatar
  • 15
1 vote
2 answers
151 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 ...
user avatar
  • 239
2 votes
1 answer
211 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} \...
user avatar
  • 929
4 votes
2 answers
188 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{...
user avatar
  • 6,217
3 votes
1 answer
759 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....
user avatar
  • 6,217
7 votes
1 answer
312 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 ...
user avatar
  • 6,217
2 votes
2 answers
218 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 ...
user avatar
  • 1,472
2 votes
1 answer
145 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): ....: ...
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 ...
user avatar
  • 929
0 votes
0 answers
36 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 ...
user avatar
  • 8,445
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} ...
user avatar
0 votes
1 answer
160 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 ...
user avatar
  • 12.9k
0 votes
0 answers
124 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 ...
user avatar
  • 591
6 votes
1 answer
973 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 ...
user avatar
  • 471
1 vote
1 answer
170 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 ...
user avatar
1 vote
0 answers
127 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{...
user avatar
  • 111
2 votes
1 answer
658 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 ...
user avatar
1 vote
0 answers
336 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 \...
user avatar
  • 929
1 vote
2 answers
517 views

Help with writing base 10 addition/subtraction formula

I am preparing this small tutorial for addition and subtraction formulas for kids who have a strong understanding of base-10 representation and also have a good enough understanding of addition and ...
user avatar
  • 21
1 vote
0 answers
257 views

Create new command python

I want create a new command in python, in https://tex.stackexchange.com/a/234232/153360 add the command sage to pythontex. How can I change or add a command which output a string instead of a latex ...
user avatar
  • 11
0 votes
0 answers
52 views

Relaxing a command's requirement to be run in mathmode (specifically \sage in tikz \draw command)

I would like to be able to build a dynamic tikz picture using some random numbers generated via sage. Presently this seems to fail because tikz doesn't like the mathmode that sage has to be run inside ...
user avatar
  • 929
1 vote
1 answer
166 views

format sagetex code like console or notebook

I'd like to put sage code in my LaTeX document that looks mostly like how an interactive session would appear, except that I want LaTeX formatted output. So, I'd like to write something like this in ...
user avatar
1 vote
1 answer
248 views

How to change background color of a sagetex sageblock-environment?

When using sagetex the background of sagecommandline environments can be easily changed via lstlistings setup. How can the background of a sageblock environment be changed? MWE: \documentclass[]{...
user avatar
0 votes
1 answer
202 views

Is there a workaround for Packages Comment and Sagetex incompatibility?

I use the "Comment package" to write exercises with or without solutions. But I also want to use the "Sagetex package" to write the solution without typos. There seems to be an incompatibility between ...
user avatar
  • 834
3 votes
1 answer
80 views

Babel with french option mess with SageTeX and `\addplot`

I'm trying to easily plot with pgfplots some python outputs. I really don't like the matplotlib2tikz default behavior, which is to copy the default parameters of matplotlib, and I can't find how to ...
user avatar
  • 403
1 vote
0 answers
161 views

I have a problem when I use tikz package with Sage [duplicate]

I used Sage 8.0 to get crystal graph : $ sage: B = crystals.Tableaux(['A',2], shape=[2,1]) $ sage: latex(B) and then I got the latex code: \documentclass{paper} \usepackage{dot2texi} \usepackage{...
user avatar
  • 11
1 vote
2 answers
363 views

Comma separated number representation fed to latex math mode from \sage{}

I came across other tex questions where people asked ways to represent numbers in comma-separated format. That is writing 1234567 as 1,234,567. I need this while teaching addition/subtraction to my ...
user avatar
  • 21
1 vote
0 answers
411 views

Integrating SageTex and Kile/TexStudio in Linux

I had followed the instructions given in the answer to a similar question, but it seems that sage never gets launched once pdf is created in that integration. I am attaching screenshot of log and ...
user avatar