%% %% This is file `ccalgo.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% cc.dtx (with options: `ccalgo,chartab') %% %% Copyright 2000-2012 %% Michael N"usken, Joachim von zur Gathen, computational complexity %% %% IMPORTANT NOTICE: %% %% This is a generated file. It is part of the %% computational complexity macro package %% derived from cc.dtx by 'tex cc.ins'. %% See cc.dtx for license information. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e}[1995/12/01] \ProvidesPackage{ccalgo}[2005/08/27 v2.05 algorithm environment for cc. Michael Nuesken, Bonn.] \let\namedalgorithm\@undefined \let\endnamedalgorithm\@undefined \let\algorithm\@undefined \let\endalgorithm\@undefined {\def\algonumerate@item[#1]{% \if@noparitem \@donoparitem \else \if@inlabel \indent \par \fi \ifhmode \unskip\unskip \par \fi \if@newlist \if@nobreak \@nbitem \else \addpenalty\@beginparpenalty \addvspace\@topsep \addvspace{-\parskip}% \fi \else \addpenalty\@itempenalty \addvspace\itemsep \fi \global\@inlabeltrue \fi \everypar{% \@minipagefalse \global\@newlistfalse \if@inlabel \global\@inlabelfalse {\setbox\z@\lastbox \ifvoid\z@ \kern-\itemindent \fi}% \box\@labels \penalty\z@ \fi \if@nobreak \@nobreakfalse \clubpenalty \@M \else \clubpenalty \@clubpenalty \everypar{}% \fi}% \if@noitemarg \@noitemargfalse \if@nmbrlist \refstepcounter\@listctr \fi \fi \sbox\@tempboxa{\makelabel{#1}}% \global\setbox\@labels\hbox{% \unhbox\@labels \hskip \itemindent \hskip -\labelwidth \hskip -\labelsep \ifdim \wd\@tempboxa >\labelwidth \box\@tempboxa \else \hbox to\labelwidth {\unhbox\@tempboxa}% \fi \hskip \labelsep}% \ignorespaces} \ifx\algonumerate@item\@item\else \PackageWarningNoLine{ccalgo}{% Command \protect\@item\space has changed.\MessageBreak Check if current package is valid} \fi} \RequirePackage{ccaux} \RequirePackage{theorem}[1995/11/23 v2.2c] \RequirePackage{thcc} \RequirePackage{relabel} \def\list@parshape{% \parshape \@ne \@totalleftmargin \linewidth} \newdimen\reinit@list@last \def\reinit@list#1{% \advance\itemindent\reinit@list@last \advance\@totalleftmargin-\reinit@list@last \advance\linewidth\reinit@list@last \global\reinit@list@last#1\relax \ifdim\reinit@list@last>\algonumerate@maxindent \global\reinit@list@last\algonumerate@maxindent\fi \advance\itemindent-\reinit@list@last \advance\@totalleftmargin\reinit@list@last \advance\linewidth-\reinit@list@last \list@parshape} \def\reinit@list@label{% \reinit@list{\wd\@tempboxa}% } \newcommand{\makealgolabel}[1]{#1.} \newcommand{\makeoptalgolabel}[1]{(#1)} \let\makeoptalgocurrentlabel\makeoptalgolabel \newcounter{algonumerate} \defprefix{algonumerate}{} \newcount\algonumerate@items \renewcommand{\thealgonumerate}{% \expandafter\ifnum\value{algonumerate}<\@ne \algonumfield% \else \arabic{algonumerate}\fi}% \def\algonumfield{\ignorespaces \ifx\@algonumfield\relax\else \expandafter\@algonumfield\csname c@algonumerate\endcsname\fi \unskip} \newif\if@speciallabel \newcommand{\labelalgonumerate}{% \count@\value{algonumerate}% \ifnum\count@<\z@ \algonumfield% \else \makealgolabel{\thealgonumerate}% \fi }% \newdimen\algo@labelsep \newdimen\steplabelwidth \newtoks\AtNextItem \newtoks\AtNextNumberedItem \newif\if@noitemargcopy \let\orig@item\item \def\item{\@ifnextchar[{\@noitemargcopyfalse\orig@item}{\@noitemargcopytrue\orig@item}} \newcount\last@algolabeltype \newcount\this@algolabeltype \newcommand{\algonumerate@label}[1]{% \expandafter\count@\value{algonumerate}% \if@noitemargcopy \ifnum\count@<\z@ \let\next\algonumerate@labelautomatic \global\last@algolabeltype\this@algolabeltype \global\this@algolabeltype\m@ne \else \let\next\algonumerate@labelnumber \global\last@algolabeltype\this@algolabeltype \global\this@algolabeltype\@ne \fi \else \def\@tempa{#1}% \ifx\@tempa\@empty \let\next\algonumerate@labelempty \global\last@algolabeltype\this@algolabeltype \global\this@algolabeltype\tw@ \else \let\next\algonumerate@labelexplicit \global\last@algolabeltype\this@algolabeltype \global\this@algolabeltype\z@ \fi \fi\next{#1}} \newcommand{\algonumerate@makelabelexplicit}[1]{% #1:\hskip\algo@labelsep% } \newcommand{\algonumerate@makelabelempty}[1]{% \hskip\steplabelwidth\hskip\algo@labelsep% } \newcommand{\algonumerate@makelabelautomatic}[1]{% #1:\hskip\algo@labelsep% } \newcommand{\algonumerate@makelabelnumber}[1]{% \hb@xt@\steplabelwidth{\hss #1% }\hskip\algo@labelsep% } \newcommand{\algonumerate@postprocess}[1]{% \expandafter\count@\value{algonumerate}% \ifnum\last@algolabeltype<\@ne \ifnum\this@algolabeltype=\@ne \medskip \fi \fi #1% \global\let\latest@item@currentlabel\@currentlabel \global\let\latest@item@bare@currentlabel\@bare@currentlabel \ifnum\count@=\m@ne \stepcounter{algonumerate}% \fi \global\@speciallabeltrue \the\AtNextItem \global\AtNextItem{}% \ifnum\this@algolabeltype=\@ne \the\AtNextNumberedItem \global\AtNextNumberedItem{}% \fi \reinit@list@label } \newcommand{\algonumerate@labelexplicit}[1]{% For algorithm i/o \algonumerate@makelabelexplicit{#1}% \global\let\algonumerate@global\global \gdef\global{\algonumerate@global\let\global\algonumerate@global \algonumerate@postprocess{% \protected@edef\@currentlabel{\csname p@\@listctr\endcsname {\makeoptalgocurrentlabel{#1}}}% \protected@edef\@bare@currentlabel{#1}% }% \global}% } \newcommand{\algonumerate@labelempty}[1]{% For algorithm i/o \algonumerate@makelabelempty{}% \global\let\algonumerate@global\global \gdef\global{\algonumerate@global\let\global\algonumerate@global \algonumerate@postprocess{}% \global}% } \newcommand{\algonumerate@labelautomatic}[1]{% For algorithm steps \algonumerate@makelabelautomatic{#1}% \global\let\algonumerate@global\global \gdef\global{\algonumerate@global\let\global\algonumerate@global \algonumerate@postprocess{% \protected@edef\@currentlabel{\csname p@\@listctr\endcsname {\makeoptalgocurrentlabel{#1}}}% \protected@edef\@bare@currentlabel{#1}% }% \global}% } \newcommand{\algonumerate@labelnumber}[1]{% For algorithm steps \algonumerate@makelabelnumber{#1}% \global\let\algonumerate@global\global \gdef\global{\algonumerate@global\let\global\algonumerate@global \algonumerate@postprocess{}% \global}% } \newdimen\algonumerate@maxindent \newdimen\@algolongestlabel \AtBeginDocument{\ifdim\algonumerate@maxindent=\z@ \algonumerate@maxindent.2\textwidth\fi} \def\algonumerateinit#1{% \setcounter{algonumerate}{-1}% \this@algolabeltype=\@M \@algolongestlabel\z@ \def\@algonumfield{}% \let\ccorg@or\or\let\or\relax \algonumerate@items\z@ \@for\@tempa:=#1\do{% \advance\algonumerate@items\@ne \@temptokena\expandafter{\@tempa}% \toks@\expandafter{\@algonumfield}% \edef\@algonumfield{\the\@temptokena\or\the\toks@}% \setbox\@tempboxa\hbox{\algonumerate@makelabelautomatic{\the\toks@}}% \ifdim\wd\@tempboxa>\@algolongestlabel\relax \@algolongestlabel\wd\@tempboxa\fi }% \let\or\ccorg@or \toks@\expandafter{\@algonumfield}% \edef\@algonumfield##1{\noexpand\ifcase-##1\noexpand\or \the\toks@\noexpand\fi}% } \newenvironment{algonumerate}{% \if@inlabel~\fi\par \list{\labelalgonumerate}{% \usecounter{algonumerate}% \let\makelabel\algonumerate@label \parsep\z@% \topsep\z@% \itemsep\z@% \parskip\z@% \leftmargin\labelsep \algo@labelsep\z@ \settowidth\steplabelwidth{\makealgolabel{99}}% \labelwidth\z@ \global\reinit@list@last\z@ }% \setcounter{algonumerate}{-\algonumerate@items}% \ifnum\algonumerate@items>\z@ \addtocounter{algonumerate}\m@ne \fi \setcounter{block@cnt}\z@ \let\step\algo@step \let\block\algo@block \let\endblock\endalgo@block \let\range\algo@range \let\endrange\endalgo@range \let\indention\algo@indention \let\endindention\endalgo@indention \let\body\algo@block \let\endbody\endalgo@block \let\meta\algo@meta \let\endmeta\endalgo@meta \def\skipremainingspecialitems{\setcounter{algonumerate}{0}}% }{% \endlist\vskip\topskip} \newdimen\blockindent \blockindent\parindent \newcounter{block@cnt} \newcommand{\nextblock}{% \stepcounter{block@cnt}\edef\currentblock{\arabic{block@cnt}}% } \newif\if@trivialrange \newcommand{\refsetrange}[2]{% {\shortlabeltrue \let\index\relax \let\@tempa\relax \protected@edef\@tempa{% \csname r@\the\algorithmmasterkey-#1\endcsname}% \let\@tempc\relax \protected@edef\@tempc{% \csname r@\the\algorithmmasterkey-#2\endcsname}% \ifx\@tempa\@tempc\global\@trivialrangetrue \else\global\@trivialrangefalse\fi }% \if@trivialrange \protected@edef\@currentlabel{}% \else \protected@edef\@currentlabel{% \csname p@\@listctr\endcsname{% \protect\short\protect\ref{\the\algorithmmasterkey-#1}% --% \protect\short\protect\ref{\the\algorithmmasterkey-#2}% }}% \fi \protected@edef\@bare@currentlabel{% \protect\bare\protect\ref{\the\algorithmmasterkey-#1}% --% \protect\bare\protect\ref{\the\algorithmmasterkey-#2}% }% } \newenvironment{algo@range}{% \par \stepcounter{block@cnt}\edef\block@{\arabic{block@cnt}}% \refsetrange{bob\block@}{eob\block@}% \AtNextNumberedItem{\algolabel{bob\block@}}% }{% \algolabel{eob\block@}% \par \global\let\algo@block@currentlabel\@currentlabel \global\let\algo@block@bare@currentlabel\@bare@currentlabel \aftergroup\algo@endrange@aftergroup } \def\algo@endrange@aftergroup{% \let\@currentlabel\latest@item@currentlabel \let\@bare@currentlabel\latest@item@bare@currentlabel } \newdimen\indention@reinit@list@last \newenvironment{algo@indention}{% \par \indention@reinit@list@last\reinit@list@last \advance\leftmargin\blockindent \advance\labelsep\blockindent \advance\@totalleftmargin\blockindent \advance\linewidth-\blockindent \def\algo@indention@undo{% \reinit@list{\indention@reinit@list@last}% \advance\leftmargin-\blockindent \advance\labelsep-\blockindent \advance\@totalleftmargin-\blockindent \advance\linewidth\blockindent } \list@parshape }{% \par \algo@indention@undo \list@parshape \aftergroup\list@parshape \global\let\algo@block@currentlabel\@currentlabel \global\let\algo@block@bare@currentlabel\@bare@currentlabel \aftergroup\algo@endrange@aftergroup } \newif\ifindented@block \newenvironment{algo@block}{% \algo@indention \algo@range}{% \endalgo@range \endalgo@indention } \newdimen\meta@indent \newenvironment{algo@meta}{% \@newlistfalse \vskip\topskip \par \meta@indent\@totalleftmargin \advance\labelsep-\meta@indent \advance\@totalleftmargin-\meta@indent \advance\linewidth\meta@indent \advance\leftmargin-\meta@indent \list@parshape }{% \vskip\topskip \par \advance\labelsep\meta@indent \advance\@totalleftmargin\meta@indent \advance\linewidth-\meta@indent \advance\leftmargin\meta@indent \aftergroup\list@parshape } \newcommand{\algo@step}[2][]{% \expandafter\ifnum\value{algonumerate}<\m@ne \PackageError{ccalgo}{Missing \protect\item}{}% \fi \cc@ifempty{#1}{\item}{\item[#1]}% \def\@tempa{#2}\ifx\@tempa\@empty\else\algolabel{#2}\fi% } \newtoks\algotitle \theorembodyfont{}% \theoremstyle{ccalgonn} \newtheorem{named@lg@r@thm*}{\the\algotitle} \defprefix{named@lg@r@thm*}#1{\the\algotitle} \theoremstyle{ccalgo} \newtheorem{named@lg@r@thm}{\the\algotitle} \defprefix{named@lg@r@thm}#1{\the\algotitle~#1} \ifx\c@namedth@@r@m\@undefined\else \let\c@named@lg@r@thm\c@namedth@@r@m \let\thenamed@lg@r@thm\thenamedth@@r@m \fi \babel\def\babelInput{Input}[german=Eingabe,french=Entr\'ee] \babel\def\babelOutput{Output}[german=Ausgabe,french=Sortie] \babel\def\babelstep{step}[german=Schritt,french=pas]%% ??? pas? \babel\def\babelStep{Step}[german=Schritt,french=Pas]%% ??? pas? \newtoks\algorithmmasterkey \newenvironment{namedalgorithm}[1]{% \pagebreak[3]% \def\algo@theorem{named@lg@r@thm}% \algotitle{#1}% \n@medalgorithm} {\endalgonumerate\csname end\algo@theorem\endcsname} \newenvironment{namedalgorithm*}[1]{% \def\algo@theorem{named@lg@r@thm*}% \algotitle{#1}% \n@medalgorithm} {\endalgonumerate\csname end\algo@theorem\endcsname} \newcommand{\n@medalgorithm}[1][\babelInput,\protect\babelOutput]{% \algonumerateinit{#1}% \n@m@d@lgorithmgetlongestlabel} \newcommand{\n@m@d@lgorithmgetlongestlabel}[1][]{% \def\@tempa{#1}% \ifx\@tempa\@empty\else \setbox\@tempboxa\hbox{\algonumerate@makelabel{#1}}% \ifdim\wd\@tempboxa>\@algolongestlabel\relax \@algolongestlabel\wd\@tempboxa\fi \fi \n@m@d@lgorithmgetmasterkey } \newcommand{\n@m@d@lgorithmgetmasterkey}[1]{% \algorithmmasterkey{#1}% \edef\@tempa{\the\algorithmmasterkey}\ifx\@tempa\@empty \PackageError{ccalgo}{Empty key for algorithm like environment}{}\fi% \n@m@d@lgorithm } \newcommand{\n@m@d@lgorithm}[1][]{% \def\@tempa{#1}% \ifx\@tempa\@empty\csname\algo@theorem\endcsname \else\csname\algo@theorem\endcsname[#1]\fi% \label{\the\algorithmmasterkey}% \algo@keywords \defprefix{algonumerate}{% \Iflabelchanged{\algo@theorem}{\uselabel{\algo@theorem} % \ifnum\c@algonumerate>\z@ \babelstep~\fi}}% \algonumerate }% \def\algolabel#1{\label{\the\algorithmmasterkey-#1}}% \newcommand{\stepref}[2]{\babelStep~\short\ref{#1-#2} in \whole\ref{#1}} \newcommand{\newalgorithm}[2]{% \def\newalgo@name{#1}% \def\newalgo@title{#2}% \n@walgorithm} \newcommand{\n@walgorithm}[1][\babelInput,\protect\babelOutput]{% \protected@edef\@tempa{% \noexpand\newenvironment{\newalgo@name}% {\noexpand\namedalgorithm{\newalgo@title}[\noexpand#1]}% {\noexpand\endnamedalgorithm}% \noexpand\newenvironment{\newalgo@name*}% {\noexpand\csname namedalgorithm*\endcsname {\newalgo@title}[\noexpand#1]}% {\noexpand\csname endnamedalgorithm*\endcsname}% }\@tempa } \babel\def\algorithmname{Algorithm}[% german=Algorithmus,french=Algorithme] \newalgorithm{algorithm}{\protect\algorithmname} \def\algo@keywords{% \def\keyword##1{\textsf{##1} \ignorespaces}% \babel\def\FOR{\keyword{For}}[german=\keyword{F{\"{u}}r}]% \babel\def\DO{\keyword{do}}[german=\keyword{erledige}]% \babel\def\endFOR{}[]% \babel\def\WHILE{\keyword{While}}[german=\keyword{Solange}]% \babel\def\endWHILE{}[]% \babel\def\REPEAT{\keyword{Repeat}}[german=\keyword{Wiederhole}]% \babel\def\UNTIL{\keyword{Until}}[german=\keyword{Bis}]% \babel\def\IF{\keyword{If}}[german=\keyword{Falls}]% \babel\def\THEN{\keyword{then}}[german=\keyword{dann}]% \babel\def\ELIF{\keyword{Else if}}[german=\keyword{Sonst wenn}]% \babel\def\ELSE{\keyword{Else}}[german=\keyword{Sonst}]% \babel\def\endIF{}[]% \babel\def\CALL{\keyword{Call}}[german=\keyword{Rufe}]% \babel\def\RETURN{\keyword{Return}}[german=\keyword{Antworte}]% \def\@tempa{nohyphenation}\ifx\languagename\@tempa\else% \expandafter\selectlanguage\expandafter{\languagename}\fi% \def\COMMENT##1{$\{$ ##1 $\}$}% } \newcommand{\optitem}[1]{% \cc@ifempty{#1}{\if@inlabel\par\else\item\fi}{\item[#1]}% } \newcommand{\algoprettify}[3]{% \setbox2\hbox{#1}% \setbox4\hbox{#2}% \setbox6\hbox{#3}% \setbox0\hbox{\unhcopy2\unhcopy4{ }\unhcopy6}% \ifdim\wd0<\linewidth \unhbox0 \else \dimen0=\linewidth \advance\dimen0 by -\wd2 \unhbox2\parbox[t]{\dimen0}{\unhbox4\strut}\par\unhbox6 \fi } \newenvironment{ifblock}[2][] {% \optitem{#1}% \nextblock \algolabel{if\currentblock}% \algoprettify{\IF}{#2}{\THEN} \indention \refsetrange{if\currentblock}{endif\currentblock}% } {% \algolabel{endif\currentblock}% \endindention} \newenvironment{elifblock}[2][]{% \optitem{#1}% \nextblock \algoprettify{\ELIF}{#2}{\THEN} \algolabel{elif\currentblock}% \indention \refsetrange{elif\currentblock}{endelif\currentblock}% }{% \algolabel{endelif\currentblock}% \endindention} \newenvironment{elseblock}[1][]{% \optitem{#1}% \nextblock \ELSE% \algolabel{else\currentblock}% \indention \refsetrange{else\currentblock}{endelse\currentblock}% }{% \algolabel{endelse\currentblock}% \endindention} \newenvironment{forblock}[2][]{% \optitem{#1}% \nextblock \algoprettify{\FOR}{#2}{% \DO \short\ref{\the\algorithmmasterkey-body\currentblock}}% \algolabel{for\currentblock}% \block\algolabel{body\currentblock}% \refsetrange{for\currentblock}{endfor\currentblock}% }{% \algolabel{endfor\currentblock}% \endblock} \newenvironment{whileblock}[2][]{% \optitem{#1}% \nextblock \algoprettify{\WHILE}{#2}{% \DO \short\ref{\the\algorithmmasterkey-body\currentblock}}% \algolabel{while\currentblock}% \block \algolabel{body\currentblock}% \refsetrange{while\currentblock}{endwhile\currentblock}% }{% \algolabel{endwhile\currentblock}% \endblock} \newenvironment{untilblock}[2][]{% \optitem{#1}% \nextblock \algoprettify{\UNTIL}{#2}{% \DO \short\ref{\the\algorithmmasterkey-body\currentblock}}% \algolabel{until\currentblock}% \block \algolabel{body\currentblock}% \refsetrange{until\currentblock}{enduntil\currentblock}% }{% \algolabel{enduntil\currentblock}% \endblock} \newenvironment{blockuntil}[2][]{% \optitem{#1}% \nextblock \def\repeat@cond{#2}% \REPEAT \short\ref{\the\algorithmmasterkey-body\currentblock}% \algolabel{repeat\currentblock}% \block \algolabel{body\currentblock}% \refsetrange{repeat\currentblock}{endrepeat\currentblock}% }{% \endblock \item \algolabel{endrepeat\currentblock}% \algoprettify{\UNTIL}{\repeat@cond}{}} \newenvironment{blockwhile}[2][]{% \optitem{#1}% \nextblock \def\repeat@cond{#2}% \REPEAT \short\ref{\the\algorithmmasterkey-body\currentblock}% \algolabel{repeat\currentblock}% \block \algolabel{body\currentblock}% \refsetrange{repeat\currentblock}{endrepeat\currentblock}% }{% \endblock \item \algolabel{endrepeat\currentblock}% \algoprettify{\WHILE}{\repeat@cond}{}} \endinput %% %% End of file `ccalgo.sty'.