octave code into latex

Vic Norton vic at norton.name
Fri Jan 4 10:55:09 CST 2008


This seems a bit late, but "listings" is the package to use to put  
octave code into latex. Here is a complete example.

    \documentclass{article}
    \usepackage{color}
    \usepackage{listings}
    \lstset{
       language=Octave,
       morecomment = [l][\itshape\color{blue}]{\%}
    }
    \begin{document}

    An octave listing example:

    \begin{lstlisting}
    % Here are two norm expressions
    function y = norm1( x )
       y = max(sum(abs( x )));
    endfunction

    function y = norm2( x )
       y = sqrt(sum( x .* x ));
    endfunction
    % End of example
    \end{lstlisting}

    \end{document}

Regards,

Vic

On Jan 4, 2008, at 8:43 AM, Peter A. Gustafson wrote:

> On Thursday 11 October 2007 05:53:24 Riccardo Corradini wrote:
>> Hi  all,
>> I would like to include some octave octave into latex.
>> Does anybody know how do it?
>> Thanks a lot
>> Riccardo
>>
>>
>> ---------------------------------
>>
>> ---------------------------------
>> L'email della prossima generazione? Puoi averla con la nuova  
>> Yahoo! Mail
>
> Check out highlight.
> http://www.andre-simon.de/
>
> It claims to support octave, though I've only used it for fortran.
>
> Pete Gustafson
>


More information about the Help-octave mailing list