Newsgroups: fj.comp.texhax
Path: galaxy.trc.rwcp.or.jp!coconuts.jaist!wnoc-tyo-news!aist-nara!wnoc-kyo-news!kuis-news!kuamp!imamura
From: imamura@kuamp.kyoto-u.ac.jp (Toshiyuki Imamura)
Subject: New mathtech.sty
Message-ID: <1995Mar1.044215.733@kuamp.kyoto-u.ac.jp>
Sender: news@kuamp.kyoto-u.ac.jp (USENET News System)
Organization: Div. of Applied Systems Science, Kyoto Univ., JAPAN
X-Newsreader: mnews [version 1.18PL3] 1994-08/01(Mon)
Date: Wed, 1 Mar 1995 04:42:15 GMT
Lines: 502
Xref: galaxy.trc.rwcp.or.jp fj.comp.texhax:5972
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.comp.texhax&nb=5972&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

$B:#B<!w5~Bg$G$9!#(B

$B:rG/$3$3$KEj9F$7$?(Bmathtech.sty$B$N:G?7HG$rEj9F$7$^$9!#(B
$B?7$?$K!">l9g$o$1$N4D6-$J$I$rDI2C$7$^$7$?!#(B
equations.sty$B$J$I$G$_$i$l$k(B cases$B4D6-$NB>!"3F9`$K<0HV9f$r?6$l$k(B
eqncases,subeqncases$B4D6-$J$I$,$"$j$^$9!#(B
mathchem.sty$B$J$I$N(Beqnspec$B$H$O$A$,$C$F(Beqnarray$B4D6-$NCf$G;H$&$3$H$,$G$-(B
$BB>$N<0$H$N0LCVB7$($,2DG=$H$J$C$F$$$^$9!#(B

$B2?$+LdBjEy$,$"$j$^$7$?$i;d08$K(BE-mail$B$r$*4j$$$7$^$9!#(B


$B$G$O(B

%
%M A T H T E C H . S T Y
%
% MATHEMATICAL THESIS TECHNICAL-STYLE option
%
%     Version 1.3 released 01 Mar 1995
%     Version 1.2 released 06 Feb 1995
%     Version 1.1 released 13 Sep 1994
%                                            Version 1.0 released 23 Jul 1993
%  for LaTeX /( AMS-LaTeX )
%
% Copyright (C) 1993 by Toshiyuki Imamura, imamura@kuamp.kyoto-u.ac.jp
%
%This style option defines the mathematical technical macros,
%
%numberwithin command
%
%equation  and equation* environment
%eqnarray and subeqnarray and sub equation environment
%
%eqncases, subeqncases and cases environment
%
%textin command
%
%newfunction, newoperator and newrelation command
%
%and the slanted capital Greek, and resizable dots command.
%
%Vdots, Hdots, Ddots, Qdots
%
%
%
\def\loadnewfont#1#2{%
  \def\tfm{#2}
  \f@ntcheck{\tfm5}\iffontexistence%
    \expandafter\font\csname#1v\endcsname=\tfm5\relax%
    \@addfontinfo\@vpt{%
      \expandafter\def\csname p#1\endcsname{\csname#1v\endcsname}}\fi%
  \f@ntcheck{\tfm7}\iffontexistence%
    \expandafter\font\csname#1vii\endcsname=\tfm7\relax%
    \@addfontinfo\@viipt{%
      \expandafter\def\csname p#1\endcsname{\csname#1vii\endcsname}}\fi%
  \f@ntcheck{\tfm10}\iffontexistence%
    \expandafter\font\csname#1x\endcsname=\tfm10\relax%
    \expandafter\font\csname#1xi\endcsname=\tfm10 scaled \magstephalf\relax%
    \expandafter\font\csname#1xii\endcsname=\tfm10 scaled \magstep1\relax%
    \expandafter\font\csname#1xiv\endcsname=\tfm10 scaled \magstep2\relax%
    \expandafter\font\csname#1xvii\endcsname=\tfm10 scaled \magstep3\relax%
   \@addfontinfo\@xpt{%
      \expandafter\def\csname p#1\endcsname{\csname#1x\endcsname}}%
    \@addfontinfo\@xipt{%
      \expandafter\def\csname p#1\endcsname{\csname#1xi\endcsname}}%
    \@addfontinfo\@xiipt{%
      \expandafter\def\csname p#1\endcsname{\csname#1xii\endcsname}}%
    \@addfontinfo\@xivpt{%
      \expandafter\def\csname p#1\endcsname{\csname#1xiv\endcsname}}%
    \@addfontinfo\@xviipt{%
      \expandafter\def\csname p#1\endcsname{\csname#1xvii\endcsname}}\fi%
  \expandafter\gdef\csname#1\endcsname{\protect\csname p#1\endcsname}}
%
%
\newif\iffontexistence \fontexistencefalse
\def\f@ntcheck#1{%
 \batchmode \font\fonts@mple=#1\relax \errorstopmode%
 \ifx\fonts@mple\nullfont \global\fontexistencefalse%
 \else \global\fontexistencetrue\fi}
%
%\loadnewfont{scr}{rsfs}% scrpit type font
%\loadnewfont{Bbb}{msbm}% blackboard bold face font
%\loadnewfont{frak}{eufm}% german frake font
%
%
%
\def\numberwithin#1#2{%
\@addtoreset{#1}{#2}%
\expandafter\def\csname the#1\endcsname{\csname the#2\endcsname.\arabic{#1}}}
%
\numberwithin{equation}{section}
%
%
%
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}{Corollary}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{definition}{Definition}[section]
\newtheorem{algorithm}{Algorithm}[section]
%
%
% New equation, multilinable math with centering align.
% New subequation, numbering with subeqno.
%
\newcounter{subequation}[equation]
\def\thesubequation{\theequation\kern.8pt\hbox to1ex{\alph{subequation}\hss}}
%
\def\equation{\stepcounter{equation}%
 \def\@eqnstepcounter{\stepcounter{equation}}%
 \let\@@eqncr=\@@@eqncr%
 \let\@currentlabel=\theequation\@equation}
\def\endequation{%
 \@@@eqncr\egroup\global\advance\c@equation\m@ne$$\global\@ignoretrue}

\@namedef{equation*}{\def\@eqncr{\nonumber\@seqncr}\equation}
\@namedef{endequation*}{\global\advance\c@equation\m@ne%
\nonumber\endequation}

\def\subequation{%
 \def\@eqnstepcounter{\stepcounter{subequation}}%
 \stepcounter{equation}\global\c@subequation\@ne%%
 \let\@eqnnum=\sub@eqnnum%
 \let\@@eqncr=\@@@eqncr%
 \let\@currentlabel=\thesubequation\@equation}
 \def\endsubequation{%
 \@@@eqncr\egroup$$\global\@ignoretrue}

\def\@equation{%
%
% ref command bug fix
% Thanks to bear@hashi1.civil.tohoku.ac.jp
%
% \let\@currentlabel=\theequation
%
 \global\@eqnswtrue\let\\=\@eqncr%
 \tabskip\@centering$$\halign to \displaywidth\bgroup\@eqnsel%
 \let\@currentlabel=\theequation%
 \hfil$\displaystyle{##}$\hfil&\llap{##}\tabskip\z@\cr}
%
% New eqnarray, such that 2nd column's space are reduced.
% New subeqnarray, numbering with subeqno
%
\def\eqnarray{\stepcounter{equation}%
 \def\@eqnstepcounter{\stepcounter{equation}}%
 \let\@currentlabel=\theequation\@eqnarray}

\def\subeqnarray{%
 \def\@eqnstepcounter{\stepcounter{subequation}}%
 \stepcounter{equation}\global\c@subequation\@ne%
 \let\@eqnnum=\sub@eqnnum%
 \let\@currentlabel=\thesubequation\@eqnarray}
\def\endsubeqnarray{\@@eqncr\egroup$$\global\@ignoretrue}

\def\@eqnarray{%
%
% ref command bug fix
% Thanks to bear@hashi1.civil.tohoku.ac.jp
%
% \let\@currentlabel=\theequation% Thanks to bear@hashi1.civil.tohoku.ac.jp
%
 \global\@eqnswtrue%
 \global\@eqcnt\z@\tabskip\@centering\let\\=\@eqncr%
 $$\halign to \displaywidth\bgroup\@eqnsel\hskip\@centering%
 $\displaystyle\tabskip\z@%
 \let\@currentlabel=\theequation%
 {##}$&\global\@eqcnt\@ne%
 \hfil$\displaystyle{{}##{}}$\hfil%
 &\global\@eqcnt\tw@$\displaystyle\tabskip\z@{##}$\hfil%
 \tabskip\@centering&\llap{##}\tabskip\z@\cr}
%
%
\def\@@eqncr{\let\@tempa\relax%
 \ifcase\@eqcnt\def\@tempa{&&&}\or\def\@tempa{&&}\else\def\@tempa{&}\fi%
 \@tempa\if@eqnsw\@eqnnum\@eqnstepcounter\fi%
 \global\@eqnswtrue\global\@eqcnt\z@\cr}
\def\@@@eqncr{&\if@eqnsw\@eqnnum\@eqnstepcounter\fi%
 \global\@eqnswtrue\cr}
%
%
%\def\sub@eqnnum{\hbox to .01pt{}\rlap%for left-eq-no.
%{\rm\hskip-\displaywidth(\thesubequation)}}
%
%\def\sub@eqnnum{\rm(\thesubequation)}%for right-eq-no.
%
%
%If you wnat to change Right-eq-no <-> Left-eq-no,
%you may use \lefteqno or \righteqno outside eq-env.
%
\def\lefteqno{\global\def\@eqnnummode{l}}
\def\righteqno{\global\def\@eqnnummode{r}}
\def\@eqnnum{%
 \if\@eqnnummode l%
  {\hbox to .01pt{}\rlap{\rm \hskip -\displaywidth(\theequation)}}%
 \else%
  {\rm(\theequation)}\fi}
\def\sub@eqnnum{%
 \if\@eqnnummode l%
  {\hbox to .01pt{}\rlap{\rm \hskip -\displaywidth(\thesubequation)}}%
 \else%
  {\rm(\thesubequation)}\fi}

\righteqno%default is right-eq-no.
%
%
\long\def\textin#1{\noalign{\noindent%
 \vskip\topsep\hbox{\vbox{\hsize\textwidth%
 \let\\=\newline%
 \noindent#1\hss}}\vskip\topsep}}
%
%
\let\ds=\displaystyle%
\let\ss=\scriptstyle%
\let\sss=\scriptscriptstyle%
\let\ts=\textstyle%
\def\math@style{\mathchoice{\ds}{\ts}{\ss}{\sss}}
\def\math@style@down{\mathchoice{\ts}{\ss}{\sss}{\sss}}
%
\def\FRAC{\@ifnextchar[{\@FRAC}{\@FRAC[.4pt]}}
\def\@FRAC[#1]#2#3{%
 \edef\m@style{\math@style}%
 \setbox\@tempboxa=\hbox{$\m@style#2$}\@tempdima\wd\@tempboxa%
 \setbox\@tempboxa=\hbox{$\m@style#3$}\@tempdimb\ht\@tempboxa%
 \ifdim\@tempdima<\wd\@tempboxa\@tempdima\wd\@tempboxa\fi%
 \ifdim\@tempdima<1.6ex\@tempdima1.6ex\fi%
 \setbox\@tempboxa=\hbox{$\mathstrut$}%
 \advance\@tempdimb-\ht\@tempboxa\ifdim\@tempdimb>\z@\@tempdimb\z@\fi%
 {{\mathchoice{\lower1.6pt\hbox to\@tempdima{\hss$\m@style#2$\hss}}%
              {\lower1.6pt\hbox to\@tempdima{\hss$\m@style#2$\hss}}%
              {\hbox to\@tempdima{\hss$\m@style#2$\hss}}%
              {\hbox to\@tempdima{\hss$\m@style#2$\hss}}%
 }%
 \above#1\relax%
 {\mathchoice{\lower.5\@tempdimb\hbox{$\m@style#3$}}%
             {\lower.5\@tempdimb\hbox{$\m@style#3$}}%
             {\hbox{$\m@style#3$}}%
             {\hbox{$\m@style#3$}}%
 }%
}}
\def\pfrac{\@ifnextchar[{\@pfrac}{\@@pfrac}}
\def\@pfrac[#1]#2#3{\FRAC{\partial^{#1}#2}{\partial#3^{#1}}}
\def\@@pfrac#1#2{\FRAC{\partial#1}{\partial#2}}
\def\slfrac#1#2{\leavevmode%
 \ifmmode%
 \raise.5ex\hbox{$#1$}\kern-.1em/\kern-.1em\lower.25ex\hbox{$#2$}%
 \else%
 \raise.5ex\hbox{#1}\kern-.1em/\kern-.1em\lower.25ex\hbox{#2}%
 \fi}
%
%
\def\newfunction#1{%
 \expandafter\def\csname#1\endcsname{\mathop{\rm#1}\nolimits}}
\def\newoperator#1#2{%
 \expandafter\def\csname#1\endcsname{\mathop{#2}\limits}}
\def\newrelation#1#2{%
 \expandafter\def\csname#1\endcsname{\mathrel{#2}\limits}}
%
\def\@iint@kern{\mathchoice{\!\!\!}{\!\!}{\!\!}{\!\!}}
\def\@iiint@kern{\mathchoice{\!\!\!\!}{\!\!}{\!\!}{\!\!}}
%
\newoperator{Ker}{\rm Ker}
\newoperator{Im}{\rm Im}
\newoperator{sumsum}{\sum\!\sum}
\newoperator{iint}{\int\@iint@kern\int}
\newoperator{iiint}{\int\@iiint@kern\int\@iiint@kern\int}
\newoperator{span}{\it span}
%
\newfunction{cond}
\newfunction{diag}
\newfunction{det}
\newfunction{trace}
\newfunction{sign}
\newfunction{const}
\newfunction{Arcsin}
\newfunction{Arccos}
\newfunction{Arctan}
\newfunction{cosec}
%
\newfunction{Arcsec}\newfunction{arcsec}
\newfunction{Arccosec}\newfunction{arccosec}
\newfunction{Arccsc}\newfunction{arccsc}
\newfunction{Arccot}\newfunction{arccot}
%
\def\@addCapitalGreek#1{%
 \expandafter\def\csname var#1\endcsname{{\mit\csname#1\endcsname}}}
%
\@addCapitalGreek{Gamma}\@addCapitalGreek{Delta}
\@addCapitalGreek{Theta}\@addCapitalGreek{Lambda}
\@addCapitalGreek{Xi}\@addCapitalGreek{Pi}
\@addCapitalGreek{Sigma}\@addCapitalGreek{Upsilon}
\@addCapitalGreek{Phi}\@addCapitalGreek{Psi}
\@addCapitalGreek{Omega}
%
%(See RakuRaku LaTeX edited by Dr.Nodera)
%
\def\fillBox{{\rule[-2pt]{5pt}{6pt}}}
\newfont{\b@g}{cmr10 scaled\magstep4}
\def\bigzerol{\smash{\hbox{\b@g0}}}
\def\bigzerou{\smash{\lower1.7ex\hbox{\b@g0}}}
\def\bigzero{\smash{\lower.85ex\hbox{\b@g0}}}
%
%  (     )    (  .  )
%  (. . .)    (  .  )
% resizable Hdots (     ) and Vdots (  .  )
%
%  (.    )    (    .)
%  (  .  )    (  .  )
% resizable ddots (    .) and qdots (.    ).
%    Ddots             Qdots
\def\Hdots[#1]{%
 \@tempdima=#1%
 \mathinner{\hbox to \@tempdima{\hss\raise.35\@tempdima\hbox{%
    .\kern.4\@tempdima.\kern.4\@tempdima.}\hss}}}
\def\Vdots[#1]{%
 \@tempdima=#1%
 \mathinner{\hbox to\@tempdima{\hss\hbox to0pt{.}%
     \raise.35\@tempdima\hbox to0pt{.}\raise.7\@tempdima\hbox to0pt{.}\hss}}}
\def\Ddots[#1]{%
 \@tempdima=#1\def\b@x{\hbox to\@tempdima{\hss}}
 \let\cdots=\b@x \let\vdots=\b@x \ddots}
\def\Qdots[#1]{%
 \@tempdima=#1\def\b@x{\hbox to\@tempdima{\hss}}
 \let\cdots=\b@x \let\vdots=\b@x \qdots}
\def\ddots{%
 \setbox\@tempboxa=\hbox{$\cdots$}\@tempdima\wd\@tempboxa
 \mathinner{\hbox to\@tempdima{\hss\raise.7\@tempdima\hbox{.}%
    \kern.2\@tempdima\raise.35\@tempdima\hbox{.}%
    \kern.2\@tempdima\hbox{.}\hss}}}
\def\qdots{%
 \setbox\@tempboxa=\hbox{$\cdots$}\@tempdima\wd\@tempboxa
 \mathinner{\hbox to\@tempdima{\hss\hbox{.}%
    \kern.2\@tempdima\raise.35\@tempdima\hbox{.}%
    \kern.2\@tempdima\raise.7\@tempdima\hbox{.}\hss}}}
\def\hdots{\cdots}
%
%
%NEW (sub)eqncases environment
%
%
\newcount\@eqnccnt
\newcount\@eqnc@nt

\let\@eqnnum@old=\relax

\def\eqncases{\@eqncases}
\def\subeqncases{%
 \ifx\@currentlabel\theequation%
 \global\c@subequation\@ne\let\@currentlabel=\thesubequation%
 \def\@eqnstepcounter{\stepcounter{subequation}}\fi\@eqncases}

\def\@eqncases{%
 \global\@eqnccnt\z@\global\setbox\z@=\vbox\bgroup\normalbaselines\m@th%
 \let\\=\@eqnccr\ialign\bgroup\global\@eqnc@nt\z@$##\hfil$&%
 \global\@eqnc@nt\@ne\quad\strut##\hfil\global\advance\@eqnccnt\@ne\crcr}

\def\endeqncases{\@@eqnccr\egroup\egroup%
 \ifx\@currentlabel\theequation\let\c@eqnc=\c@equation%
 \else\let\c@eqnc=\c@subequation\fi%
 \let\the@eqnc=\@eqnnum\mk@eqncnum}
\def\endsubeqncases{\@@eqnccr\egroup\egroup%
 \let\c@eqnc=\c@subequation%
 \let\the@eqnc=\sub@eqnnum\mk@eqncnum}

\def\@eqnccr{\@@eqnccr\noalign{\vskip.5\jot}}
\def\@@eqnccr{\let\@tempa\relax%
 \ifcase\@eqnc@nt\def\@tempa{&}\or\def\@tempa{}\fi%
 \@eqnstepcounter\@tempa\cr}

\def\mk@eqncnum{%
 \left\{\;\vcenter{\copy\z@}\right.%
 \@eqnc@nt\@eqnccnt\global\advance\@eqnc@nt-1\advance\c@eqnc-1%
 \ifnum\@eqnccnt=\@ne\global\setbox\z@=\vbox{\the@eqnc}\else%
 \def\@num{\hbox{\vrule height\ht\tw@ depth\dp\tw@ width\z@\the@eqnc}%
  \kern.5\jot}%
 \def\@last{\setbox\z@=\vbox{\unvbox\z@\unskip\global\setbox\tw@=\lastbox}}%
 \@last\setbox\@ne=\vbox{\@num}\loop\advance\c@eqnc by-1\advance\@eqnccnt-1%
 \@last\@last\setbox\@ne=\vbox{\@num\unvbox\@ne}\ifnum\@eqnccnt>\@ne\repeat\fi%
 \global\setbox\z@=\vbox{\kern.5\jot\box\@ne}%
 \global\advance\c@eqnc\@eqnc@nt\global\let\@eqnnum@old=\@eqnnum%
 \gdef\@eqnnum{\@eqncnum\global\let\@eqnnum=\@eqnnum@old}}

\def\@eqncnum{$\vcenter{\box\z@}$}

%
%CASES environment
%
\def\cases{\left\{\;\vcenter\bgroup\normalbaselines\m@th%
 \def\@cr{\cr\noalign{\vskip.5\jot}}\let\\=\@cr%
 \ialign\bgroup$##\hfil$&\quad\strut##\hfil\crcr}
\def\endcases{\crcr\egroup\egroup\right.}

\endinput
%
%Tiny document
%
mathematical envirnment

i) equation environment ( centering multi-eq-lines )
   No numbering can be done with '*'

\begin{equation}
f(x) = .... \\
g(x) = ....
\end{equation}

ii) subequation environment ( centering multi-eq-lines with sub-eq no.)
    No numbering can be done but it is nonsense.

\begin{subequation}
f(x) = .... \\
g(x) = ....
\end{subequation}

iii) eqnarray environment ( aligning ,at '&', multi-eq-lines )
     No numbering can be done with '*'

\begin{eqnarray}
f(x)&=&.... \\
g(x)&=&....
\end{eqnarray}

iv) subeqnarray environment ( aligning ,at '&', multi-eq-lines with sub-eq no. )
    No numbering can be done but it is nonsense.

\begin{subeqnarray}
f(x)&=&.... \\
g(x)&=&....
\end{subeqnarray}

\thesubequation is used in sub(equation|eqnarray) environment.
\ref command is also applied in sub* envirnment.


v) eqncases environment is the case environment with equation numbering
   with every items, and also subeqncases is with subeqation numbering.
  (in subeqnarray env, numbering is forced to subequation.)

\begin{eqnarray}
f(x) &=& \begin{subeqncases}
   1 & if $x>0$\\
  -1 & if $x\le0$
 \end{subeqncases}\\
g(x) &=& \tan x
\end{eqnarray}

If only one numbering for cases, it is available with cases environment and
no numbering is able to use both cases and nonumber;

\begin{eqnarray}
f(x) &=& \begin{cases}
   1 & if $x>0$\\
  -1 & if $x\le0$
 \end{cases}\\
g(x) &=& \tan x
\end{eqnarray}

vi) In multiline-eqs, \textin command can be very useful.
    This line can be forced not to be aligned.

\begin{eqnarray}
f(x)&=&.....\\
\textin{where, x is in ...}
g(x)&=&.....
\end{eqnarray}

    Compiling image is,

f(x)=......

where, x is in ...

g(x)=.....

    In \textin \par and \\ (breakline) is available, but some command,
    for example \verb, is not available.

vii) Some mathematical fonts can be loaded easily.

\loadnewfont{frak}{eufm}

    Above commmad make us use to eufm(German frak font) as '\frak' command,
    and font-size changing is automatically applied.

viii) Slanted Greek Capital font can be used.

\varXXXX means slanted Greek capital font in math-mode.

ix) re-sizable triple-dot commands(\cdot,\vdots,\ddots,and \qdots).

normalsize is \hdots, \vdots, \ddots, \qdots
(size of \ddots and \qdots is automatically changed with font-size)

re-sizable  is \Hdots[#1], \Vdots[#1], \Ddots[#1], \Qdots[#1]
(#1 is size of width)

ix) AMS-like command is also supported.

\numberwithin
\ds,\ss,\sss
\newfunction,\newoperator,\newrelation ... etc.


