\NeedsTeXFormat{pLaTeX2e}
%
% progressive.cls
%
%   pLaTeX2e class file for Editing novels book
%   by NAKATA Yoshinori(white@jks.is.tsukuba.ac.jp)
%
\ProvidesClass{progressive}
  [2000/06/12 v4.00 pLaTeX class for ` Progressive ']
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{tbook}\typeout{\CurrentOption}}
\ProcessOptions\relax
\LoadClass[a5paper,twoside,titlepage,openright,10pt,twocolumn]{tbook}
\pagestyle{plain}
\parindent=0pt
\parsep=0pt
\parskip=0pt
\baselineskip=16pt
\topskip=\baselineskip

\topmargin=-1in \advance\topmargin 4mm
\headheight=8mm
\headsep=4mm
\footskip=10mm
\textheight=118mm
\textwidth=180mm
\oddsidemargin =-1in
\advance\oddsidemargin 14mm
\evensidemargin=-1in
\advance\evensidemargin 16mm
\columnsep=6mm
\setcounter{tocdepth}{1}
\kanjiskip=0pt plus .050zw minus .080zw

\def\center#1{\hbox to \hsize{\hfil #1 \hfil}}
\def\bottom#1{\hbox to \hsize{\hfil #1}}
\def\?!{\raise1pt\hbox{\yoko ?!}\hglue\kanjiskip}
\def\!#1{\raise1pt\hbox{\yoko !#1}\hglue\kanjiskip}
\def\[!?{\raise1pt\hbox{\yoko !?}\hglue\kanjiskip}
\def\��{\nobreak��\unskip}

\long\def\@ifdefun[{\@ifnextchar ]{\@ifdefunFALSE[}{\@ifdefunTRUE[}}
\long\def\@ifdefunFALSE[#1]#2#3{#3}
\long\def\@ifdefunTRUE[#1]#2#3{#2}


% define \@fillarg
%% use proxy as \@dblarg
\long\def\@fillarg#1{\@ifnextchar[{#1}{\@xfillarg{#1}}}
\long\def\@xfillarg#1#2{#1[]{#2}}

% renew \secdef
%% for renew inner-definition of \part or others
\def\secdef#1#2{\@ifstar{#2}{\@fillarg{#1}}}

%
% renew \maketitle
%
\newif\ifsubtitle \subtitlefalse
\def\subtitle#1{\global\def\@subtitle{#1} \subtitletrue}
\def\@subtitle{\relax}

\newif\iftitleillust\titleillustfalse
\def\titleillust#1{\global\edef\@titleillust{#1} \titleillusttrue}

\def\maketitle{%
\begin{titlepage}
  \let\footnotesize\small
  \let\footnoterule\relax
  \let\footnote\thanks
  \iftitleillust %
   \includeillust{\@titleillust}
  \else
   \hbox to \textwidth{
    \ifsubtitle %
     \hbox to \textheight{\yoko\Large\itshape\bfseries\@subtitle\hfil}
    \fi
   \hfil
   \hbox{\fontsize{30pt}{45pt}\selectfont\@title}
   \kern10pt\hfil
   }
  \fi
  \end{titlepage}%
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\p@thanks\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}

% renew \part
% Usage:   \part{PartName} 
%       or \part[author Name]{PartName}
%       or \part[author Name][Part Face Graphic File]{Part Name}
\def\part{%
  \if@openright \cleardoublepage \else \clearpage \fi
  \thispagestyle{empty}%
  \if@twocolumn\onecolumn\@tempswatrue\else\@tempswafalse\fi
  \secdef\@part\@spart}

\def\@part[#1]{\@ifnextchar [{\@@illustpart[#1]}{\@@part[#1]}}

\def\@@illustpart[#1][#2]#3{%
  \ifnum \c@secnumdepth >-2\relax%
    \refstepcounter{part}%
    \addcontentsline{toc}{part}{%
       \hbox to15cm{\kern1cm\hbox to9cm{\LARGE #3\hfil}\hbox to5cm{#1\hfil}}}%
  \else%
    \addcontentsline{toc}{part}{\kern1cm\hbox to14cm{\LARGE #3\hfil #1}}%
  \fi\markboth{}{}%
  {\@includeillust{#2}}\@endpart
}

\def\@@part[#1]#2{%
  \vfil%
  \ifnum \c@secnumdepth >-2\relax%
    \refstepcounter{part}%
    \addcontentsline{toc}{part}{%
       \hbox to15cm{\kern1cm\hbox to9cm{\LARGE #2\hfil}\hbox to5cm{#1\hfil}}}%
  \else%
    \addcontentsline{toc}{part}{\kern1cm\hbox to14cm{\LARGE #2\hfil #1}}%
  \fi%
  \markboth{}{}%
  {\centering%
   \interlinepenalty\@M\reset@font%
   \ifnum \c@secnumdepth >-2\relax%
     \Huge\bfseries%
     \par\vskip60\p@%
   \fi%
   #2\par}%
   \vfil
   \@endpart}

\def\@spart#1{{%
  \vfil
  \centering
  \interlinepenalty\M@\reset@font
  \Huge\bfseries#1\par}%
  \vfil
  \@endpart}

\def\@endpart{\newpage
   \if@tempswa\twocolumn\fi}
    
%
% renew \tableofcontents
%
\renewcommand{\tableofcontents}{%
  \newpage
  \if@twocolumn\@restonecoltrue\onecolumn
  \else\@restonecolfalse\fi
  \hspace{3\baselineskip}
  \section*{\LARGE ��\hskip2zw ��
    \@mkboth{��\hskip2zw ��}{��\hskip2zw ��}%
  }\@starttoc{toc}%
  \if@restonecol\twocolumn\fi
}

%
% setting for open from odd-number page
%
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
    \hbox{}
    \thispagestyle{empty}
    \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}


%
%\includeEPSillust
% sorry, only for DVIPS/DVIOUT
\def\includeEPSillust#1{%
\vbox to \textwidth{%\yoko%
 \kern-1in\kern-\topmargin\kern-\headheight\kern-\headsep%
 \hbox to \textheight{%\yoko
  \kern-1in \kern-\hoffset%
  \kern \ifodd \thepage -\oddsidemargin \else -\evensidemargin \fi%
  \special{epsfile=#1 truedirection}\hss}\vss}}%

%
%\includeBMPillust
%  sorry, only for DVIOUT
% Please put this command at begin of page's list.
\def\includeBMPillust#1{%
\hbox to 0cm{%
  \kern-1in\kern-1\topmargin\kern-1\headheight\kern-1\headsep%
  \vbox to0cm{
    \kern\textheight\kern1in
    \ifodd \thepage \kern\oddsidemargin \else\kern\evensidemargin\fi
    \special{bmpfile=#1 hsize=15cm}
    \vss}
  \hss}}

% \illustpage
%   command for make illust space
\def\illustpage{\@ifnextchar [{\@illustpage}{\@illustpage[]}}

\def\@illustpage[#1]{%
 \begin{figure*}[p]
  \@ifdefun[#1]{\@includeillust{#1}}{}
  \advance\textwidth 1.3cm
  \hbox to \textwidth{}
  \vbox to \textheight{}
 \end{figure*}}

\def\includeillust#1{
  \if@twocolumn\@restonecoltrue\onecolumn\else\@restonecolfalse\fi
  \@includeillust{#1}
  \if@restonecol\twocolumn\fi}
\def\@includeillust#1{\expandafter\@@includeillust#1!}
\def\@@includeillust#1.#2!{%
\vbox to \textwidth{\yoko%
 \kern\voffset\kern\paperheight
 \kern-1in\kern-\topmargin\kern-\headheight\kern-\headsep
 \hbox to0cm{%
  \kern-\textheight\kern-1in\kern-\hoffset
  \kern\ifodd\thepage-\oddsidemargin\else-\evensidemargin\fi
  \special{PSfile=#1.#2}\hss}\vss}}

% \afternote
%   command for afternotes

\def\afternote{\@ifnextchar [{\@afternote}{\@afternote[1]}}
\def\@afternote[#1]#2{%
  \setbox1=\vbox to .98\textheight{%
      \hsize=9.2cm\hbox to 9.2cm{}\if 0#1 \relax\else\vss\fi #2 \vss}
  \if 1#1 \fbox{\box1} \else \box1 \fi%
}

% \blankpage
%  command for make blank page
%
\def\blankpage{
{\onecolumn
\thispagestyle{empty}
\hbox{}
\newpage}
}

\def\addonlycontentsline#1#2#3{%
  \protected@write\@auxout
    {\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}%
    {\string\@writefile{#1}%
       {\protect\contentsline{#2}{#3}{}}}%
}

%%% Under here,including customized 'nruby.sty'
%
%   nruby.sty   (NAIST ruby macro)
%       version 1.1     1993-12-25
%       version 2.0     1994-02-13
%               by T.Ogihara    ogihara@itc.aist-nara.ac.jp
%               Customized by NAKATA Yoshinori(white@jks.is.tsukuba.ac.jp)
%   Usage: \ruby{word}{ruby}

\typeout{`nruby' V.2.0 <13 Dec 93> by T.Ogihara.}

\def\rubysize{\tiny}

\def\ruby#1#2{\leavevmode{%
\setbox1=\hbox{#1}\setbox2=\hbox{\bf\rubysize#2}%
\ifdim\wd1>\wd2\setbox2=\hbox to\wd1{\bf\rubysize\sparse{#2}}%
\else\ifdim\wd1<\wd2\setbox1=\hbox to\wd2{\sparse{#1}}\fi%
\fi%
\vbox{\baselineskip=3pt\hrule height0pt width0pt depth-3pt \box2\box1}}}

% English mode was deleted (Ver.2.0).

\let\rubie\ruby

% To use '@' as ruby macro, you must use \useruby first.
%   Usage: @word(ruby)

\def\rubii#1(#2){\ruby{#1}{#2}}
\let\dospecialsorig\dospecials
\def\mydospecials{\def\dospecials{\dospecialsorig\makeatother}}
\catcode`\@=\active
\def\useruby{\mydospecials\catcode`\@=\active\let@=\rubii}
\catcode`\@=11
\def\nouseruby{\makeatother\let\dospecials\dospecialsorig}
\let\userubie\useruby
\let\nouserubie\nouseruby


% \boten adds emphasizing dots on each character.
%   Usage: \boten@TEXT@
%       where '@' can be any char.
\def\botenchar{$bullet$}
\def\boten#1{\let\do@next=\boten@tail\let\endtail=#1\boten@tail}
\def\boten@tail#1#2{\setbox1=\hbox{#1}%
\vbox{\baselineskip=3pt\hrule height0pt width0pt depth-3pt%
\hbox to\wd1{\hfil\rubysize\botenchar\hfil}\box1}%
\penalty\hyphenpenalty\if\endtail#2\let\do@next=\feed@One\fi\do@next#2}
\def\feed@One#1{\relax}

%       sparse
%       Usage1: \sparse[20mm]{TEXT}
%       Usage2: \sparse*[20mm]{TEXT}
%       Usage3: \sparse{TEXT}  or  \sparse*{TEXT}
%
\def\sparselist#1{\hfill\let\do@next=\do@tail\let\endtail=#1\do@tail}
\def\do@tail#1#2{#1%
  \if\endtail#2\let\do@next=\feed@one\else\hfill\fi\do@next#2}
\def\feed@one#1{\hfill}

\def\sparseList#1{\let\do@next=\do@Tail\let\endtail=#1\do@Tail}
\def\do@Tail#1#2{#1%
  \if\endtail#2\let\do@next=\feed@One\else\hfill\fi\do@next#2}
% \def\feed@One#1{\relax}
%
% Thanx to Iwakuma & Furukawa
%
\def\sparse{\@ifstar{\let\sparse@skip\relax\@sparse}
{\let\sparse@skip\hss\@sparse}}
\def\@sparse{\@ifnextchar [{\bx@sparse}{\op@sparse}}
\def\bx@sparse[#1]#2{\hbox to#1{\op@sparse{#2}}}
\def\op@sparse#1{\sparse@skip%
 \@ifundefined{jintercharskip}{%
 \kanjiskip=0pt plus 1fil\xkanjiskip=\kanjiskip #1}{%
 \jintercharskip=0pt plus 1fil\jasciikanjiskip=\jintercharskip #1}\sparse@skip}
%
\endinput
