\NeedsTeXFormat{pLaTeX2e}
\ProvidesClass{sugaku}[
  2014/05/12 v.1.0l^^j
  sugaku.cls]

\newif\if@Final \@Finalfalse
\newif\if@Press \@Pressfalse
\newif\ifdraft \draftfalse
\newif\if@enablejfam \@enablejfamfalse%\@enablejfamtrue
\newif\if@layoutgrid \@layoutgridfalse
\newif\if@Trace \@Tracefalse
\newif\if@Spread 
\newif\if@TateMode
\newif\if@MinTenFont \@MinTenFontfalse
\newif\if@PaperSize 
\newbox\@OnePage

\newdimen\JQ \JQ .259817mm
\newdimen\Jpt \Jpt 1.03927pt
\newcount\@tempcntc
\newbox\@tempboxb

\@twosidetrue
\@mparswitchtrue
\@twocolumnfalse

\DeclareOption{gauge}{\@layoutgridtrue}
\DeclareOption{draft}{\drafttrue \setlength\overfullrule{5pt}}
\DeclareOption{final}{\@Finaltrue\draftfalse \setlength\overfullrule{0pt}}
\DeclareOption{press}{\@Presstrue}
\DeclareOption{trace}{\@Tracetrue}
\DeclareOption{spread}{\@Spreadtrue}
\DeclareOption{min10}{\@MinTenFonttrue}
\DeclareOption{papersize}{\@PaperSizetrue}
\ExecuteOptions{draft}
\ProcessOptions

%%%%
%%%% trace mode
%%%%

\if@Trace
  \tracingmacros=2
  \tracingcommands=2
  \showboxdepth=50
  \showboxbreadth=50
  \tracingonline=0
\else\fi

%%%%
%%%% packages
%%%%

\RequirePackage{color}
\if@Press
  \RequirePackage{colortbl}
\else\fi
\RequirePackage{longtable}
\RequirePackage{graphicx}
\RequirePackage{multicol}

%%%%
%%%% fonts
%%%%

\RequirePackage{amssymb}
\RequirePackage{bm}
\if@Press
  \RequirePackage{formalscript,pifrak,pibb}
\else
\fi

% 
\begingroup
\nfss@catcodes
\edef\@roman@ratio{[1.04]}
\DeclareFontFamily{OT1}{cmr}{\hyphenchar\font=45}
\DeclareFontShape{OT1}{cmr}{m}{n}{
        <-6>    s * \@roman@ratio cmr5
        <6-7>   s * \@roman@ratio cmr6
        <7-8>   s * \@roman@ratio cmr7
        <8-12>  s * \@roman@ratio cmr10
        <12-17> s * \@roman@ratio cmr12
        <17->   s * \@roman@ratio cmr17
      }{
      \fontdimen2\font=1.11025\fontdimen2\font
      }
\DeclareFontShape{OT1}{cmr}{m}{sl}{
        <-8>    s * \@roman@ratio cmsl8
        <8-12>  s * \@roman@ratio cmsl10
        <12->   s * \@roman@ratio cmsl12
        }{}
\DeclareFontShape{OT1}{cmr}{m}{it}{
        <-8>    s * \@roman@ratio cmti7
        <8-12>  s * \@roman@ratio cmti10
        <12->   s * \@roman@ratio cmti12
      }{}
\DeclareFontShape{OT1}{cmr}{m}{sc}{
        <-8> s * \@roman@ratio cmcsc9
        <8-> s * \@roman@ratio cmcsc10
      }{}
\DeclareFontShape{OT1}{cmr}{m}{ui}{
        <->  s * \@roman@ratio cmu10
      }{}
\DeclareFontShape{OT1}{cmr}{b}{n}{
        <->  s * \@roman@ratio cmb10
      }{}
%\DeclareFontShape{OT1}{cmr}{bx}{n}{
%        <-6>    s * \@roman@ratio cmbx5
%        <6-7>   s * \@roman@ratio cmbx6
%        <7-8>   s * \@roman@ratio cmbx7
%        <8-12>  s * \@roman@ratio cmbx10
%        <12->   s * \@roman@ratio cmbx12
%        }{}
\DeclareFontShape{OT1}{cmr}{bx}{n}{
        <-5>    s * \@roman@ratio cmbx5
        <5-6>   s * \@roman@ratio cmbx6
        <6-7>   s * \@roman@ratio cmbx7
        <7-8.2>   s * \@roman@ratio cmbx10
        <8.2->    s * \@roman@ratio cmbx12
        }{}
\DeclareFontShape{OT1}{cmr}{bx}{sl}{
        <->     s * \@roman@ratio cmbxsl10
      }{}
\DeclareFontShape{OT1}{cmr}{bx}{it}{
        <->     s * \@roman@ratio cmbxti10
      }{}
\DeclareFontShape{OT1}{cmr}{bx}{ui}
      {<->ssub * cmr/m/ui}{}
\DeclareFontFamily{OT1}{cmss}{\hyphenchar\font=45}
\DeclareFontShape{OT1}{cmss}{m}{n}{
        <-8>    s * \@roman@ratio cmss8
        <8-12>  s * \@roman@ratio cmss10
        <12-17> s * \@roman@ratio cmss12
        <17->   s * \@roman@ratio cmss17
%%       <->   s * \@roman@ratio cmssbx 10
      }{}
\DeclareFontShape{OT1}{cmss}{m}{it}
      {<->ssub*cmss/m/sl}{}
\DeclareFontShape{OT1}{cmss}{m}{sl}{
        <-8>    s * \@roman@ratio cmssi8
        <8-12>  s * \@roman@ratio cmssi10
        <12-17> s * \@roman@ratio cmssi12
        <17->   s * \@roman@ratio cmssi17
      }{}
\DeclareFontShape{OT1}{cmss}{m}{sc}
       {<->ssub*cmr/m/sc}{}
\DeclareFontShape{OT1}{cmss}{m}{ui}
       {<->ssub*cmr/m/ui}{}
\DeclareFontShape{OT1}{cmss}{sbc}{n}{
        <->   s * \@roman@ratio cmssdc10
       }{}
\DeclareFontShape{OT1}{cmss}{bx}{n}{
        <->   s * \@roman@ratio cmssbx10
      }{}
\DeclareFontShape{OT1}{cmss}{bx}{ui}
       {<->ssub*cmr/bx/ui}{}
\DeclareFontFamily{OT1}{cmtt}{\hyphenchar \font\m@ne}
\DeclareFontShape{OT1}{cmtt}{m}{n}{
        <-8>    s * \@roman@ratio cmtt8
        <8-12>  s * \@roman@ratio cmtt9
        <12->   s * \@roman@ratio cmtt12
      }{}
\DeclareFontShape{OT1}{cmtt}{m}{it}{
        <->     s * \@roman@ratio cmitt10
      }{}
\DeclareFontShape{OT1}{cmtt}{m}{sl}{
        <->     s * \@roman@ratio cmsltt10
      }{}
\DeclareFontShape{OT1}{cmtt}{m}{sc}{
        <->     s * \@roman@ratio cmtcsc10
      }{}
\DeclareFontShape{OT1}{cmtt}{m}{ui}
  {<->ssub * cmtt/m/it}{}
\DeclareFontShape{OT1}{cmtt}{bx}{n}
  {<->ssub * cmtt/m/n}{}
\DeclareFontShape{OT1}{cmtt}{bx}{it}
  {<->ssub * cmtt/m/it}{}
\DeclareFontShape{OT1}{cmtt}{bx}{ui}
  {<->ssub * cmtt/m/it}{}
\DeclareFontFamily{OT1}{cmfr}{\hyphenchar\font=45}
\DeclareFontShape{OT1}{cmfr}{m}{n}{%
        <->   s *  \@roman@ratio cmff10
    }{}
\DeclareFontShape{OT1}{cmfr}{m}{it}{
        <->   s *  \@roman@ratio cmfi10
    }{}
\DeclareFontFamily{OT1}{cmdh}{\hypenchar\font=45}
\DeclareFontShape{OT1}{cmdh}{m}{n}{
        <->   s * \@roman@ratio cmdunh10
    }{}
\DeclareFontFamily{OT1}{cmfib}{\hyphenchar\font=45}
\DeclareFontShape{OT1}{cmfib}{m}{n}{
        <->   s * \@roman@ratio cmfib8
    }{}
\DeclareFontFamily{OML}{cmm}{\skewchar\font127 }
\DeclareFontShape{OML}{cmm}{m}{it}{
        <-6>   s * \@roman@ratio cmmi5
        <6-7>  s * \@roman@ratio cmmi6
        <7-8>  s * \@roman@ratio cmmi7
        <8-12>  s * \@roman@ratio cmmi10
        <12->   s * \@roman@ratio cmmi12
      }{}
\DeclareFontShape{OML}{cmm}{b}{it}{%
        <-7>   s * \@roman@ratio cmmib5
        <7-8>  s * \@roman@ratio cmmib7
        <8->   s * \@roman@ratio cmmib10
      }{}
\DeclareFontShape{OML}{cmm}{bx}{it}
   {<-> ssub * cmm/b/it}{}
\DeclareFontFamily{OML}{cmr}{\skewchar\font127 }
\DeclareFontShape{OML}{cmr}{m}{n}
   {<-> ssub * cmm/m/it}{}
\DeclareFontShape{OML}{cmr}{m}{it}
   {<-> ssub * cmm/m/it}{}
\DeclareFontShape{OML}{cmr}{m}{sl}
   {<-> ssub * cmm/m/it}{}
\DeclareFontShape{OML}{cmr}{m}{sc}
   {<-> ssub * cmm/m/it}{}
\DeclareFontShape{OML}{cmr}{bx}{n}
   {<-> ssub * cmm/b/it}{}
\DeclareFontShape{OML}{cmr}{bx}{it}
   {<-> ssub * cmm/b/it}{}
\DeclareFontShape{OML}{cmr}{bx}{sl}
   {<-> ssub * cmm/b/it}{}
\DeclareFontShape{OML}{cmr}{bx}{sc}
   {<-> ssub * cmm/b/it}{}
\DeclareFontFamily{OMS}{cmsy}{\skewchar\font48 }
\DeclareFontShape{OMS}{cmsy}{m}{n}{%
        <-6>   s * \@roman@ratio cmsy5
        <6-7>  s * \@roman@ratio cmsy6
        <7-8>  s * \@roman@ratio cmsy7
        <8->  s * \@roman@ratio cmsy10
      }{}
\DeclareFontShape{OMS}{cmsy}{b}{n}{%
        <-7>   s * \@roman@ratio cmbsy5
        <7-8>  s * \@roman@ratio cmbsy7
        <8->   s * \@roman@ratio cmbsy10
      }{}
\DeclareFontFamily{OMS}{cmr}{\skewchar\font48 }
\DeclareFontShape{OMS}{cmr}{m}{n}
   {<-> ssub * cmsy/m/n}{}
\DeclareFontShape{OMS}{cmr}{m}{it}
   {<-> ssub * cmsy/m/n}{}
\DeclareFontShape{OMS}{cmr}{m}{sl}
   {<-> ssub * cmsy/m/n}{}
\DeclareFontShape{OMS}{cmr}{m}{sc}
   {<-> ssub * cmsy/m/n}{}
\DeclareFontShape{OMS}{cmr}{bx}{n}
   {<-> ssub * cmsy/b/n}{}
\DeclareFontShape{OMS}{cmr}{bx}{it}
   {<-> ssub * cmsy/b/n}{}
\DeclareFontShape{OMS}{cmr}{bx}{sl}
   {<-> ssub * cmsy/b/n}{}
\DeclareFontShape{OMS}{cmr}{bx}{sc}
   {<-> ssub * cmsy/b/n}{}
\DeclareFontFamily{OMX}{cmex}{}{}
\DeclareFontShape{OMX}{cmex}{m}{n}{
          <-> s *  \@roman@ratio cmex10
        }{}
\DeclareFontFamily{U}{lasy}{}
\DeclareFontShape{U}{lasy}{m}{n}{
        <-6>   s * \@roman@ratio lasy5
        <6-7>  s * \@roman@ratio lasy6
        <7-8>  s * \@roman@ratio lasy7
        <8->  s * \@roman@ratio lasy10
        }{}
\DeclareFontShape{U}{lasy}{b}{n}{
        <->    s * \@roman@ratio lasyb10
        }{}
\DeclareFontFamily{U}{msa}{}
\DeclareFontShape{U}{msa}{m}{n}{
          <-7>   s * \@roman@ratio msam5
          <7-8>  s * \@roman@ratio msam7
          <8->   s * \@roman@ratio  msam10
          }{}
\DeclareFontFamily{U}{msb}{}
\DeclareFontShape{U}{msb}{m}{n}{
          <-7>  s * \@roman@ratio msbm5
          <7-8> s * \@roman@ratio msbm7
          <8->  s * \@roman@ratio msbm10
          }{}
