Anonymous avatar Anonymous committed 9840256

Mathematica, Maple plotting section; updated plot3d for graphs to use Tachyon; required for Sage 2.10.3

Comments (0)

Files changed (3)

 * What about graphs and TikZ?
 
 * kpsewhich stuff from CTAN upload page?
+
+* Harald's static idea
+
+* Jason's verb for % idea
 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 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 ``\texttt{imagemagick}''
-option, which will use the Imagemagick \texttt{convert} utility to make
-EPS files. See the documentation for details.
+a valid format for 3D plotting}. Sage right now (version 2.10.3) 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
+``\texttt{imagemagick}'' option, which will use the Imagemagick
+\texttt{convert} utility to make EPS files. See the documentation for
+details.
 
 Here's the famous Sage cube graph:
 
 
 % need empty [] so sageplot knows you want png format, and aren't
 % passing an option to includegraphics
-\sageplot[][png]{G.plot3d()}
+\sageplot[][png]{G.plot3d(engine='tachyon')}
 
 \end{document}

sagetexpackage.dtx

 %<latex>\NeedsTeXFormat{LaTeX2e}
 %<latex>\ProvidesPackage{sagetex}
 %<*latex>
-  [2008/03/10 v1.4 embedding Sage into LaTeX documents]
+  [2008/03/12 v1.5 embedding Sage into LaTeX documents]
 %</latex>
 %<*driver>
 \documentclass{ltxdoc}
 % inside an fbox is really hard. Verbatim stuff doesn't work because
 % it's fragile. This code works; it's copied out of Scott Pakin's
 % dtxtut.tex. 
+% 
+% There is \textbackslash but I don't like how that looks. 
 % \fi
 % {\catcode`\|=0 \catcode`\\=12
 % |gdef|bslash{\}}
 %
 % A less trivial, and perhaps more useful example is plotting. You can
 % include a plot of the sine curve without manually producing a plot,
-% saving an EPS or PDF file, and doing the \verb|\includegraphics|
+% saving an EPS or PDF file, and doing the |\includegraphics|
 % business with the correct filename yourself. If you write this:
 % \begin{quote}
 % |Here is a lovely graph of the sine curve:|
 % \section{Usage} \label{s:usage}
 % 
 % Let's begin with a rough description of how \ST works. Naturally the
-% very first step is to put \verb|\usepackage{sagetex}| in the preamble
-% of your document. When you use macros from this package and run \LTX
-% on your file, along with the usual zoo of auxiliary files, a |.sage|
-% file is written. This is a Sage source file that uses the Python
-% module from this package and when you run Sage on that file, it will
-% produce a |.sout| file. That file contains \LTX code which, when you
-% run \LTX on your source file again, will pull in all the results of
-% Sage's computation.
+% very first step is to put |\usepackage{sagetex}| in the preamble of
+% your document. When you use macros from this package and run \LTX on
+% your file, along with the usual zoo of auxiliary files, a |.sage| file
+% is written. This is a Sage source file that uses the Python module
+% from this package and when you run Sage on that file, it will produce
+% a |.sout| file. That file contains \LTX code which, when you run \LTX
+% on your source file again, will pull in all the results of Sage's
+% computation.
 %
 % All you really need to know is that to typeset your document, you need
 % to run \LTX, then run Sage, then run \LTX again. 
 % in Sage.
 %
 % Note that since \LTX will do macro expansion on whatever you give
-% to \verb|\sage|, you can mix \LTX variables and Sage variables! If
+% to |\sage|, you can mix \LTX variables and Sage variables! If
 % you have defined the Sage variable |foo| to be $12$ (using, say, the
 % |sageblock| environment), then you can do something like this:
 % \begin{quote}
 % \end{center}
 % You can specify a file format if you like. This must be the
 % \emph{second} optional argument, so you must use empty brackets if
-% you're not passing anything to \verb|\includegraphics|:
+% you're not passing anything to |\includegraphics|:
 % \begin{center}
 % |\sageplot[][png]{plot(sin(x), x, 0, pi)}|
 % \end{center}
 % Tachyon, Sage's 3D plotting system, produces bitmap formats like BMP
 % and PNG.
 %
