% tkokugo.sty (v1.00)by Shinsaku Fujita 1998/09/13
% Copyright (C) 1998 by Shinsaku Fujita, All rights reserved. 
%
%  国語のテスト用紙作成用の各種命令
%
%  作成者: 藤田眞作
%          fujitas@chem.kit.ac.jp
%
%   藤田眞作著「続LaTeX2e階梯(縦書編)」所載
%
%   無保証
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\j@urnalname{tkokugo}
\def\versi@ndate{September 13, 1998}
\def\versi@nno{ver1.00}
\def\copyrighth@lder{SF} % Shinsaku Fujita
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\typeout{Option Style `\j@urnalname' (\versi@nno) <\versi@ndate>\space 
[\copyrighth@lder]}
%
% nippon.sty (v.1.00) (C) January 03, 1993 by S. Fujita
% より
%
%   \漢数字
%   \イロハ
%   \いろは
%
%   藤田 眞作 著　『化学者・生化学者のためのLaTeX』
%   東京化学同人、東京 (1993)をご覧下さい。
%
\def\@漢数字#1{\ifcase#1\or 一\or 二\or 三\or 四\or 五\or 六\or 七
\or 八\or 九\or 十
\or 十一\or 十二\or 十三\or 十四\or 十五\or 十六\or 十七
\or 十八\or 十九\or 二十 
\or 廿一\or 廿二\or 廿三\or 廿四\or 廿五\or 廿六\or 廿七
\or 廿八\or 廿九\or 三十
\or 丗一\or 丗二\or 丗三\or 丗四\or 丗五\or 丗六\or 丗七
\or 丗八\or 丗九\or 四十\else\@ctrerr\fi\relax}
\def\漢数字#1{\@漢数字{\@nameuse{c@#1}}}
%%%
\def\@いろは#1{\ifcase#1\or い\or ろ\or は\or に\or ほ\or へ\or と
\or ち\or り\or ぬ\or る\or を\or わ\or か\or よ
\or た\or れ\or そ\or つ\or ね\or な\or ら\or む
\or う\or ゐ\or の\or お\or く\or や\or ま
\or け\or ふ\or こ\or え\or て
\or あ\or さ\or き\or ゆ\or め\or み\or し\or ゑ\or ひ\or も\or せ\or す
\or ん\else\@ctrerr\fi\relax}
\def\いろは#1{\@いろは{\@nameuse{c@#1}}}
%%%
\def\@イロハ#1{\ifcase#1\or イ\or ロ\or ハ\or ニ\or ホ\or ヘ\or ト
\or チ\or リ\or ヌ\or ル\or ヲ\or ワ\or カ\or ヨ
\or タ\or レ\or ソ\or ツ\or ネ\or ナ\or ラ\or ム
\or ウ\or ヰ\or ノ\or オ\or ク\or ヤ\or マ
\or ケ\or フ\or コ\or エ\or テ
\or ア\or サ\or キ\or ユ\or メ\or ミ\or シ\or ヱ\or ヒ\or モ\or セ\or ス
\or ン\else\@ctrerr\fi\relax}
\def\イロハ#1{\@イロハ{\@nameuse{c@#1}}}
%
% カウンター出力命令
%  \アイウ
%  \あいう
%
\def\@アイウ#1{\ifcase#1\or ア\or イ\or ウ\or エ\or オ
\or カ\or キ\or ク\or ケ\or コ
\or サ\or シ\or ス\or セ\or ソ
\or タ\or チ\or ツ\or テ\or ト
\or ナ\or ニ\or ヌ\or ネ\or ノ
\or ハ\or ヒ\or フ\or ヘ\or ホ
\or マ\or ミ\or ム\or メ\or モ
\or ヤ\or ヰ\or ユ\or ヱ\or ヨ
\or ワ\or ヲ\or ン
\else\@ctrerr\fi\relax}
\def\アイウ#1{\@アイウ{\@nameuse{c@#1}}}
\def\@あいう#1{\ifcase#1\or あ\or い\or う\or え\or お
\or か\or き\or く\or け\or こ
\or さ\or し\or す\or せ\or そ
\or た\or ち\or つ\or て\or と
\or な\or に\or ぬ\or ね\or の
\or は\or ひ\or ふ\or へ\or ほ
\or ま\or み\or む\or め\or も
\or や\or ゐ\or ゆ\or ゑ\or よ
\or わ\or を\or ん
\else\@ctrerr\fi\relax}
\def\あいう#1{\@あいう{\@nameuse{c@#1}}}
%
% 丸数字(アラビア数字用)
% 二桁の場合は、間を詰める
%
\let\marusujifonti=\tiny
\let\marusujifontii=\footnotesize
\def\marurensuji#1{\@tempcnta=\z@
\expandafter\@tfor\expandafter\member\expandafter:%
\expandafter=#1\do{\advance\@tempcnta\@ne}%
\ifnum\@tempcnta=\@ne
 \mbox{\ooalign{%
 \hfil\kern-.07zw\lower.03zw\hbox{\marusujifonti
 \rensuji{#1}}\hfil\cr\cr
 \hbox{\marusujifontii \mbox{$\bigcirc$}}}}%
\else
 \mbox{\ooalign{%
 \hfil\lower.05zw\hbox{\marusujifonti \rensuji{%
\expandafter\@tfor\expandafter\member\expandafter:%
\expandafter=#1\do{\member\kern-0.18zw}\kern0.18zw%
}}\hfil\cr\cr
 \hbox{\marusujifontii \mbox{$\bigcirc$}}}}%
\fi}
%
% 丸囲み文字
% 二文字でもそのまま
%
\def\marukakomi#1{%
 \mbox{\ooalign{%
 \hfil\raise.07ex\hbox{\marusujifonti
 \rensuji{\null\kern-.1zw#1}}\hfil\cr\cr
 \hbox{\marusujifontii \mbox{$\bigcirc$}}}}}
%
% 文字を小判型の枠で囲む
%
\def\ovalkanji#1{$\vcenter{%
\hbox{\unitlength=1mm
\begin{picture}<t>(5,2)(-2.5,-1)
%この設定はおかしいが、(5,4)などとすると
%領域が大きくなりすぎるのでこのようにした。原因?
\put(0,0){\oval(5,2)[t]}%
\put(0,0){\oval(5,2)[b]}%
\put(0,0){\makebox(0,0){#1}}%
\end{picture}}}$}
%
% 文字を丸括弧で囲む
%
\def\kakkosuji#1{%
\kanjitoibkakko#1\kanjitoiekakko}%
%
% 連番の問題番号を行間に出力
%
% アラビア数字
%
% \sujitoi[数字]
%  オプション[数字]  [0] 修飾なし
%　                  [1] (デフォルト) 丸囲みの数字
%　                  [2] 括弧縦方向。連数字
%　                  [3] 括弧横方向。連数字
%
\def\sujitoibkakko{(}
\def\sujitoiekakko{)}
%\def\sujitoibkakko{[}
%\def\sujitoiekakko{]}
\def\sujitoi{\@ifnextchar[%]
{\@sujitoi}{\@sujitoi[1]}}

\def\@sujitoi[#1]{%
\refstepcounter{sujitoi}%
\ifcase#1\relax
\hbox to\z@{\hskip-.5zw%
\raise.9zh\hbox{\scriptsize
\rensuji{\the\c@sujitoi}}\hss}%
\or
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\expandafter\marurensuji{\the\c@sujitoi}}\hss}%
\or
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{\tiny
\isujikakko{\the\c@sujitoi}%
%\sujitoibkakko\rensuji{\the\c@sujitoi}\sujitoiekakko
}\hss}%
\or
\hbox to\z@{\hskip-.5zw%
\raise1.2zh\hbox{\tiny
\iisujikakko{\the\c@sujitoi}%
%\rensuji{\sujitoibkakko\the\c@sujitoi\sujitoiekakko}%
}\hss}%
\fi}
\def\isujikakko#1{%
\sujitoibkakko\rensujI{#1}\sujitoiekakko}
\def\iisujikakko#1{%
\rensuji{\sujitoibkakko#1\sujitoiekakko}}
%
% 連番の問題番号を行間に出力
%
% 英字(大文字)
%
% \Eijitoi[数字]
%  オプション[数字]  [0] 修飾なし
%　                  [1] (デフォルト) 丸囲みの英大文字
%　                  [2] 括弧縦方向。英大文字
%　                  [3] 括弧横方向。英大文字
%
\def\eijitoibkakko{(}
\def\eijitoiekakko{)}
\def\Eijitoi{\@ifnextchar[%]
{\@Eijitoi}{\@Eijitoi[1]}}
\def\@Eijitoi[#1]{%
\refstepcounter{Eijitoi}%
\ifcase#1\relax
\hbox to\z@{\hskip-.5zw%
\raise.9zh\hbox{\scriptsize
\rensuji{\Alph{Eijitoi}}}\hss}%
\or
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\expandafter\marukakomi{\Alph{Eijitoi}}}\hss}%
\or
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{\tiny
\eijitoibkakko\rensujI{\Alph{Eijitoi}}\eijitoiekakko
%\eijitoibkakko\rensuji{\Alph{Eijitoi}}\eijitoiekakko
}\hss}%
\or
\hbox to\z@{\hskip-.5zw%
\raise1.2zh\hbox{\tiny
\rensuji{\eijitoibkakko\Alph{Eijitoi}\eijitoiekakko}%
}\hss}%
\fi}
%
% 連番の問題番号を行間に出力
%
% 英字(小文字)
%
% \eijitoi[数字]
%  オプション[数字]  [0] 修飾なし
%　                  [1] (デフォルト) 丸囲みの英小文字
%　                  [2] 括弧縦方向。英小文字
%　                  [3] 括弧横方向。英小文字
%
\def\eijitoi{\@ifnextchar[%]
{\@eijitoi}{\@eijitoi[1]}}
\def\@eijitoi[#1]{%
\refstepcounter{eijitoi}%
\ifcase#1\relax
\hbox to\z@{\hskip-.5zw%
\raise.9zh\hbox{\scriptsize
\rensuji{\alph{eijitoi}}}\hss}%
\or
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\expandafter\marukakomi{\alph{eijitoi}}}\hss}%
\or
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{\tiny
%\eijitoibkakko\rensuji{\alph{eijitoi}}\eijitoiekakko
\eijitoibkakko\rensujI{\alph{eijitoi}}\eijitoiekakko
}\hss}%
\or
\hbox to\z@{\hskip-.5zw%
\raise1.2zh\hbox{\tiny
\rensuji{\eijitoibkakko\alph{eijitoi}\eijitoiekakko}%
}\hss}%
\fi}
%
% 連番の問題番号を行間に出力
%
% 漢数字(一)
%
% \kanjitoi[数字]
%  オプション[数字]  [0] 修飾なし
%　                  [1] (デフォルト) 丸囲みの漢字
%　                  [2] 括弧縦方向。漢字
%　                  [3] 括弧横方向。漢字
%
% 内部で\Kanjiを使用。たとえば、11 は一一
%
%
\def\kanjitoibkakko{(}
\def\kanjitoiekakko{)}
\def\kanjitoi{\@ifnextchar[%]
{\@kanjitoi}{\@kanjitoi[1]}}
\def\@kanjitoi[#1]{%
\refstepcounter{kanjitoi}%
\ifcase#1\relax
\hbox to\z@{\hskip-.5zw%
\raise.9zh\hbox{\scriptsize\gt
%\rensuji{\the\c@sujitoi}}\hss}%
\Kanji{kanjitoi}}\hss}%
\or
\settowidth{\dimen\z@}{\tiny \Kanji{kanjitoi}}%
\settowidth{\dimen\@ne}{\tiny 一}%
\advance\dimen\@ne-\dimen\z@
\ifdim\dimen\@ne>-0.1pt
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\expandafter\marukakomi{\Kanji{kanjitoi}}}\hss}%
\else
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\tiny
\ovalkanji{\Kanji{kanjitoi}}}\hss}%
\fi
\or
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{\tiny
\kanjitoibkakko\Kanji{kanjitoi}\kanjitoiekakko
}\hss}%
\or
\settowidth{\dimen\z@}{\tiny \Kanji{kanjitoi}}%
\settowidth{\dimen\@ne}{\tiny 一}%
\advance\dimen\@ne-\dimen\z@
\ifdim\dimen\@ne>-0.1pt
\hbox to\z@{\hskip-.5zw%
\raise1.2zh\hbox{%
\rensuji{%
\tiny
\kanjitoibkakko\Kanji{kanjitoi}\kanjitoiekakko}%
}\hss}%
\else
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\rensuji{%
\tiny
{\footnotesize\kanjitoibkakko}%
\hskip-.06zw
\pbox<t>[1zw]{\Kanji{kanjitoi}}%
\hskip-.06zw
{\footnotesize\kanjitoiekakko}%
}}\hss}%
\fi
%}\hss}%
\fi}
%
% 連番の問題番号を行間に出力
%
% 漢数字(二)
%
% \kansujitoi[数字]
%  オプション[数字]  [0] 修飾なし
%　                  [1] (デフォルト) 丸囲みの漢字
%　                  [2] 括弧縦方向。漢字
%　                  [3] 括弧横方向。漢字
%
% 内部で「\漢数字」を使用。たとえば、11 は十一
%
%
\def\kansujitoi{\@ifnextchar[%]
{\@kansujitoi}{\@kansujitoi[1]}}
\def\@kansujitoi[#1]{%
\refstepcounter{kansujitoi}%
\ifcase#1\relax
\hbox to\z@{\hskip-.5zw%
\raise.9zh\hbox{\scriptsize\gt
\漢数字{kansujitoi}}\hss}%
\or
\settowidth{\dimen\z@}{\tiny \漢数字{kansujitoi}}%
\settowidth{\dimen\@ne}{\tiny 一}%
\advance\dimen\@ne-\dimen\z@
\ifdim\dimen\@ne>-0.1pt
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\expandafter\marukakomi{\漢数字{kansujitoi}}}\hss}%
\else
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\tiny
\ovalkanji{\漢数字{kansujitoi}}}\hss}%
\fi
\or
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{\tiny
\kanjitoibkakko\漢数字{kansujitoi}\kanjitoiekakko
}\hss}%
\or
\settowidth{\dimen\z@}{\tiny \漢数字{kansujitoi}}%
\settowidth{\dimen\@ne}{\tiny 一}%
\advance\dimen\@ne-\dimen\z@
\ifdim\dimen\@ne>-0.1pt
\hbox to\z@{\hskip-.5zw%
\raise1.2zh\hbox{%
\rensuji{%
\tiny
\kanjitoibkakko\漢数字{kansujitoi}\kanjitoiekakko}%
}\hss}%
\else
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\rensuji{%
\tiny
{\footnotesize\kanjitoibkakko}%
\hskip-.06zw
\pbox<t>[1zw]{\漢数字{kansujitoi}}%
\hskip-.06zw
{\footnotesize\kanjitoiekakko}%
}}\hss}%
\fi
%}\hss}%
\fi}
%
% 連番の問題番号を行間に出力
%
% 平仮名(あいう)
%
% \auitoi[数字]
%  オプション[数字]  [0] 修飾なし
%　                  [1] (デフォルト) 丸囲みの平仮名
%　                  [2] 括弧縦方向。平仮名
%　                  [3] 括弧横方向。平仮名
%
% 内部で「\あいう」を使用。
%
\def\aiutoi{\@ifnextchar[%]
{\@aiutoi}{\@aiutoi[1]}}
\def\@aiutoi[#1]{%
\refstepcounter{aiutoi}%
\ifcase#1\relax
\hbox to\z@{\hskip-.5zw%
\raise.9zh\hbox{\scriptsize\gt
\あいう{aiutoi}}\hss}%
\or
\settowidth{\dimen\z@}{\tiny \あいう{aiutoi}}%
\settowidth{\dimen\@ne}{\tiny 一}%
\advance\dimen\@ne-\dimen\z@
\ifdim\dimen\@ne>-0.1pt
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\expandafter\marukakomi{\あいう{aiutoi}}}\hss}%
\else
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\tiny
\ovalkanji{\あいう{aiutoi}}}\hss}%
\fi
\or
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{\tiny
\kanjitoibkakko\あいう{aiutoi}\kanjitoiekakko
}\hss}%
\or
\settowidth{\dimen\z@}{\tiny \あいう{aiutoi}}%
\settowidth{\dimen\@ne}{\tiny 一}%
\advance\dimen\@ne-\dimen\z@
\ifdim\dimen\@ne>-0.1pt
\hbox to\z@{\hskip-.5zw%
\raise1.2zh\hbox{%
\rensuji{%
\tiny
\kanjitoibkakko\あいう{aiutoi}\kanjitoiekakko}%
}\hss}%
\else
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\rensuji{%
\tiny
{\footnotesize\kanjitoibkakko}%
\hskip-.06zw
\pbox<t>[1zw]{\あいう{aiutoi}}%
\hskip-.06zw
{\footnotesize\kanjitoiekakko}%
}}\hss}%
\fi
%}\hss}%
\fi}
%
% 連番の問題番号を行間に出力
%
% 片仮名(アイウ)
%
% \Auitoi[数字]
%  オプション[数字]  [0] 修飾なし
%　                  [1] (デフォルト) 丸囲みの片仮名
%　                  [2] 括弧縦方向。片仮名
%　                  [3] 括弧横方向。片仮名
%
% 内部で「\アイウ」を使用。
%
\def\Aiutoi{\@ifnextchar[%]
{\@Aiutoi}{\@Aiutoi[1]}}
\def\@Aiutoi[#1]{%
\refstepcounter{Aiutoi}%
\ifcase#1\relax
\hbox to\z@{\hskip-.5zw%
\raise.9zh\hbox{\scriptsize\gt
\アイウ{Aiutoi}}\hss}%
\or
\settowidth{\dimen\z@}{\tiny \アイウ{Aiutoi}}%
\settowidth{\dimen\@ne}{\tiny 一}%
\advance\dimen\@ne-\dimen\z@
\ifdim\dimen\@ne>-0.1pt
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\expandafter\marukakomi{\アイウ{Aiutoi}}}\hss}%
\else
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\tiny
\ovalkanji{\アイウ{Aiutoi}}}\hss}%
\fi
\or
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{\tiny
\kanjitoibkakko\アイウ{Aiutoi}\kanjitoiekakko
}\hss}%
\or
\settowidth{\dimen\z@}{\tiny \アイウ{Aiutoi}}%
\settowidth{\dimen\@ne}{\tiny 一}%
\advance\dimen\@ne-\dimen\z@
\ifdim\dimen\@ne>-0.1pt
\hbox to\z@{\hskip-.5zw%
\raise1.2zh\hbox{%
\rensuji{%
\tiny
\kanjitoibkakko\アイウ{Aiutoi}\kanjitoiekakko}%
}\hss}%
\else
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\rensuji{%
\tiny
{\footnotesize\kanjitoibkakko}%
\hskip-.06zw
\pbox<t>[1zw]{\アイウ{Aiutoi}}%
\hskip-.06zw
{\footnotesize\kanjitoiekakko}%
}}\hss}%
\fi
%}\hss}%
\fi}
%
% 連番の問題番号を行間に出力
%
% 平仮名(いろは)
%
% \irohatoi[数字]
%  オプション[数字]  [0] 修飾なし
%　                  [1] (デフォルト) 丸囲みのいろは
%　                  [2] 括弧縦方向。いろは
%　                  [3] 括弧横方向。いろは
%
% 内部で「\いろは」を使用。
%
\def\irohatoi{\@ifnextchar[%]
{\@irohatoi}{\@irohatoi[1]}}
\def\@irohatoi[#1]{%
\refstepcounter{irohatoi}%
\ifcase#1\relax
\hbox to\z@{\hskip-.5zw%
\raise.9zh\hbox{\scriptsize\gt
\いろは{irohatoi}}\hss}%
\or
\settowidth{\dimen\z@}{\tiny \いろは{irohatoi}}%
\settowidth{\dimen\@ne}{\tiny 一}%
\advance\dimen\@ne-\dimen\z@
\ifdim\dimen\@ne>-0.1pt
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\expandafter\marukakomi{\いろは{irohatoi}}}\hss}%
\else
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\tiny
\ovalkanji{\いろは{irohatoi}}}\hss}%
\fi
\or
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{\tiny
\kanjitoibkakko\いろは{irohatoi}\kanjitoiekakko
}\hss}%
\or
\settowidth{\dimen\z@}{\tiny \いろは{irohatoi}}%
\settowidth{\dimen\@ne}{\tiny 一}%
\advance\dimen\@ne-\dimen\z@
\ifdim\dimen\@ne>-0.1pt
\hbox to\z@{\hskip-.5zw%
\raise1.2zh\hbox{%
\rensuji{%
\tiny
\kanjitoibkakko\いろは{irohatoi}\kanjitoiekakko}%
}\hss}%
\else
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\rensuji{%
\tiny
{\footnotesize\kanjitoibkakko}%
\hskip-.06zw
\pbox<t>[1zw]{\いろは{irohatoi}}%
\hskip-.06zw
{\footnotesize\kanjitoiekakko}%
}}\hss}%
\fi
%}\hss}%
\fi}
%
% 連番の問題番号を行間に出力
%
% 平仮名(イロハ)
%
% \Irohatoi[数字]
%  オプション[数字]  [0] 修飾なし
%　                  [1] (デフォルト) 丸囲みのイロハ
%　                  [2] 括弧縦方向。イロハ
%　                  [3] 括弧横方向。イロハ
%
% 内部で「\イロハ」を使用。
%
\def\Irohatoi{\@ifnextchar[%]
{\@Irohatoi}{\@Irohatoi[1]}}
\def\@Irohatoi[#1]{%
\refstepcounter{Irohatoi}%
\ifcase#1\relax
\hbox to\z@{\hskip-.5zw%
\raise.9zh\hbox{\scriptsize\gt
\イロハ{Irohatoi}}\hss}%
\or
\settowidth{\dimen\z@}{\tiny \イロハ{Irohatoi}}%
\settowidth{\dimen\@ne}{\tiny 一}%
\advance\dimen\@ne-\dimen\z@
\ifdim\dimen\@ne>-0.1pt
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\expandafter\marukakomi{\イロハ{Irohatoi}}}\hss}%
\else
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\tiny
\ovalkanji{\イロハ{Irohatoi}}}\hss}%
\fi
\or
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{\tiny
\kanjitoibkakko\イロハ{Irohatoi}\kanjitoiekakko
}\hss}%
\or
\settowidth{\dimen\z@}{\tiny \イロハ{Irohatoi}}%
\settowidth{\dimen\@ne}{\tiny 一}%
\advance\dimen\@ne-\dimen\z@
\ifdim\dimen\@ne>-0.1pt
\hbox to\z@{\hskip-.5zw%
\raise1.2zh\hbox{%
\rensuji{%
\tiny
\kanjitoibkakko\イロハ{Irohatoi}\kanjitoiekakko}%
}\hss}%
\else
\hbox to\z@{\hskip-.8zw%
\raise1.2zh\hbox{%
\rensuji{%
\tiny
{\footnotesize\kanjitoibkakko}%
\hskip-.06zw
\pbox<t>[1zw]{\イロハ{Irohatoi}}%
\hskip-.06zw
{\footnotesize\kanjitoiekakko}%
}}\hss}%
\fi
%}\hss}%
\fi}
%
% カウンターの本文出力命令
%   カウンターの番号を一つ進めて、値を出力
%  
%   \sujibango{カウンター}     アラビア数字
%   \irohabango{カウンター}    いろは
%   \Irohabango{カウンター}    イロハ
%   \aiubango{カウンター}      平仮名
%   \Aiubango{カウンター}      片仮名
%   \kansujibango{カウンター}  漢数字
%   \kanjibango{カウンター}    漢数字
%   \alphbango{カウンター}     英字小文字
%   \Alphbango{カウンター}     英字大文字
%
\let\outputcounter=\arabic
\def\toibango#1{\refstepcounter{#1}\outputcounter{#1}}

%\def\sujibango#1{%
%\let\outputcounter=\arabic
%\refstepcounter{#1}\outputcounter{#1}}

\def\sujibango#1{%
\refstepcounter{#1}\arabic{#1}}

%\def\irohabango#1{%
%\let\outputcounter=\いろは\toibango{#1}}

\def\irohabango#1{%
\refstepcounter{#1}\いろは{#1}}

\def\Irohabango#1{%
\refstepcounter{#1}\イロハ{#1}}

\def\aiubango#1{%
\refstepcounter{#1}\あいう{#1}}
\def\Aiubango#1{%
\refstepcounter{#1}\アイウ{#1}}

%\def\kansujibango#1{%
%\let\outputcounter=\漢数字\toibango{#1}}
\def\kansujibango#1{\refstepcounter{#1}\漢数字{#1}}

\def\kanjibango#1{%
\refstepcounter{#1}\Kanji{#1}}
\def\alphbango#1{%
\refstepcounter{#1}\alph{#1}}

%\def\Alphbango#1{%
%\let\outputcounter=\Alph\toibango{#1}}
\def\Alphbango#1{\refstepcounter{#1}\Alph{#1}}
%\def\Alphbango#1{\refstepcounter{#1}
%\expandafter\@Alph\csname c@#1\endcsname}
%
%
% カウンター
%
%
\newcounter{sujitoi}
%\def\thesujitoi{\arabic{sujitoi}}%default
\def\thesujitoI{\expandafter\marurensuji{\the\c@sujitoi}}
\newcounter{Eijitoi}
%\def\theEijitoi{\Alph{Eijitoi}}
\def\theEijitoi{\@Alph\c@Eijitoi}
\def\theEijitoI{\marukakomi{\Alph{Eijitoi}}}
\newcounter{eijitoi}
\def\theeijitoi{\alph{eijitoi}}
\def\theeijitoI{\marukakomi{\alph{eijitoi}}}
\newcounter{kanjitoi}
\def\thekanjitoi{\Kanji{kanjitoi}}
\def\thekanjitoI{\marukakomi{\Kanji{kanjitoi}}}
\newcounter{kansujitoi}
\def\thekansujitoi{\漢数字{kansujitoi}}
\def\thekansujitoI{\marukakomi{\漢数字{kansujitoi}}}
\newcounter{aiutoi}
\def\theaiutoi{\あいう{aiutoi}}
\def\theaiutoI{\marukakomi{\あいう{aiutoi}}}
\newcounter{Aiutoi}
\def\theAiutoi{\アイウ{Aiutoi}}
\def\theAiutoI{\marukakomi{\アイウ{Aiutoi}}}
\newcounter{irohatoi}
\def\theirohatoi{\いろは{irohatoi}}
\def\theirohatoI{\marukakomi{\いろは{irohatoi}}}
\newcounter{Irohatoi}
\def\theIrohatoi{\イロハ{Irohatoi}}
\def\theIrohatoI{\marukakomi{\イロハ{Irohatoi}}}
%
% 相互参照
%
%
\let\marumeirei=\marurensuji
\def\setumon@setref#1#2#3{%
  \ifx#1\relax
    \protect\G@refundefinedtrue
    \nfss@text{\reset@font\bfseries ??}%
    \@latex@warning{Reference `#3' on page \thepage \space
              undefined}%
  \else
    \expandafter\marumeirei%
    \expandafter{\expandafter#2#1\relax}% change \null to \relax
  \fi}
