von bloodworks » Fr 26. Okt 2012, 12:15
In Anlehnung an den Standard Stil von ML 2011. Dein Hauptproblem ist aber, dass deine Zeilen zu lang sind für eine Seite. Da musst du dann halt überlgen wie du das machen willst. (Wobei ich mich ernsthaft frage wie man mit Matlab so eine Definitionsorgie hinbekommt. Im Normalfall reicht es aus die Matrix einmal zu definieren.)
\documentclass{article}
\usepackage{xcolor, showframe}
\definecolor{mlgreen}{rgb}{.035,.6,.251}
\definecolor{mlviolett}{rgb}{.643,.259,.804}
\usepackage{listings}
\lstdefinestyle{mlab}{language=Matlab, numbers=left, numberstyle=\tiny,%5
basicstyle={\ttfamily},%
keywordstyle={\color{blue}},%
commentstyle=\color{mlgreen},%
stringstyle=\color{mlviolett},%
breaklines=true,
} %
\begin{document}
\begin{lstlisting}[style=mlab, caption=Beispielcode]{Name}
function [X,U] = Test(e)
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
X = 3*e;
U = e/2;
% definigs range
x=[-2:.1:2];
% computing y
y=x.^2;
%2d plot
plot(x,y)
disp('done')
\end{lstlisting}
\end{document}
In Anlehnung an den Standard Stil von ML 2011. Dein Hauptproblem ist aber, dass deine Zeilen zu lang sind für eine Seite. Da musst du dann halt überlgen wie du das machen willst. (Wobei ich mich ernsthaft frage wie man mit Matlab so eine Definitionsorgie hinbekommt. Im Normalfall reicht es aus die Matrix einmal zu definieren.)
[code]\documentclass{article}
\usepackage{xcolor, showframe}
\definecolor{mlgreen}{rgb}{.035,.6,.251}
\definecolor{mlviolett}{rgb}{.643,.259,.804}
\usepackage{listings}
\lstdefinestyle{mlab}{language=Matlab, numbers=left, numberstyle=\tiny,%5
basicstyle={\ttfamily},%
keywordstyle={\color{blue}},%
commentstyle=\color{mlgreen},%
stringstyle=\color{mlviolett},%
breaklines=true,
} %
\begin{document}
\begin{lstlisting}[style=mlab, caption=Beispielcode]{Name}
function [X,U] = Test(e)
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
a = 1; b=2; c=3; d=4; e=5; f=6; g=7;a = 1; b=2; c=3; d=4; e=5; f=6;
X = 3*e;
U = e/2;
% definigs range
x=[-2:.1:2];
% computing y
y=x.^2;
%2d plot
plot(x,y)
disp('done')
\end{lstlisting}
\end{document}
[/code]