% state.cd % Anders G S Svensson % Source: state.nw % $Revision: 1.17 $ % $Date: 1996/02/22 10:00:43 $ \usecarrot{environ} \def\state@newstatement@#1#2{% \@def@{#1captionu}{% \@cs@{state@caption@\@cs@{state@style@#1}}{#1}{#2}{}} \state@newst@tement@{#1}{#2}\state@beginstate@} \let\newstatement\state@newstatement@ \def\state@newst@tement@#1#2#3{% \state@initstatement@{#1}{#2} \state@statecsdef@{#1}{#3}\state@endstate@ \@ifnext@<{\state@skip@{pre}{#1}% {\state@skip@{post}{#1}{}}}% {}} \DeclareOption{block} {\def\state@statecsdef@#1#2#3{% \Bdef*{#1}{#2{#1}}\Edef*{#1}{#3{#1}}}} \DeclareOption{environ} {\def\state@statecsdef@#1#2#3{% \Bdef{#1}{#2{#1}}\Edef{#1}{#3{#1}}}} \IfOption{environ}{}{\Option{block}} \def\state@skip@#1#2#3<#4>{\relax \@ifempty@{#4}{#3}{% \@def@{state@#1skip@#2}{\@s@\z@\@sum@\@s@#4+@\vskip\@s@}#3}} \def\state@initstatement@#1#2{% \@def@{state@style@#1}{\state@style@def@ult}% \@def@{state@preskip@#1}{% \@s@\z@ \expandafter\@sum@ \expandafter\@s@\defaultprestatementskip+@\vskip\@s@} \@def@{state@postskip@#1}{% \@s@\z@ \expandafter\@sum@ \expandafter\@s@\defaultpoststatementskip+@\vskip\@s@} \@def@{state@prehook@#1}{\state@prehook@def@ult}% \@def@{state@posthook@#1}{\state@posthook@def@ult}% \@def@{state@captionhook@#1}{\state@captionhook@def@ult}% \@def@{state@bodyhook@#1}{\state@bodyhook@def@ult}% \@def@{#1tag}{\defaultstatementtag{#2}}% \@def@{#1paren}{\defaultstatementparen}% \@def@{#1plug}{\defaultstatementplug}} \def\state@define@#1[#2]{% \@define@{state@#1@#2}} \def\state@defvar@#1{\relax \@ifnextchar@[{\state@define@{#1}}{\state@define@{#1}[def@ult]}} \def\prestatementhook{\state@defvar@{prehook}} \def\poststatementhook{\state@defvar@{posthook}} \def\captionhook{\state@defvar@{captionhook}} \def\bodyhook{\state@defvar@{bodyhook}} \let\state@prehook@def@ult\relax \let\state@posthook@def@ult\relax \let\state@bodyhook@def@ult\relax \def\state@captionhook@def@ult{\bf} \def\defaultprestatementskip{-\lastskip+\medskipamount+-.5\parskip} \def\defaultpoststatementskip{\medskipamount+-.5\parskip} \def\defaultstatementparen#1{(#1)} \def\defaultstatementplug{\hskip.75em} \def\defaultstatementtag#1#2{#1 #2} \def\state@beginstate@#1{\par \begingroup \@cs@{state@prehook@#1}% \@cs@{state@preskip@#1}% \state@statenonum@{#1}{u}} \def\state@endstate@#1{\par \@cs@{state@posthook@#1}% \@cs@{state@postskip@#1}% \endgroup\ignorespaces} \def\state@statenonum@#1#2{% \@ifnextchar@[{\state@state@{#1}{#2}}{\state@state@{#1}{#2}[]}} \def\state@state@#1#2[#3]{\relax \state@statementcaption@{#1}{\@cs@{#1caption#2}{#3}}\ignorespaces} \def\state@statementcaption@#1#2{% {\@cs@{state@captionhook@#1}#2}\@cs@{state@bodyhook@#1}} \def\statementstyle{\relax \@ifnextchar@[\state@styleforclass@{\state@styleforclass@[def@ult]}} \def\state@styleforclass@[#1]{% \@afterassignment@{\state@checkstyle@{#1}}\@t@} \def\state@checkstyle@#1{% \@ifundefined@{state@caption@\the\@t@}% {\@Warning@{Unknown statement style: \the\@t@}}% {\@edef@{state@style@#1}{\the\@t@}}} \def\state@style@def@ult{post} \def\state@caption@post#1#2#3#4{% \noindent #2% \@ifempty@{#3}{}{\ #3}% \@ifempty@{#4}{}{\ \@cs@{#1paren}{#4}}\@cs@{#1plug}} \def\state@caption@pre#1#2#3#4{% \noindent\@ifempty@{#3}{}{#3\ }% #2% \@ifempty@{#4}{}{\ \@cs@{#1paren}{#4}}\@cs@{#1plug}} \def\state@caption@nlpost#1#2#3#4{% \noindent #2% \@ifempty@{#3}{}{\ #3}% \@ifempty@{#4}{}{\ \@cs@{#1paren}{#4}}\@cs@{#1plug}% \unskip\par\penalty10000\smallskip\noindent} \def\state@caption@nlpre#1#2#3#4{% \noindent \@ifempty@{#3}{}{#3\ }% #2% \@ifempty@{#4}{}{\ \@cs@{#1paren}{#4}}\@cs@{#1plug}% \unskip\par\penalty10000\smallskip\noindent} \def\state@caption@clpre#1#2#3#4{% {\parindent\z@ \leftskip=0pt plus 1fil \rightskip=0pt plus 1fil \parfillskip\z@ \@ifempty@{#3}{}{#3\ }% #2% \@ifempty@{#4}{}{\ \@cs@{#1paren}{#4}}\@cs@{#1plug}\par}% \unskip\par\penalty10000\smallskip\noindent} \def\state@caption@clpost#1#2#3#4{% {\parindent\z@ \leftskip=0pt plus 1fil \rightskip=0pt plus 1fil \parfillskip\z@ #2% \@ifempty@{#3}{}{\ #3}% \@ifempty@{#4}{}{\statementspace\@cs@{#1paren}{#4}}\@cs@{#1plug}% \unskip\par}% \penalty10000\smallskip\noindent} \def\state@newnumberstatement@{% \@ifnextchar@*% {\expandafter\state@newstatement@\@eat@}% \state@newstatementwithnumbers@} \def\state@newstatementwithnumbers@#1{% \@ifnextchar@[% {\state@newstatementwithin@{#1}}% {\state@newstatementwith@{#1}}} \def\state@newstatementwithin@#1[#2]#3{ \newcounter{#1}[#2] \@def@{#1caption}{% \@cs@{state@caption@\@cs@{state@style@#1}}{#1}{#3}{\@cs@{the#1}}} \@def@{#1captionu}{% \@cs@{state@caption@\@cs@{state@style@#1}}{#1}{#3}{}} \state@newst@tement@{#1}{#3}\state@beginnumstate@} \def\state@newstatementwith@#1#2{% \@def@{#1caption}{% \@cs@{state@caption@\@cs@{state@style@#1}}{#1}{#2}{\@cs@{the#1}}} \@def@{#1captionu}{% \@cs@{state@caption@\@cs@{state@style@#1}}{#1}{#2}{}} \@ifnextchar@[% {\state@newst@tementwith@{#1}{#2}}% {\newcounter{#1}\state@newst@tement@{#1}{#2}\state@beginnumstate@}} \def\state@newst@tementwith@#1#2[#3]{% \numberwith{#1}{#3}\state@newst@tement@{#1}{#2}\state@beginnumstate@} \def\state@beginnumstate@#1{\par \begingroup \@cs@{state@prehook@#1}% \@cs@{state@preskip@#1}% \@ifnextchar@*% {\@expandafter@{\state@statenonum@{#1}{u}}\@eat@}% {\stepcounter{#1}\def\currentcounter{#1}\state@statenonum@{#1}{}}} \DeclareOption{number} {\usecarrot{counter} \let\newstatement\state@newnumberstatement@}