%
% アラビア数字の相互参照
%
% \sujitoiref[数字]
%  オプション[数字]  [0] 修飾なし
%　                  [1] (デフォルト) 丸囲みの数字
%　                  [2] 括弧縦方向。数字
%　                  [3] 括弧横方向。数字
%
\def\sujitoiref{\@ifnextchar[%]
{\@sujitoiref}{\@sujitoiref[1]}}
\def\@sujitoiref[#1]#2{%
\ifcase#1\relax
{%
\let\marumeirei=\rensuji
\expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}%
}
\or
{%
\let\marusujifonti=\scriptsize
\let\marusujifontii=\normalsize
\let\marumeirei=\marurensuji
\expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}%
}%
\or
{%
\let\marusujifonti=\scriptsize
\let\marusujifontii=\normalsize
\let\marumeirei=\isujikakko
\expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}%
}%
\or
{%
\let\marumeirei=\iisujikakko
\expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}%
}%
\fi
}
%
% 汎用の相互参照命令
%
% \toiref[数字]
%  オプション[数字]  [0] 修飾なし
%　                  [1] (デフォルト) 丸囲みの文字
%　                  [2] 括弧縦方向。文字
%　                  [3] 括弧横方向。文字
%
% アルファベット (大文字、小文字)
% あいう　アイウ
% いろは　イロハ
%
\def\toiref{\@ifnextchar[%]
{\@toiref}{\@toiref[1]}}