-% Because of this, when producing 3D plots with \verb|\sageplot|,
+% Because of this, when producing 3D plots with |\sageplot|,
 % \emph{you must specify a file format}. The PNG format is compressed
 % and lossless and is by far the best choice, so use that whenever
 % possible. (Right now, it is always possible.) If you do not specify a
 % to see your graphics when you use |latex| and DVI files while writing
 % your document.
 %
-% \paragraph{But that's not good enough!} The \verb|\sageplot| command
-% tries to be both flexible and easy to use, but if you are just not
-% happy with it, you can always do things manually: inside a
-% |sagesilent| environment (see the next section) you could do
+% \paragraph{But that's not good enough!} \label{s:notgoodenough}
+% The |\sageplot| command tries to be both flexible and easy to use, but
+% if you are just not happy with it, you can always do things manually:
+% inside a |sagesilent| environment (see the next section) you could do
 % \begin{quote}
 %   |your special commands|\\
 %   |x = your graphics object|\\
 % executing Sage code.\\
 %
 % \DescribeEnv{sageblock} Any text between |\begin{sageblock}| and
-% |\end{sageblock}| will be typset into your file, and also written into
+% |\end{sageblock}| will be typeset into your file, and also written into
 % the |.sage| file for execution. This means you can do something like
 % this:
 % \begin{quote}
 %
 % Thanks to Franco Saliola for reporting this.
 %
+% \paragraph{Plotting from Mathematica, Maple, etc.} Sage can use
+% Mathematica, Maple, and friends and can tell them to do plotting, but
+% since it cannot get those plots into a Sage graphics object, you
+% cannot use |\sageplot| to use such graphics. You'll need to use the
+% method described in ``But that's not good enough!''
+% (\hyperref[s:notgoodenough]{page~\pageref*{s:notgoodenough}}) with
+% some additional bits to get the directory right---otherwise your file
+% will get saved to someplace in a hidden directory.
+%
+% For Mathematica, you can do something like this inside a |sagesilent|
+% or |sageblock| environment:
+% \begin{quote}
+%   |mathematica('plot = commands to make your plot')|\\
+%   |mathematica('Export["%s/graphicsfile.eps", plot]' % os.getcwd())|
+% \end{quote}
+% then put |\includegraphics[opts]{graphicsfile}| in your file.
+%
+% For Maple, you'll need something like
+% \begin{quote}
+%   |maple('plotsetup(ps, plotoutput=`%s/graphicsfile.eps`, \|\\
+%   |  plotoptions=`whatever`);' % os.getcwd())|\\
+%   |maple('plot(function, x=1..whatever);')|
+% \end{quote}
+% and then |\includegraphics| as necessary.
+%
+% These interfaces, especially when plotting, can be finicky. The above
+% commands are just meant to be a starting point.
+%
+%
 % \StopEventually{}
 %
 % \section{Implementation}
 % \tikzstyle{box}=[draw, shape=rectangle, thick]
 %
 % \begin{macro}{\sageplot}
-% \changes{v1.3}{2008/03/08}{Iron out warnings, cool TikZ flowchart}
+% \changes{v1.3}{2008/03/08}{Iron out warnings, cool Ti\emph{k}Z flowchart}
 % This function is similar to |\sage|. The neat thing that we take
 % advantage of is that commas aren't special for arguments to \LTX
 % commands, so it's easy to capture a bunch of keyword arguments that
 % warning will be issued since all the |\ref|s find a |\newlabel|.)
 % Anyway, I think it's easier to grab an MD5 sum out of the end of the
 % file than parse the output from running |latex| on your file. (The
-% regular expression \verb|^%[0-9a-f]{32}%| will find the MD5 sum.)
+% regular expression |^%[0-9a-f]{32}%| will find the MD5 sum.)
 %
 % Now we are done with the |.sout| file. Close it, rename it, and tell
 % the user we're done.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.