Blame view
alg.sty
7.27 KB
1fbcbd399 first commit |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
%% %% This is file `alg.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% alg.dtx (with options: `package') %% %% IMPORTANT NOTICE: %% %% For the copyright see the source file. %% %% Any modified versions of this file must be renamed %% with new filenames distinct from alg.sty. %% %% For distribution of the original source see the terms %% for copying and modification in the file alg.dtx. %% %% This generated file may be distributed as long as the %% original source files, as listed above, are part of the %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) \def\filedate{13 March 2001} %% alg.dtx %% Copyright (c) 1995, 1999, 2001 Staffan Ulfberg \NeedsTeXFormat{LaTeX2e}[1996/12/01] \ProvidesPackage{alg} [2001/02/12] \RequirePackage{float, ifthen} ewlength{\algleftmarginwidth}\setlength{\algleftmarginwidth}{.5in} ewlength{\algrightmarginwidth}\setlength{\algrightmarginwidth}{.5in} ewlength{\alglinenowidth}\setlength{\alglinenowidth}{1.2cm} ewlength{\algtabwidth}\setlength{\algtabwidth}{.5cm} ewlength{\alg@fromleft} ewlength{\alg@tmplen} ewsavebox{\alg@tmpbox} ewcounter{alg@inmargin}\setcounter{alg@inmargin}{0} ewcounter{algline} ewboolean{alg@linenums} ewboolean{alg@nonumber} \def\alg@language{english} \@ifpackageloaded{babel}{ \iflanguage{english}{\def\alg@language{english}}{} \iflanguage{american}{\def\alg@language{american}}{} %\iflanguage{swedish}{\def\alg@language{swedish}}{} %\iflanguage{french}{\def\alg@language{french}}{} %\iflanguage{german}{\def\alg@language{german}}{}}{} \DeclareOption{english}{\def\alg@language{english}} \DeclareOption{american}{\def\alg@language{american}} %\DeclareOption{swedish}{\def\alg@language{swedish}} \DeclareOption{french}{\def\alg@language{french}} \DeclareOption{german}{\def\alg@language{german}} \ProcessOptions \ifthenelse{\equal{\alg@language}{english}}{ \def\alg@floatname{Algorithm} \def\alg@listname{List of Algorithms} \def\alg@descname{Description} \def\alg@inputname{Input} \def\alg@outputname{Output}}{} \ifthenelse{\equal{\alg@language}{american}}{ \def\alg@floatname{Algorithm} \def\alg@listname{List of Algorithms} \def\alg@descname{Description} \def\alg@inputname{Input} \def\alg@outputname{Output}}{} \ifthenelse{\equal{\alg@language}{swedish}}{ \def\alg@floatname{Algoritm} \def\alg@listname{Algoritmer} \def\alg@descname{Beskrivning} \def\alg@inputname{Input} \def\alg@outputname{Output}}{} \ifthenelse{\equal{\alg@language}{french}}{ \def\alg@floatname{Algorithme} \def\alg@listname{Liste des algorithmes} \def\alg@descname{Description} \def\alg@inputname{Entr\'{e}e} \def\alg@outputname{Sortie}}{} \ifthenelse{\equal{\alg@language}{german}}{ \def\alg@floatname{Algorithmus} \def\alg@listname{Algorithmenverzeichnis} \def\alg@descname{Beschreibung} \def\alg@inputname{Eingabe} \def\alg@outputname{Ausgabe}}{} ewcommand\floatc@alg[2]{{\bfseries\rmfamily \hspace{\algleftmarginwidth}#1:} #2\par} ewcommand\fs@alg{ \let\@fs@capt\floatc@alg \def\@fs@pre{}\def\@fs@post{}\def\@fs@mid{\vspace{3pt}} \let\@fs@iftopcapt\iftrue} \floatstyle{alg} ewfloat{algorithmfloat}{h}{loa} \floatname{algorithmfloat}{\alg@floatname} ewcommand{\listofalgorithms}{\listof{algorithmfloat}{\alg@listname}} ewcommand{\alg@margin} { \ifthenelse{\value{alg@inmargin}=0} { \advance\leftskip\algleftmarginwidth \advance\rightskip\algrightmarginwidth \alg@fromleft=\leftskip } {} \stepcounter{alg@inmargin} \parskip=0cm\parindent=0cm } ewcommand{\alg@unmargin} { \setcounter{alg@inmargin}{0}% \advance\leftskip-\algleftmarginwidth% \advance\rightskip-\algrightmarginwidth% } ewenvironment{algorithm}[1][H] { \begin{algorithmfloat}[#1]\alg@margin } { \alg@unmargin\end{algorithmfloat} } ewenvironment{alg@tab}[1] { \setboolean{alg@nonumber}{false}% \ifthenelse{\value{alg@inmargin}=0} {\vskip\baselineskip}{} \alg@margin \let\\=\alg@cr \catcode`\^^M=10 \setcounter{algline}{0}\refstepcounter{algline} \advance\leftskip#1 \alg@putlineno\ignorespaces } { \setbox\alg@tmpbox=\lastbox \ifhbox\alg@tmpbox{\vskip-\baselineskip}\else\par\fi \alg@unmargin \ifthenelse{\value{alg@inmargin}=0}{\vskip\baselineskip}{} } ewenvironment{algtab}[1][\alglinenowidth] { \setboolean{alg@linenums}{true}\begin{alg@tab}{#1} } {\end{alg@tab}} ewenvironment{algtab*}[1][0cm] { \setboolean{alg@linenums}{false}\begin{alg@tab}{#1} } {\end{alg@tab}} ewcommand{\alg@kill}{\setbox\alg@tmpbox=\lastbox% \ifvoid\alg@tmpbox\PackageError{alg}{Attempt to remove label in middle of line}\fi} ewcommand{\algbegin}[1][\algtabwidth]{\advance\leftskip#1% \alg@kill\alg@putlineno\ignorespaces} ewcommand{\algend}[1][\algtabwidth]{\advance\leftskip-1#1% \alg@kill\alg@putlineno\ignorespaces} ewcommand{\algnonumber}{\alg@kill\alg@putlabel{}% \setboolean{alg@nonumber}{true}\ignorespaces} ewcommand{\alg@cr}{\par\refstepcounter{algline}% \setboolean{alg@nonumber}{false}\alg@putlineno\ignorespaces} ewcommand{\alg@putlineno} {% \ifthenelse{\boolean{alg@linenums}} {% \ifthenelse{\boolean{alg@nonumber}}{\alg@putlabel{}} {% \alg@putlabel{(\arabic{algline})}}}% {\alg@putlabel{}}} ewcommand{\alg@putlabel}[1]{{% \alg@tmplen=\leftskip \advance\alg@tmplen-\alg@fromleft% \makebox[0cm][r]{\makebox[\alg@tmplen][l]{#1}}}} ewcommand{\algdescript}[1]{\alg@margin\textbf{\alg@descname: }#1\par} ewcommand{\alginout}[2]{\alg@margin\textbf{\alg@inputname: }#1\par \textbf{\alg@outputname: }#2\par} ewcommand{\algname}[2]{\alg@margin\textsc{#1}(#2)\par} ewcommand{\alglabel}[1]{% \ifthenelse{\boolean{alg@linenums}}{% \label{#1}}{\alg@kill\alg@putlabel{#1}}\ignorespaces} ewcommand{\algref}[1]{\ifthenelse{\boolean{alg@linenums}}% {\ref{#1}}{#1}} ewcommand{\algand}{\mbox{\textbf{and }}} ewcommand{\algbreak}{\textbf{break}} ewcommand{\algcall}[2]{\textsc{#1}(#2)} ewcommand{\algcase}[1]{\algend\textbf{case} #1\\\algbegin} ewcommand{\algcontinue}{\textbf{continue}} ewcommand{\algdefault}{\algend\textbf{default}\\\algbegin} ewcommand{\algelse}{\algend\textbf{else}\\\algbegin} ewcommand{\algelseif}[1]{\algelsif{#1}} ewcommand{\algelsif}[1]{\algend\textbf{else if} #1\\\algbegin} ewcommand{\algerror}{\textbf{error }} ewcommand{\algfalse}{\mbox{\textbf{false }}} ewcommand{\algforto}[2]{\textbf{for} #1 \textbf{to} #2\\\algbegin} ewcommand{\algforeach}[1]{\textbf{foreach} #1\\\algbegin} ewcommand{\alggoto}{\textbf{goto~}} ewcommand{\algif}[1]{\textbf{if} #1\\\algbegin} ewcommand{\algifthen}[2]{\textbf{if} #1 \textbf{then} #2\\} ewcommand{\algifthenelse}[3]{\setbox\alg@tmpbox= \hbox{\textbf{if} #1 }\copy\alg@tmpbox\textbf{then} #2\\ \settowidth{\alg@tmplen}{\box\alg@tmpbox}% \algbegin[\alg@tmplen]\textbf{else} #3\\ \algend[\alg@tmplen]} ewcommand{\algnot}{\mbox{\textbf{not }}} ewcommand{\algor}{\mbox{\textbf{or }}} ewcommand{\algpardo}{\mbox{\textbf{pardo}}} ewcommand{\algprint}{\textbf{print }} ewcommand{\algrepeat}{\textbf{repeat}\\\algbegin} ewcommand{\algreturn}{\textbf{return~}} ewcommand{\algswitch}[1]{\textbf{switch} #1\\\algbegin} ewcommand{\algtrue}{\mbox{\textbf{true }}} ewcommand{\alguntil}[1]{\algend\textbf{until} #1\ \\} ewcommand{\algwhile}[1]{\textbf{while} #1\\\algbegin} \endinput %% %% End of file `alg.sty'. |