\def\@toiref[#1]#2{%
\ifcase#1\relax
{%
\gt
\let\marumeirei=\rensuji
\expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}%
}%
\or
{%
\let\marusujifonti=\scriptsize
\let\marusujifontii=\normalsize
\let\marumeirei=\marukakomi
\expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}%
}%
\or
{%
\let\marumeirei=\isujikakko
\expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}%
}%
\or
{%
\let\marumeirei=\iisujikakko
\expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}%
}%
\fi
}
%
% 漢数字用の相互参照命令
%
% \kansujitoiref[数字]
%  オプション[数字]  [0] 修飾なし
%　                  [1] (デフォルト) 丸囲みの漢数字
%　                  [2] 括弧縦方向。漢数字
%　                  [3] 括弧横方向。漢数字
%  「\漢数字」を使用
%
\def\kansujitoiref{\@ifnextchar[%]
{\@kansujitoiref}{\@kansujitoiref[1]}}
\def\@kansujitoiref[#1]#2{%
\ifcase#1\relax
{%
\gt
\let\marumeirei=\relax
\expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}%
}%
\or
\setbox4=\hbox{\tiny
 \let\marumeirei=\relax
 \expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}}%
 \dimen\z@=\wd4
\settowidth{\dimen\@ne}{\tiny 一}%
 \advance\dimen\@ne by-\dimen\z@
 \ifdim\dimen\@ne>-.1pt
 {%
   \let\marusujifonti=\scriptsize
   \let\marusujifontii=\normalsize
   \let\marumeirei=\marukakomi
   \expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}%
 }%
  \else
 {%
   \let\marumeirei=\ovalkanji
   {\tiny
   \expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}}%
   }%
 \fi
