Ask Your Question

Revision history [back]

Is there a way to use sage-boolean-values in Latex

Hey there,

im completely new to sage and so far i got along quite well, but i can't figure this one out. I want to create randomized mathproblems and i want latex to decide what to print depending on calculations in sage.

So here is a functional minimal example:

\documentclass{article} \usepackage{sagetex}

\begin{document} \begin{sagesilent} a = ZZ.random_element(1,20) b = ZZ.random_element(1,20) \end{sagesilent} $\sage{a}-\sage{b}$ \end{document}

What do i need to do if i want to switch a and b depending on if the result is negative or not?

Is there a way to use sage-boolean-values in Latex

Hey there,

im completely new to sage and so far i got along quite well, but i can't figure this one out. I want to create randomized mathproblems and i want latex to decide what to print depending on calculations in sage.

So here is a functional minimal example:

\documentclass{article}
\usepackage{sagetex}

\usepackage{sagetex} \begin{document} \begin{sagesilent} a = ZZ.random_element(1,20) b = ZZ.random_element(1,20) \end{sagesilent} $\sage{a}-\sage{b}$ \end{document}

\end{document}

What do i need to do if i want to switch a and b depending on if the result is negative or not?