% macro.tex
%	Last update: 2017/02/23 F.Kanehori
%
\makeatletter

% some character usage
\catcode`\_=\active
\catcode`\^=\active
\catcode`\<=\active
\catcode`\>=\active
\def_{\ifmmode\sb\else\_\fi}
\def^{\ifmmode\sp\else\^\fi}
\def<{\ifmmode\langle\else$\langle$\fi}
\def>{\ifmmode\langle\else$\rangle$\fi}

% length
\def\WID{2ZW}			% indent width

% abbreviations
\def\ARROW{$\rightarrow$}	% right arrow
\def\CS{C\#}			% C#
\def\CPP{C++}			% C++
%\def\SL{Y\llap=}		% yen sign
\def\SL{\symbol{'134}}		% backslash
\def\Project{\it{Project\,}}
\def\CONT{\ \ {\footnotesize{(���̍s�ɑ���)}}}

% for table
\let\MC\multicolumn
\def\ParBox#1#2{\parbox[t]{#1}{#2}\vspace{.5ZH}}

% alias for reducing braces
\let\it@\it
\let\tt@\tt
\let\bf@\bf
\def\it#1{{\it@{#1\,}}}
\def\tt#1{{\tt@{#1}}}
\def\bf#1{{\bf@{#1}}}

% quoted names
\def\dname#1{\tt{\,"#1"\,}}	% for directory name
\def\fname#1{\tt{\,"#1"\,}}	% for file name
\def\sname#1{\SQuote{#1}}	% for solution name
\def\pname#1{\SQuote{#1}}	% for project name

% quoted word
\def\SQuote#1{\hbox{\,\raise.4ex\hbox{{\tt `}}#1\tt{\raise.4ex\hbox{{\tt '}}}\,}}
\def\DQuote#1{\hbox{\,\raise.4ex\hbox{{\tt "}}#1\tt{\raise.4ex\hbox{{\tt "}}}\,}}

% rule
\def\rrule#1{\vbox{%
    \vspace{-1.0\baselineskip}
    \begin{flushright}
    \begin{tabular}{c} \hbox to #1{}\\\hline \end{tabular}
    \end{flushright}}
    \vspace{-0.5\baselineskip}}

% narrower[size][margin]{body}
%	charsize:	t, f, s, [n]
%	margin:		[\the\leftmargin]
%
\def\narrow{\@ifnextchar[{\narrow@}{\narrow@def[Z][\the\leftmargin]}}
\def\narrow@[#1]{%
	\@ifnextchar[{\narrow@def[#1]}{\narrow@@[#1]}}
\def\narrow@@[#1]{%
	\ifx#1t \def\@size{t} \def\@mgn{\the\leftmargin} \else
	\ifx#1f \def\@size{f} \def\@mgn{\the\leftmargin} \else
	\ifx#1s \def\@size{s} \def\@mgn{\the\leftmargin} \else
	\ifx#1n \def\@size{n} \def\@mgn{\the\leftmargin} \else
	\ifx#1l \def\@size{l} \def\@mgn{\the\leftmargin} \else
		\def\@size{Z} \def\@mgn{#1}	\fi\fi\fi\fi\fi
	\narrow@def[\@size][\@mgn]}
\def\narrow@repl#1{\def\@lmgn{\the\leftmargin} \def\@text{[#1]}}
\def\narrow@same#1{\def\@lmgn{#1} \def\@text{}}
\def\narrow@def[#1][#2]{%
	\if#1t \def\font@def{Y} \let\font@size\tiny	    \else
	\if#1f \def\font@def{Y} \let\font@size\footnotesize \else
	\if#1s \def\font@def{Y} \let\font@size\small	    \else
	\if#1n \def\font@def{Y} \let\font@size\normalsize   \else
	\if#1l \def\font@def{Y} \let\font@size\large	    \else
	\if#1Z \def\font@def{Y} \let\font@size\relax	    \else
	       \def\font@def{N} \let\font@size\relax	    \fi\fi\fi\fi\fi\fi
	\if\font@def Y \narrow@same{#2} \else \narrow@repl{#2} \fi
	\list{}{\topsep 0pt \partopsep 0pt \parsep 0pt \itemsep 0pt
		\rightmargin 0pt \leftmargin \@lmgn \relax}\item[]
	\begingroup\font@size\@text}
\def\end@narrow{\endgroup\endlist}
\let\endnarrow\end@narrow

\makeatother
% end: marco.tex
