help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: octave to (la)tex conversion


From: Juan Pablo Carbajal
Subject: Re: octave to (la)tex conversion
Date: Tue, 2 Oct 2012 08:22:42 +0200

On Tue, Oct 2, 2012 at 1:01 AM, Leo Butler <address@hidden> wrote:
> Maxima has the function 'tex' that lets one transform an object in
> Maxima to a string of tex code. This is quite useful: an emacs mode
> (imaxima) uses this to create a front end that looks really
> professional; plus, with mathjax, it can be rolled into a nice web-based
> frontend.
>
> Is there anything similar in Octave?
>
> ----------
> What I have in mind is the following application: I am writing course
> notes that have a lot of numerical examples in them. With \write18, I
> can put these inside a LaTeX file and have Octave do the computations. I
> would like to have Octave run a hook before quitting to dump all of the
> user-defined variables into a tex file as tex macros. It doesn't need to
> be fancy, something like
>
> x=1:2; ==>
> \def\octavex#1{\ifnum#1=1{1}\else\ifnum#1=2{2}\else\relax\fi\fi}
>
> IPC on the cheap, if you like. It seems like someone might have already
> written something like this.
>
> Leo
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

Leo,

There are packages for latex that would parse your code and highlight
it nicely, e.g.
http://stackoverflow.com/questions/1966425/source-code-highlighting-in-latex
This may be more useful than converting octave to latex (which to me
sounds only useful when defining functions, like in a CAS). with those
tools you just insert your code and it looks nice in your latex
document, no conversion needed.

I do not know if a latex output has been already implemented. However
if you would like to give ti a try, the instructions of jwe here
http://wiki.octave.org/User:KaKiLa#make_output_format_a_valid_input_format
may be useful. Basically you could define a new output function that
does the conversion to tex. It may be not trivial though.

Cheers
-- 
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]