Attachment 'sagetex.sty'

Download

%%
%% This is file `sagetex.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% sagetexpackage.dtx  (with options: `latex')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2008 by Dan Drake <[email protected]>
%% 
%% This program is free software: you can redistribute it and/or modify it
%% under the terms of the GNU General Public License as published by the
%% Free Software Foundation, either version 2 of the License, or (at your
%% option) any later version.
%% 
%% This program is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%% General Public License for more details.
%% 
%% You should have received a copy of the GNU General Public License along
%% with this program.  If not, see <http://www.gnu.org/licenses/>
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sagetex}
  [2008/03/12 v1.4 embedding Sage into LaTeX documents]
\RequirePackage{verbatim}
\RequirePackage{graphicx}
\RequirePackage{makecmds}
\RequirePackage{ifpdf}
\RequirePackage{ifthen}
\newcounter{[email protected]}
\newcounter{[email protected]}
\setcounter{[email protected]}{0}
\setcounter{[email protected]}{0}
\newlength{\sagetexindent}
\setlength{\sagetexindent}{5ex}
\newcommand{\[email protected]}{False}
\DeclareOption{imagemagick}{\renewcommand{\[email protected]}{True}}
\ProcessOptions\relax
\newwrite\[email protected]
\immediate\openout\[email protected]=\jobname.sage
\newcommand{\[email protected]}[1]{\immediate\write\[email protected]{#1}}
\iffalse
%% To get .sage files to automatically change the Python path to find
%% sagetex.py, delete the \iffalse and \fi lines surrounding this and
%% change the directory below to where sagetex.py can be found.
\[email protected]{import sys}
\[email protected]{sys.path.insert(0, 'directory with sagetex.py')}
\fi
\[email protected]{import sagetex}
\[email protected]{sagetex.openout('\jobname')}
\InputIfFileExists{\jobname.sout}{}{}
\newcommand{\sage}[1]{%
\[email protected]{try:}%
\[email protected]{ sagetex.inline(\[email protected], #1)}%
\[email protected]{except:}%
\[email protected]{ sagetex.goboom(\the\inputlineno)}%
\begin{NoHyper}\ref{@sagelabel\[email protected]}\end{NoHyper}%
\@ifundefined{[email protected]@sagelabel\[email protected]}{\gdef\[email protected]{x}}{}%
\stepcounter{[email protected]}}
\AtBeginDocument{\provideenvironment{NoHyper}{}{}}
\catcode`\%=12
\newcommand{\percent}{%}
\catcode`\%=14
\newcommand{\[email protected]}{sage-plots-for-\jobname.tex}
\newcommand{\sageplot}[1][width=.75\textwidth]{%
  \@ifnextchar[{\[email protected][#1]}{\[email protected][#1][notprovided]}%]
}
\def\[email protected][#1][#2]#3{%
\[email protected]{try:}%
\[email protected]{ sagetex.initplot('\jobname')}%
\[email protected]{ sagetex.plot(\[email protected], #3, format='#2', epsmagick=\[email protected])}%
\[email protected]{except:}%
\[email protected]{ sagetex.goboom(\the\inputlineno)}%
\ifpdf
  \ifthenelse{\equal{#2}{notprovided}}%
    {\[email protected]{#1}{pdf}}%
    {\[email protected]{#1}{#2}}%
\else
  \ifthenelse{\equal{#2}{notprovided}}%
    {\[email protected]{#1}{eps}}%
    {\ifthenelse{\equal{\[email protected]}{True}}
      {\[email protected]{#1}{eps}}%
      {\IfFileExists{\[email protected]/plot-\[email protected]#2}%
        {\framebox[2cm]{\rule[-1cm]{0cm}{2cm}\textbf{??}}%
         \PackageWarning{sagetex}{Graphics file
         \[email protected]/plot-\[email protected]#2\space on page \thepage\space
         cannot be used with DVI output. Use pdflatex or create an EPS
         file. Plot command is}}%
        {\framebox[2cm]{\rule[-1cm]{0cm}{2cm}\textbf{??}}%
         \PackageWarning{sagetex}{Graphics file
         \[email protected]/plot-\[email protected]#2\space on page \thepage\space
         does not exist}%
         \gdef\[email protected]{x}}}}%
\fi
\stepcounter{[email protected]}}
\newcommand{\[email protected]}[2]{%
  \IfFileExists{\[email protected]/plot-\[email protected]#2}%
    {\includegraphics[#1]{\[email protected]/plot-\[email protected]#2}}%
    {\framebox[2cm]{\rule[-1cm]{0cm}{2cm}\textbf{??}}%
     \PackageWarning{sagetex}{Graphics file
     \[email protected]/plot-\[email protected]#2\space on page \thepage\space does not
     exist}%
     \gdef\[email protected]{x}}}
\newcommand{\[email protected]}{%
  \@bsphack%
  \[email protected]{sagetex.blockbegin()}%
  \[email protected]{try:}%
  \let\do\@makeother\dospecials\catcode`\^^M\active}
\newcommand{\[email protected]}{%
\[email protected]{except:}%
\[email protected]{ sagetex.goboom(\the\inputlineno)}%
\[email protected]{sagetex.blockend()}}
\newenvironment{sageblock}{\[email protected]%
\def\[email protected]{\[email protected]{ \the\[email protected]}%
\hspace{\sagetexindent}\the\[email protected]\par}%
\verbatim}%
{\[email protected]\endverbatim}
\newenvironment{sagesilent}{\[email protected]%
\def\[email protected]{\[email protected]{ \the\[email protected]}}%
\[email protected]}%
{\[email protected]\@esphack}
\newenvironment{sageverbatim}{%
\def\[email protected]{\hspace{\sagetexindent}\the\[email protected]\par}%
\verbatim}%
{\endverbatim}
\AtEndDocument{\[email protected]{sagetex.endofdoc()}%
\@ifundefined{[email protected]}{}%
{\PackageWarningNoLine{sagetex}{There were undefined Sage formulas
and/or plots}%
\PackageWarningNoLine{sagetex}{Run Sage on \jobname.sage, and then run
LaTeX on \jobname.tex again}}}
\endinput
%%
%% End of file `sagetex.sty'.

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.