1. Dan Drake
  2. SageTeX


Dan Drake  committed 1ba3b09

add sagestr, other updates; remove old installation instructions

  • Participants
  • Parent commits 09cb064
  • Branches default

Comments (0)

Files changed (4)

File Makefile

View file
 	pdflatex $(pkg).dtx
 example.pdf: example.tex sagetex.sty sagetex.py
-	latex example.tex
+	pdflatex example.tex
 	sage example.sage
-	latex example.tex
+	pdflatex example.tex
 	pdflatex example.tex
 %.ind: $(dtxs)
 	latex $(pkg).dtx
 	sed -e 's/usage|hyperpage/usagehyperpage/g' -i sagetexpackage.idx
-	makeindex -s gglo.ist -o $(pkg).gls $(pkg).glo 
+	makeindex -s gglo.ist -o $(pkg).gls $(pkg).glo
 	makeindex -s gind.ist -o $(pkg).ind $(pkg).idx
 sagetex.sty: py-and-sty.dtx $(pkg).dtx
 remote-sagetex.py: remote-sagetex.dtx
 	yes | latex $(pkg).ins
 	latexcleanup clean .
 	rm -fr sage-plots-for-* E2.sobj *.pyc sagetex.tar.gz sagetex.py sagetex.pyc sagetex.sty makestatic.py sagetexparse.py extractsagecode.py dist MANIFEST remote-sagetex.py auto
 # make a source distribution, used for building the spkg
 dist: all
 	python setup.py sdist --formats=tar

File example.tex

View file
 \title{Examples of embedding Sage in \LaTeX{} with \textsf{Sage\TeX}}
 \author{Dan Drake and others}
 \sageplot{G4plot, axes=False}
+To fiddle with aspect ratio, first save the plot object:
+  p = plot(x, 0, 1) + circle((0,0), 1)
+  p.set_aspect_ratio(1)
+Now plot it and see the circular circle and nice 45 degree angle:
 Indentation and so on works fine.
  s     = 7
 3D plotting right now is problematic because there's no convenient way
 to produce vector graphics. We can make PNGs, though, and since the
 \verb|sageplot| command defaults to EPS and PDF, \emph{you must specify
-a valid format for 3D plotting}. Sage right now (version 4.02) can't
-produce EPS or PDF files from plot3d objects, so if you don't specify a
-valid format, things will go badly. You can specify the
+  a valid format for 3D plotting}. Sage right now (version 4.2.1) can't
+produce EPS or PDF files from \texttt{plot3d} objects, so if you don't
+specify a valid format, things will go badly. You can specify the
 ``\texttt{imagemagick}'' option, which will use the Imagemagick
 \texttt{convert} utility to make EPS files. See the documentation for
   x, y = var('x y')
   g = plot3d(sin(pi*(x^2+y^2))/2,(x,-1,1),(y,-1,1))
-  g.show(filename='my_cool_name', viewer='tachyon')
+  g.show(filename='sage-plots-for-example.tex/my-3d-plot', viewer='tachyon')
+{Hey! Run Sage so that this plot exists!}
 \section{Pausing Sage\TeX}
 size, while changing only one thing.
-  \sage{pascals_triangle(n)}
+  \sagestr{pascals_triangle(n)}
-  import time
-  time.sleep(30)

File py-and-sty.dtx

View file
 %    \end{macrocode}
-% \subsubsection{The \texttt{\protect\bslash sage} macro}
+% \subsubsection{The \texttt{\protect\bslash sage} and
+% \texttt{\protect\bslash sagestr} macros}
 % \label{sec:sagemacro}
-% \begin{macro}{\sage}
+% \begin{macro}{\ST@sage}
+% \changes{v2.1.1}{2009/05/14}{Add ST@sage, sagestr, and refactor.}
 % This macro combines |\ref|, |\label|, and Sage all at once. First, we
 % use Sage to get a \LTX representation of whatever you give this
 % function. The Sage script writes a |\newlabel| line into the |.sout|
 % \LTX wants to put a space after that, which is why we don't put the
 % ``except'' on its own line here in the source.
 %    \begin{macrocode}
  _st_.inline(\theST@inline, #1)^^Jexcept:^^J
 %    \end{macrocode}
 % \end{macro}
+% \begin{macro}{\sage}
+% This is the user-visible macro; it runs Sage's |latex()| on its
+% argument.
+%    \begin{macrocode}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\sagestr}
+% ilike above, but doesn't run latex
+%    \begin{macrocode}
+%    \end{macrocode}
+% \end{macro}
 % \begin{macro}{\percent}
 % A macro that inserts a percent sign. This is more-or-less stolen from the
 % \textsf{Docstrip} manual; there they change the catcode inside a group
   def inline(self, counter, s):
     self.progress('Inline formula %s' % counter)
     self.souttmp.write('\\newlabel{@sageinline' + str(counter) + '}{{' + \
-                 latex(s).rstrip() + '}{}{}{}{}}\n')
+                 s.rstrip() + '}{}{}{}{}}\n')
 %    \end{macrocode}
 % We are using five fields, just like |hyperref| does, because that
 % works whether or not |hyperref| is loaded. Using two fields, as in

