[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mcode.sty for LaTeX
From: |
Juan Pablo Carbajal |
Subject: |
Re: mcode.sty for LaTeX |
Date: |
Wed, 29 May 2013 22:01:18 +0200 |
On Wed, May 29, 2013 at 7:53 PM, c. <address@hidden> wrote:
> that package already contains a set of defaults for Octave
listings is ok but an update is required. This is my lisitng
configuration to get code similar to what one sees in a Gedit editor
\usepackage{listings}
\lstset{
language=Octave,
backgroundcolor=\color{white}, % choose the background color; you
must add \usepackage{color} or \usepackage{xcolor}
basicstyle=\footnotesize, % the size of the fonts that are used
for the code
breakatwhitespace=false, % sets if automatic breaks should
only happen at whitespace
breaklines=true, % sets automatic line breaking
captionpos=b, % sets the caption-position to bottom
commentstyle=\itshape\color{Blue}, % comment style
escapeinside={\%*}{*)}, % if you want to add LaTeX within your code
extendedchars=true, % lets you use non-ASCII characters;
for 8-bits encodings only, does not work with UTF-8
frame=trBL, % adds a frame around the code
frameround=fttt,
keepspaces=true, % keeps spaces in text, useful for
keeping indentation of code (possibly needs columns=flexible)
classoffset=0,
keywordstyle=\color{RoyalBlue}, % keyword style
deletekeywords={function,endfunction, if,endif},
classoffset=1,
morekeywords={function,endfunction, if,endif},
keywordstyle=\bf\color{Red}, % keyword style
classoffset=2,
morekeywords={persistent}, % if you want to add more
keywords to the set
keywordstyle=\bf\color{ForestGreen}, % keyword style
classoffset=0,
literate={/}{{{\color{Mahogany}/}}}1 {*}{{{\color{Mahogany}*}}}1
{.*}{{{\color{Mahogany}.*}}}2 {+}{{{\color{Mahogany}+{}}}}1
{=}{{{\bf\color{Mahogany}=}}}1 {-}{{{\color{Mahogany}-}}}1
{[}{{{\bf\color{RedOrange}[}}}1 {]}{{{\bf\color{RedOrange}]}}}1,
numbers=left, % where to put the line-numbers;
possible values are (none, left, right)
numbersep=6pt, % how far the line-numbers are from the code
numberstyle=\tiny\color{mygray}, % the style that is used for the line-numbers
rulecolor=\color{black}, % if not set, the frame-color may be
changed on line-breaks within not-black text (e.g. comments (green
here))
showspaces=false, % show spaces everywhere adding
particular underscores; it overrides 'showstringspaces'
showstringspaces=false, % underline spaces within strings only
showtabs=false, % show tabs within strings adding
particular underscores
stepnumber=2, % the step between two line-numbers.
If it's 1, each line will be numbered
stringstyle=\color{mymauve}, % string literal style
tabsize=2, % sets default tabsize to 2 spaces
title=\lstname % show the filename of files included
with \lstinputlisting; also try caption instead of title
}
Maybe a dedicated octave style is even better... who knows.