summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/algorithmicx/algmatlab.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/algorithmicx/algmatlab.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/algorithmicx/algmatlab.sty')
-rw-r--r--macros/latex/contrib/algorithmicx/algmatlab.sty68
1 files changed, 68 insertions, 0 deletions
diff --git a/macros/latex/contrib/algorithmicx/algmatlab.sty b/macros/latex/contrib/algorithmicx/algmatlab.sty
new file mode 100644
index 0000000000..e274a7dfa9
--- /dev/null
+++ b/macros/latex/contrib/algorithmicx/algmatlab.sty
@@ -0,0 +1,68 @@
+% 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}}}%
+%