File sagetexpackage.dtx

View file
 %<python>__version__ = """
-  [2009/06/17 v2.2.1 embedding Sage into LaTeX documents]
+  [2009/07/27 v2.2.2 embedding Sage into LaTeX documents]
 % \fi
-% \CheckSum{335}
+% \CheckSum{341}
 % \CharacterTable
 %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
 % \changes{v2.0}{2009/01/14}{Fixed up installation section, final
 % \emph{final} 2.0}
-% To install \ST, you need to do two things: make \ST known to Sage, and
-% to \LTX. There are two basic methods to do those two things.
 % \newcommand{\sageroot}{\$SAGE\_ROOT}
-% In what follows, ``\texttt{\sageroot}'' refers to the root directory
-% of your Sage installation.
-% \subsection{As a Sage spkg}
-% \label{sec:install-spkg}
-% The easiest way to install \ST is by using Sage's own spkg
-% installation facility; visit the
-% \href{http://sagemath.org/packages/optional/}{optional packages page}
-% and run \texttt{sage -i} with the appropriate file name. This will let
-% Sage know about \ST; you still need to let \LTX know about it.
-% The simplest way to ``install'' \ST for \LTX is to copy the file
-% |sagetex.sty| from \texttt{\sageroot/local/share/texmf} to the same
-% directory as your document. This will always work, as \LTX always
-% searches the current directory for files.
-% Rather than make lots of copies of |sagetex.sty|, you can keep it (and
-% the rest of the \ST documentation) in a |texmf| directory. The easiest
-% thing to do is to create a |texmf| directory in your home directory
-% and use the |texhash| utility so that your \TeX{} system can find the
-% new files. See
-% \href{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=privinst}
-% {\texttt{www.tex.ac.uk/cgi-bin/texfaq2html?label=privinst}} which
-% describes the basic ideas, and also
-% \href{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=what-TDS}
-% {\texttt{www.tex.ac.uk/cgi-bin/texfaq2html?label=what-TDS}} which has
-% some information specific to MiK\TeX. Linux/Unix users can use
-% |$HOME/texmf| and users of Mac\TeX{} should use |$HOME/Library/texmf|.
-% To copy the files that \LTX needs into your |texmf| directory, simply
-% do
-% \begin{quote}
-%   \texttt{cp -r \sageroot/local/share/texmf/* HOMEPREFIX/texmf/}
-% \end{quote}
-% where |HOMEPREFIX| is the appropriate prefix for your own |texmf|
-% tree. Then you need to make \TeX{} aware of the new files by running
-% \begin{quote}
-%   \texttt{texhash HOMEPREFIX/texmf/}
-% \end{quote}
-% \subsection{From CTAN}
-% \label{sec:install-ctan}
-% You can also get \ST from \href{http://tug.ctan.org/pkg/sagetex}{its
-% CTAN page}. This is not the recommended way to get \ST, but it will
-% work.
-% If you get \ST from CTAN, you will need to make the |sagetex.sty| file
-% available to \LTX using any of the methods described above, and you
-% will also need to make |sagetex.py| known to Sage. You can either keep
-% a copy of that file in the same directory as your document or put it
-% where Sage will find it. You can use the |$SAGE_PATH| environment
-% variable (which is analogous to the |$PYTHONPATH| variable) to tell
-% Sage where the file is, or manually copy |sagetex.py| into
-% \texttt{\sageroot/local/lib/python/site-packages}.
+% new installation section FIXME FIXME FIXME
 % \subsection{Using \TeX Shop}
 % \label{sec:using-texshop}
 % displayed math environment
 % as appropriate.\\
+% \DescribeMacro{\sagestr}
+% \fbox{\texttt{\bslash sagestr}\marg{Sage code}}
+% is identical to |\sage|, but is does \emph{not} run Sage's |latex|
+% function on the code you give it; it simply runs the Sage code and
+% pulls the result into your \LTX file. This is useful for calling
+% functions that return \LTX code; see the example file distributed
+% along with \ST for a demonstration of using this command to easily
+% produce a table.
 % \DescribeMacro{\percent} If you are doing modular arithmetic or string
 % formatting and need a percent sign in a call to |\sage| (or
 % |\sageplot|), you can use |\percent|. Using a bare percent sign won't