summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ximera/src/interactives/sagemath.dtx
blob: 95d378afdea1325b93837c152b07f27801456ae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
% \subsection{SageMath support}
% Load Sage\TeX\ if it exists.
%    \begin{macrocode}
%<*classXimera>
\IfFileExists{sagetex.sty}{\RequirePackage{sagetex}}{}
%</classXimera>
%    \end{macrocode}

% \DescribeEnv{sageCell}{Create an interactive SageMath widget.}
%    \begin{macrocode}
%<*classXimera>
\DefineVerbatimEnvironment{sageCell}{Verbatim}{numbers=left,frame=lines,label=SAGE,labelposition=topline}
%</classXimera>
%    \end{macrocode}
%    \begin{macrocode}
%<*htXimera>
\renewenvironment{sageCell}{\NoFonts}{\EndNoFonts}
\ScriptEnv{sageCell}{\ifvmode \IgnorePar\fi \EndP\HCode{<div class="sage"><script type="text/x-sage">}\HtmlParOff}{\HtmlParOn\HCode{\Hnewline</script></div>}}
%</htXimera>
%    \end{macrocode}

% \DescribeEnv{sageOutput}{Execute SageMath code and output the result.}
%    \begin{macrocode}
%<*classXimera>
\DefineVerbatimEnvironment{sageOutput}{Verbatim}{numbers=left,frame=lines,label=SAGE-Output,labelposition=topline}
%</classXimera>
%    \end{macrocode}

%    \begin{macrocode}
%<*htXimera>
\renewenvironment{sageOutput}{\NoFonts}{\EndNoFonts}
\ScriptEnv{sageOutput}{\ifvmode \IgnorePar\fi \EndP\HCode{<div class="sageOutput"><script type="text/x-sage">}}{\HCode{\Hnewline</script></div>}}
%</htXimera>
%    \end{macrocode}

% \DescribeEnv{sageSilent}{Execute SageMath code without outputing the result.}
%    \begin{macrocode}
%<*htXimera>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewenvironment{sagesilent}{\NoFonts}{\EndNoFonts}
\ScriptEnv{sagesilent}{\ifvmode \IgnorePar\fi \EndP\HCode{<script type="text/sagemath">}\HtmlParOff}{\HtmlParOn\HCode{</script></div>}}
%</htXimera>
%    \end{macrocode}