%%% ...
\DeclareFontFamily{U}{euex}{}
\DeclareFontShape{U}{euex}{m}{n}{
        <->   s * \@roman@ratio euex10 % AMS file refers to euex7 but I dont have it.
        }{}
\DeclareFontFamily{U}{euf}{}
\DeclareFontShape{U}{euf}{m}{n}{
        <-7>  s * \@roman@ratio eufm5
        <7-8> s * \@roman@ratio eufm7
        <8->  s * \@roman@ratio eufm10
         }{}
\DeclareFontShape{U}{euf}{b}{n}{
        <-7>  s * \@roman@ratio eufb5
        <7-8> s * \@roman@ratio eufb7
        <8->  s * \@roman@ratio eufb10
         }{}
\DeclareFontFamily{U}{eur}{\skewchar\font'177}
\DeclareFontShape{U}{eur}{m}{n}{
        <-7>   s * \@roman@ratio eurm5
        <7-8> s * \@roman@ratio eurm7
        <8->  s * \@roman@ratio eurm10
         }{}
\DeclareFontShape{U}{eur}{b}{n}{
        <-7>   s * \@roman@ratio eurb5
        <7-8>  s * \@roman@ratio eurb7
        <8->   s * \@roman@ratio eurb10
         }{}
\DeclareFontFamily{U}{eus}{\skewchar\font'60}
\DeclareFontShape{U}{eus}{m}{n}{
        <-7>  s * \@roman@ratio eusm5
        <7-8> s * \@roman@ratio eusm7
        <8->  s * \@roman@ratio eusm10
         }{}
\DeclareFontShape{U}{eus}{b}{n}{
        <-7>  s * \@roman@ratio eusb5
        <7-8> s * \@roman@ratio eusb7
        <8->  s * \@roman@ratio eusb10
         }{}
\endgroup

% 
\if@MinTenFont
  \DeclareFontShape{JY1}{mc}{m}{n}{<-> s * [1] min10}{}
  \DeclareFontShape{JY1}{gt}{m}{n}{<-> s * [1] goth10}{}
\else
  \DeclareFontShape{JY1}{mc}{m}{n}{<-> s * [1] jis}{}
  \DeclareFontShape{JY1}{gt}{m}{n}{<-> s * [1] jisg}{}
\fi
\DeclareFontShape{JY1}{mc}{bx}{n}{<->ssub*gt/m/n}{}
\DeclareFontShape{JY1}{mc}{b}{n}{<->ssub*gt/m/n}{}
\DeclareFontShape{JY1}{mc}{m}{it}{<->ssub*mc/m/n}{}
\DeclareFontShape{JY1}{mc}{m}{sl}{<->ssub*mc/m/n}{}
\DeclareFontShape{JY1}{gt}{m}{it}{<->ssub*gt/m/n}{}
\DeclareFontShape{JY1}{gt}{m}{sl}{<->ssub*gt/m/n}{}
\DeclareFontShape{JY1}{mc}{bx}{it}{<->ssub*gt/m/n}{}
\DeclareFontShape{JY1}{mc}{bx}{sl}{<->ssub*gt/m/n}{}
\DeclareFontShape{JT1}{mc}{m}{it}{<->ssub*gt/m/n}{}
\DeclareFontShape{JT1}{mc}{m}{sl}{<->ssub*gt/m/n}{}
\DeclareFontShape{JT1}{gt}{m}{it}{<->ssub*gt/m/n}{}
\DeclareFontShape{JT1}{gt}{m}{sl}{<->ssub*gt/m/n}{}
\DeclareFontShape{JT1}{mc}{bx}{it}{<->ssub*gt/m/n}{}
\DeclareFontShape{JT1}{mc}{bx}{sl}{<->ssub*gt/m/n}{}

\DeclareOldFontCommand{\mc}{\normalfont\mcfamily}{\mathmc}
\DeclareOldFontCommand{\gt}{\normalfont\gtfamily}{\mathgt}
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries\mathversion{bold}}{\mathbf}
\DeclareTextFontCommand{\textbf}{\bf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
\DeclareRobustCommand*{\cal}{\@fontswitch\relax\mathcal}

\def\textmc#1{\relax\ifmmode\hbox\fi{\mcfamily #1}}
\def\textgt#1{\relax\ifmmode\hbox\fi{\gtfamily #1}}

% 
\if@Press
  \RequirePackage{phnm}
  \RequirePackage{cid-gaiji}
\else
  \def\CID#1{��}
  \def\gaiji#1{��}
  \def\IBM#1{��}
\fi

%%%%
%%%% fontsize
%%%%

\def\@setfontsize#1#2#3{%
  \ifx\protect\@typeset@protect
    \let\@currsize#1%
  \fi
  \fontsize{#2}{#3}\selectfont
  \ifdim\parindent>\z@
    \parindent=1zw
  \fi
  \kanjiskip=0zw plus .5H minus .5H
  \ifdim\xkanjiskip>\z@
    \xkanjiskip=0.25zw plus 1H minus .5H
  \fi}

\renewcommand{\normalsize}{%
  \@setfontsize\normalsize{9\Jpt}{23H}%
  \lineskiplimit4H
  \lineskip=\lineskiplimit
  \topsep.5\baselineskip\parskip0mm\partopsep0mm
  \abovedisplayskip .5\baselineskip \@plus.05\baselineskip \@minus.05\baselineskip
  \abovedisplayshortskip .5\baselineskip \@plus.05\baselineskip \@minus.05\baselineskip
  \belowdisplayshortskip .5\baselineskip \@plus.05\baselineskip \@minus.05\baselineskip
  \belowdisplayskip \abovedisplayskip
  \let\@listi\@listI}
\normalsize
\newbox\WabunUnit
\setbox\WabunUnit\hbox{\char\euc"A1A1}%
\setlength\Cht{\ht\WabunUnit}
\setlength\Cdp{\dp\WabunUnit}
\setlength\Cwd{\wd\WabunUnit}
\setlength\Cvs{\baselineskip}
\setlength\Chs{\wd\WabunUnit}
\parindent1zw
\newbox\RomanUnit
\newdimen\Cht@roman
\newdimen\Cdp@roman
\setbox\RomanUnit\hbox{\char'50}
\setlength\Cht@roman{\ht\RomanUnit}
\setlength\Cdp@roman{\dp\RomanUnit}

\newcommand{\small}{%
  \@setfontsize\small{8\Jpt}{15H}%
  \abovedisplayskip .5\baselineskip \@plus.05\baselineskip \@minus.05\baselineskip
  \abovedisplayshortskip \abovedisplayskip
  \belowdisplayshortskip \abovedisplayskip
  \belowdisplayskip \abovedisplayskip
  \def\@listi{\leftmargin\leftmargini
              \topsep \z@
              \parsep \z@
              \itemsep \parsep}%
  }

\newcommand{\footnotesize}{%
  \@setfontsize\footnotesize{7\Jpt}{9.5}%
  \abovedisplayskip .5\baselineskip \@plus.05\baselineskip \@minus.05\baselineskip
  \abovedisplayshortskip \abovedisplayskip
  \belowdisplayshortskip \abovedisplayskip
  \belowdisplayskip \abovedisplayskip
  \def\@listi{\leftmargin\leftmargini
              \topsep \z@
              \parsep \z@
              \itemsep \parsep}%
}

%%% title: \Large, \large 
\newcommand{\Large}{\@setfontsize\Large{12\Jpt}{23H}}
\newcommand{\large}{\@setfontsize\large{10\Jpt}{23H}}

\newcommand{\scriptsize}{\@setfontsize\scriptsize\@viipt\@viiipt}
\newcommand{\tiny}{\@setfontsize\tiny\@vpt\@vipt}
\newcommand{\LARGE}{\@setfontsize\LARGE\@xviipt{25}}
\newcommand{\huge}{\@setfontsize\huge\@xxpt{28}}
\newcommand{\Huge}{\@setfontsize\Huge\@xxvpt{33}}

%%%%
%%%% layout: b5, 45w*38l
%%%%

\setlength\paperheight{257mm}
\setlength\paperwidth {182mm}

\setlength\textwidth{\Cwd}
\multiply\textwidth by45
\setlength\textheight{\baselineskip}
\multiply\textheight by38
\advance\textheight by-\Cwd
\advance\textheight by2H % 

\setlength\topmargin{13mm}
\setlength\headheight{3mm}
\setlength\headsep{4mm}
\setlength\topskip{\Cht}\addtolength\topskip{2H}%

\ifdim\topskip>\Cht
  \addtolength{\headsep}{-\topskip}
  \addtolength{\headsep}{\Cht}
  \addtolength{\textheight}{\topskip}
  \addtolength{\textheight}{-\Cht}
\else\fi

\setlength\footskip{6mm}
\setlength\maxdepth{\lineskip}

\@tempdimb=\paperwidth
\advance\@tempdimb by-\textwidth
\divide\@tempdimb by2
\setlength{\oddsidemargin}{\@tempdimb}
\setlength{\evensidemargin}{\oddsidemargin}
\addtolength{\oddsidemargin}{1.5mm}
\addtolength{\evensidemargin}{-1.5mm}

\setlength\marginparwidth{20mm}
\setlength\marginparsep{10mm}

% twocolumn: bibliography
\setlength\columnsep{2zw}
\setlength\columnseprule{0\p@}

%%%%
%%%% math
%%%%

\if@enablejfam
  \DeclareSymbolFont{mincho}{JY1}{mc}{m}{n}
  \DeclareSymbolFontAlphabet{\mathmc}{mincho}
  \SetSymbolFont{mincho}{bold}{JY1}{gt}{m}{n}
  \DeclareMathAlphabet{\mathgt}{JY1}{gt}{m}{n}
  \reDeclareMathAlphabet{\mathrm}{\@mathrm}{\@mathmc}
  \reDeclareMathAlphabet{\mathbf}{\@mathbf}{\@mathgt}
  \jfam\symmincho
\fi

\RequirePackage{amsmath}[2000/07/18]

\jot=.175\baselineskip %% 

\newbox\@strut@box@
\setbox\@strut@box@\hbox{\vrule\@height.88zw \@depth.12zw \@width\z@}
\def\reset@strutbox@{%
  \global\setbox\strutbox@\hbox{%
    \lower.5\normallineskiplimit
       \vbox{\kern-\normallineskiplimit
       \copy\@strut@box@}}}

\allowdisplaybreaks
\def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}\kern1zw}
\renewcommand{\eqref}[1]{\textup{(\ref{#1})}}
\def\env@cases{%
  \let\@ifnextchar\new@ifnextchar
  \left\lbrace
  \def\arraystretch{1.2}%
  \array{@{\,}l@{\quad}l@{}}%
}
\newenvironment{casesset}[1][1.2]{%
  \let\@ifnextchar\new@ifnextchar
  \def\arraystretch{#1}%
  \array{@{\,}l@{\quad}l@{}}%
}{\endarray}

%%% eqnarray 

\def\eqnarray{%
   \stepcounter{equation}%
   \def\@currentlabel{\p@equation\theequation}%
   \global\@eqnswtrue
   \m@th
   \global\@eqcnt\z@
   \tabskip\@centering
   \let\\\@eqncr
   $$\everycr{}\halign to\displaywidth\bgroup
       \hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel
      &\global\@eqcnt\@ne \hfil$\displaystyle{{}##{}}$\hfil
      &\global\@eqcnt\tw@ $\displaystyle{##}$\hfil\tabskip\@centering
      &\global\@eqcnt\thr@@ \hb@xt@\z@\bgroup\hss##\egroup
         \tabskip\z@skip
      \cr}

% frac

\let\fracorg=\frac
\newbox\@fracbox
\newbox\@fracboxa
\newbox\@fracboxb
\def\@frac{\@ifnextchar[{\@@frac}{\@@frac[\z@]}}
\def\@@frac[#1]#2#3#4{%
  \setbox\@fracboxb=\hbox{\scalebox{#4}{$\m@th#2#3$}}\relax%
  \setbox\@fracboxa=\hbox{\scalebox{#4}{$\m@th#2 A$}}\relax%
  \ifdim\wd\@fracboxb<\wd\@fracboxa\relax%
    \setbox\@fracbox=\hbox to\wd\@fracboxa{\hss\lower#1\hbox{\scalebox{#4}{$#2#3$}}\hss}
  \else
    \setbox\@fracbox=\hbox{\lower#1\hbox{\scalebox{#4}{$#2#3$}}}\relax%
  \fi%
\box\@fracbox}%

\def\dfrac#1#2{%
  \displaystyle{{%
    \begingroup\@frac{\textstyle}{#1}{1}\endgroup\@@over%
    {\@frac{\textstyle}{#2}{1}}%
  }}%
}
\def\tfrac#1#2{%
  \textstyle{{%
    \begingroup\@frac[-1.4pt]{\textstyle}{#1}{1}\endgroup\@@over% 13/2/1
    {\@frac[2pt]{\textstyle}{#2}{1}}% 13/2/1
  }}%
}
\def\sfrac#1#2{%
  \scriptstyle{{%
    \begingroup\@frac{\scriptscriptstyle}{#1}{1}\endgroup\@@over%
    {\@frac{\scriptscriptstyle}{#2}{1}}%
  }}%
}
\def\ssfrac#1#2{%
  \scriptscriptstyle{{%
    \begingroup\@frac{\scriptscriptstyle}{#1}{1}\endgroup\@@over%
    {\@frac{\scriptscriptstyle}{#2}{1}}%
  }}%
}
\let\tfrac\dfrac% 13/2/1

\DeclareRobustCommand\frac[2]{%
  \mathchoice{\dfrac{#1}{#2}}{\tfrac{#1}{#2}}{\sfrac{#1}{#2}}{\ssfrac{#1}{#2}}%
}

% root

\let\sqrtorig=\sqrt

\def\r@@t#1#2{%
  \setbox\@tempboxa\hbox{$\m@th#1#2$}\relax%
  \setbox\@tempboxb\hbox{$\m@th#1 M$}\relax%
  \@tempdima=\wd\@tempboxa
  \dimen@\wd\@tempboxb
  \ifdim\@tempdima>\dimen@
    \setbox\z@\hbox{$\m@th#1\sqrtsign{#2}$}\relax%
  \else%
    \advance\@tempdima by-\dimen@
    \multiply\@tempdima by-1
    \setbox\z@\hbox{$\m@th#1\sqrtsign{\hskip.5\@tempdima#2\hskip.5\@tempdima}$}\relax%
  \fi%
  \dimen@\ht\z@ \advance\dimen@-\dp\z@
  \mkern5mu\raise.6\dimen@\copy\rootbox
  \mkern-10mu\box\z@}
\DeclareRobustCommand\sqrt{\@ifnextchar[{\@sqrt}{\@sqrt[\mskip7mu]}}

%%% special root

\if@Press
\DeclareFontFamily{OMX}{yhex}{}{}
\DeclareFontShape{OMX}{yhex}{m}{n}{
   <-> s * yhcmex10v
   }{}
\DeclareSymbolFont{yhlargesymbols}{OMX}{yhex}{m}{n}
\DeclareMathRadical{\NonVerticalSqrtsign}{symbols}{"70}{yhlargesymbols}{"70}
\fi

% eqnum
\renewcommand\theequation{\@arabic\c@equation}

\newif\if@temp@equation@flag \@temp@equation@flagfalse

% eqnum: (1), (2),... 
\newcommand{\EquationNumberNormal}{%
  \@temp@equation@flagfalse
  \renewcommand\theequation{\@arabic\c@equation}%
}

% eqnum: (1.1), (1.2),..., (2.1), (2.2), 
\newcommand{\EquationNumberSection}{%
  \@temp@equation@flagtrue
  \renewcommand\theequation{\thesection.\@arabic\c@equation}%
}

% Default: \EquationNumberNormal

%%%%
%%%% theorem environments
%%%%

\RequirePackage{amsthm}[2000/10/26]

%%% 2006/09/15
\@ifundefined{thm@headsep}{%
\newdimen\thm@headsep \thm@headsep=1zw
\def\deferred@thm@head#1{%
  \if@inlabel \indent \par \fi % eject a section head if one is pending
  \if@nobreak
    \adjust@parskip@nobreak
  \else
    \addpenalty\@beginparpenalty
    \addvspace\@topsep
    \addvspace{-\parskip}%
  \fi
  \global\@inlabeltrue
  \everypar\dth@everypar
  \sbox\@labels{\normalfont#1}%
  \ignorespaces
}
\newtoks\dth@everypar
\dth@everypar={%
  \@minipagefalse \global\@newlistfalse
  \if@inlabel
    \global\@inlabelfalse
    \begingroup \setbox\z@\lastbox
     \ifvoid\z@ \kern-\itemindent \fi
    \endgroup
    \unhbox\@labels
  \fi
  \if@nobreak \@nobreakfalse \clubpenalty\@M
  \else \clubpenalty\@clubpenalty \everypar{}%
  \fi
}%
}{\relax}
%%%

\newif\if@after@thmhead% 120319

\def\@begintheorem#1#2[#3]{%
  \deferred@thm@head{\the\thm@headfont \thm@indent
    \@ifempty{#1}{\let\thmname\@gobble}{\let\thmname\@iden}%
    \@ifempty{#2}{\let\thmnumber\@gobble}{\let\thmnumber\@iden}%
    \@ifempty{#3}{\let\thmnote\@gobble}{\let\thmnote\@iden}%
    \thm@swap\swappedhead\thmhead{#1}{#2}{#3}%
    \the\thm@headpunct
    \thmheadnl % possibly a newline.
    \unskip\hskip\thm@headsep
  }%
  \@after@thmheadtrue% 120319
  \ignorespaces}

\def\thmhead@plain#1#2#3{%
  \thmname{#1}\thmnumber{\@ifnotempty{#1}{\hbox to\xkanjiskip{}}\@upn{#2}}%
  \thmnote{\the\thm@notefont\hbox{\hskip\fontdimen2\font}(#3)}}
\let\thmhead\thmhead@plain

\def\thm@space@setup{%
  \thm@preskip=\z@ \thm@postskip=\thm@preskip
}

\def\@thm#1#2#3{%
  \ifhmode\unskip\unskip\par\fi
  \normalfont
  \trivlist
  \let\thmheadnl\relax
  \let\thm@swap\@gobble
  \thm@space@setup
  #1% style overrides
  \@topsep \thm@preskip               % used by thm head
  \@topsepadd \thm@postskip           % used by \@endparenv
  \def\@tempa{#2}\ifx\@empty\@tempa
    \def\@tempa{\@oparg{\@begintheorem{#3}{}}[]}%
  \else
    \refstepcounter{#2}%
    \def\@tempa{\@oparg{\@begintheorem{#3}{\csname the#2\endcsname}}[]}%
  \fi
  \@tempa
}

\def\@xthm#1#2[#3]{%
  \ifx\relax#3\relax
    \newcounter{#1}%
  \else
    \newcounter{#1}[#3]%
    \@xp\xdef\csname the#1\endcsname{\@xp\@nx\csname the#3\endcsname
      \@thmcountersep\@thmcounter{#1}}%
  \fi
  \@addtoreset{#1}{chapter}%% <--
  \toks@{#2}%
  \@xp\xdef\csname#1\endcsname{%
    \@nx\@thm{%
      \let\@nx\thm@swap
        \if S\thm@swap\@nx\@firstoftwo\else\@nx\@gobble\fi
      \@xp\@nx\csname th@\the\thm@style\endcsname}%
      {#1}{\the\toks@}}%
}

\def\@endtheorem{\endtrivlist\@endpefalse}

\def\th@plain{%
  \def\thm@indent{\noindent\hbox to1zw{}}%\let\thm@indent\noindent % no indent
  \thm@headfont{\bfseries}% heading font is bold
  \thm@notefont{\bfseries\mathversion{bold}}%{\mdseries}% same as heading font
  \thm@headpunct{}% add period after heading
  \let\thm@swap\@gobble
  \thm@preskip\z@ %.5\baselineskip
  \thm@headsep=1zw
  \thm@postskip\thm@preskip\relax%\theorempreskipamount
  \normalfont % body font
}

%%%%
%%%% typeset parameters
%%%%

\widowpenalty=0
\displaywidowpenalty=0
\jcharwidowpenalty=0
\clubpenalty=0
\predisplaypenalty=50
\postdisplaypenalty=0
\binoppenalty=0
\relpenalty=0
\delimiterfactor=850
\delimitershortfall=10pt
\nulldelimiterspace=1.2pt % defalut=1.2pt
\mathsurround=\z@ % default=0pt
\scriptspace=0.5pt % default=0.5pt
\medmuskip=4mu plus 1mu minus 1mu
\thickmuskip=5mu plus 1mu
% \kanjiskip=0zw plus .5H minus .5H
% \xkanjiskip=0.25zw plus .5H minus .5H

%%%% \inhibitglue 
\def\<{\ifvmode\leavevmode\fi\inhibitglue}

%%%%
%%%% zen-kaku char penalties
%%%%

\postbreakpenalty\jis"2146=10000     % quote left
\prebreakpenalty\jis"2147=10000      % quote right
\postbreakpenalty\jis"2148=10000     % double quote left
\prebreakpenalty\jis"2149=10000      % double quote right
\prebreakpenalty\jis"213F=10000      % slash
\prebreakpenalty\jis"2173=10000      % percent
\inhibitxspcode\jis"2229=2          % yubin mark
\inhibitxspcode\jis"2173=1          % percent

%%%%
%%%% table parameter
%%%%

\setlength\arraycolsep{.5zw}%
\setlength\tabcolsep{.5zw}
\setlength\arrayrulewidth{.12mm}
\setlength\doublerulesep{3H}%{\z@}
\setlength\tabbingsep{\labelsep}
\setlength\fboxsep{.5zw}
\setlength\fboxrule{.12mm}

%%%%
%%%% list env parameter
%%%%

\setlength\leftmarginii {1zw}% 120223: \z@ --> 1zw
\setlength\leftmarginiii{1zw}% 120223: \z@ --> 1zw
\setlength\leftmarginiv {1zw}% 120223: \z@ --> 1zw
\setlength\leftmarginv  {1zw}% 120223: \z@ --> 1zw
\setlength\leftmarginvi {1zw}% 120223: \z@ --> 1zw
\setlength  \labelsep  {0.5zw}
\setlength  \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
\setlength\partopsep{\z@}
\@beginparpenalty -\@lowpenalty
\@endparpenalty   -\@lowpenalty
\@itempenalty     -\@lowpenalty
\def\@listi{\leftmargin\leftmargini
  \parsep \z@ \topsep\z@
  \itemsep \z@ \relax}
\let\@listI\@listi
\@listi
\def\@listii{\leftmargin\leftmarginii
  \labelwidth\leftmarginii \advance\labelwidth-\labelsep
  \topsep \z@
  \parsep \z@
  \itemsep\parsep}
\def\@listiii{\leftmargin\leftmarginiii
  \labelwidth\leftmarginiii \advance\labelwidth-\labelsep
  \topsep \z@
  \parsep \z@
  \itemsep\parsep}
\def\@listiv {\leftmargin\leftmarginiv
              \labelwidth\leftmarginiv
              \advance\labelwidth-\labelsep}
\def\@listv  {\leftmargin\leftmarginv
              \labelwidth\leftmarginv
              \advance\labelwidth-\labelsep}
\def\@listvi {\leftmargin\leftmarginvi
              \labelwidth\leftmarginvi
              \advance\labelwidth-\labelsep}
\renewcommand{\theenumi}{\@arabic\c@enumi}
\renewcommand{\theenumii}{\@alph\c@enumii}
\renewcommand{\theenumiii}{\@roman\c@enumiii}
\renewcommand{\theenumiv}{\@Alph\c@enumiv}
\newcommand{\labelenumi}{(\theenumi)}
\newcommand{\labelenumii}{(\theenumii)}
\newcommand{\labelenumiii}{(\theenumiii)}% 120223: \theenumiii. --> (\theenumiii)
\newcommand{\labelenumiv}{\theenumiv.}
\renewcommand{\p@enumii}{\theenumi}
\renewcommand{\p@enumiii}{\theenumi\<�i\theenumii�j}
\renewcommand{\p@enumiv}{\p@enumiii\theenumiii}
\newcommand\labelitemi{\textbullet}
\newcommand\labelitemii{\normalfont\bfseries \textendash}
\newcommand\labelitemiii{\textasteriskcentered}
\newcommand\labelitemiv{\textperiodcentered}

\def\@trivlist{%
  \if@noskipsec \leavevmode \fi
  \@topsepadd \topsep
  \ifvmode
    \advance\@topsepadd \partopsep
  \else
    \unskip
    \@after@thmheadfalse% 120328 see \@begintheorem
    \par
  \fi
  \if@inlabel
    \@noparitemtrue
    \@noparlisttrue
  \else
    \if@newlist \@noitemerr \fi
    \@noparlistfalse
    \@topsep \@topsepadd
  \fi
  \advance\@topsep \parskip
  \leftskip \z@skip
  \rightskip \@rightskip
  \parfillskip \@flushglue
  \par@deathcycles \z@
  \@setpar{\if@newlist
             \advance\par@deathcycles \@ne
             \ifnum \par@deathcycles >\@m
               \@noitemerr
               {\@@par}%
             \fi
           \else
             {\@@par}%
           \fi}%
  \global \@newlisttrue
  \@outerparskip \parskip}

\def\@adjust@after@thmhead{\if@after@thmhead\global\@after@thmheadfalse\else\kern\listparindent\fi}% 120328 see \@begintheorem

\def\itemize{%
  \ifnum \@itemdepth >\thr@@\@toodeep\else
    \advance\@itemdepth\@ne
    \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
    \expandafter
    \list
      \csname\@itemitem\endcsname
      {%
       \labelsep=\z@
       \itemindent=\labelwidth
       \topsep\z@%
       \itemsep=\z@
       \parsep=\itemsep%
       \listparindent=1zw
       \def\makelabel##1{\@adjust@after@thmhead\hbox to1zw{##1\hss}\hfil}}% 120319 
  \fi}
\let\enditemize =\endlist

\def\enumerate{%
  \ifnum \@enumdepth >\thr@@\@toodeep\else
    \advance\@enumdepth\@ne
    \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
      \expandafter
      \list
        \csname label\@enumctr\endcsname
        {% 120319  \labelsep=1zw --> \z@, add @after@thmhead flag
         \labelsep\z@
         \itemindent\labelwidth
         \listparindent=1zw
         \usecounter\@enumctr
         \def\makelabel##1{\@adjust@after@thmhead\hbox to2zw{##1\hss}\hfil}}%
  \fi}
\let\endenumerate =\endlist

\newenvironment{description}{%
  \list{}{%
    \listparindent1zw
    \labelwidth=\leftmargin
    \labelsep=1zw
    \advance \labelwidth by -\labelsep
    \advance \labelwidth by -1zw
    \let \makelabel=\descriptionlabel}}{\endlist}
\newcommand*\descriptionlabel[1]{\normalfont\bf #1\hfil}

\newenvironment{quotation}{%
  \list{}{%
    \listparindent1zw
    \itemindent\listparindent
    \itemindent\z@
    \listparindent\z@
    \leftmargin2zw
    \rightmargin2zw}%
  \item\relax}{\endlist}

\newenvironment{quote}{%
  \list{}{%
    \topsep.5\baselineskip
    \labelsep\z@
    \labelwidth\z@
    \rightmargin3zw
    \leftmargin3zw
    \listparindent\z@
    \itemindent\z@}
  \item\relax}{\endlist}

%%%%
%%%% float parameter
%%%%

\setcounter{topnumber}{2}
\renewcommand{\topfraction}{.8}
\setcounter{bottomnumber}{1}
\renewcommand{\bottomfraction}{.8}
\setcounter{totalnumber}{3}
\renewcommand{\textfraction}{.1}
\renewcommand{\floatpagefraction}{.8}
\setlength\floatsep    {1.5\baselineskip}
\setlength\textfloatsep{1.5\baselineskip}
\setlength\intextsep   {1.5\baselineskip}
\setlength\@fptop{\z@ \@plus 1fil}
\setlength\@fpsep{\Cvs \@plus 2fil}
\setlength\@fpbot{\z@ \@plus 1fil}

%%%%
%%%% macros
%%%%

\newdimen\@gyoudimen
\newcount\@gyoucount
\newbox\@gyoubox
\newdimen\@g@cht
\newdimen\@g@cdp

\long\def\gyoudori#1#2{\par
  \setbox\@gyoubox\hbox{��}
  \@g@cht=\ht\@gyoubox
  \@g@cdp=\dp\@gyoubox
  \ifdim\topskip<\Cht
    \nointerlineskip%
    \ifdim\lastskip=\@gyoudimen
    \vskip-\@gyoudimen\else\fi
    \@gyoucount=#1 \advance\@gyoucount by-1\relax
    \@gyoudimen=\@gyoucount\baselineskip
    \advance\@gyoudimen by \@g@cht
    \advance\@gyoudimen by \@g@cdp
    \vskip\baselineskip
    \vskip-\@g@cht
    \vskip-\@g@cdp
    \vbox to\@gyoudimen{%
      \vskip\z@ plus.0001fil{#2}\par
      \vskip\z@ plus.0001fil}
    \@gyoudimen=-\@g@cdp\vskip\@gyoudimen
  \else
    \@gyoucount=#1 \advance\@gyoucount by-1\relax
    \null\hrule height\z@
    \vbox to\@gyoucount\baselineskip{%
      \kern -\@g@cht\vskip\z@ plus.0001fil{#2}\par
      \vskip\z@ plus.0001fil\kern-\@g@cdp}
  \fi
}

\newbox\@gyouboxb
\newdimen\@gyoudimenb
\newcount\@tempcntz
\long\def\Gyodori#1{%
  \setbox\@gyouboxb\vbox{#1}
  \@gyoudimenb .5\baselineskip
  \@tempcntz=\ht\@gyouboxb
  \advance\@tempcntz by \dp\@gyouboxb
  \advance\@tempcntz by \@gyoudimenb
  \divide\@tempcntz by\baselineskip \advance\@tempcntz by1\relax
  \gyoudori{\the\@tempcntz}{\box\@gyouboxb}}

\newdimen\@jidoridimen

\def\jidoria#1#2{%
  \@jidoridimen=#1\relax%
  \setbox\@tempboxa=\hbox{#2}\relax%
  \ifdim\@jidoridimen>\wd\@tempboxa
    \edef\@jidori@setup{%
      \spaceskip\z@  plus1.1fil%
      \kanjiskip\z@  plus1fil%
      \xkanjiskip\z@ plus1.1fil%
    }%
    \leavevmode\hbox to\@jidoridimen{%
      \@jidori@setup%
      \xkanjiskip=\kanjiskip
      #2}%
  \else
    \box\@tempboxa%
  \fi
}

\def\jidorib#1#2{%
  \@jidoridimen=#1\relax%
  \edef\@jidori@setup{%
    \spaceskip\z@  plus.001fil minus.0001fil%
    \kanjiskip\z@  plus.001fil minus.0001fil%
    \xkanjiskip\z@ plus.01fil minus.0001fil%
  }%
  \leavevmode\hbox to\@jidoridimen{%
  \@jidori@setup%
  \@jidori@split{#2}\unskip}%
}

\def\@jidori@split#1{%
  \def\jidori@split@kernel##1{%
    \def\reserved@jidori{##1}%
    \ifx\reserved@jidori\@nnil%
      \let\next@jidori@split=\relax%
    \else%
      \def\next@jidori@split{\jidori@split@kernel}%
        \def\@put@jidori@char{##1\hskip\kanjiskip}%
      \@put@jidori@char
    \fi%
    \next@jidori@split%
  }%
  \jidori@split@kernel#1\@nil%
}%

\let\kintou\jidoria

%%%%
%%%% pagestyle
%%%%

% ruby
\newdimen\rubydimen

\if@Press
\newcommand{\ruby@g}[2]{%
  \leavevmode
  \setbox0=\hbox{#1}%
  \rubydimen=\f@size\p@
  \setbox1=\hbox{\fontsize{0.5\rubydimen}{0pt}\selectfont #2}%
  \ifdim\wd0>\wd1 \dimen0=\wd0 \else \dimen0=\wd1 \fi
  \hbox{%
    \kanjiskip=0pt plus 2fil
    \xkanjiskip=0pt plus 2fil
    \vbox{%
      \hbox to \dimen0{%
        \fontsize{0.5\rubydimen}{0pt}\selectfont% \kanjistrut
        \hfil\smash{#2}\hfil}%
      \nointerlineskip
      \hbox to \dimen0{%\kanjistrut
      \hfil#1\hfil}}}}
\else
\newcommand{\ruby@g}[2]{#1}
\fi

% 
\def\@ShikakuChar{\char\jis"2222}
\definecolor{gaugecolor}{cmyk}{.09,.23,.32,.1}
\def\@OneLineOfGauge@odd{%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{5}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{10}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{15}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{20}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{25}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{30}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{35}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{40}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{45}}
\def\@OneLineOfGauge@even{%
  \ruby@g{\@ShikakuChar}{45}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{40}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{35}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{30}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{25}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{20}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{15}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{10}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar\ruby@g{\@ShikakuChar}{5}%
  \@ShikakuChar\@ShikakuChar\@ShikakuChar\@ShikakuChar}
\newcount\linecount@gauge \linecount@gauge=1
\def\@OneLine@gauge{%
  \@tempcntc=39\relax% 
  \advance\@tempcntc by-\linecount@gauge
  \leavevmode\llap{\textcolor{gaugecolor}{%
    \scriptsize\kansuji\number\linecount@gauge\hskip.5zw}}%
  \ifodd\linecount@gauge\relax%
    \textcolor{gaugecolor}{\@OneLineOfGauge@odd}%
  \else%
    \textcolor{gaugecolor}{\@OneLineOfGauge@even}%
  \fi
  \rlap{\textcolor{gaugecolor}{\hskip.5zw\scriptsize\kansuji\number\@tempcntc}}%
  \par}

\def\@@gauge{%
  \hbox to\z@{%
    \hss\vbox to\z@{%
      \vskip\headsep\parindent\z@
      \ifdim\topskip<\Cht\vskip\topskip\else\vskip\topskip\vskip-\Cht\fi
      \vskip-\tombowrule
      \color{gaugecolor}%
      \hrule height\tombowrule\hbox{\vrule width\tombowrule%
      \dimen@=\textheight \advance\dimen@ by\maxdepth\relax%
      \vbox to\if@TateMode\textwidth\else\dimen@\fi{%
        \if@TateMode\tate\else\fi
        \hsize=\if@TateMode\textheight\else\textwidth\fi\normalsize\normalfont%
          \parfillskip=\z@\relax%
          \loop
            \ifnum\linecount@gauge<39
              \@OneLine@gauge
            \advance\linecount@gauge by1
          \repeat%
      \vss}%
      \vrule width\tombowrule}\hrule height\tombowrule%
    \vss}%
  \hss}%
}

\def\@gauge{\if@layoutgrid\protect\@@gauge\else\fi}

\def\rightmark{\expandafter\@rightmark\botmark\@empty\@empty}

%%%%%%%%%% layout grid
\if@layoutgrid
\def\L@Paper@Domain{%
  {\color{gaugecolor}\smash{%
    \lower\paperheight\hbox to\z@{%
      \hss\vrule height\paperheight width\tombowrule depth\z@}%
    \lower\paperheight\hbox to\z@{%
      \hskip\paperwidth\if@Spread\hskip-.5\tombowrule\else\fi%
        \vrule height\paperheight width\tombowrule depth\z@\hss}%
    \lower\paperheight\hbox to\z@{%
      \lower\tombowrule\hbox{\vrule width\paperwidth height\tombowrule depth\z@}\hss}%
    \hbox to\z@{\vrule width\paperwidth height\tombowrule depth\z@\hss}}}}
\def\R@Paper@Domain{%
  {\color{gaugecolor}\smash{%
    \lower\paperheight\hbox to\z@{%
      \vrule height\paperheight width\tombowrule depth\z@\hss}%
    \lower\paperheight\hbox to\z@{%
      \hss\lower\tombowrule\hbox{\vrule width\paperwidth height\tombowrule depth\z@}}%
    \hbox to\z@{\hss\vrule width\paperwidth height\tombowrule depth\z@}}}}
\else
\def\L@Paper@Domain{}\def\R@Paper@Domain{}
\fi

\newcommand{\nonbrefont}{%
  \reset@font%
  \fontsize{8.5\Jpt}{\z@}%
  \selectfont%
}

%%\newcounter{totalpage}%% 12/12/18 

\def\bookinfo#1#2#3{%
  \gdef\@volume@sugaku{#1}%
  \gdef\@number@sugaku{#2}%
  \gdef\@state@article{#3}%
}

\def\@volume@sugaku{99}
\def\@number@sugaku{1}
\def\@default@state@article{���Ҍ��e}
\let\@state@article\@default@state@article
\long\def\@if@manuscript{% 13/2/1
  \ifx\@state@article\@default@state@article
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}

\def\FirstProof{% 13/2/1
  \def\@set@sugaku@page{\setcounter{page}{1}}%
  \let\@CurrentSugakuInfo\@default@CurrentSugakuInfo
  \def\TombowHeaderInfo{}%
}
\def\���Z{\gdef\@state@article{���Z}}
\def\�čZ{\gdef\@state@article{�čZ}}
\def\�O�Z{\gdef\@state@article{�O�Z}}

\def\define@depend@number#1#2#3#4#5{%
% #1�F��`���������߁i\����������́j�C
% #2�F�P���̏ꍇ�̒�`
% #3�F�Q���̏ꍇ
% #4�F�R���̏ꍇ
% #5�F�S���̏ꍇ
  \expandafter\def\csname#1\endcsname{%
    \if\@number@sugaku1\relax%
      #2%
    \else
      \if\@number@sugaku2\relax%
        #3%
      \else
        \if\@number@sugaku3\relax%
          #4%
        \else
          \if\@number@sugaku4\relax%
            #5%
          \else
            \@latex@error{�w���w�x�͂P�`�S�܂ł�������܂���B}
          \fi
        \fi
      \fi
    \fi
  }%
}

\define@depend@number{@month@sugaku}{1}{4}{7}{10}
\def\@year@sugaku{%
  \@tempcnta=2000 \advance\@tempcnta by-52\relax%
  \advance\@tempcnta by\@volume@sugaku\relax%
    \@arabic\@tempcnta%
}

\def\@CurrentSugakuInfo{���w\@volume@sugaku{}��\@number@sugaku{}��\kern1zw\@year@sugaku{}�N\@month@sugaku{}��}% 13/2/1
\def\@default@CurrentSugakuInfo{���w00��0��\kern1zw0000�N00��}% 13/2/1
\def\CurrentSugakuInfo{\@if@manuscript{\@default@CurrentSugakuInfo}{\@CurrentSugakuInfo}}% 13/2/1


\define@depend@number{@season@sugaku}{�~}{�t}{��}{�H}
%%\define@depend@number{determine@totalpage}% 11/03/18, 11/05/09
%%  {\setcounter{totalpage}{1}}
%%  {\setcounter{totalpage}{113}}
%%  {\setcounter{totalpage}{225}}
%%  {\setcounter{totalpage}{337}}
%%\AtBeginDocument{\determine@totalpage}
\define@depend@number{@set@sugaku@page}% 12/12/18
  {\setcounter{page}{1}}
  {\setcounter{page}{113}}
  {\setcounter{page}{225}}
  {\setcounter{page}{337}}
\AtBeginDocument{\@set@sugaku@page}

%%\def\thetotalpage{\@arabic\c@totalpage}% 12/12/18

\newcount\@header@type
\@header@type=1

\def\ps@plain{%
  \def\@oddhead{\nonbrefont%
    \hss\@gauge\hbox to\z@{\hss\rightmark\hss}\hss%
    \llap{\hbox to\textwidth{\hfil\thepage\kern\Cwd}}% 12/12/18
    }%
  \def\@evenhead{\nonbrefont%
    \rlap{\hbox to\textwidth{\kern\Cwd\thepage\hfil}\hss}% 12/12/18
    \hss\@gauge\hbox to\z@{\hss\leftmark\hss}\hss%
    }%
  \def\@evenfoot{\nonbrefont%
    \hfil%
    \smash{\lower2zw\hbox to\textwidth{\hfill\CurrentSugakuInfo\hfill}}% 12/12/18
    \hfil%
  }%
  \def\@oddfoot{\nonbrefont%
    \hfil%
    \smash{\lower2zw\hbox to\textwidth{\hfill\CurrentSugakuInfo\hfill}}% 12/12/18
    \hfil%
  }%
}

\def\ps@non{%
%  \let\@mkboth\@gobbletwo%
  \def\@oddhead{\nonbrefont%
    \hss\@gauge\hss%
    \llap{\hbox to\textwidth{\hfil\thepage\kern\Cwd}}% 12/12/18
    }%
  \def\@evenhead{\nonbrefont%
    \rlap{\hbox to\textwidth{\kern\Cwd\thepage\hfil}\hss}% 12/12/18
    \hss\@gauge\hss%
    }%
  \def\@evenfoot{\nonbrefont%
    \hfil%
    \smash{\lower2zw\hbox to\textwidth{\hfill\CurrentSugakuInfo\hfill}}% 12/12/18
    \hfil%
  }%
  \def\@oddfoot{\nonbrefont%
    \hfil%
    \smash{\lower2zw\hbox to\textwidth{\hfill\CurrentSugakuInfo\hfill}}% 12/12/18
    \hfil%
  }%
}

%%%%
%%%% main titles (counter: c@chapter)
%%%%

% ���]�Ȃǂ̃}�[�N�icolor.sty�g�p�j
\def\@report@head@@font{%
  \reset@font%
%  \usekanji{JY1}{gt}{m}{n}
  \bf\fontsize{16\JQ}{\z@}\selectfont%
}

\def\make@report@head#1{\bgroup%
  \if#1\@empty
  \else
  \fboxsep=\z@\relax%
  \fbox{%
    \fboxsep=1mm\relax%
    \colorbox[gray]{.7}{%
      \hskip2mm%
      \@report@head@@font\kintou{4zw}{#1}%
      \hskip2mm%
    }%
  }%
  \fi
\egroup}

\def\���]{\report[0]{���]}}
\def\���]n{\sreport[0]{���]}\thispagestyle{non}}
\def\�_��{\report[1]{�_��}\thispagestyle{non}}
\def\�_��n{\sreport[1]{�_��}\thispagestyle{non}}
\def\�v�Z�@�Ɛ��w{\report[1]{�v�Z�@�Ɛ��w}}
\def\���ꂩ��{\report[1]{���ʊ��\hskip.5zw\dash{}���ꂩ��w�Ԑl�̂��߂�\dash}\def\@report@name{���ꂩ��}}% 13/07/11 
\def\���{\sreport[2]{���}\thispagestyle{non}}
\def\��e{\report[0]{��e}}
\def\��en{\sreport[0]{��e}\thispagestyle{non}}
\def\���w�j{\report[1]{���w�j}}
\def\���w�jn{\sreport[1]{���w�j}}
\def\�����t�@�C�i���X{\report[1]{�����t�@�C�i���X}}
\def\�����t�@�C�i���Xn{\sreport[1]{�����t�@�C�i���X}}

\def\ExpositoryArticles{\report[1]{�_��}\thispagestyle{non}}
\def\BookReviews{\report[0]{���]}}
\def\ComputerAidedAnalysis{\report[1]{�v�Z�@���p���}}
\def\ComputerScienceAndMathematics{\report[1]{�v�Z�@�Ɛ��w}}

\def\@book@review@string{���]}%
\def\@if@book@review{%
  \ifx\@report@name\@book@review@string%
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}

% �I�v�V��������
% 0 �d�d ���͋��ɋL����
% 1 �d�d ���͋L�����E�^�C�g��
% 2 �d�d ���͋��Ƀ^�C�g��

\def\report{\@ifnextchar[{\@report}{\@report[0]}}%]

\def\@set@header@type{%
  \let\@mkboth\@gobbletwo%
  \ifnum\@header@type=0% (report, report)�i���]�Ȃǁj
    \def\@reportmark##1{\markboth{\protect\kintou{8zw}{##1}}{\protect\kintou{8zw}{##1}}}%
    \let\@titlemark\@gobble%
  \else
    \ifnum\@header@type=1% (report, title)�i�_���Ȃǁj
      \def\@reportmark##1{\markboth{\protect\kintou{8zw}{##1}}{}}%
      \def\@titlemark##1{\markright{##1}}%
    \else
      \ifnum\@header@type=2% (title, title)�i���L���j
        \let\@reportmark\@gobble%
        \def\@titlemark##1{\markboth{##1}{##1}}%
      \else
      \fi
    \fi
  \fi
}

\def\@report[#1]#2{%
  \global\@header@type=#1\relax%
  \gdef\@report@name{#2}%
  \@set@header@type%
  \setcounter{chapter}{0}%
  \@if@manuscript{}{%
    \gyoudori{\@if@book@review{2}{3}}%
      {\noindent\make@report@head{\@report@name}}}%
  \nopagebreak[4]%
}

\def\sreport[#1]#2{%
  \global\@header@type=#1\relax%
  \gdef\@report@name{#2}%
  \@set@header@type%
  \setcounter{chapter}{0}%
  \nopagebreak[4]%
}

\def\@report@name{}

% title font
\def\@title@@font#1{%
  \gdef\title@@font{%
    \reset@font%
    \@tempdima=#1\Jpt\relax%
    \fontsize{\@tempdima}{1.5\@tempdima}%
%%    \sffamily\gtfamily\kanjiseries{r}\romanseries{m}\mathversion{bold}%
    \bf\sffamily\selectfont%
    \ybaselineshift.05zw\relax%
  }%
}

\def\@subtitle@@font#1{%
  \gdef\subtitle@@font{%
    \reset@font%
    \@tempdima=#1\Jpt\relax%
    \fontsize{\@tempdima}{1.5\@tempdima}%
    \rmfamily%
    \selectfont%
    \ybaselineshift.05zw\relax%
  }%
}
\def\@author@@font{%
  \reset@font%
  \Large\rmfamily%
  \selectfont%
}

\def\@title@bookreview@@font#1{%
  \gdef\title@bookreview@@font{%
    \reset@font%
    \@tempdima=#1\Jpt\relax%
    \fontsize{\@tempdima}{\normalbaselineskip}%
%    \sffamily\gtfamily\kanjiseries{r}\romanseries{m}\mathversion{bold}%
    \bf\sffamily\selectfont%
    \ybaselineshift.05zw\relax%
  }%
}
\def\@subtitle@bookreview@@font#1{%
  \gdef\subtitle@bookreview@@font{%
    \reset@font%
    \@tempdima=#1\Jpt\relax%
    \fontsize{\@tempdima}{\normalbaselineskip}%
    \rmfamily%
    \selectfont%
    \ybaselineshift.05zw\relax%
  }%
}
\def\@author@bookreview@@font#1{%
  \reset@font%
  \@tempdima=#1\Jpt\relax%
  \fontsize{\@tempdima}{\z@}%
  \rmfamily%
  \selectfont%
}

% title
\newcommand{\maketitle}{%
  \maketitle@Warning
  \maketitlehead{\@title}{\@subtitle}{\@author}%
  \@reportmark{\@report@name}% 
  \@titlemark{\@title}%
  \global\let\@title\relax
  \global\let\@subtitle\relax
  \global\let\@author\relax
  \stepcounter{chapter}
  \setcounter{equation}{0}
  \setcounter{notecount}{0}
  \@xsect{1sp}
}

\let\@title\relax
\let\@subtitle\relax
\let\@author\relax
\let\@reportmark\@gobble
\let\@titlemark\@gobble

\def\maketitle@Warning{%
  \ifx\@title\relax
    \ClassWarning{sugaku}{title������`�ł�}
  \else\fi
  \ifx\@author\relax
    \ClassWarning{sugaku}{author������`�ł��B}
  \else\fi
}

\def\title{\@ifnextchar[{\title@}{\title@[\@if@book@review{10}{12}]}}

\long\def\title@[#1]#2{%
  \@if@book@review{\@title@bookreview@@font{#1}}{\@title@@font{#1}}%
  \gdef\@title{#2}%
}

\long\def\subtitle{\@ifnextchar[{\subtitle@}{\subtitle@[10]}}

\long\def\subtitle@[#1]#2{%
  \@if@book@review{\@subtitle@bookreview@@font{#1}}{\@subtitle@@font{#1}}%
  \gdef\@subtitle{#2}%
}

\def\author{\@ifnextchar[{\author@specialcase}{\author@}}
\def\author@#1{%
  \@if@book@review%
  {\gdef\@author{#1}}%
  {\gdef\@author{#1}}%
}
\def\author@specialcase[#1]#2{%
  \def\@author@footnote{#1}
  \@if@book@review%
  {\gdef\@author{#2}}%
  {\gdef\@author{#2}}%
}

\let\@subtitle\relax
\let\@title\relax
\let\@author\relax
%%\let\@author@footnote\@undefined

\let\title@@font\relax
\let\subtitle@@font\relax
\let\title@bookreview@@font\relax
\let\subtitle@bookreview@@font\relax

\def\maketitlehead{%
  \@if@book@review%
    {\maketitlehead@bookreview}%
    \maketitlehead@main
}

\def\maketitlehead@main#1#2#3{%
  \normalsize
  \gyoudori{4}{%
    \begin{center}
      {\title@@font #1}\par
      {\subtitle@@font #2}\par
    \end{center}
  }%
  \nopagebreak[4]%
  \gyoudori{2}{%
  \vfill
    \vbox to\z@{\vss%
      \let\and\par%
      \@author@@font%
      \dimen@\textwidth\relax%
      \advance\dimen@ by-7zw\relax%
      \kanjiskip\z@ plus 1fil\relax
      \xkanjiskip=\kanjiskip\relax%
      \parindent\z@\relax%
      \parfillskip\z@\relax%
      \leftskip\dimen@\relax%
      \ifx\@author@footnote\@undefined
        #3%
      \else
        \setbox\z@\hbox{\,$^{*)}$}\relax%
        \hspace*{-\wd\z@}#3\box0\relax%
      \fi
      \par%
    }%
  \vskip.5\baselineskip%
  }%
  \ifx\@author@footnote\@undefined\else
    \setcounter{footnote}{1}\footnotetext{\@author@footnote}%
    \let\@author@footnote\@undefined%
  \fi
  \nopagebreak[4]%
}

\def\maketitlehead@bookreview#1#2#3{%
  \normalsize
  \gyoudori{2}{%
    \begin{center}
    \vskip-.25\baselineskip
      {\title@bookreview@@font%
       #1}
      {\subtitle@bookreview@@font%
       #2}\par
    \end{center}
  \vss}%
  \nopagebreak[4]%
  \gyoudori{2}{%
  \vfill
    \vbox to\z@{\vss%
      \let\and\par%
      \@author@bookreview@@font{10}%
      \dimen@\textwidth\relax%
      \advance\dimen@ by-7zw\relax%
      \kanjiskip\z@ plus 1fil\relax
      \parindent\z@\relax%
      \parfillskip\z@\relax%
      \leftskip\dimen@\relax%
      #3\par%
    }%
  \vskip.5\baselineskip%
  }%
  \nopagebreak[4]%
}

%%%%
%%%% titles (chapter, section,...)
%%%%

\setcounter{secnumdepth}{3}
\newcounter{part}
\newcounter{chapter}
\newcounter{section}[chapter]
\newcounter{subsection}[section]
\newcounter{subsubsection}[subsection]
\newcounter{paragraph}[subsubsection]
\newcounter{subparagraph}[paragraph]
\renewcommand{\thepart}{\@Roman\c@part}
\renewcommand{\thechapter}{\@arabic\c@chapter}
\renewcommand{\thesection}{%\thechapter.
\@arabic\c@section}
\renewcommand{\thesubsection}{\thesection.\@arabic\c@subsection}
\renewcommand{\thesubsubsection}{%
   \thesubsection.\@arabic\c@subsubsection}
\renewcommand{\theparagraph}{%
   \thesubsubsection.\@arabic\c@paragraph}
\renewcommand{\thesubparagraph}{%
   \theparagraph.\@arabic\c@subparagraph}
\newcommand{\@chapapp}{\prechaptername}
\newcommand{\@chappos}{\postchaptername}
\newcommand{\@secapp}{}

%%%% chapter

%%%% section, subsection, etc.

\def\@section@@font{\bf}%{\bf\gtfamily\kanjiseries{r}\romanfamily\rmdefault\selectfont}

\def\@startsection#1#2#3#4#5#6{%
  \if@noskipsec\leavevmode\fi%
% <==
  \@tempskipb=\z@\relax%
    \ifnum#2=1
      \ifdim\lastskip=1sp%
        \advance\@tempskipb by#4\relax%
      \else\fi%
      \if@temp@equation@flag
        \setcounter{equation}{0}%
      \else\fi%
    \else\fi%
% ==>
  \par%
  \@tempskipa #4\relax%
  \advance\@tempskipa by-\@tempskipb\relax%%% 
  \@afterindenttrue
  \ifdim \@tempskipa <\z@
    \@tempskipa -\@tempskipa \@afterindentfalse
  \fi
  \if@nobreak
    \everypar{}%
  \else
%    \addpenalty\@secpenalty %
    \addvspace\@tempskipa\relax%
  \fi
  \noindent%
  \@ifstar
    {\@ssect{#3}{#4}{#5}{#6}}%
    {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}%
    }%

\def\@seccntformat#1{\csname the#1\endcsname\hskip1zw}
\def\@sect#1#2#3#4#5#6[#7]#8{%
  \ifnum #2>\c@secnumdepth
    \let\@svsec\@empty
  \else
    \refstepcounter{#1}%
    \protected@edef\@svsec{\@seccntformat{#1}\relax}%
  \fi
  \@tempskipa #5\relax%
  \ifdim \@tempskipa<\z@
    \def\@svsechd{#6{\hskip#3\relax\@svsec#8}%
      \csname #1mark\endcsname{#7}%
        }% 
  \else
    \begingroup%
      \interlinepenalty \@M % 
      #6{%
        \@hangfrom{\hskip#3\relax\@svsec}%
        #8\@@par}%
    \endgroup%
    \csname #1mark\endcsname{#7}%
  \fi
  \@xsect{#5}}
\def\@xsect#1{%
  \@tempskipa #1\relax%
  \ifdim \@tempskipa<\z@
    \@nobreakfalse
    \global\@noskipsectrue
    \everypar{%
      \if@noskipsec
        \global\@noskipsecfalse
       {\setbox\z@\lastbox}%
        \clubpenalty\@M
        \begingroup\@svsechd\endgroup
        \unskip
        \@tempskipa #1\relax
        \hskip -\@tempskipa
      \else
        \clubpenalty \@clubpenalty
        \everypar{}%
      \fi}%
  \else
    \par\nobreak%
    \vskip\@tempskipa
%    \@afterheading
  \fi
  \par% 
  \ignorespaces}
\def\@ssect#1#2#3#4#5{%
  \@tempskipa #3\relax
  \ifdim \@tempskipa<\z@
    \def\@svsechd{#4{\hskip#1\relax#5}}%
  \else
    \begingroup%
      #4{%
        \@hangfrom{\hskip #1}%
          \interlinepenalty \@M #5\@@par}%
    \endgroup
  \fi
  \@xsect{#3}}

\newcommand{\section}{\@startsection{section}{1}{1zw}%
  {\baselineskip}% above
  {\z@}% below
  {\normalfont\@section@@font}}

\newcommand{\subsection}{\@startsection{subsection}{2}{1zw}%
    {\z@}% above
    {\z@}% below
    {\normalfont\@section@@font}}

\newcommand{\subsubsection}{\@startsection{subsubsection}{3}{1zw}%
    {\z@}%
    {\z@}%
    {\normalfont\@section@@font}}

\newcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}%
    {\z@}%
    {-1zw}%
    {\normalfont\normalsize ��}}

\newcommand{\subparagraph}{\@startsection{subparagraph}{5}{\z@}%
   {\z@}{-1zw}%
   {\normalfont\bf}}

%%%%
%%%% float
%%%%

\newcommand{\captionfont}{\small}

\def \@floatboxreset {%
        \reset@font
        \captionfont
        \@setminipage
}

\def \@endfloatbox{%
      \ifnum\topsep>0\vskip-\topsep\fi
      \ifnum\partopsep>0\vskip-\partopsep\fi
      \par\vskip\z@skip      %% \par\vskip\z@ added 15 Dec 87
      \@minipagefalse
      \outer@nobreak
    \egroup                  %% end of vbox
  \color@endbox
}

\def \@addtocurcol {%
   \@insertfalse
   \@setfloattypecounts
   \ifnum \@fpstype=8
   \else
     \ifnum \@fpstype=24
     \else
       \@flsettextmin
       \advance \@textmin \@textfloatsheight
       \@reqcolroom \@pageht
       \ifdim \@textmin>\@reqcolroom
         \@reqcolroom \@textmin
       \fi
       \advance \@reqcolroom \ht\@currbox
       \ifdim \@colroom>\@reqcolroom
         \@flsetnum \@colnum
         \ifnum \@colnum>\z@
           \@bitor\@currtype\@deferlist
           \if@test
           \else
             \@bitor\@currtype\@botlist
             \if@test
               \@addtobot
             \else
               \ifodd \count\@currbox
                 \advance \@reqcolroom \intextsep
                 \ifdim \@colroom>\@reqcolroom
                   \global \advance \@colnum \m@ne
                   \global \advance \@textfloatsheight \ht\@currbox
                   \global \advance \@textfloatsheight 2\intextsep
                   \global \advance \@textfloatsheight -1zw%\Cht% <--
                   \@cons \@midlist \@currbox
                   \if@nobreak
                     \nobreak
                     \@nobreakfalse
                     \everypar{}%
                   \else
                     \addpenalty \interlinepenalty
                   \fi
                   \vskip \intextsep
                   \box\@currbox
                   \penalty\interlinepenalty
                   \vskip-1zw%%\Cht% <--
                   \vskip\intextsep
                   \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
                   \outputpenalty \z@
                   \@inserttrue
                 \fi
               \fi
               \if@insert
               \else
                 \@addtotoporbot
               \fi
             \fi
           \fi
         \fi
       \fi
     \fi
   \fi
   \if@insert
   \else
     \@resethfps
     \@cons\@deferlist\@currbox
   \fi
}

\newcommand{\figurename}{�}}
\renewcommand{\tablename}{�\}
\newcounter{figure}[chapter]
\renewcommand \thefigure
      {\@arabic\c@figure}
\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{\figurename\nobreak\thefigure}
\def\fname@figure{\figurename}
\newenvironment{figure}%
               {\def\@currentlabel{\thefigure}% 13/02/12
                \bgroup%
                \captionfont%
                \setlength\abovecaptionskip{1mm}% 13/02/12
                \setlength\belowcaptionskip{0mm}% 13/02/12
                \@float{figure}}
               {\end@float\egroup}
\newenvironment{figure*}%
               {\@dblfloat{figure}}%
               {\end@dblfloat}
%\newcounter{table}[chapter]
\@addtoreset{table}{chapter}
\renewcommand \thetable{\@arabic\c@table}
\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{\tablename\nobreak\thetable}
\def\fname@table{\tablename}
\newenvironment{table}%
               {\def\@currentlabel{\thetable}% 13/02/12
                \bgroup%
                \captionfont%
                \setlength\abovecaptionskip{0mm}% 13/02/12
                \setlength\belowcaptionskip{1mm}% 13/02/12
                \@float{table}}
               {\end@float\egroup}
\newenvironment{table*}%
               {\@dblfloat{table}}%
               {\end@dblfloat}
\newlength\abovecaptionskip
\newlength\belowcaptionskip
\setlength\abovecaptionskip{2mm}%
\setlength\belowcaptionskip{2mm}%

\def\caption{%
 \@ifstar{%
   \ifx\@captype\@undefined
     \@latex@error{\noexpand\caption outside float}\@ehd
     \expandafter\@gobble
   \else
     \expandafter\@firstofone
   \fi
   {\@dblarg{\@scaption\@captype}}%
 }{%
   \ifx\@captype\@undefined
     \@latex@error{\noexpand\caption outside float}\@ehd
     \expandafter\@gobble
   \else
     \refstepcounter\@captype
     \expandafter\@firstofone
   \fi
   {\@dblarg{\@caption\@captype}}%
}}

\newbox\box@bi
\newtoks\toks@bi

\long\def\tmp@bi@#1\\#2\@nil{%
  \setbox\box@bi\hbox{\the\toks@bi#1}\relax%
  \vbox\bgroup%
  \ifdim\wd\box@bi>\hsize\relax%
    \advance\hsize by-3.5cm\relax%
  \else
    \hsize\wd\box@bi\relax%
  \fi%
  \partopsep\z@\relax%
  \topsep\z@\relax%
  \trivlist%\raggedright
  \let\\\@centercr \rightskip\z@skip \leftskip\z@skip \parindent\z@
  \item\relax%
  \par\leavevmode\null\the\toks@bi#1\\\the\toks@bi#2%
  \endtrivlist\egroup}

\long\def\@breakshape[#1]#2{%
  \toks@bi{#1}\relax%
  {\fboxrule\z@\fboxsep\z@\relax%
  \fbox{\tmp@bi@#2\\\@empty\@nil}}}

\long\def\breakshape{\@ifnextchar[{\@breakshape}{\@breakshape[]}}

\long\def\@makecaption#1#2{%
{\captionfont
    \global \@minipagefalse\bgroup\topsep\z@
    \trivlist \centering\item\relax%
      \breakshape[\captionfont]{#1�F#2}
    \endtrivlist\egroup
  }}
\long\def\@caption#1[#2]#3{%
  \par
  \vskip\abovecaptionskip\begingroup
    \@parboxrestore
    \if@minipage
      \@setminipage
    \fi
    \normalsize
    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
  \endgroup\vskip\belowcaptionskip}

\long\def\@scaption#1[#2]#3{%
  \par
  \vskip\abovecaptionskip\begingroup
    \@parboxrestore
    \if@minipage
      \@setminipage
    \fi
    \@makecaption{\csname fname@#1\endcsname}{\ignorespaces #3}\par
  \endgroup\vskip\belowcaptionskip}

%%%%
%%%% footnote
%%%%

\skip\footins=\Cwd %% 
%%%%%% footnote
\def\@fnsymbol#1{\ensuremath{\ifcase#1\or *\or **\or {**}*\or
   \dagger \or \ddagger \or \dagger\dagger \or \ddagger\ddagger
   \else\@ctrerr\fi}}
\renewcommand{\thefootnote}{\@fnsymbol\c@footnote}
\let\footnotes@ve=\footnote
\def\footnote{\inhibitglue\footnotes@ve}
\def\@makefnmark{\hbox{\@textsuperscript{\normalfont
      \thefootnote)%
      }}}
\renewcommand{\footnoterule}{%
  \kern\z@%
  \hrule width .4\textwidth height.12mm
  \kern-\lineskip\kern.12mm\kern7H %
  }
\@addtoreset{footnote}{chapter}

\setbox\@tempboxa\hbox{\footnotesize\char\euc"A1A1}
\@tempdima=\wd\@tempboxa
\footnotesep=\@tempdima

\long\def\@footnotetext{%
  \insert\footins\bgroup
    \normalfont\footnotesize
    \interlinepenalty\interfootnotelinepenalty
    \splittopskip\footnotesep
    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
       \csname p@footnote\endcsname\@thefnmark
    }%
    \color@begingroup
      \@makefntext{%
        \rule\z@\footnotesep\ignorespaces}%
      \futurelet\next\fo@t}
\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
                                \else \let\next\f@t\fi \next}
\def\f@@t{\bgroup\aftergroup\@foot\let\next}
\def\f@t#1{#1\@foot}
\def\@foot{\@finalstrut\strutbox\color@endgroup\egroup}
\newcommand\@makefntext[1]{%
  \parindent 1zw
  \thefootnote)\hskip1zw #1%
  }

\let\footinsert=\footnote

%%%%
%%%% note 
%%%%

\newcounter{notecount} 
\setcounter{notecount}{0}
\def\thenotecount{\@arabic\c@notecount}

\long\def\endnote#1{%
  \<\kern\z@\stepcounter{notecount}%
  \penalty10000\textsuperscript{\thenotecount)}%
  \protect\long\expandafter\gdef\csname note@\thenotecount\endcsname{#1}%
}

\def\endnotehead{\bibtitle{����}}
\def\@endnotelabel#1{#1)}

\def\outputnote{%
  \if@interior@bib@
    \@outputnote
  \else
    \begin{multicols}{2}%
      \@bibliography@@size% .=. \samll 
      \bibliography@setup%
      \@outputnote
    \end{multicols}
  \fi
}

\def\@outputnote{%
\bgroup
  \@ifundefined{note@1}{\relax}{%
    \endnotehead%
    \@beginparpenalty\@M\relax%
    \@tempcnta=\thenotecount\relax%
    \advance\@tempcnta by1\relax%
    \setcounter{notecount}{0}%
      \list{\@endnotelabel{\@arabic\c@enumi}}%
           {\settowidth\labelwidth{\@endnotelabel{1}}%
            \labelsep1zw
            \itemindent\labelwidth
            \leftmargin=1zw
            \usecounter{enumi}%
            \let\p@enumi\@empty
            \def\theenumi{\@arabic\c@enumi}}% \renewcommand to \def 2006/06/22
    \loop
      \stepcounter{notecount}
      \ifnum\@tempcnta>\c@notecount
        \item{}%{\thenotecount} 
        \csname note@\thenotecount\endcsname\par
        \global\expandafter\let\csname note@\thenotecount\endcsname=\@undefined%
    \repeat
  %
  \setcounter{notecount}{0}%\global\@newlistfalse% 2005/06/13
  \endlist% 2006/06/23 
  }% 
\egroup\par
}

\let\footnote\endnote

%%%%
%%%% bibliography
%%%%

\newdimen\bibindent
\setlength\bibindent{2zw}

\def\@bibliography@@size{%
  \small\fontsize{11\JQ}{15H}\selectfont
  \lineskip=1H \lineskiplimit=\lineskip
  \xkanjiskip=.2zw plus.05zw minus.05zw
  \abovedisplayskip .15\baselineskip \@plus.05\baselineskip \@minus.05\baselineskip
  \abovedisplayshortskip .15\baselineskip \@plus.05\baselineskip \@minus.05\baselineskip
  \belowdisplayshortskip .15\baselineskip \@plus.05\baselineskip \@minus.05\baselineskip
  \belowdisplayskip \abovedisplayskip}

\def\bibtitle@@font{%
  \bf\usekanji{JY1}{gt}{m}{n}\selectfont%
}

\def\bibtitle#1{%
  \gyoudori{2}{%
    \centerline{%
      \bibtitle@@font%
      \kintou{5zw}{#1}%
    }%
  }%
  \nopagebreak[4]\par
}

\def\thebibliographyhead{\bibtitle{����}}

\long\def\g@addto@macro#1#2{%
  \begingroup
    \toks@\expandafter{#1#2}%
    \xdef#1{\the\toks@}%
  \endgroup}

\long\def\@addto@macro@@#1#2{%
    \toks@\expandafter{#1#2}%
    \edef#1{\the\toks@}%
}

\let\@beginbibliographyhook\@empty
\let\@endbibliographyhook\@empty
\def\g@AtBeginBibliography{\g@addto@macro\@beginbibliographyhook}
\def\g@AtEndBibliography{\g@addto@macro\@endbibliographyhook}
\def\AtBeginBibliography{\@addto@macro@@\@beginbibliographyhook}
\def\AtEndBibliography{\@addto@macro@@\@endbibliographyhook}

\def\bibitem{\@ifnextchar[\@lbibitem\@bibitem}
\def\@lbibitem[#1]#2{\item[\@lbiblabel{#1}]\if@filesw
      {\let\protect\noexpand
       \immediate
       \write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces}
\def\@bibitem#1{\item\if@filesw \immediate\write\@auxout
       {\string\bibcite{#1}{\the\value{\@listctr}}}\fi\ignorespaces}

\def\@biblabel#1{%
  \setbox\z@\hbox{#1}\relax%
  \dimen0=\wd0\relax%
  \setbox2\hbox{99}\relax%
  \dimen2=\wd2\relax%
  \if@interior@bib@
    \ifdim\dimen0<\dimen2
      [\hbox to\wd2{\hss#1\hss}]%
    \else
      [#1]%
    \fi
  \else
    \ifdim\dimen0<\dimen2
      [\,#1\,]%
    \else
      [#1]%
    \fi
  \fi
  }

\let\@lbiblabel\@biblabel

\def\bibliography@setup{%
  \dimen3=.6\fontdimen3\font
  \dimen4=.6\fontdimen4\font
  \def\,{\nobreak\hskip.1667em plus\dimen3 minus\dimen4 }
  \long\def\emph##1{##1}
  \let\em\relax
  \sfcode`.=1000
  \sfcode`:=1000
}

\newif\if@interior@bib@ \@interior@bib@false

\newenvironment{thebibliography}[1]
     {\begin{multicols}{2}% multicol.sty 
      \@interior@bib@true\relax%
      \@bibliography@@size% 
      \bibliography@setup%
      \let\AtBeginBibliography\@firstofone
      \@beginbibliographyhook% AtBeginBibliogrpahy
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{1}}%
            \labelsep1zw
            \itemindent\labelwidth
            \leftmargin=1zw
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \@clubpenalty \clubpenalty
      \sfcode`\.\@m
      \lineskip\z@\relax%
      \lineskiplimit\z@\relax% 
      \thebibliographyhead% 
      \@beginparpenalty\@M% 
      }
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist
      \let\AtEndBibliography\@firstofone
      \@endbibliographyhook% EndBeginBibliogrpahy
      \@interior@bib@false
      \end{multicols}}

\newcommand\newblock{\ }%{\hskip .11em\@plus.33em\@minus.07em}

\g@AtBeginBibliography{\outputnote}

\def\@cite#1#2{\@biblabel{#1\if@tempswa , #2\fi}}

%%%%
%%%%  \label, \ref 
%%%%

\def\@sugaku@label@prefix{\@report@name\thechapter:}
\def\@sugaku@label@prefix@bib{\@report@name\thechapter:bib:}

\def\label#1{\@bsphack
  \protected@write\@auxout{}%
         {\string\newlabel{\@sugaku@label@prefix#1}{{\@currentlabel}{\thepage}}}%
  \@esphack}
% need amsmath.sty
\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{\@sugaku@label@prefix#1}
}
%
\def\ref#1{%
  \expandafter\@setref\csname r@\@sugaku@label@prefix#1\endcsname%
  \@firstoftwo{\@sugaku@label@prefix#1}}
%%%% \cite, \bibitem
\def\@lbibitem[#1]#2{\item[\@biblabel{#1}\hfill]\if@filesw
  {\let\protect\noexpand
  \immediate
  \write\@auxout{\string\bibcite{\@sugaku@label@prefix@bib#2}{#1}}}\fi\ignorespaces}
\def\@bibitem#1{\item\if@filesw \immediate\write\@auxout
  {\string\bibcite{\@sugaku@label@prefix@bib#1}{\the\value{\@listctr}}}\fi\ignorespaces}

\def\@citex[#1]#2{%
  \let\@citea\@empty
  \edef\reserved@a{#2}%
  \@cite{\@for\@citeb:=\reserved@a\do
    {\@citea\def\@citea{,\penalty\@m\ }%
     \edef\@tempa{\expandafter\@firstofone\@citeb\@empty}% <-- for bibTeX
     \if@filesw\immediate\write\@auxout{\string\citation{\@tempa}}\fi% <-- 
     \edef\@citeb{\@sugaku@label@prefix@bib\expandafter\@firstofone\@citeb\@empty}% <--
%     \edef\@citeb{\@sugaku@label@prefix@bib\expandafter\@firstofone\@citeb\@empty}% <--
%     \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
     \@ifundefined{b@\@citeb}{\mbox{\reset@font\bfseries ?}%
       \G@refundefinedtrue
       \@latex@warning
         {Citation `\@citeb' on page \thepage \space undefined}}%
       {\hbox{\csname b@\@citeb\endcsname}}}}{#1}}

% need amsthm.sty
\def\@xnthm#1#2{%
  \let\@tempa\relax
  \@xp\@ifdefinable\csname\@sugaku@label@prefix#2\endcsname{% <--
    \global\@xp\let\csname end\@sugaku@label@prefix#2\endcsname\@endtheorem% <--
    \edef\@thm@name@new{\csname\@sugaku@label@prefix#2\endcsname}% <--
    \@xp\let\csname#2\endcsname\@thm@name@new% <--
    \@xp\let\csname end#2\endcsname\@endtheorem% <--
    \ifx *#1% unnumbered, need to get one more mandatory arg
      \edef\@tempa##1{%
        \gdef\@xp\@nx\csname\@sugaku@label@prefix#2\endcsname{%
          \@nx\@thm{\@xp\@nx\csname th@\the\thm@style\endcsname}%
            {}{##1}}}%
    \else % numbered theorem, need to check for optional arg
      \def\@tempa{\@oparg{\@ynthm{\@sugaku@label@prefix#2}}[]}%
    \fi
  }%
  \@tempa
}

\def\@ynthm#1[#2]#3{%
  \edef\@thm@name@new{\@sugaku@label@prefix#2}% <--
  \ifx\relax#2\relax
    \def\@tempa{\@oparg{\@xthm{#1}{#3}}[]}%
  \else
    \@ifundefined{c@\@thm@name@new}{%
      \def\@tempa{\@nocounterr{\@thm@name@new}}%
    }{%
      \@xp\xdef\csname the#1\endcsname{\@xp\@nx\csname the\@thm@name@new\endcsname}%
      \toks@{#3}%
      \@xp\xdef\csname#1\endcsname{%
        \@nx\@thm{%
          \let\@nx\thm@swap
            \if S\thm@swap\@nx\@firstoftwo\else\@nx\@gobble\fi
          \@xp\@nx\csname th@\the\thm@style\endcsname}%
            {\@thm@name@new}{\the\toks@}}%
      \let\@tempa\relax
    }%
  \fi
  \@tempa
}

%%%%
%%%% tstombow
%%%%

\newdimen\pagewidth  \pagewidth=\paperwidth
\newdimen\pageheight \pageheight=\paperheight

\newdimen\tombowrule   \tombowrule.1mm % 
\newdimen\tombowlength \tombowlength 10mm % 
\newdimen\tombowgap    \tombowgap     3mm % 

\def\tb@v{\hbox to\tombowgap{\hss
 \vrule width\tombowrule height\tombowlength \kern-\tombowrule\kern\tombowgap%
 \vrule width\tombowrule height\tombowlength\hss}}
\def\tb@h{\vbox to\tombowgap{\hsize\tombowlength\vss
 \hrule height\tombowrule width\tombowlength \kern-\tombowrule\kern\tombowgap%
 \hrule height\tombowrule width\tombowlength\vss}}

\def\@RH{\rlap{%
  \vbox to\z@{\offinterlineskip\vss\tb@v\hbox{\kern\tombowgap\tb@h}}%
  }}
\def\@LH{\llap{%
  \vbox to\z@{\offinterlineskip\vss\hbox{\kern\tombowlength\tb@v}\hbox{\tb@h\kern\tombowgap}}%
  }}
\def\@RB{\rlap{%
  \vbox to\z@{\offinterlineskip\hbox{\kern\tombowgap\tb@h}\tb@v\vss}%
  }}
\def\@LB{\llap{%
  \vbox to\z@{\offinterlineskip\hbox{\tb@h\kern\tombowgap}\hbox{\kern\tombowlength\tb@v}\vss}%
  }}

\def\@PLUS{%
  \hb@xt@\z@{%
    \hb@xt@\z@{\hss
      \vbox to\z@{\vss\hrule height\tombowrule width\tombowlength\vss}\hss}%
    \hb@xt@\z@{\hss
      \vbox to\z@{\vss\hrule width\tombowrule height\tombowlength\vss}\hss}%
    }%
  }
\def\@PLUST{\vbox to\z@{\vss\@PLUS\kern.5\tombowlength\kern\tombowgap}}
\def\@PLUSB{\vbox to\z@{\kern.5\tombowlength\kern\tombowgap\@PLUS\vss}}
\def\@PLUSL{\llap{\@PLUS\kern.5\tombowlength\kern\tombowgap}}
\def\@PLUSR{\rlap{\kern.5\tombowlength\kern\tombowgap\@PLUS}}

\def\@tombow@header{%
  \vbox to\z@{\vskip-\tombowlength\vskip-\tombowgap%
    \rlap{%
      \if@Spread
        \if@TateMode
          \ifodd\c@page
          \else
            \kern\pagewidth
          \fi
        \else
          \ifodd\c@page
            \kern\pagewidth
          \fi
        \fi
      \fi
    \hskip1.5cm\reset@font\@TombowHeader}%
  \vss}%
}

\def\TombowHeader#1{%
  \gdef\@TombowHeader{#1}
}

\def\@default@TombowHeaderInfo{% 13/2/1
  \@volume@sugaku{}��\@number@sugaku{}���i\@season@sugaku{}�G���j
}
\def\TombowHeaderInfo{\@default@TombowHeaderInfo}% 13/2/1

\def\CompileDay{�i\the\year�E\the\month�E\the\day�j\inhibitglue}
\TombowHeader{% 13/2/1
  \fbox{{\bf\kintou{3zw}{\@state@article}}}
  \if@Press\CompileDay\fi\quad
  ���{���w��w���w�x%
  \if@Press\TombowHeaderInfo\else\fi
  \quad
  page:\ \the\c@page
}

%% 13/07/11
\newcounter{totalpage}
\setcounter{totalpage}{1}
\def\thetotalpage{{\ttfamily\itshape\the\c@totalpage}}
\def\@print@totalpage{% 
  \if@Press
  {\@tempdima=\tombowgap\advance\@tempdima+\tombowlength
  \if@Spread
    \ifodd\c@page
      \if@TateMode
        \hbox to2\pagewidth{\smash{\lower\@tempdima\hbox to\z@{\hss\llap{\thetotalpage}\hskip2\tombowrule\hskip\tombowgap\hskip1mm}}\hfill}%
      \else
        \hbox to2\pagewidth{\hfill\smash{\lower\@tempdima\hbox to\z@{\hskip2\tombowrule\hskip\tombowgap\hskip1mm\rlap{\thetotalpage}\hss}}}%
      \fi
    \else
      \if@TateMode
        \hbox to2\pagewidth{\hfill\smash{\lower\@tempdima\hbox to\z@{\hskip2\tombowrule\hskip\tombowgap\hskip1mm\rlap{\thetotalpage}\hss}}}%
      \else
        \hbox to2\pagewidth{\smash{\lower\@tempdima\hbox to\z@{\hss\llap{\thetotalpage}\hskip2\tombowrule\hskip\tombowgap\hskip1mm}}\hfill}%
      \fi
    \fi
  \else
    \hbox to\pagewidth{\hfill\smash{\lower\@tempdima\hbox to\z@{\hskip2\tombowrule\hskip\tombowgap\hskip1mm\rlap{\thetotalpage}\hss}}}
  \fi}
  \fi
}
%%

\def\@outputpage{%
\iftdir
  \@TateModetrue
\else
  \@TateModefalse
\fi
\begingroup
  \iftdir
    \dimen\z@\textwidth \textwidth\textheight \textheight\dimen\z@
  \fi
  \let\protect\noexpand
  \@resetactivechars
  \@parboxrestore
  \global\setbox\@OnePage
   \vbox to\pageheight{\if@TateMode\yoko\fi%
     \set@typeset@protect
     \if@specialpage
       \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
     \fi
     \if@twoside
       \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
          \iftdir\let\@themargin\evensidemargin
          \else\let\@themargin\oddsidemargin\fi
       \else \let\@thehead\@evenhead
          \let\@thefoot\@evenfoot
           \iftdir\let\@themargin\oddsidemargin
           \else\let\@themargin\evensidemargin\fi
     \fi\fi
     \reset@font\normalsize\normalsfcodes
     \let\label\@gobble
     \let\index\@gobble
     \let\glossary\@gobble
     \baselineskip\z@skip
     \lineskip\z@skip
     \lineskiplimit\z@
     \@begindvi
     \vbox to\z@{\box\@OnePage\vss}%%
     \hbox to\if@Spread 2\fi\pagewidth{\L@Paper@Domain%
       \@LH\@tombow@header\hfil\@PLUST\hfil\@RH%
     \R@Paper@Domain}%
     \vbox to\z@{\kern.5\pageheight%
     \hbox to\if@Spread 2\fi\pagewidth{\@PLUSL\hfil\@PLUSR}\vss}%
     \vskip \topmargin%
     \hbox to\pagewidth{\kern\@themargin%
      \if@Spread
        \if@TateMode
          \ifodd\c@page
          \else
            \kern\pagewidth
          \fi
        \else
          \ifodd\c@page
            \kern\pagewidth
          \fi
        \fi
      \fi
      \vbox{\setbox\@tempboxa
      \vbox to\headheight{\vfil
        \color@hbox\normalcolor
          \hb@xt@\textwidth{\@thehead}%
        \color@endbox}
        \dp\@tempboxa\z@
        \box\@tempboxa
        \vskip \headsep
        \box\@outputbox
        \baselineskip\footskip
        \color@hbox\normalcolor
          \hbox to\textwidth{\@thefoot}%
        \color@endbox}\hss}
     \vss
     \hbox to\if@Spread 2\fi\pagewidth{\@LB\hfil\@PLUSB\hfil\@RB}
     \@print@totalpage%% 13/07/11
   }
   \if@Spread
     \ifodd\c@page
       \shipout\box\@OnePage
     \fi
   \else
     \shipout\box\@OnePage
   \fi
\endgroup
\global\@colht\textheight
\stepcounter{page}\stepcounter{totalpage}\let\firstmark\botmark}% 13/07/11, 12/12/18 \stepcounter{totalpage}

\AtEndDocument{%
  \if@Spread
      \clearpage\null\thispagestyle{empty}\clearpage\null\thispagestyle{empty}
  \fi}

%% 120223: offset value 
\if@Final
%%  \tombowrule\z@
  \tombowrule=.1mm
  \addtolength{\voffset}{-1in}
  \addtolength{\hoffset}{-1in}
%%  \special{papersize=182mm,257mm}
  \if@PaperSize
    \special{papersize=182mm,257mm}
  \else
    \addtolength{\voffset}{20mm}
    \addtolength{\hoffset}{14mm}
  \fi
  \TombowHeader{}
\else
  \tombowrule.1mm
  \addtolength{\voffset}{-1in}
  \addtolength{\hoffset}{-1in}
  \if@Spread
    \if@PaperSize
      \special{papersize=364mm,257mm}
    \else
      \@tempdima=297mm\advance\@tempdima-\paperheight\divide\@tempdima+2
      \addtolength{\voffset}{\@tempdima}
      \@tempdima=420mm\advance\@tempdima-2\paperwidth\divide\@tempdima+2
      \addtolength{\hoffset}{\@tempdima}
      \special{papersize=420mm,297mm}
    \fi
  \else
    \if@PaperSize
      \special{papersize=182mm,257mm}
    \else
      \@tempdima=297mm\advance\@tempdima-\paperheight\divide\@tempdima+2
      \addtolength{\voffset}{\@tempdima}
      \@tempdima=210mm\advance\@tempdima-\paperwidth\divide\@tempdima+2
      \addtolength{\hoffset}{\@tempdima}
      \special{papersize=210mm,297mm}
    \fi
  \fi
\fi

%%%%
%%%% macors
%%%%

\newenvironment{data}{%
  \bgroup\trivlist \raggedleft\item\relax\small\spaceskip.5zw
  }{\endtrivlist\par\egroup}

\def\medskip{\vskip.5\baselineskip}
\def\bigskip{\vskip\baselineskip}
\def\smallskip{\vskip.25\baselineskip}

\def\beginNOBREAK{\@nobreaktrue}
\def\endNOBREAK{\@nobreakfalse}

\def\�H{�H\ClosedYakumonoPenalty}
\def\�I{�I\ClosedYakumonoPenalty}
\def\ClosedYakumonoPenalty{%
  \futurelet\@let@token\next@token@}
\def\next@token@{%
  \ifx\@let@token�j%
    \penalty10000
  \else
    \ifx\@let@token)%
      \penalty10000
    \else
      \ifx\@let@token�C%
        \penalty10000
      \else
        \ifx\@let@token,%
          \penalty10000
        \else
          \ifx\@let@token�D%
            \penalty10000
          \else
            \ifx\@let@token.%
              \penalty10000
            \else
              \ifx\@let@token�v%
                \penalty10000
              \else
                \ifx\@let@token�r%
                  \penalty10000
                \else
                  \ifx\@let@token]%
                    \penalty10000
                  \else
                    \ifx\@let@token�x%
                      \penalty10000
                    \else
                      \ifx\@let@token�z%
                        \penalty10000
                      \else
                        \ifx\@let@token�l%
                          \penalty10000
                        \else
                          \ifx\@let@token'%
                            \penalty10000
                          \else
                            \ifx\@let@token"%
                              \penalty10000
                            \else
                              \hskip.6zw\inhibitglue
                            \fi
                          \fi
                        \fi
                      \fi
                    \fi
                  \fi
                \fi
              \fi
            \fi
          \fi
        \fi
      \fi
    \fi
  \fi\ignorespaces}
\def\�F{\kern0mm\ifvmode\leavevmode\fi\hbox to1zw{\hss �F\hss}}
\def\�C{,\hskip.65zw plus.02zw minus.05zw\ignorespaces}
\def\dash{%
  \leavevmode\hbox to1.5zw{%
    \kanjiskip\z@ minus1fil \hskip-.1zw�|\hss�|\hss�|\hskip-.1zw}%
  \ignorespaces}
\def\textcdots{\leavevmode\hbox to1.5zw{\kanjiskip\z@ plus1fil minus1fil\<�E\hss�E\hss�E\<}}
\def\textldots{\<\hbox to1.5zw{\kanjiskip\z@ plus1fil minus1fil�D\<\hss�D\<\hss�D\<}}
\def\bysame{\ifvmode\leavevmode\fi\vrule width3zw height.12mm depth0mm}

\def\omotekei{\@ifnextchar[{\@omotekei}{\@omotekei[8cm]}}
\def\@omotekei[#1]{%
  \nopagebreak[4]\gyoudori{2}{%
  \noindent\leavevmode\smash{\raise.06mm\hbox to \textwidth{\hss%
    \vrule width#1 height.12mm depth\z@\hss}}%
  }%
}

\def\hangcarryover{\edef\next{\hangafter=\the\hangafter
  \hangindent=\the\hangindent}
  \par\next
  \edef\next{\prevgraf=\the\prevgraf}
  \indent\next
}

\def\hangitem{\@ifnextchar[{\@hangitem@a}{\@hangitem@b}}
\def\@hangitem@a[#1]#2{%
  \hangindent#1\hangafter1\noindent
  \leavevmode\hbox to#1{#2\hss}\ignorespaces}
\def\@hangitem@b#1{%
  \setbox\@tempboxa\hbox{#1}
  \@tempdima=\wd\@tempboxa
  \hangindent\@tempdima\hangafter1\noindent
  \leavevmode\box\@tempboxa\ignorespaces}

%%%%%%%%%%%
%%%%%%%%%%% math
%%%%%%%%%%%

\renewcommand{\binom}[2]{%
  \mathchoice{\binom@display{#1}{#2}}{\binom@text{#1}{#2}}
  {\binom@text{#1}{#2}}{\binom@text{#1}{#2}}%
}

\newcommand{\binom@display}[2]{%
  \left({\renewcommand{\arraystretch}{.9}
    \begin{array}{@{\,}c@{\,}}#1\\ #2\end{array}}\right)}

\newcommand{\binom@text}[2]{\genfrac{(}{)}{0pt}{}{#1}{#2}}

%%% need amsmath.sty
\newenvironment{pmatrixset}{%
  \,\bgroup%
  \arraycolsep=\fontdimen2\font
  \renewcommand{\arraystretch}{.9}%
  \matrix@check\pmatrixset\env@matrix
}{
  \endmatrix\egroup\,%
}

\renewenvironment{pmatrix}{%
  \left(\,\bgroup%
  \arraycolsep=\fontdimen2\font
  \renewcommand{\arraystretch}{.9}%
  \matrix@check\pmatrix\env@matrix
}{
  \endmatrix\egroup\,\right)%
}

\def\qqqed{%
  \hfill\scalebox{0.5}[1]{$\square$}\kern-.02zw\hbox to0mm{\hss\scalebox{0.5}[1]{$\square$}}}
\let\qed\qqqed

%%%%
%%%% hyphenation
%%%%
\@input{sugaku-hyphen.tex}

%%%%
%%%% 
%%%%

\pagenumbering{arabic}
\pagestyle{plain}
\raggedbottom

\endinput
