%%
%% This is file `vjc-prob.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% vp-src.dtx 
%% 
%% Created by Jan Sustek, 2006-2009
%% 
\NeedsTeXFormat{LaTeX2e}
\def\JS@ClassName{vjc-prob}
\ProvidesClass{\JS@ClassName}[2009/03/10 v0.02^^JLaTeX
  document class for Vojtech Jarnik Competition]
\def\JS@ClassError{\ClassError{\JS@ClassName}}
\def\JS@ClassWarning{\ClassWarning{\JS@ClassName}}
\def\JS@ClassWarningNoLine{\ClassWarningNoLine{\JS@ClassName}}
\DeclareOption{vyber}{\def\JS@volba{vyber}}
\DeclareOption{uprava}{\def\JS@volba{uprava}}
\DeclareOption{soutez}{\def\JS@volba{soutez}}
\DeclareOption{short}{\def\JS@volba{short}}
\DeclareOption{reseni}{\def\JS@volba{reseni}}
\def\JS@volbazaslani{zaslani}
\let\JS@volba\JS@volbazaslani
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
\LoadClass[a4paper,10pt]{article}
\RequirePackage[margin=20mm]{geometry}
\def\temp{short}
\ifx\temp\JS@volba
  \geometry{landscape,margin=10mm}
  \RequirePackage{multicol}
\fi
\RequirePackage{amsmath,amssymb,fancyhdr}
\let\ea\expandafter
\long\def\JS@longemptydef{}
\long\def\JS@ifempty#1{%
  \long\ea\def\ea\JS@ifemptyA\ea{#1}%
  \ifx\JS@longemptydef\JS@ifemptyA}
\def\JS@ignore#1{\def#1##1##{\toks0=}}
\def\JS@ignoreenv#1{\@namedef{#1}{\setbox0=\vbox\bgroup
    \hsize\maxdimen
    \emergencystretch\maxdimen
    \hbadness10001
    \JS@ignore\ref}
  \@namedef{end#1}{\egroup}}
\newif\ifJS@softinputwarning
\newread\PO@testin
\def\softinput#1{\let\PO@next=\relax \openin\PO@testin=#1
  \ifeof\PO@testin
    \ifJS@softinputwarning
      \JS@ClassWarning{The file #1 does not exist}%
    \fi
  \else
    \closein\PO@testin \def\PO@next{\input{#1}}
  \fi
  \PO@next}
\def\ja@datumcas{{\ifnum\day<10 0\fi\the\day-%
  \ifcase\month\or Jan\or Feb\or Mar\or Apr\or May\or Jun\or Jul\or
    Aug\or Sep\or Oct\or Nov\or Dec\fi-\the\ori@year\
  \count255=\time
  \divide\count255by60
  \the\count255:%
  \multiply\count255by60
  \advance\time-\count255
  \ifnum\time<10 0\fi\the\time}}
\def\JS@Inita#1#2{\gdef#2##1{\edef#1{##1}}}
\def\JS@Initb#1#2{\gdef#2##1{\def#1{##1}}}
\def\JS@Initc#1#2{%
  {\escapechar-1
  \ea\JS@Inita\csname JS@\string#1\endcsname#1}%
  #1{#2}}
\def\JS@Initd*#1#2{%
  {\escapechar-1
  \ea\JS@Initb\csname JS@\string#1\endcsname#1}%
  #1{#2}}
\def\JS@Init{\@ifnextchar*{\JS@Initd}{\JS@Initc}}
\let\ori@year\year
\JS@Init\year{??}
\JS@Init\category{??}
\JS@Init\problemno{??}
\JS@Init*\rocniksouteze{!!$^{\text{th}}$}
\JS@Init*\datumsouteze{!!$^{\text{th}}$ Month 20!!}
\JS@Init\points{0}
\JS@Init*\author{}
\JS@Init*\university{}
\chardef\JS@oriescapechar\escapechar
\def\JS@podlevolby#1{\escapechar-1
  \ea\def\ea#1\ea{\csname\string#1@\JS@volba\endcsname}
  \escapechar\JS@oriescapechar}
\JS@podlevolby\prob
\JS@podlevolby\ja@problemhead
\JS@podlevolby\ja@czapati
\JS@podlevolby\ja@rzapati
\JS@podlevolby\ja@cykluspressoutezici
\JS@podlevolby\ja@problemendsymbol
\JS@podlevolby\ja@multicols
\JS@podlevolby\ja@endmulticols
\pagestyle{fancy}
\cfoot{\ja@czapati}
\rfoot{\ja@rzapati}
\def\headrulewidth{0pt}
\def\JS@journalcontent{}
\long\def\JS@addtojournalcontent#1{\ea\global\ea
  \def\ea\JS@journalcontent\ea{\JS@journalcontent#1}}
\newtoks\JS@endtoks
\def\JS@endtoksjournal{problems}
\long\def\problems#1\end#{\JS@addtojournalcontent{#1}
  \afterassignment\JS@journalA\JS@endtoks=}
\long\def\JS@journalA{\ea
  \def\ea\JS@endtoksA\ea{\the\JS@endtoks}
  \ifx\JS@endtoksA\JS@endtoksjournal
    \ea\JS@firstpass
  \else
    \JS@addtojounalcontent\end
    \ea\JS@addtojournalcontent\ea{\ea{\the\JS@endtoks}}
    \ea\problems
  \fi}
\let\endproblems\relax
\newwrite\JS@pkgfile
\long\def\JS@firstpass{\immediate\openout\JS@pkgfile=\jobname.pkg
  \JS@softinputwarningtrue
  \ea\JS@firstpassA
    \JS@journalcontent\prob\JS@firstpassAend}
\long\def\JS@firstpassA#1\prob#2\JS@firstpassAend{
  \JS@ifempty{#2}
    \let\JS@next\JS@secondpass
  \else
    \long\def\JS@next{\JS@paperfirstpass#2\JS@firstpassAend}
  \fi
  \JS@next}
\long\def\JS@paperfirstpass#1 #2\JS@firstpassAend{
  \JS@pfpTest#1\JS@pfpT
  \ifx\JS@pfpTA\JS@pfpTB
    \def\JS@pfpN{\JS@paperfirstpass#2\JS@firstpassAend}
  \else
    \def\JS@pfpN{\JS@paperfirstpassA{#1}
      \JS@firstpassA#2\JS@firstpassAend}
  \fi\JS@pfpN}
\def\JS@pfpTest#1#2\JS@pfpT{\def\JS@pfpTA{#1}}
\def\JS@pfpTB{(}
\newtoks\JS@usepackagetoks
\def\JS@paperfirstpassA#1{\begingroup
  \JS@ignore\documentclass
  \JS@ignore\selectlanguage
  \def\usepackage##1##{\def\JS@packageoptions{##1}
    \afterassignment\JS@usepackageA
    \JS@usepackagetoks=}
  \def\document{\end{document}\endinput}
  \let\enddocument\relax
  \globaldefs-1
  \softinput{#1}
  \globaldefs0
  \endgroup}
\def\JS@usepackageA{\immediate\write\JS@pkgfile
  {\string\usepackage\JS@packageoptions
    {\the\JS@usepackagetoks}}}
\def\JS@secondpass{
  \immediate\closeout\JS@pkgfile
  \end{problems}
  \input\jobname.pkg
  \JS@softinputwarningfalse
  \begin{document}
  \ja@multicols
  \ja@cykluspressoutezici\JS@journalcontent
  \ja@endmulticols
  \end{document}}
\def\ja@vskip#1{\skip0=#1
  \ifdim\lastskip<\skip0\relax
  \vskip-\lastskip
  \vskip#1\fi}
\def\ja@addpenalty#1{\JS@ifempty{#1}\else\addpenalty{#1}\fi}
\def\ja@endofline{\unskip
  \nobreak\hfill\penalty71\hskip1em\null\nobreak\hfill}
\def\ja@defenvhskip{\hskip.5em plus.5em\relax}
\def\ja@defenvneghskip{\hskip-.5em plus-.5em\relax}
\newif\ifja@outerdefenv
\newif\ifja@inenv
\newif\ifja@envnobegin
\newif\ifja@envnoend
\def\ja@defineenv{\futurelet\ja@outertok\ja@defineenvA}
\def\ja@defineenvA{\ifx\ja@outertok\outer
    \ja@outerdefenvtrue
    \let\ja@deAnext\ja@defineenvB
  \else
    \ja@outerdefenvfalse
    \def\ja@deAnext{\ja@defineenvB\outer}
  \fi
  \ja@deAnext}
\def\ja@defineenvB\outer#1#2#3#4#5#6#7#8{
  \ifja@outerdefenv
    \def\ja@outerenv@err{\ifja@inenv
        \JS@ClassError{Environment `#1' cannot be used inside another
          environment}{`#1' is an outer environment.}
      \fi}
  \else
    \def\ja@outerenv@err{}%
  \fi
  \ea\def\csname#1\ea\endcsname\ea
    {\ja@outerenv@err
    \ifja@envnobegin
      \let\ja@next\relax
    \else
      \def\ja@next{\par
        \ja@addpenalty{#3}%
        \ja@vskip{#2}%
        \ja@inenvtrue
        \ja@envnoendfalse
        \noindent{\bf#4}\ja@defenvhskip
        #5\@firstofone}
    \fi
    \ja@next}
  \ea\def\csname end#1\endcsname
    {\ifja@envnoend\else
      #6\par
      \ja@addpenalty{#8}%
      \ja@vskip{#7}
    \fi}}
\ja@defineenv\outer{problem}\medskipamount{-300}
  {\ja@resetequation Problem~\ja@problemhead}\sl
  \ja@problemendsymbol\smallskipamount{-50}
\def\ja@resetequation{\setcounter{equation}{0}}
\ja@defineenv\outer{origin}\smallskipamount{}{Origin}
  \rm{}\smallskipamount{55}
\ja@defineenv\outer{solution}\smallskipamount{-50}{}\ja@solution
  {\ja@solutionendhspace\ja@solutionendsymbol}
  \smallskipamount{55}
\def\ja@solution#1{\futurelet\ja@solutionA\ja@solutionB}
\def\ja@solutionB{\ifx[\ja@solutionA
    \let\ja@solnext\ja@solutionC
  \else
    \def\ja@solnext{\ja@solutionC[Solution]}%
  \fi
  \ja@solnext}
\def\ja@solutionC[#1]{\unskip{\bf#1}\rm\ja@defenvhskip\@firstofone}
\def\ja@solutionendhspace{\ja@endofline}
\def\ja@solutionendsymbol{{\normalsize$\Box$}}
\ja@defineenv{remark}\smallskipamount{}{Remark}
  \rm{}\smallskipamount{55}
\ja@defineenv{proclaim}\smallskipamount{-50}{}
  \ja@proclaim{}\smallskipamount{55}
\def\ja@proclaim#1#2{\unskip{\bf#2}\ja@defenvhskip\sl\@firstofone}
\ja@defineenv{proof}\smallskipamount{}{Proof}
  \rm{\ja@proofendhspace\ja@proofendsymbol}\smallskipamount{}
\def\ja@proofendhspace{\ja@endofline}
\def\ja@proofendsymbol{{\tiny$\Box$}}
\def\JS@currentfile{}
\def\ref#1{\ea\@setref
    \csname r@\JS@currentfile:#1\endcsname\@firstoftwo{#1}}
\def\pageref#1{\ea\@setref
    \csname r@\JS@currentfile:#1\endcsname\@secondoftwo{#1}}
\def\label#1{\@bsphack
  \protected@write\@auxout{}%
    {\string\newlabel{\JS@currentfile:#1}%
      {{\@currentlabel}{\thepage}}}%
  \@esphack}
\def\label@in@display#1{%
    \ifx\df@label\@empty\else
        \@amsmath@err{Multiple \string\label's:
            label '\df@label' will be lost}\@eha
    \fi
    \gdef\df@label{\JS@currentfile:#1}}
\def\JS@categoryII{2}
\def\JS@hlavickasouteze{
  \centerline{\rm The \JS@rocniksouteze\ Annual Vojt\v ech Jarn\'\i k}
  \centerline{\rm International Mathematical Competition}
  \centerline{\rm Ostrava, \JS@datumsouteze}
  \centerline{\rm Category~I\ifx\JS@category\JS@categoryII I\fi}
  \ifnum\ja@cislostudenta=0 \else
    \smallskip
    \centerline{\rm Competitor No.\
      \ifnum\ja@cislostudenta>0 \the\ja@cislostudenta\fi}
  \fi}
\DeclareRobustCommand\em
        {\@nomath\em \ifdim \fontdimen\@ne\font >\z@
                       \upshape \else \slshape \fi}
\def\k#1{\setbox0\hbox{#1}\ifdim\ht0=1ex\accent157 #1%
   \else{\ooalign{\unhbox0\crcr\hss\char157}}\fi}
\def\ja@problemhead@zaslani{j\JS@year-\JS@category-\JS@problemno}
\def\ja@problemendsymbol@zaslani{%
  \ifx\JS@author\@empty
    \ifx\JS@university\@empty
    \else
      \ja@peszA{\JS@university}%
    \fi
  \else
    \ifx\JS@university\@empty
      \ja@peszA{\JS@author}%
    \else
      \ja@peszA{\JS@author\,/\,\JS@university}%
    \fi
  \fi}
\def\ja@peszA#1{\ja@endofline\hbox{\rm[#1]}}
\ifx\JS@volba\JS@volbazaslani
  \JS@ignoreenv{shortproblem}
\fi
\def\prob@vyber{\@ifnextchar(\prob@vA\prob@vB}
\def\prob@vA(#1) {\prob@vB}
\def\prob@vB#1 {\begingroup
  \JS@ignore\documentclass
  \JS@ignore\usepackage
  \JS@ignoreenv{shortproblem}
  \def\JS@currentfile{#1}
  \let\document\@empty
  \let\enddocument\@empty
  \setcounter{page}{1}
  \softinput{#1}
  \par\pagebreak
  \endgroup}
\let\ja@problemhead@vyber\ja@problemhead@zaslani
\let\ja@problemendsymbol@vyber\ja@problemendsymbol@zaslani
\def\ja@czapati@vyber{\ja@problemhead@vyber\,/\,\thepage}
\let\ja@rzapati@vyber\ja@datumcas
\def\prob@short{\@ifnextchar(\prob@hA\prob@hB}
\def\prob@hA(#1#2) #3 {\begingroup
  \JS@ignore\documentclass
  \JS@ignore\usepackage
  \JS@ignoreenv{problem}
  \JS@ignoreenv{origin}
  \JS@ignoreenv{solution}
  \JS@ignoreenv{remark}
  \JS@ignoreenv{proclaim}
  \JS@ignoreenv{proof}
  \let\document\@empty
  \let\enddocument\@empty
  \softinput{#3}
  \par
  \endgroup}
\def\prob@hB#1 {\prob@hA(00) #1 }
\def\ja@problemhead@short{\JS@problemno}
\def\shortproblem{\par
  \hbox to 0pt\bgroup\bf\JS@problemno\ \rm\@firstofone}
\def\endshortproblem{\hss\egroup\vskip3pt minus 3pt}
  \def\ja@multicols@short{\begin{multicols}2}
  \def\ja@endmulticols@short{\end{multicols}}
\def\prob@uprava{\@ifnextchar(\prob@uA\prob@uB}
\def\prob@uA(#1#2) #3 {\begingroup
  \category{#1}
  \problemno{#2} \JS@ignore\problemno
  \JS@ignore\documentclass
  \JS@ignore\usepackage
  \JS@ignoreenv{origin}
  \JS@ignoreenv{solution}
  \JS@ignoreenv{remark}
  \JS@ignoreenv{proclaim}
  \JS@ignoreenv{proof}
  \JS@ignoreenv{shortproblem}
  \def\JS@currentfile{#3}
  \let\document\@empty
  \let\enddocument\@empty
  \def\prob@uAA{#1#2}
  \def\prob@uAB{21}
  \ifx\prob@uAA\prob@uAB
    \pagebreak
  \fi
  \ifx1#2\JS@hlavickasouteze\fi
  \vskip1cm
  \input#3
  \par
  \endgroup}
\def\prob@uB#1 {}
\def\ja@problemhead@uprava{\JS@problemno}
\def\ja@problemendsymbol@uprava{\ifnum\JS@points>0
    \ja@endofline\hbox{\rm[\JS@points\,points]}
  \fi}
\let\ja@rzapati@uprava\ja@rzapati@vyber
\def\prob@soutez{\@ifnextchar(\prob@sA\prob@sB}
\def\prob@sA(#1#2) #3 {\begingroup
  \category{#1}
  \problemno{#2} \JS@ignore\problemno
  \ifx\ja@cpssC\JS@category
    \JS@ignore\documentclass
    \JS@ignore\usepackage
    \JS@ignoreenv{origin}
    \JS@ignoreenv{solution}
    \JS@ignoreenv{remark}
    \JS@ignoreenv{proclaim}
    \JS@ignoreenv{proof}
    \JS@ignoreenv{shortproblem}
    \def\JS@currentfile{#3}
    \let\document\@empty
    \let\enddocument\@empty
    \pagebreak
    \JS@hlavickasouteze
    \vskip1cm
    \input#3
    \par
  \fi
  \endgroup}
\def\prob@sB#1 {}
\let\ja@problemhead@soutez\ja@problemhead@uprava
\let\ja@problemendsymbol@soutez\ja@problemendsymbol@uprava
\newcount\ja@cislostudenta
\JS@Init\pocetI{0}
\JS@Init\pocetII{0}
\JS@Init\shiftII{100}
\def\ja@cykluspressoutezici@soutez#1{
  \def\ja@cpssC{1}
  \ja@cislostudenta0
  \loop \ifnum\ja@cislostudenta<\JS@pocetI \advance\ja@cislostudenta1
    #1
  \repeat
  \ja@cislostudenta-1 #1
  \def\ja@cpssC{2}
  \ja@cislostudenta0
  \loop \ifnum\ja@cislostudenta<\JS@pocetII \advance\ja@cislostudenta1
    \advance\ja@cislostudenta\JS@shiftII\relax
    #1
    \advance\ja@cislostudenta-\JS@shiftII\relax
  \repeat
  \ja@cislostudenta-1 #1}
\def\prob@reseni{\@ifnextchar(\prob@rA\prob@rB}
\def\prob@rA(#1#2) #3 {\begingroup
  \category{#1}
  \problemno{#2} \JS@ignore\problemno
  \JS@ignore\documentclass
  \JS@ignore\usepackage
  \JS@ignoreenv{origin}
  \JS@ignoreenv{remark}
  \JS@ignoreenv{shortproblem}
  \def\JS@currentfile{#3}
  \let\document\@empty
  \let\enddocument\@empty
  \pagebreak
  \JS@hlavickasouteze
  \vskip1cm
  \input#3
  \par
  \endgroup}
\def\prob@rB#1 {}
\let\ja@problemhead@reseni\ja@problemhead@uprava
\let\ja@problemendsymbol@reseni\ja@problemendsymbol@uprava
\endinput
%%
%% End of file `vjc-prob.cls'.
