 \documentclass{article}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% tex2sws %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Defines the environments for sage code
\usepackage{sagetex}
%% Use the worksheet boolean to control
%% items like vertical spacing and margins
%% that vary between the printed page and
%% a web page
\usepackage{ifthen}
\newboolean{worksheet}
\ifx \HCode\UnDef \setboolean{worksheet}{false}
\else \setboolean{worksheet}{true} \fi
%% Use this before any pgf/tikz packages are included
\ifthenelse{\boolean{worksheet}}
{\def\pgfsysdriver{pgfsystex4ht.def}}{\relax}
%% Use this if you have hyperlinks
\ifthenelse{\boolean{worksheet}}
{\usepackage[tex4ht]{hyperref}}{\usepackage[pdftex]{hyperref}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% syntax package will display SAGE code inline (code not executed)
%% Needs \% to effect a percent symbol
%% sagetex package offers a \percent, which we might use if supported by tex4ht
%% Needs \caret command (defined below) to effect SAGE exponentiation output
%% It would be nice to accomplish all this with the sagetex package  just
%% inline prettyprinting of very small hunks of SAGE, with no evaluation
\usepackage{syntax}
\newcommand{\sageinline}[1]{\lit*{#1}}
\newcommand{\caret}{\^{}}
% For tikz graphics, with pdflatex or tex2sws
\usepackage{tikz}
% For combinatorial graphs
% Seems to have some conflict with the syntax package
% So choose one or the other
% \usepackage{tkzgraph, tkzberge}
%
\begin{document}
%
%
Sage can compute some large numbers quickly, especially with the \sageinline{factorial()} function.
%
\begin{sageverbatim}
factorial(2010)
\end{sageverbatim}
%
\end{document}
