% daijihng.sty 
% by Shinsaku Fujita 
% Copyright (C) S. Fujita (2000). All rights reserved. 
% Version 1.00 2000/01/04
%
%  作成者: 藤田眞作
%          fujitas@chem.kit.ac.jp
%
%   藤田眞作著「入門・縦横文書術」所載
%
%\typeout{Option Style `daijihng.sty' by S. Fujita}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\j@urnalname{daijihng}
\def\versi@ndate{March 2, 2000}
\def\versi@nno{ver1.00}
\def\copyrighth@lder{SF} % Shinsaku Fujita
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\typeout{Option Style `\j@urnalname' (\versi@nno) <\versi@ndate>\space 
[\copyrighth@lder]}
\typeout{藤田眞作著「続LaTeX2e階梯・縦組編」所載}
\typeout{藤田眞作著「入門・縦横文書術」所載}
%
% 藤田眞作著「続\LaTeXe{}階梯・縦組編」第12章
% パッケージ収録に際して、\parboxを\vboxに変え、
% \kanjiskip=0pt plus 1fil
% を入れて字間が開くようにした。
% 1999/12/18 by Shinsku Fujita 
%
\newcount\kanzancnt
\def\mojikanzan#1{%
\kanzancnt=0
\@tfor\member:=#1\do{\advance\kanzancnt by1}%文字数を勘定
\ifodd\kanzancnt \advance\kanzancnt by1\fi
\divide\kanzancnt by2%折り返したあとの文字数(normalsize)
\multiply\kanzancnt by40
\divide\kanzancnt by5
\advance\kanzancnt by7%<.3は切り下げ。>=.3は切り上げ 
\divide\kanzancnt by10%折り返したあとの文字数(footnotesize)
}
\newenvironment{jisagedaiji}[1]{%
\mojikanzan{#1}%
\@tempdima=1zw
\multiply\@tempdima\kanzancnt
\@tempdimb=\@tempdima
\advance\@tempdimb by2zw
\setbox0=\vbox to0pt{\hbox to0pt{\hss
%S. Fujita 1999/12/18
%\parbox{\@tempdima}{%
%\footnotesize#1}\kern1zw}\vss}%
\vbox{\hsize=\@tempdima
\kanjiskip=0pt plus 1fil
\footnotesize
\noindent#1}\kern1zw}\vss}%
\setbox1=\vbox\bgroup\noindent\leavevmode
\hangindent=\@tempdimb\hangafter=-2\relax\box0\relax}
{\egroup\noindent\leavevmode\box1\relax\par}
%
% hangssec環境
% by Shinsaku Fujita 1999/12/18
% 項の題字をハンギングインデントにするように、
% 最初の段落を整形する。
% 題字は二行
% 
\newenvironment{hangssec}[1]{%
\setbox0=\hbox{\small\bfseries #1}\@tempcnta=\wd0
\setbox1=\hbox{\kern1zw}\@tempcntb=\wd1
\multiply\@tempcnta by5\relax
\divide\@tempcnta by \@tempcntb
\advance\@tempcnta by7\relax
\divide\@tempcnta by10\relax
\@tempdima=1zw
\multiply\@tempdima by\@tempcnta
\advance \@tempdima by1zw
\@tempdimb=\@tempdima
\advance\@tempdimb by4zw
\setbox0=\vbox to0pt{\hbox to0pt{\hss
\raise.6zw\hbox to2zw{\refstepcounter{subsection}%
\addcontentsline{toc}{subsection}{%
   \protect\numberline{\thesubsection}#1}%
{\normalsize\bfseries\thesubsection}\hss}%
\vbox{\hsize\@tempdima\small\bfseries
\kanjiskip=0pt plus 1fil
\baselineskip=1.2zw
\noindent#1}\kern1zw}\vss}%
\setbox1=\vbox\bgroup\noindent\leavevmode
\hangindent=\@tempdimb\hangafter=-2\relax\box0\relax}
{\egroup\noindent\leavevmode\box1\relax\par}
%
% hngmdsi環境
% by Shinsaku Fujita 1999/12/18
% 項の題字をハンギングインデントにするように、
% 最初の段落を整形する
% 題字は一行
% 
\newenvironment{hngmdsi}[1]{%
\setbox0=\hbox{\small\bfseries #1}\@tempcnta=\wd0
\setbox1=\hbox{\kern1zw}\@tempcntb=\wd1
\multiply\@tempcnta by10\relax \divide\@tempcnta by \@tempcntb
\advance\@tempcnta by7\relax \divide\@tempcnta by10\relax
\@tempdima=1zw \multiply\@tempdima by\@tempcnta
\advance \@tempdima by1zw \@tempdimb=\@tempdima
\advance\@tempdimb by2zw
\setbox0=\vbox to0pt{\kern0.5\baselineskip
\hbox to0pt{\hss\hbox to\@tempdima{\small\bfseries
\kanjiskip=0pt plus 1fil #1}\kern1zw}\vss}%
\setbox1=\vbox\bgroup\noindent\leavevmode
\hangindent=\@tempdimb\hangafter=-2\relax\box0\relax}
{\egroup\noindent\leavevmode\box1\relax\par}
\makeatother
\endinput
