[texhax] Octave in LaTeX

James Quirk jjq at galcit.caltech.edu
Thu Nov 10 01:36:23 CET 2011

On Wed, 9 Nov 2011, Gordon Haverland wrote:

> On November 9, 2011, Cristina Abrantes wrote:
> > I'm working in article about Octave and LaTeX for a paper at my
> > university. I would like to know if is there any package to
> > run Octave inside a LaTeX archive?
> > Because my goal is to create a PDF using the both language.
> Probably not the solution you were looking for, but you can call 
> Octave from Perl (Inline::Octave) and you can do various LaTeX 
> things in Perl as well.  And perl can call pdflatex (or whatever) 
> to bring things together.
The example:


shows that it is also possible to run an octave session from
within a LaTeX generated PDF by using a /RichMedia
annotation with a localhost server, at least under OSX
and Linux. For details run either:

   perl -x octave.pdf -help


   ruby -x octave.pdf -help

This particular example includes a built-in source-browser
that shows how the document is programmed. To activate
the source-browser, open the bookmarks panel and click on 
mk_octave. If you study the source you'll see the likes
of fold::latex, fold::perl, fold::python, and fold::ruby.
These work a bit like the Inline::Octave alluded to above,
with the generalization that folds can be nested re-entrantly.
The implications of which are discussed in an easter-egg,
which accessible from the browser's splash page.


p.s. Linux users will need to use Adobe Reader 9.3.4
as /RichMedia annotations are crippled in 9.4.x .

More information about the texhax mailing list