\NeedsTeXFormat{pLaTeX2e}
%
% gds_remix.cls
%
%   pLaTeX2e class file for Editing novels book
%   by NAKATA Yoshinori(white@niu.ne.jp)
%
\ProvidesClass{gds_remix}
  [2004/05/02 v0.02 pLaTeX class for ` GDsharp ']
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{jbook}\typeout{\CurrentOption}}
\ProcessOptions\relax
\LoadClass[a5paper,twoside,10pt]{gdsharp}

\renewcommand{\normalsize}{%
    \@setfontsize\normalsize{6}{9}%
  \abovedisplayskip 8\p@ \@plus2\p@ \@minus4\p@
  \abovedisplayshortskip \z@ \@plus3\p@
  \belowdisplayshortskip 4\p@ \@plus3\p@ \@minus3\p@
   \belowdisplayskip \abovedisplayskip
   \let\@listi\@listI}
\normalsize
\setbox0\hbox{\char\euc"A1A1}%
\setlength\Cht{\ht0}
\setlength\Cdp{\dp0}
\setlength\Cwd{\wd0}
\setlength\Cvs{\baselineskip}
\setlength\Chs{\wd0}
\renewcommand{\small}{%
  \@setfontsize\small{5}{7.5}%
  \abovedisplayskip 6.5\p@ \@plus3\p@ \@minus4\p@
  \abovedisplayshortskip \z@ \@plus2\p@
  \belowdisplayshortskip 3\p@ \@plus2\p@ \@minus2\p@
  \def\@listi{\leftmargin\leftmargini
              \topsep 4\p@ \@plus2\p@ \@minus2\p@
              \parsep 2\p@ \@plus\p@ \@minus\p@
              \itemsep \parsep}%
  \belowdisplayskip \abovedisplayskip}
\renewcommand{\footnotesize}{%
  \@setfontsize\footnotesize{4}{6}%
  \abovedisplayskip 5\p@ \@plus2\p@ \@minus4\p@
  \abovedisplayshortskip \z@ \@plus\p@
  \belowdisplayshortskip 3\p@ \@plus\p@ \@minus2\p@
  \def\@listi{\leftmargin\leftmargini
              \topsep 3\p@ \@plus\p@ \@minus\p@
              \parsep 2\p@ \@plus\p@ \@minus\p@
              \itemsep \parsep}%
  \belowdisplayskip \abovedisplayskip}
\renewcommand{\scriptsize}{\@setfontsize\scriptsize{3}{5}}
\renewcommand{\tiny}{\@setfontsize\tiny{2}{4}}
\renewcommand{\large}{\@setfontsize\large{8}{11}}
\renewcommand{\Large}{\@setfontsize\Large{10}{14}}
\renewcommand{\LARGE}{\@setfontsize\LARGE{12}{16}}
\renewcommand{\huge}{\@setfontsize\huge{15}{20}}
\renewcommand{\Huge}{\@setfontsize\Huge{20}{26}}

%
% 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}

% \article is alias to \chapter
\def\article{\chapter}

\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{%
  \if@openright \cleardoublepage \else \clearpage \fi
  \setcounter{footnote}{0}%
  \thispagestyle{plain}
  \secdef\@part\@spart}
\def\@part[#1]{\@ifnextchar [{\@@part[#1]}{\@dblarg{\@@part[#1]}}}

\def\Ipart[#1]#2{
 \if@openright \cleardoublepage \else \clearpage \fi
 \def\PartName{#2}
  \ifnum \c@secnumdepth >-2\relax%
    \refstepcounter{part}%
    \typeout{part:#2}%
    \addcontentsline{toc}{part}{ % 
      #2} %
 \else%
    \addcontentsline{toc}{part}{ % 
      #2} %
 \fi\markboth{}{} %
 {\typeout{illust : #1}\thispagestyle{empty}\includeEPSillust{#1}}\@endpart 
}



\def\@@part[#1][#2]#3{%
  \def\PartName{#3}
  \vfil%
  \ifnum \c@secnumdepth >-2\relax%
    \refstepcounter{part}%
    \typeout{part:#3}%
    \addcontentsline{toc}{part}{ % 
      #2} %
 \else%
    \addcontentsline{toc}{part}{ %
      #2} %
  \fi%
  {\centering%
   \interlinepenalty\@M\reset@font%
   \ifnum \c@secnumdepth >-2\relax%
     \LARGE%
     \par\vskip60\p@%
   \fi%
   #3\par
%   \hbox to \textwidth{\hfil \textbf{\large #1}}\par}%
   \hbox to \hsize{\hfil \textbf{\large #1}}\par}%
   \vskip20\p@%
   \@endpart}

% renew \chapter
% Usage:   \chapter{ChapterName} 
%       or \chapter[author Name]{ChapterName}
%       or \chapter[author Name][ChapterName in Index]{Chapter Name}
\def\chapter{%
  \newpage
  \setcounter{footnote}{0}%
%  \if@openright \cleardoublepage \else \clearpage \fi
  \thispagestyle{plain}
%  \if@twocolumn\onecolumn\@tempswatrue\else\@tempswafalse\fi
  \secdef\@chapter\@schapter}
\def\@chapter[#1]{\@ifnextchar [{\@@chapter[#1]}{\@chapter@[#1]}}
\def\@chapter@[#1]#2{\@@chapter[#1][#2 / #1]{#2}}
\def\@@chapter[#1][#2]#3{ %
  \def\PartName{#3}
  \def\ChapterName{#3}
  \vfil %
  \ifnum \c@secnumdepth >-2\relax %
    \refstepcounter{chapter} %
    \typeout{chapter:#3} %
    \addcontentsline{toc}{chapter}{ % 
      #2\leaders\hbox to0.33333zw{\hfil\raise.5ex\hbox{.}\hfil}} %
 \else %
    \addcontentsline{toc}{chapter}{ %
      #2\leaders\hbox to0.33333zw{\hfil\raise.5ex\hbox{.}\hfil}} %
  \fi %
  {\centering %
   \interlinepenalty\@M\reset@font %
   \ifnum \c@secnumdepth >-2\relax %
     \LARGE %
     \par\vskip60\p@ %
   \fi %
   #3\par
   \hbox to \hsize{\hfil \textbf{\large #1}}\par} %
   \vskip5\p@ %
}

\renewcommand{\l@part}[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{2.25em \@plus\p@}%
    \begingroup
    \parindent\z@\rightskip\@pnumwidth
    \parfillskip-\@pnumwidth
    {\leavevmode\Large\bfseries
     \setlength\@lnumwidth{4zw}%
     #1\hfil\nobreak
     \hbox to\@pnumwidth{\hss#2}}\par
%    \nobreak
    \global\@nobreaktrue
    \everypar{\global\@nobreakfalse\everypar{}}%
     \endgroup
  \fi}

\renewcommand*{\l@chapter}[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \addvspace{1.0em \@plus\p@}%
    \begingroup
      \parindent\z@ \rightskip\@pnumwidth \parfillskip-\rightskip
      {\leavevmode\bfseries
       \setlength\@lnumwidth{4zw}%
       \advance\leftskip\@lnumwidth
       #1\hfil\nobreak\nobreak\hbox to\@pnumwidth{\hss#2}}\par
      \penalty\@highpenalty
    \endgroup
  \fi}
