% Matlab ALGORITHMIC STYLE -- Released 27 APR 2005 % for LaTeX version 2e % % Copyright Szasz Janos % E-mail szaszjanos@users.sourceforge.net % \NeedsTeXFormat{LaTeX2e}% \ProvidesPackage{algmatlab}% \RequirePackage{ifthen}% \RequirePackage{algorithmicx}% \typeout{Document Style - matlab environments for use with the `algorithmicx' style}% % \ProcessOptions% % % *** DECLARATIONS *** % \algnewlanguage{matlab}% \alglanguage{matlab}% % % *** KEYWORDS *** % \newcommand\textkeyword{\textbf} \newcommand\textfunc{\texttt} % % *** DECLARED LOOPS *** % \algdef{SE}[WHILE]{While}{End}[1]{\textkeyword{while}\ #1}{\textkeyword{end}}% \algdef{Se}[FOR]{For}{End}[1]{\textkeyword{for}\ #1}% \algdef{Se}[IF]{If}{End}[1]{\textkeyword{if}\ #1}% \algdef{C}[IF]{IF}{ElseIf}[1]{\textkeyword{else}\textkeyword{if}\ #1}% \algdef{Ce}[ELSE]{IF}{Else}{End}{\textkeyword{else}}% \algdef{LSxnE}[FUNCTION]{Function}{End}{65535}% [2]{\textkeyword{function}\ \textfunc{#1}\ifthenelse{\equal{#2}{}}{}{(#2)}}% % \algdef{SxE}[SWITCH]{Switch}{End}[1]{\let\Case\ALG@thecase\textkeyword{switch}\ #1}% {\textkeyword{end}}% \algdef{LS}[CASE]{Case}{65535}[1]{\let\Case\Case@continue\textkeyword{case}\ #1:}% \let\ALG@thecase\Case% \algdef{LxC}[CASE]{CASE}{Case@continue}{65535}[1]{\let\Case\Case@continue\textkeyword{case}\ #1:}% \algdef{LC}[OTHERWISE]{CASE}{Otherwise}{65535}{\textkeyword{otherwise}:}% % \renewcommand\algorithmiccomment[1]{\hskip 1.5em\textit{\% #1}}% % \newcommand\algnewfunction[2]% {% \expandafter\newcommand\csname #1\endcsname[1]{\textfunc{#2}\((\)##1\()\)}% }% % \algnewfunction{Line}{line}% \algnewfunction{Scatter}{scatter}% \algnewfunction{Plot}{plot}% \algnewfunction{Zeros}{zeros}% \algnewfunction{Ones}{ones}% \algnewfunction{Load}{load}% \algnewfunction{Size}{size}% \algnewfunction{Disp}{disp}% \algnewfunction{Min}{min}% \algnewfunction{Max}{max}% % \def\Break{\textkeyword{break}}% \def\Return{\textkeyword{return}}% \def\Global{\textkeyword{global}}% \def\Hold#1{\textkeyword{hold} #1}% % % *** OTHER DECLARATIONS *** % \algrenewcommand\ALG@beginalgorithmic{\let\leftbr[\let\rightbr]\def\[{\textbf{\leftbr}}\def\]{\textbf{\rightbr}}}% %