Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass[]{article}
- usepackage{sagetex}
- usepackage{xcolor}
- lstset{language=Sage,
- commentstyle={ttfamilycolor{green}},
- keywordstyle={ttfamilycolor{blue}bfseries},
- stringstyle ={ttfamilycolor{dgraycolor}bfseries},
- tabsize = 4,
- basicstyle={small ttfamily},
- backgroundcolor= color{orange!20},
- }
- begin{document}
- The following function computes the square of a number:
- begin{sageblock}
- def f(x):
- return x**2
- end{sageblock}
- Testing in the code gives for $x=2$ the value sage{f(2)}.
- Commandline Version:
- begin{sagecommandline}
- sage: x = 2
- sage: f(2)
- end{sagecommandline}
- end{document}
Add Comment
Please, Sign In to add comment