octave-maintainers
[Top][All Lists]
Advanced

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

Re: mcode.sty for LaTeX


From: Richard Crozier
Subject: Re: mcode.sty for LaTeX
Date: Thu, 30 May 2013 14:57:06 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1

On 30/05/2013 14:35, Juan Pablo Carbajal wrote:
On Thu, May 30, 2013 at 10:20 AM, Richard Crozier <address@hidden> wrote:
On 29/05/2013 18:53, c. wrote:
On 29 May 2013, at 17:46, address@hidden wrote:

Message: 2
Date: Wed, 29 May 2013 16:17:43 +0100
From: Richard Crozier <address@hidden>
To: address@hidden
Subject: Re: mcode.sty for LaTeX
Message-ID: <address@hidden>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 29/05/2013 15:12, Ben Abbott wrote:
Does this look useful for us?


http://www.howtotex.com/tips-tricks/how-to-include-matlab-code-in-latex-documents/

Modifying to suit Octave's syntax looks straight forward.

Ben


I use this a lot, very handy, but since the ultimate source is the ML
file exchange, you should maybe ask the author to email a copy to the
list or upload to CTAN if Octave is going to use it.

Richard
What does it do differently than

\usepackage{listings}

\begin{lstlisting}[language=Octave]
a = 1;    # Octave comment
b = 2;
c = a^2 + b^2;
for i = 1:10
   disp (i)
endfor
\end{lstlisting}

it seems it only defines a different set of default styles for matlab
language than is defined in listings.sty
but that package already contains a set of defaults for Octave that I like
and use a lot, and it also takes care
of Octave-only keywords like "endif", "endfor", "endfunction" etc….

c.



It turns out that if you combine mcode.sty with language=Octave, they seem
to work together at first glance, i.e. endfor, endfunction etc. are
highlighted. I've attached an example.

The main difference is that the non mcode.sty version is in black and white,
I prefer the highlighted version, but it would depend what I was using it
for.

Richard





--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

With he listing configurations I sent listings look much better than
that results. It is just a matter of committing a new style definition
to the maintainer of the package.

Your style is also nice, but I couldn't get it to produce fixed width output, like the mcode.sty seems to do, although I'm not certain.

Richard


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



reply via email to

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