summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/sympytexpackage
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-05-21 22:06:44 +0000
committerKarl Berry <karl@freefriends.org>2014-05-21 22:06:44 +0000
commit89896ca732dbf868c5286ac48b324e1700be4d20 (patch)
tree73bd410ae06c24a2dd4169486cfebdbd620e16e9 /Master/texmf-dist/tex/latex/sympytexpackage
parente9c424012078dfba8a839b14b82a3c99ce75ce4c (diff)
sympytexpackage (21may14)
git-svn-id: svn://tug.org/texlive/trunk@34176 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/sympytexpackage')
-rw-r--r--Master/texmf-dist/tex/latex/sympytexpackage/sympytex.sty149
1 files changed, 149 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/sympytexpackage/sympytex.sty b/Master/texmf-dist/tex/latex/sympytexpackage/sympytex.sty
new file mode 100644
index 00000000000..d78d2ef3ab2
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/sympytexpackage/sympytex.sty
@@ -0,0 +1,149 @@
+%%
+%% This is file `sympytex.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% sympytexpackage.dtx (with options: `latex')
+%%
+%% This is a generated file.
+%%
+%% Copyright (C) 2009 by Tim Molteno <tim@physics.otago.ac.nz>
+%%
+%% 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{sympytex}
+ [2014/05/16 v0.3 Added sympy plotting support. Code cleanup]
+\RequirePackage{verbatim}
+\RequirePackage{graphicx}
+\RequirePackage{makecmds}
+\RequirePackage{ifpdf}
+\RequirePackage{ifthen}
+\newcounter{ST@inline}
+\newcounter{ST@plot}
+\setcounter{ST@inline}{0}
+\setcounter{ST@plot}{0}
+\newlength{\sympytexindent}
+\setlength{\sympytexindent}{5ex}
+\newcommand{\ST@epsim}{False}
+\DeclareOption{imagemagick}{\renewcommand{\ST@epsim}{True}}
+\ProcessOptions\relax
+\newwrite\ST@sf
+\immediate\openout\ST@sf=\jobname.sympy
+\newcommand{\ST@wsf}[1]{\immediate\write\ST@sf{#1}}
+\iffalse
+%% To get .sympy files to automatically change the Python path to find
+%% sympytex.py, delete the \iffalse and \fi lines surrounding this and
+%% change the directory below to where sympytex.py can be found.
+\ST@wsf{import sys}
+\ST@wsf{sys.path.insert(0, 'directory with sympytex.py')}
+\fi
+\ST@wsf{import sympy}
+\ST@wsf{import sympytex}
+\ST@wsf{sympytex.openout('\jobname')}
+\InputIfFileExists{\jobname.sout}{}{}
+\newcommand{\sympy}[1]{%
+\ST@wsf{try:}%
+\ST@wsf{ sympytex.inline(\theST@inline, #1)}%
+\ST@wsf{except:}%
+\ST@wsf{ sympytex.goboom(\the\inputlineno)}%
+\begin{NoHyper}\ref{@sympylabel\theST@inline}\end{NoHyper}%
+\@ifundefined{r@@sympylabel\theST@inline}{\gdef\ST@rerun{x}}{}%
+\stepcounter{ST@inline}}
+\newcommand{\sympyplain}[1]{%
+\ST@wsf{try:}%
+\ST@wsf{ sympytex.inlineplain(\theST@inline, #1)}%
+\ST@wsf{except:}%
+\ST@wsf{ sympytex.goboom(\the\inputlineno)}%
+\begin{NoHyper}\ref{@sympylabel\theST@inline}\end{NoHyper}%
+\@ifundefined{r@@sympylabel\theST@inline}{\gdef\ST@rerun{x}}{}%
+\stepcounter{ST@inline}}
+\AtBeginDocument{\provideenvironment{NoHyper}{}{}}
+\catcode`\%=12
+\newcommand{\percent}{%}
+\catcode`\%=14
+\newcommand{\ST@plotdir}{sympy-plots-for-\jobname.tex}
+\newcommand{\sympyplot}[1][width=.75\textwidth]{%
+ \@ifnextchar[{\ST@sympyplot[#1]}{\ST@sympyplot[#1][notprovided]}%]
+}
+\def\ST@sympyplot[#1][#2]#3{%
+\ST@wsf{try:}%
+\ST@wsf{ sympytex.initplot('\jobname')}%
+\ST@wsf{ sympytex.plot(\theST@plot, #3, format='#2', epsmagick=\ST@epsim)}%
+\ST@wsf{except:}%
+\ST@wsf{ sympytex.goboom(\the\inputlineno)}%
+\ifpdf
+ \ifthenelse{\equal{#2}{notprovided}}%
+ {\ST@inclgrfx{#1}{pdf}}%
+ {\ST@inclgrfx{#1}{#2}}%
+\else
+ \ifthenelse{\equal{#2}{notprovided}}%
+ {\ST@inclgrfx{#1}{eps}}%
+ {\ifthenelse{\equal{#2}{eps}}
+ {\ST@inclgrfx{#1}{eps}}%
+ {\ifthenelse{\equal{\ST@epsim}{True}}
+ {\ST@inclgrfx{#1}{eps}}%
+ {\IfFileExists{\ST@plotdir/plot-\theST@plot.#2}%
+ {\framebox[2cm]{\rule[-1cm]{0cm}{2cm}\textbf{??}}%
+ \PackageWarning{sympytex}{Graphics file
+ \ST@plotdir/plot-\theST@plot.#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{sympytex}{Graphics file
+ \ST@plotdir/plot-\theST@plot.#2\space on page \thepage\space
+ does not exist}%
+ \gdef\ST@rerun{x}}}}}%
+\fi
+\stepcounter{ST@plot}}
+\newcommand{\ST@inclgrfx}[2]{%
+ \IfFileExists{\ST@plotdir/plot-\theST@plot.#2}%
+ {\includegraphics[#1]{\ST@plotdir/plot-\theST@plot.#2}}%
+ {\framebox[2cm]{\rule[-1cm]{0cm}{2cm}\textbf{??}}%
+ \PackageWarning{sympytex}{Graphics file
+ \ST@plotdir/plot-\theST@plot.#2\space on page \thepage\space does not
+ exist}%
+ \gdef\ST@rerun{x}}}
+\newcommand{\ST@beginsfbl}{%
+ \@bsphack%
+ \ST@wsf{sympytex.blockbegin()}%
+ \ST@wsf{try:}%
+ \let\do\@makeother\dospecials\catcode`\^^M\active}
+\newcommand{\ST@endsfbl}{%
+\ST@wsf{except:}%
+\ST@wsf{ sympytex.goboom(\the\inputlineno)}%
+\ST@wsf{sympytex.blockend()}}
+\newenvironment{sympyblock}{\ST@beginsfbl%
+\def\verbatim@processline{\ST@wsf{ \the\verbatim@line}%
+\hspace{\sympytexindent}\the\verbatim@line\par}%
+\verbatim}%
+{\ST@endsfbl\endverbatim}
+\newenvironment{sympysilent}{\ST@beginsfbl%
+\def\verbatim@processline{\ST@wsf{ \the\verbatim@line}}%
+\verbatim@start}%
+{\ST@endsfbl\@esphack}
+\newenvironment{sympyverbatim}{%
+\def\verbatim@processline{\hspace{\sympytexindent}\the\verbatim@line\par}%
+\verbatim}%
+{\endverbatim}
+\AtEndDocument{\ST@wsf{sympytex.endofdoc()}%
+\@ifundefined{ST@rerun}{}%
+{\PackageWarningNoLine{sympytex}{There were undefined Sympy formulas
+and/or plots}%
+\PackageWarningNoLine{sympytex}{Run python on \jobname.sympy, and then run
+LaTeX on \jobname.tex again}}}
+\endinput
+%%
+%% End of file `sympytex.sty'.