%
%
\ifcat a\noexpand @\let\next\relax\else \def\next{%
\documentclass{kluwer}\usepackage{doc}\MakePercentIgnore}\fi\next
\NeedsTeXFormat{LaTeX2e}    
% \def\changes#1#2{}
% \changes{1997/07/10}{bugfix in title@thanks: move thanks into ititle@.}
% \changes{1997/07/10}{bugfix in opening: inserted hsize == textwidth. This
%               to enforce double width in abstract (twocolumn layouts)}
% \changes{1997/07/10}{changes in ititle@ to correct spacing of thanks. This
%    removed the need for title@@ and title@thanks: both removed}
% \changes{1997/07/10}{speccright etc. removed (never used)}
% \changes{1997/07/10}{crude vertical spacing fix for @arttype if copyrighthead}
% \changes{1998/01/06}{fix thispagestyle (crt. endup on 2nd page if abstract too long)}
% \changes{1998/02/04}{added new hooks: "beforeartskip", "titlebaselinefactor"}
% \changes{1998/02/04}{made "classification", "keywords", "abbreviations" and "nomenclature" long}
% \changes{1998/02/06}{force "email" lowercase}
% \changes{1998/02/06}{removed () around defaulted dates}
\def\filedate{1998/02/11}                                            
\def\filename{kluopen.sty}
%\DoNotIndex{\@M,\def,\c@secnumdepth,\baselineskip,\@pnumwidth,\else,\fi}
%\DoNotIndex{\newcommand,\z@,\relax,\renewcommand,\ifnum,\csname,\endcsname}
%\DoNotIndex{\baselineskip,\vskip,\hskip,\relax,\secdef,\refstepcounter}
%\DoNotIndex{\normalsize,\numberline,\protect,\endinput,\hfill}
%\DoNotIndex{\@compare,\ifx,\global,\gdef,\def,\let,\hbox,\par,\typeout}
%\CodelineIndex
%\newcommand{\Bs}{$\backslash$}
%\parindent=0pt
%\parskip=3pt
%\hfuzz=11pt
%\MakeShortVerb{\|}
%\setlength{\marginparwidth}{0in}
%\addtolength{\textwidth}{4pc}
%\begin{document}
%\begin{opening}
%\title{\filename}
%\date{\filedate}
%\author{Kluwer Academic Publishers\surname{}}
%\institute{~}
%\runningtitle{\filename\ -- \filedate}
%\runningauthor{Kluwer Academic Publishers}
%\editor{Test}
%\journalcode{test}
%\begin{abstract}
% This internal stylefile defines most of the special kluwer
% opening commands. 
%\end{abstract} 
%\end{opening}
%\tableofcontents
%\newpage\section{Implementation}
%    \begin{macrocode}
\ProvidesPackage{kluopen}[\filedate ]
%    \end{macrocode}
% \subsection{The opening environment}
% The beginning of this environment is rather empty, there is not much
% need to do anything here. All definitions inside the `opening' have
% to be indirect |\def|s anyway, so we will start worrying about
% typesetting things at the end of the environment. 
%
%    \begin{macrocode}
\gdef\title#1{\title@{#1}}
\gdef\author#1{\author@{#1}}
\gdef\date#1{\date@{#1}} 
\def\opening{%
  \let\title=\title@
  \let\author=\author@
  \let\date=\date@
  \let\arttype=\arttype@
  \let\subtitle=\subtitle@
  \let\dedication=\dedication@
  \let\translation=\translation@
  \let\received=\received@
  \let\orf=\orf@     
  \let\accepted=\accepted@
  \let\revised=\revised@
  \let\institute=\institute@ 
  \hsize\textwidth
  }
%    \end{macrocode}
% Since |\listfiles| is a definite `preambleonly' command, we can test
% for that. IF |\listfiles| = |\@notprerr| typeset opening, ELSE
% typeset opening at begin document. 
%
% If new commands are added to this list, don't forget to add them
% above too. Also, please gobble all arguments carefully. Als note
% that these redefinitions only take place if there is an |opening|
% environment. 
%
% The new syntax for |opening| is to use it {\it after\/}
% |\begin{document}| and/or |\begin{article}|, but we still honour the
% old syntax. Also, because I wanted to support |\maketitle| the
% ordinary way, |\maketitle| is |\let| to |\endopening|.     
%    \begin{macrocode}
\gdef\maketitle{\endopening}
\def\endopening{%
  \ifx\listfiles\@notprerr \maketitle@@ \else 
  \AtBeginDocument{\maketitle@@}\fi
  \gdef\title##1{\opening@only\title}
  \gdef\subtitle##1{\opening@only\subtitle}
  \gdef\orf##1{\opening@only\orf}
  \gdef\dedication##1{\opening@only\dedication}
  \gdef\translation##1{\opening@only\translation}
  \gdef\received##1{\opening@only\received}
  \gdef\revised##1{\opening@only\revised}
  \gdef\author##1{\opening@only\author}
  \gdef\institute##1{\opening@only\institute}
  \gdef\date##1{\opening@only\date}%
  \gdef\arttype##1{\opening@only\arttype}
  }
