%%%%%
%%%%% manual.sty		SANO H, July 5, 1994
%%%%% 				SANO H, July 11, 1994
%%%%%

%
% パラメータ
%

\newdimen\paperwidth          % 用紙の横幅
\newdimen\paperheight         % 用紙の高さ

\newdimen\defdp               % 基本組の和文の深さ
\newdimen\defht               % 基本組の和文の高さ
\newdimen\defwd               % 基本組の和文の横幅

\newdimen\zdp                 % 現在の組の和文の深さ
\newdimen\zht                 % 現在の組の和文の高さ
\newdimen\zwd                 % 現在の組の和文の横幅

\newdimen\hs                  % 現在の字送り
\newdimen\vs                  % 現在の行送り


%
% 基本組の字送り、行送り
%

\newdimen\Hs                  % 基本組の字送り
\newdimen\Vs                  % 基本組の行送り


%
% フラグ
%

\newif\ifvsize \vsizefalse    % 実/仮想ボディーフラグ

%
%  \make@box{横幅}{高さ}{罫線の太さ}{本体}
%
%  本体は天地左右センター揃えで出力
%

\long\def\make@box#1#2#3#4{%
\vbox{\parindent=0pt\offinterlineskip
\@tempdima=#2
\advance\@tempdima by-#3 \advance\@tempdima by-#3
\hrule width#1 height#3 depth0pt
\hbox to#1{%
\vrule width#3 height\@tempdima depth0pt
\hss
\vbox to\@tempdima{\vss\hbox{#4}\vss}%
\hss
\vrule width#3 height\@tempdima depth0pt}%
\hrule width#1 height#3 depth0pt}}

%
% Vs への行間隔指定
%

\global\Vs=\baselineskip

%
% 行取りのマクロ
%

\def\gyodori#1{\par%
  \bgroup
  \baselineskip=#1
  \advance\baselineskip by +\defdp
  \dimen0=\baselineskip
  \advance\dimen0 by -\normalbaselineskip
  \advance\dimen0 by +\defht
  \dimen1=\normalbaselineskip
  \advance\dimen1 by -\defht
  \vbox to \dimen0 \bgroup%
    \baselineskip=\normalbaselineskip
    \boxmaxdepth=0pt
    \lineskiplimit=0pt
    \lineskip=0pt
    \prevdepth=\dimen1
	\futurelet\next\@gyo%
}
\def\@gyo{%
\ifcat\bgroup\noexpand\next \let\next\@@gyo\else\let\next\@@@gyo\fi\next}
\def\@@gyo{\bgroup\aftergroup\@gyoend\let\next}
\def\@@@gyo#1{#1\@gyoend}
\def\@gyoend{\par\kern0pt\egroup\egroup\prevdepth=\defdp}

%
% \tableofcontents
%

\def\@pnumwidth{1.55em}
\def\@tocrmarg {2.55em}
\def\@dotsep{4.5}
\setcounter{tocdepth}{3}


\def\tableofcontents{%
  \@restonecolfalse%
  \if@twocolumn
    \@restonecoltrue%
    \onecolumn
  \fi%
  \subsection*{目 次\@mkboth{目 次}{目 次}}%
  \@starttoc{toc}%
  \if@restonecol
    \twocolumn
  \fi}

%
% 書体定義／選択のマクロ
%
%  \definefont{名前}{pt数}{和文書体}{欧文書体}
% 
%  \selectfont{名前}
% 
%  使用可能なpt数
%  5, 6, 7, 8, 9, 10, 11, 12, 14, 17, 20, 25
%

\def\definefont#1#2#3#4{%
%\@ifundefined{#1}{%
\expandafter\def\csname #1@font\endcsname{%
  \def\@tmp{\csname #1\endcsname}%
  \@nomath\@tmp%
  \let\@currsize=\@tmp%
  \ptconv{#2}%
  %
  \setbox0=\hbox{漢}
  \zwd=\wd0
  \zht=\ht0
  \zdp=\dp0
  %
  \ifvsize
    \kanjiskip=#2pt plus .25pt minus .25pt
    \advance\kanjiskip by -\zwd
  \else
    \kanjiskip=\z@ plus .25pt minus .25pt
  \fi
  \hs=\kanjiskip
  \advance\hs by \zwd
  \@ifundefined{#3}{\@latexerr{name '#3' undefined}\@eha}%
    {\csname #3\endcsname}%
  \@ifundefined{#4}{\@latexerr{name '#4' undefined}\@eha}%
    {\csname #4\endcsname}%
  }%}%
% {\if@debug\@latexerr{name '#1' already used}\@eha\fi}%
}

\def\selectfont#1{%
  \@ifundefined{#1@font}%
   {\@latexerr{name '#1@font' undefined}\@eha}%
   {\csname #1@font\endcsname}%
}

\def\ptconv#1{%
\ifnum #1 = 5
      \vpt\@vpt
\else \ifnum #1 = 6
      \vipt\@vipt
\else \ifnum #1 = 7
      \viipt\@viipt
\else \ifnum #1 = 8
      \viiipt\@viiipt
\else \ifnum #1 = 9
      \ixpt\@ixpt
\else \ifnum #1 = 10
      \xpt\@xpt
\else \ifnum #1 = 11
      \xipt\@xipt
\else \ifnum #1 = 12
      \xiipt\@xiipt
\else \ifnum #1 = 14
      \xivpt\@xivpt
\else \ifnum #1 = 17
      \xviipt\@xviipt
\else \ifnum #1 = 20
      \xxpt\@xxpt
\else \ifnum #1 = 25
      \xxvpt\@xxvpt
\else
      \@latexerr{wrong pt-size in \string\ptsize}\@eha%
\fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi
}


%
% 書体の設定
%

\definefont{section}{25}{gt}{bf}
\definefont{paragraph}{10}{gt}{bf}

%\def\l@subsubsection{\@dottedtocline{4}{10em}{5em}}

%
% 見出し
%

\newif\if@left \@leftfalse

%
% section
%
\def\thesection{\arabic{section}}
\def\section{\secdef\@section\@@section}
\def\@section[#1]#2{\@@@section{#2}}
\def\@@section#1{\@@@section{#1}}
\def\@@@section#1{%
\refstepcounter{section}
\@makesectionhead{\thesection}{#1}}
%
\def\@makesectionhead#1#2{%
\clearpage%
\if@left
  \ifodd\c@page\null\thispagestyle{empty}\newpage\fi
\fi
\null
\vskip-\Vs
\gyodori{10\Vs}{%
\parindent=0pt
\hrule width \textwidth height 0pt depth 4pt
\nointerlineskip
\vbox to 0pt{%
\vbox to 20mm{%
\vss
\hbox to \textwidth{\hss\selectfont{section}#1章\hss}}\vss}
\vskip35mm
\setbox0=\hbox{\selectfont{section}あ}
\vskip-\ht0
\vskip-\dp0
\nointerlineskip
\vbox to 0pt{%
\parindent=0pt
\selectfont{section}
\setbox0=\hbox{#2}
\ifdim\wd0 > \textwidth
  \leftskip=0pt plus 1fill
  \rightskip=0pt plus 1fill
  \baselineskip=\ht0
  \advance\baselineskip by \dp0
% \advance\baselineskip by 2mm
  \advance\baselineskip by 1mm
  \unhbox0
\else
  \hbox to \textwidth{\hss\box0\hss}
\fi
\vss}
\vss
\hrule width \textwidth height 0.8pt depth 0pt
\vskip1.5mm
\hrule width \textwidth height 0.8pt depth 0pt
}
\nobreak
\sectionmark{#1章\hskip1\zwd#2}
\thispagestyle{specialpage}}


%
% paragraph
%
% paragraph の数字表示を禁止し、■を見出しマークとする
%
\def\theparagraph{■}
\def\paragraph{\secdef\@paragraph\@@paragraph}
\def\@paragraph[#1]#2{\@@@paragraph{#2}}
\def\@@paragraph#1{\@@@paragraph{#1}}
%
\def\@@@paragraph#1{%
\refstepcounter{paragraph}
\@makeparagraphhead{\theparagraph}{#1}}
%
\def\@makeparagraphhead#1#2{
\vskip\Vs
\gyodori{1\Vs}{\vss
\hbox{\selectfont{paragraph}#1 #2}}\nobreak}
%

%%%%%%%%%% A4 判で用紙を広く使用するための設定 %%%%%%%%%%

\setlength{\topmargin}{-11mm}
\setlength{\headsep}{20pt}
%\setlength{\headheight}{0pt}
\setlength{\textwidth}{14cm} % 16cm
\setlength{\textheight}{22.5cm} % 22.5cm
\setlength{\evensidemargin}{15mm} %%%%% 1.5mm
\setlength{\oddsidemargin}{15mm} %%%%% 1.5mm
%\setlength{\columnsep}{1.0cm} % コラム間の幅の指定

%%%%%
%%%%% セクションのインデンテーションを変える(「LATEX 自由自在」から引用)
%%%%% 第三パラメータを変更
%%%%% \def\section{\@startsection {section}{1}{\z@}{.....
%%%%%                                          ===
%%%%% −値が大きい程左寄りになる。
%%%%%

%\def\section{\@startsection {section}{1}{-0.4in}{-3.5ex plus
%-1ex minus -.2ex}{2.3ex plus .2ex}{\Large\bf}}

\def\subsection{\@startsection{subsection}{2}{-0.2in}{-3.25ex
plus -1ex minus  -.2ex}{1.5ex plus .2ex}{\large\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex
plus -1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}

%
%  用紙サイズ（A5版一段組み）
%

\newif\ifpaper@AFive

%
% 章見出しマクロ
%

\newdimen\x@tick \x@tick=1pt           % 罫線の太さ
\newdimen\x@size \x@size=\textwidth    % ボックスの幅

\newdimen\y@size                       % ボックスの高さ
\newdimen\x@skip                       % ボックス間の上下のズレ
\newdimen\y@skip                       % 文字列と罫線との横アキ
\newdimen\rt@ud                        % 左側の上側アキ
\newdimen\lt@ud                        % 右側の上側アキ

\ifpaper@AFive
  \y@size=36mm
  \x@skip=3mm
  \y@skip=7mm
  \rt@ud=13mm
  \lt@ud=29mm
\else
  \y@size=41mm
  \x@skip=5mm
  \y@skip=10mm
  \rt@ud=16mm
  \lt@ud=34mm
\fi

\advance\y@size by\x@skip
%\advance\rt@ud  by\x@skip
\advance\rt@ud  by\x@tick
%\advance\lt@ud  by\x@skip
\advance\lt@ud  by\x@tick

\newdimen\z@skip
\z@skip\y@skip \advance\z@skip by\x@skip

\advance\x@size by-\x@skip

\def\maketitlebox#1{%
\gyodori{10\Vs}{\parindent=0pt\offinterlineskip
\vbox to0pt{\make@box{\x@size}{\y@size}{\x@tick}{}\vss}%
\vskip\x@skip
\hskip\x@skip
\vbox to0pt{\make@box{\x@size}{\y@size}{\x@tick}{\LARGE #1}\vss}%
%\unvbox0
\vss
\nobreak}}

%%%%%%%%%% Some Handy Macros %%%%%%%%%%
%%%%% Letters
\newcommand{\SANOLab}{{\sc Sano Laboratory}}

%%%%% command display
\newcommand{\com}[1]{
\vspace{4mm}
\fbox{\parbox{120mm}
{\vspace*{2mm}\hspace*{2mm}{\sf (fs11124) s1234567[1]}{\it #1}\vspace*{2mm}}}
\vspace{4mm}}
%%%%% issue display
\newcommand{\issue}[1]{
\vspace*{4mm}
\fbox{\parbox{120mm}
{\vspace*{2mm}\hspace*{2mm}{\bf#1}\vspace*{2mm}}}
\vspace*{4mm}}

%%%%% attention displaya
\def\attention#1{
\hbox to\linewidth{\hrulefill}
\vspace{-4mm}
\begin{description}
\item [注意] {#1}
\end{description}
\vspace{-5mm}
\hbox to\linewidth{\hrulefill}
}

%%%%% CF. display
\def\confer#1{
\hbox to\linewidth{\hrulefill}
\vspace{-4mm}
\begin{description}
\item [CF.] {#1}
\end{description}
\vspace{-5mm}
\hbox to\linewidth{\hrulefill}
}

%\newcommand{\attention}[1]{
%\hbox to\linewidth{\hrulefill}
%\begin{description}
%\item [注意] {#1}
%\end{description}
%\hbox to\linewidth{\hrulefill}}
\def\itukakaku{{\em To be written ... in no distant future.}}

%%%%% figonhere
\newcommand{\figonhere}[4]{\ifcase \wintex
{\bfg \vspace*{#3} ({#4})の図 \efg{#1}}\or % For Linux Tex
{\bfg \bmpfile(#2,#3){#4} \efg{#1}}\fi} % For WinTex
\def\wintex{0}

%%%%% bmponhere
\newcommand{\bmponhere}[4]{\ifcase \wintex
{\bfg \vspace*{#3}({#4})の図\end{figure}}\or % For Linux Tex
{\bfg \bmpfile(#2,#3){#4}\end{figure}}\fi} % For WinTex
\def\wintex{0}

%%%%% Abbrivations %%%%%
\newcommand{\btb}[1]{\begin{table}[htb]\centering
%  \caption{{\dg\bf\hspace*{2mm} #1}}\medskip\label{#1}}
  \caption{{\bf\hspace*{2mm} #1}}\medskip\label{#1}}
\newcommand{\etb}{\end{table}}
\newcommand{\bt}{\begin{tabular}}
\newcommand{\et}{\end{tabular}}
\newcommand{\bfg}{\begin{figure}[htb]\centering}
\newcommand{\efg}[1]{
%  \caption{{\dg\bf\hspace*{2mm} #1}}\medskip\label{#1}
  \caption{{\bf\hspace*{2mm} #1}}\medskip\label{#1}
  \end{figure}}

%%%%% List Environments %%%%%
\newcommand{\bi}{
\begin{quote}\begin{itemize}\baselineskip1.2em}
\newcommand{\ei}{\end{itemize}\end{quote}}
\newcommand{\be}{
\begin{quote}\begin{enumerate}\baselineskip1.2em}
\newcommand{\ee}{\end{enumerate}\end{quote}}
\newcommand{\bd}{
\begin{quote}\begin{description}\baselineskip1.2em}
\newcommand{\ed}{\end{description}\end{quote}}

%%%%% TYPE SET %%%%%
\newcommand{\fillin}[1]{{\it #1}} % Letters to be filled in.
\newcommand{\writeout}[1]{{\tt #1}} % Letters type out
\newcommand{\keyin}[1]{{\sf #1}} % Key symbol to be typed
\newcommand{\pathname}[1]{{\sl #1}} % path name

\newcommand{\escX}{{\bf ``M+x''}} % Meta + X Key
\newcommand{\ctrlX}[1]{{\fbox ``Ctrl--#1''}} % Ctrl + X Key
\newcommand{\ctrlXY}[2]{{\bf ``Ctrl--#1,Ctrl--#2''}} % Ctrl + X ,Ctrl + YKey

%%%%% Abbrivations of Manuals

%%%%%
%%%%% End of file

%%%% Addition by Maejima %%%%
%% definition for "indent" %%
\newenvironment{indention}[1]{\par
\addtolength{\leftskip}{#1}
\begingroup}{\endgroup\par}