\or
 {%
   \let\marumeirei=\kakkosuji
   {%\tiny
   \expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}}%
 }%
\or
 {%
   \let\marumeirei=\iisujikakko
   {%\tiny
   \expandafter\setumon@setref\csname r@#2\endcsname\@firstoftwo{#2}}%
 }%
\fi
}
%
% 連数字関係の再定義
%
\rensujiskip=0.25zw plus.125zw minus.05zw
%
\def\rensujikakko#1{(%
\hskip-\rensujiskip\nobreak#1%
\hskip-\rensujiskip\hskip0.063zw\nobreak)}
%
% \rensujI
% \rensujiより\rensujiskipを除いたもの
%
\DeclareRobustCommand\rensujI{%
  \@ifstar{\not@advancelinetrue\@rensujI}{\@rensujI}}
\def\@rensujI{\@ifnextchar[{\@@rensujI}{\@@rensujI[c]}}
\def\@@rensujI[#1]#2{\ifydir\hbox{#2}\else
%%%%  \hskip\rensujIskip
  \ifvmode\leavevmode\fi
  \ifnot@advanceline\not@advancelinefalse\else
    \setbox\z@\hbox{\yoko#2}%
    \@tempdima\ht\z@ \advance\@tempdima\dp\z@
    \if #1c\relax\vrule\@width\z@ \@height.5\@tempdima \@depth.5\@tempdima
    \else\if #1r\relax\vrule\@width\z@\@height\z@ \@depth\@tempdima
    \else\vrule\@width\z@ \@height\@tempdima \@depth\z@
    \fi\fi
  \fi
  \if #1c\relax\hbox to1zw{\yoko\hss#2\hss}%
  \else\if #1r\relax\vbox{\hbox to1zw{\yoko\hss#2}}%
  \else\vtop{\hbox to1zw{\yoko#2\hss}}%
  \fi\fi
%%%  \hskip\rensujiskip
\hskip0.063zw
\fi}


\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%テスト用
\documentclass{tarticle}
%\usepackage{tundline}
\usepackage{tsayusen}
\usepackage{tnamisen}
%\usepackage{furiknkt}
%\usepackage{ascmac}
\usepackage{tkokugo}

\begin{document}

\section{イロハのテスト}

あああああ\Irohatoi{}\label{iii}いいいい
あああああ\Irohatoi[0]{}\label{iii1}いいいい
あああああ\Irohatoi[2]{}\label{iii2}\sayubosen{いいい}い
あああああ\Irohatoi[3]{}\label{iii3}\sayubosen{いいい}い
あああああ\Irohatoi{}\label{iii4}\miginijusen{いい}いい
あああああ\Irohatoi{}\label{iii5}\miginamisen{いい}いい

\setcounter{Irohatoi}{11}
あああああ\Irohatoi{}\label{iii6}\miginamisen{いい}いい


通し
{\let\outputcounter=\イロハ
\toibango{Irohatoi}}番号
\Irohabango{Irohatoi}

ref \toiref{iii}
ref \toiref[0]{iii1}
ref \toiref{iii1}
ref \toiref[2]{iii2}
ref \toiref[3]{iii3}
ref \toiref{iii4}
ref \toiref{iii5}
ref \toiref{iii6}


\section{いろはのテスト}

あああああ\irohatoi{}\label{hhh}いいいい
あああああ\irohatoi[0]{}\label{hhh1}いいいい
あああああ\irohatoi[2]{}\label{hhh2}\sayubosen{いいい}い
あああああ\irohatoi[3]{}\label{hhh3}\sayubosen{いいい}い
あああああ\irohatoi{}\label{hhh4}\miginijusen{いい}いい
あああああ\irohatoi{}\label{hhh5}\miginamisen{いい}いい

\setcounter{irohatoi}{11}
あああああ\irohatoi{}\label{hhh6}\miginamisen{いい}いい

\irohabango{irohatoi}

ref \toiref{hhh}
ref \toiref[0]{hhh1}
ref \toiref{hhh1}
ref \toiref[2]{hhh2}
ref \toiref[3]{hhh3}
ref \toiref{hhh4}
ref \toiref{hhh5}
ref \toiref{hhh6}

\section{アイウエオのテスト}

あああああ\Aiutoi{}\label{ggg}いいいい
あああああ\Aiutoi[0]{}\label{ggg1}いいいい
あああああ\Aiutoi[2]{}\label{ggg2}\sayubosen{いいい}い
あああああ\Aiutoi[3]{}\label{ggg3}\sayubosen{いいい}い
あああああ\Aiutoi{}\label{ggg4}\miginijusen{いい}いい
あああああ\Aiutoi{}\label{ggg5}\miginamisen{いい}いい

\setcounter{Aiutoi}{11}
あああああ\Aiutoi{}\label{ggg6}\miginamisen{いい}いい

\Aiubango{Aiutoi}

ref \toiref{ggg}
ref \toiref[0]{ggg1}
ref \toiref[2]{ggg2}
ref \toiref[3]{ggg3}
ref \toiref{ggg4}
ref \toiref{ggg5}
ref \toiref{ggg6}

\section{あいうえおのテスト}

あああああ\aiutoi{}\label{fff}いいいい
あああああ\aiutoi[0]{}\label{fff1}いいいい
あああああ\aiutoi[2]{}\label{fff2}\sayubosen{いいい}い
あああああ\aiutoi[3]{}\label{fff3}\sayubosen{いいい}い
あああああ\aiutoi{}\label{fff4}\miginijusen{いい}いい
あああああ\aiutoi{}\label{fff5}\miginamisen{いい}いい

\setcounter{aiutoi}{11}
あああああ\aiutoi{}\label{fff6}\miginamisen{いい}いい

\aiubango{aiutoi}

ref \toiref{fff}
ref \toiref[0]{fff1}
ref \toiref[2]{fff2}
ref \toiref[3]{fff3}
ref \toiref{fff4}
ref \toiref{fff5}
ref \toiref{fff6}

\section{漢字のテスト}

あああああ\kansujitoi{}\label{eee}いいいい
あああああ\kansujitoi[0]{}\label{eee1}いいいい
あああああ\kansujitoi[2]{}\label{eee2}\sayubosen{いいい}い
あああああ\kansujitoi[3]{}\label{eee3}\sayubosen{いいい}い
あああああ\kansujitoi{}\label{eee4}\miginijusen{いい}いい
あああああ\kansujitoi{}\label{eee5}\miginamisen{いい}いい

\setcounter{kansujitoi}{11}
あああああ\kansujitoi{}\label{eee6}\miginamisen{いい}いい

\kansujibango{kansujitoi}

\setcounter{kansujitoi}{20}
\kansujibango{kansujitoi}

ref \kansujitoiref{eee} ssssss
ref \kansujitoiref[0]{eee1}
ref \kansujitoiref[2]{eee2}
ref \kansujitoiref[3]{eee3}
ref \kansujitoiref{eee4}
ref \kansujitoiref{eee5}
ref \kansujitoiref{eee6}


\section{漢字のテスト}

あああああ\kanjitoi{}\label{ddd}いいいい
あああああ\kanjitoi[0]{}\label{ddd1}いいいい
あああああ\kanjitoi[2]{}\label{ddd2}\sayubosen{いいい}い
あああああ\kanjitoi[3]{}\label{ddd3}\sayubosen{いいい}い
あああああ\kanjitoi{}\label{ddd4}\miginijusen{いい}いい
あああああ\kanjitoi{}\label{ddd5}\miginamisen{いい}いい

\setcounter{kanjitoi}{11}
あああああ\kanjitoi{}\label{ddd6}\miginamisen{いい}いい

\kanjibango{kanjitoi}

\setcounter{kanjitoi}{20}
\kanjibango{kanjitoi}

ref \kansujitoiref{ddd}
ref \kansujitoiref[0]{ddd1}
ref \kansujitoiref[2]{ddd2}
ref \kansujitoiref[3]{ddd3}
ref \kansujitoiref{ddd4}
ref \kansujitoiref{ddd5}
ref \kansujitoiref{ddd6}


\section{アルファベットのテスト}

あああああ\eijitoi{}\label{ccc}いいいい
あああああ\eijitoi[0]{}\label{ccc1}いいいい
あああああ\eijitoi[2]{}\label{ccc2}\sayubosen{いいい}い
あああああ\eijitoi[3]{}\label{ccc3}\sayubosen{いいい}い
あああああ\eijitoi{}\label{ccc4}\miginijusen{いい}いい
あああああ\eijitoi{}\label{ccc5}\miginamisen{いい}いい

\setcounter{eijitoi}{11}
あああああ\eijitoi{}\label{ccc6}\miginamisen{いい}いい

\alphbango{eijitoi}

ref \toiref{ccc}
ref \toiref[0]{ccc1}
ref \toiref[2]{ccc2}
ref \toiref[3]{ccc3}
ref \toiref{ccc4}
ref \toiref{ccc5}
ref \toiref{ccc6}

\section{アルファベットのテスト}

あああああ\Eijitoi{}\label{bbb}いいいい
あああああ\Eijitoi[0]{}\label{bbb1}いいいい
あああああ\Eijitoi[2]{}\label{bbb2}\sayubosen{いいい}い
あああああ\Eijitoi[3]{}\label{bbb3}\sayubosen{いいい}い
あああああ\Eijitoi{}\label{bbb4}\miginijusen{いい}いい
あああああ\Eijitoi{}\label{bbb5}\miginamisen{いい}いい

\setcounter{Eijitoi}{11}
あああああ\Eijitoi{}\label{bbb6}\miginamisen{いい}いい

\Alphbango{Eijitoi}

ref \toiref{bbb}
ref \toiref[0]{bbb1}
ref \toiref[2]{bbb2}
ref \toiref[3]{bbb3}
ref \toiref{bbb4}
ref \toiref{bbb5}
ref \toiref{bbb6}

\section{アラビア数字のテスト}

あああああ\sujitoi{}\label{aaa}いいいい
あああああ\sujitoi[0]{}\label{aaa1}いいいい
あああああ\sujitoi[2]{}\label{aaa2}\sayubosen{いいい}い
あああああ\sujitoi[3]{}\label{aaa3}\sayubosen{いいい}い
あああああ\sujitoi{}\label{aaa4}\miginijusen{いい}いい
あああああ\sujitoi{}\label{aaa5}\miginamisen{いい}いい

\setcounter{sujitoi}{11}
あああああ\sujitoi{}\label{aaa6}\miginamisen{いい}いい

\sujibango{sujitoi}

ref \sujitoiref{aaa}
ref \sujitoiref[0]{aaa1}
ref \sujitoiref[2]{aaa2}
ref \sujitoiref[3]{aaa3}
ref \sujitoiref{aaa4}
ref \sujitoiref{aaa5}
ref \sujitoiref{aaa6}
\end{document}