%    \end{macrocode}
% Let `opening only' == warning.
%    \begin{macrocode}
\def\opening@only#1{\PackageWarning{kluopen}{\string#1\space 
                effective only inside opening environment.}}
%    \end{macrocode}
% \subsection{Internal Author and institute commands}
% author and institute commands are seriously intertwined. Too bad
% about the relocation that used to happen in |humnkap|, because has
% been sacrificed again. It turned out be more of a fuzz than it was
% worth. 
%
% The general idea is to keep four different command lists that stack
% the authors and institutes. 
%
% Let's do the easy thing first. These are the `user' changeable
% parameters for authors and institutes. 
%    \begin{macrocode}
\def\authorsize{\normalsize \raggedright}
\def\authorcase#1{#1}                  
\def\authorindent{0pt}
\def\afterallauthorsskip{1em\relax}
\def\afterauthorskip{0pt}
\def\institutesize{\footnotesize\it}
\def\institutecase#1{#1}
\def\instituteindent{0pt}
\def\institutesep{.4\baselineskip}
\def\authorand{and}
%    \end{macrocode}
% This is a hook for klups.sty (oldstyle numerals)
%    \begin{macrocode}                           
\def\i@oldseries{}
%    \end{macrocode}
% 
% We only need |\@temptokenb|, because |\@temptokena| is a \LaTeX\
% scratch register.  
%    \begin{macrocode}
\newtoks\@temptokenb
%    \end{macrocode}
% The list will, for example, look like this:
%\begin{verbatim}
%\@authors == {\@k@p {A. \surname{Thor}}\@k@p {B. \surname{Thor}}} 
%\end{verbatim}
%    \begin{macrocode}
\long\def\append@item#1\to#2{%
  \@temptokena={\@k@p{#1}}%
  \@temptokenb=\expandafter{#2}%
  \xdef#2{\the\@temptokenb\the\@temptokena}}
%    \end{macrocode}
% Extraction macros. Typical usage: 
%
%\begin{verbatim}
%\get@left\@instituteauthors\to\@curauths
%\end{verbatim}
%
% This will expand into: 
%
%\begin{verbatim}
%\g@l\@k@p \ITEM1\@k@p \ITEM2 ...\g@l \@instituteauthors \@curauths
%\end{verbatim} 
%
% And from there into
%
%\begin{verbatim}
%\def\@curauths \ITEM1 \def\@institeauthors{\ITEM2 ...}
%\end{verbatim}
%
% Gee, this looks so easy if you write it out :-). 
%    \begin{macrocode}
\def\get@left#1\to#2{\expandafter\g@l#1\g@l#1#2}
\long\def\g@l\@k@p#1#2\g@l#3#4{\def#4{#1}\def#3{#2}}
%    \end{macrocode}
% This will contain the authors for the current institute.
%    \begin{macrocode}
\def\@authors{}%
%    \end{macrocode}
% This will contain all authors.
%    \begin{macrocode}
\def\@allauthors{}%
%    \end{macrocode}
% This will contain all institutes.
%    \begin{macrocode}
\def\@institutes{}%
%    \end{macrocode}
% This will contain items containing all of the authors that are
% tied up to one institute.  
%    \begin{macrocode}
\def\@instituteauthors{}%
%    \end{macrocode}
% These two are temporaries that need to be initialized.
%    \begin{macrocode}
\def\@curauths{}
\def\@curinst{}
%    \end{macrocode}
% These are the insertion macros. |\author@| is the internal version
% of |\author|, and just adds to the two author lists.
%
% |\institute@| is a bit trickier, it has to store the institute
% itself for later retrieval, but it also has to clear |\@authors|, so
% it can be used again for the next institute. It does this by moving
% all of the collected authors in the |\@authors| list as one item
% into the |\authors@institute| list. 
%
% Because |\@institutes| and |\@instituteauthors| are parallel, there
% will be an error condition if there are authors after the last
% institute. The |\expandafter|'s are needed to get |\@authors| folded
% out. 
%    \begin{macrocode}
\def\author@#1{\append@item#1\to\@authors
  \append@item#1\to\@allauthors }                            
\def\institute@#1{\append@item#1\to\@institutes
  \expandafter\append@item\expandafter{\@authors}\to\@instituteauthors
  \gdef\@authors{}}
%    \end{macrocode}
% Format one name. 
%
% The box in the first part is needed because we have to typeset once
% in order to get the |\thanks|.
%
% The |\expandafter|'s in the second part bypass grouping. Param \#2
% is either a comma or nothing. The italic correction is needed if
% authors are typeset in Italics, or the thankssymbol will come out to
% far to the left.
% 
% \changes{1997/08/13}{Removed null box for thankssymbol and switched 
%                         places with comma (hor. spacing bugs)}
%    \begin{macrocode}
\newif\ifthanks
\def\orf@#1{#1}
\def\@formatname#1#2{\begingroup
   \def\thanks##1{\global\thankstrue}\setbox0\vbox{#1}%
   \endgroup
   \begingroup
   \ifthanks 
     \edef\fn##1\thanks##2{\authorcase{##1}\/%
        \noexpand\thanks{##2}#2}\expandafter\fn#1
   \else
      \edef\fn##1{{\authorcase{##1}}#2}%
        \expandafter\fn\expandafter{#1}%
   \fi
   \endgroup\global\thanksfalse }
%    \end{macrocode} 
%
% Format authors presently in |\@curauths| (These are the ones belonging
% to one specific institute). 
%
% First, loop over |\@curauths| counting the number of authors. Then
% we know how many, so loop over again, typesetting all. The |,| needs
% to be given separately to make sure |\thanks| works inside an
% author. 
%
% It there are 0 authors, nothing will happen at all.
%    \begin{macrocode}
\newcount\cnt@authors
\def\@formatauthors{\begingroup 
  \authorsize
  \leavevmode
  \gdef\surname##1{##1}%
  \gdef\email##1{ \hbox{({\tt \lowercase{##1}})}}%
  \cnt@authors=0
  \def\@k@p##1{\advance\cnt@authors by 1}\@curauths
  \def\@k@p##1{\advance\cnt@authors by -1
    \ifnum\cnt@authors>1 
    \@formatname{##1}{,}\penalty0\ \fi     % signif. space
    \ifnum\cnt@authors=1                               % before \fi's !!
    \@formatname{##1}{} \authorand \penalty0\ \fi        
    \ifnum\cnt@authors<1 
    \@formatname{##1}{}\par\fi}\@curauths
   \vskip \afterauthorskip
  \endgroup}
%    \end{macrocode}
% Format one institute.
%    \begin{macrocode}
\def\@formatinstitute{{\institutesize \institutecase{\@curinst}\par}}
%    \end{macrocode}
% Format all authors and all institutes. Indentation is done through
% parindent and hangindent instead of rightskip, because otherwise a
% |\centering| would fail. 
%
% There is a space of |\institutesep| + |\parskip| between every
% author\,/\,institute block, and double that space between the last
% two (don't understand that). 
%
% This macro also takes care of the case that there is no institute at
% all given, which is likely to happen in the \LaTeX\ compatibility
% mode. {\it This does not allow you to have only the last author without
% an institute\/}. 
%
% The |\relax| after |\@institutes| is absolutely necessary, or the
% author will be set twice!
%    \begin{macrocode}
\newcount\cnt@institutes
\def\@authorsandinstitutes{\begingroup 
  \authorsize
  \cnt@authors=0
  \def\@k@p##1{\advance\cnt@authors by 1}\@allauthors
  \cnt@institutes=0                      
  \def\@k@p##1{\advance\cnt@institutes by 1}\@institutes\relax
  \ifnum\cnt@institutes=0 
    \let\@curauths\@allauthors
    \parindent=\authorindent
    \hangindent=\authorindent
    \@formatauthors 
  \fi
  \loop\ifnum\cnt@institutes>0
    \get@left\@instituteauthors\to\@curauths
    \parindent=\authorindent
    \hangindent=\authorindent
    \@formatauthors
    \get@left\@institutes\to\@curinst
    \parindent=\instituteindent
    \hangindent=\instituteindent
    \@formatinstitute
    \ifnum\cnt@institutes=2 \vskip \institutesep\relax \fi
    \ifnum\cnt@institutes>1 \vskip \institutesep\relax \fi
    \advance\cnt@institutes by -1
  \repeat
  \vskip \afterallauthorsskip
  \gdef\@authors{}%
  \gdef\@allauthors{}%
  \gdef\@institutes{}%
  \gdef\@instituteauthors{}%
  \gdef\@curauths{}%
  \gdef\@curinst{}%
\endgroup}
%    \end{macrocode}
% \subsection{Typesetting the title and subtitle}
% First, here are the user settings again:
%    \begin{macrocode}
\def\titleflushstyle{}
\def\titlefont{\Large\rm}
\def\titlecase#1{#1}
\def\titleindent{0pt}
\def\aftertitleskip{1.8pc }
\def\presubtitleskip{-1.4pc }
\def\aftersubtitleskip{1pc }
\def\subtitlefont{\large\it}
\def\subtitleflushstyle{}
%    \end{macrocode}
% Internal commands. |\@maketitle| will call |\@title|. |\title@| is
% just an internal for |\title|.
%    \begin{macrocode}
\def\title@#1{\gdef\@title{%
    \@formattitle{#1}\par \vskip \aftertitleskip }}
\def\@title{}
%    \end{macrocode}
% The trick with the vbox is the same as above, to get |\thanks|.
%    \begin{macrocode}
\def\@formattitle#1{\begingroup
  \def\thanks##1{\global\thankstrue}%
  \setbox\@tempboxa\vbox{#1}\endgroup
  \begingroup
    \titleflushstyle
    \ifthanks
      \def\fn##1\thanks##2{\ititle@{##1}{\,\thanks{##2}}}%
      \expandafter\fn#1
    \else
      \def\fn##1{\ititle@{##1}{}}\expandafter\fn\expandafter{#1}%
    \fi
  \endgroup\global\thanksfalse }
%    \end{macrocode}
% Not much left to do here. The flush style has been set by
% |\@formattitle|,  skips before and after by |\@title|. 
%    \begin{macrocode}           
\def\titlebaselinefactor{1.05}
\def\ititle@#1#2{\begingroup     
    \parindent \titleindent
    \hangindent \titleindent
    \hyphenpenalty10000
    {\titlefont\titlecase{#1}#2%
    \baselineskip=\titlebaselinefactor\baselineskip
    \par} 
    \endgroup}
%    \end{macrocode}
% Basically, this is just an echo of title.
%    \begin{macrocode}
\def\@subtitle{}
\def\subtitle@#1{\gdef\@subtitle{\vskip \presubtitleskip 
    \@formatsubtitle{#1}\par \vskip \aftersubtitleskip }}
\def\@formatsubtitle#1{\begingroup
  \def\thanks##1{\global\thankstrue}\setbox0\vbox{#1}\endgroup
  \begingroup \subtitleflushstyle
    \ifthanks
  \def\fn##1\thanks##2{\subtitle@thanks{##1}{##2}}\expandafter\fn#1
    \else
      \def\fn##1{\subtitle@@{##1}}\expandafter\fn\expandafter{#1}\fi
  \endgroup
  \par\global\thanksfalse}
\def\subtitle@thanks#1#2{\isubtitle@{#1}\thanks{#2}\par
    \ignorespaces}
\def\subtitle@@#1{\isubtitle@{#1}\par\ignorespaces}
\def\isubtitle@#1{{\subtitlefont #1}}
%    \end{macrocode}
% \subsection{Date, article type, dedication and translation.}
% These are all fairly straightforward, so I will not pay too much
% attention to these commands.
%    \begin{macrocode}
\def\afterdateskip{.7\baselineskip}
\def\datesize{\footnotesize}
\def\@date{{\i@oldseries\datesize Received: \@received ; 
    Accepted\@accepted}\vskip \afterdateskip
    \gdef\@received{\ldots\ldots}%
    \gdef\@accepted{\ldots\ldots}}
\def\date@#1{\gdef\@date{{\i@oldseries\datesize #1\par}\vskip \afterdateskip
    \gdef\@received{\ldots\ldots}%
    \gdef\@accepted{\ldots\ldots}}}
\def\@received{\ldots\ldots}
\def\@accepted{: \ldots\ldots}
\def\revised@#1{\gdef\@accepted{ in revised form: #1}}
\def\received@#1{\gdef\@received{#1}}
\def\accepted@#1{\gdef\@accepted{ in final form: #1}}
%    \end{macrocode}
% 
%    \begin{macrocode}
\def\artsize{\normalsize\it}
\def\afterartskip{1.5pc}
\def\beforeartskip{0pc}
\def\@arttype{}
\def\arttype@#1{\gdef\@arttype{\vskip\beforeartskip\noindent
      {\artsize #1\vskip\afterartskip}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@dedication{}
\def\dedicationsize{\normalsize\it\raggedright}
\def\prededicationskip{18pt}
\def\afterdedicationskip{18pt}
\def\dedication@#1{\gdef\@dedication{%
     \unskip\vskip \prededicationskip
     {\dedicationsize #1\par}%
     \vskip \afterdedicationskip}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@translation{}
\def\translationsize{\normalsize\it\raggedright}
\def\pretranslationskip{18pt}
\def\aftertranslationskip{18pt}
\def\translation@#1{\gdef\@translation{%
     \unskip\vskip \pretranslationskip
     {\translationsize #1\par}%
     \vskip \aftertranslationskip}}
%    \end{macrocode}
% \subsection{Abstract, keywords, abbreviations, classification 
% and nomenclature} 
% All of these are suppposed to have the same size. The only one with
% a flexible before/after skip is |abstract|, but they all have their
% own font defined for the name. 
%    \begin{macrocode}
\providecommand{\abstractname}{Abstract}
\providecommand{\keywordsname}{Keywords}
\providecommand{\abbreviationsname}{Abbreviations}
\providecommand{\nomenclaturename}{Nomenclature}
\def\abstractsize{\footnotesize}  
\def\abstractnamefont{\bf}
\def\abstractdot{.~}
\def\keynamefont{\bf}
\def\nomennamefont{\bf}
\def\abbrevnamefont{\bf}
\def\classnamefont{\bf}
\def\afterabstractskip{.7\baselineskip\relax}
\def\preabstractskip{0pt\relax}
%    \end{macrocode}
% Abstract is a box, because we still want to support the opening
% environment before |\begin{document}|. 
%
%{\it Note that the stylefile is resposible for making sure that these
%are typeset at all}.              
%    \begin{macrocode}
\newbox\@abstractbox 
\def\@abstract{}
\newenvironment{abstract}{%
  \gdef\@abstract{\message{\abstractname}%
    {\vskip\preabstractskip
    \noindent
    \unvbox\@abstractbox 
    \vskip\afterabstractskip }}%
  \global\setbox\@abstractbox\vbox\bgroup \abstractsize \noindent
    {\abstractnamefont\abstractname\abstractdot}}{\par\egroup }
\def\@keywords{}
\long\def\keywords#1{%          
    \gdef\@keywords{\message{\keywordsname}%
        {\abstractsize\noindent{\keynamefont
      \keywordsname:~}#1\par \vskip.7\baselineskip}}}
\def\@abbreviations{}
\def\abbrev#1#2{#1 -- #2}              
\long\def\abbreviations#1{%
     \gdef\@abbreviations{\message{\abbreviationsname}% 
        {\abstractsize\noindent{\abbrevnamefont \abbreviationsname:~}%
        #1\par \vskip.7\baselineskip}}}
\def\@nomenclature{}
\def\nomen#1#2{#1 -- #2}              
\long\def\nomenclature#1{%
     \gdef\@nomenclature{\message{\nomenclaturename}% 
       {\abstractsize\noindent{\nomennamefont
       \nomenclaturename:\par}\noindent #1\par \vskip.7\baselineskip}}}
\def\@classification{}
\long\def\classification#1#2{%
     \gdef\@classification{\message{Classification}% 
       {\abstractsize\noindent{\classnamefont #1: }% 
       #2\par \vskip.7\baselineskip}}}
\def\motto{\@ifnextchar[{\prosemotto}{\poemmotto}}
\newbox\mottobox     
\def\@motto{}
\long\def\poemmotto{\global\setbox\mottobox\vbox \bgroup   
        \noindent
         \hbox to\hsize\bgroup\begingroup 
            \hfill\vbox\bgroup\hsize =15pc
            \footnotesize \raggedright \noindent
            \parskip=3pt}
\long\def\prosemotto[#1]{\global\setbox\mottobox\vbox \bgroup   
            \noindent
         \hbox to\hsize\bgroup \begingroup
            \hfill\vbox\bgroup\hsize =15pc
            \raggedright \footnotesize \noindent 
            \parskip=3pt}
\def\endmotto{\par \egroup \endgroup \egroup  
    \vspace{1\baselineskip}\egroup 
    \gdef\@motto{\par\message{Motto}\box\mottobox \gdef\@motto{}}}
%    \end{macrocode}
% \subsection{@maketitle}
% Internal commands for typesetting of the front part. |\@maketitle|
% has been kept as simple as possible, making it easy to redefine the
% order inside a stylefile. For twocolumn output, everything that is
% done inside |\@maketitle| is typeset over two columns.
%
% As noted above, if the stylefile feels like removing some of these
% commands, it also has to find a way to have them typeset, because
% that will no longer be automatic. 
%    \begin{macrocode}
\def\@maketitle{% 
   \@arttype \@title \@subtitle \@authorsandinstitutes \@date 
   \@abstract \@keywords \@abbreviations \@classification 
   \@nomenclature \@translation \@dedication \@motto}
%    \end{macrocode}
% This command is called by |\endopening| and |\maketitle|.  
%    \begin{macrocode}
\def\openingflushstyle{}
\def\maketitle@@{%
  \begingroup
     \setcounter{footnote}{0}%
     \def\thefootnote{\fnsymbol{footnote}}%
     \if@twocolumn
        \twocolumn[{\openingflushstyle
                 \parindent 0pt
                 \@maketitle}]
        \thispagestyle{opening}%
        \@extramaketitle
     \else  
       \newpage\global\@topnum\z@ 
       \thispagestyle{opening}%
       {\openingflushstyle \parindent 0pt \@maketitle}%
     \fi
     \markboth{\@runningauthor}{\@runningtitle}%
     \@thanks
   \endgroup
   \setcounter{footnote}{0}%
   \let\@maketitle\relax
   \gdef\@thanks{}%
   \gdef\@title{}%
   \let\thanks\relax }
%    \end{macrocode}
%    \begin{macrocode}
\def\runningtitle#1{\gdef\@runningtitle{#1}}
\gdef\@runningtitle{}
\def\runningauthor#1{\gdef\@runningauthor{#1}}
\gdef\@runningauthor{}
\endinput
%    \end{macrocode}
%\PrintIndex
%\end{document}
% end of kluopen.sty





