diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/algorithmicx/algmatlab.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/algorithmicx/algmatlab.sty | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/algorithmicx/algmatlab.sty b/Master/texmf-dist/tex/latex/algorithmicx/algmatlab.sty new file mode 100644 index 00000000000..be33bf10b17 --- /dev/null +++ b/Master/texmf-dist/tex/latex/algorithmicx/algmatlab.sty @@ -0,0 +1,75 @@ +% Matlab ALGORITHMIC STYLE -- Released 18 MAR 2004 +% 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}% +% +\def\ALG@setmatlab{t}% +\DeclareOption{noset}{\def\ALG@setmatlab{}}% +\DeclareOption{set}{\def\ALG@setmatlab{t}}% +\ProcessOptions% +% +% *** DECLARATIONS *** +% +\algnewlanguage{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{LSxN}[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 *** +% +\def\ALG@beginalgorithmic{\let\leftbr[\let\rightbr]\def\[{\textbf{\leftbr}}\def\]{\textbf{\rightbr}}}% +% +% +% +\ifthenelse{\equal{\ALG@setmatlab}{t}}{\alglanguage{matlab}}{}% +\let\ALG@setmatlab\relax% +% |