Hi Scott, 

On Wed, 2012-10-03 at 06:16 -0400, Scott Kostyshak wrote:

> I've been meaning to checkout SAGE + LyX so if no one comes along to
> help you I might take a look.

I appreciate the offer. After some quality time looking into how the
module works and how SageTeX processes documents, I was able to get it
up and running. I found this page to be extremely helpful:
http://www.sagemath.org/doc/tutorial/sagetex.html

Of course, like all things, I was hoping to get a quick response via the
list. I decided last year that I wanted to go back to school to improve
my mechanical engineering skills and was hoping to get Sage working for
a lab report.

(Why I decided more education would be desirable is completely beyond
me. I've forgotten how thoroughly miserable it is to be a student. While
I frequently have to work late, it's been years since I've had to pull
an all-night session to finish homework. It's every bit as bad as I
remember. It might even be worse, if you factor in age.)

> How did you install SAGE? In the past
> I've compiled from source which was very smooth but took a while.
> There is also a PPA: https://launchpad.net/~aims/+archive/sagemath

To get Sage installed, I used the PPA. I thought about compiling from
source so that I could integrate it with the system Python, and then
thought better of it. The installation from the PPA was quick and I
haven't had any issues, so far.

To install the SageTeX module (which has to be done separately from
installing Sage), I copied the sagetex folder into my LaTeX path and ran
texhash.

> Which version do you have installed?

I'm running version 5.1.

> Does the terminal output or View Messages toolbar give any useful
> output that you could share?

The output was helpful, but didn't make much sense until I read more
about how SageTeX works.

Sage processes files in two steps. You write your document, then you run
LaTeX (pdflatex, xelatex, lualatex, or regular latex) on it. This
creates a second file, with the Sage processing instructions in it. This
has a *.sagetex.sage file extension.

At this point, you have to run Sage on this secondary file, which
generates your equations, plots and other elements so that they can be
incorporated into your original LaTeX file. At that point, you run LaTeX
on the original file a second time to produce the typeset document.

The problem I was having is that I was only running LaTeX on my new
documents. The converters I set up didn't follow the appropriate pathway
of LaTeX -> Sage -> LaTeX. Once I added in the Sage processing step,
everything started to work.

> Do you have a minimum working example that you could send or link to?

Absolutely, attached is a simple example that I'm working up into a
template.

I'm just getting started with Sage, but now that it's working, I'm quite
impressed with what I've seen. For the past 10 years or so, I've been
using aging copies of Maple for symbolic computation, and this looks
like it will allow me to modernize. (I don't actually have to do much
symbolic math, so it hasn't been that big of a deal.)

Being able to work from within LyX, in a manner very similar to the way
I work with R code via Knitr/Sweave, is going to be very nice. Knowing
that it's all open is even better.

Cheers,

Rob

PS, when I get time, I'm going to try and update the instructions on the
Wiki to make a couple of things clearer. I'll also probably write a blog
post about it, just so I've got a record of how I got things working. If
you'd like, I'll send you a link when it's finished.

Attachment: Sage Report.lyx
Description: application/lyx

Reply via email to