%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     author          = "Enrico Bertolazzi",
%%%     version         = "0.7",
%%%     date            = "22-SEPT-96",
%%%     filename        = "easyvector.sty",
%%%     address         = "Laboratorio di Matematica Applicata
%%%                        Trento University,
%%%                        Via Mesiano, Trento, Italy",
%%%     FAX             = "+39 (461) 882672",
%%%     email           = "bertolaz@ing.unitn.it (Internet)",
%%%     supported       = "yes. Please send comments via E-mail",
%%%     docstring       = "package for easy typing of vectors 
%%%                        matrices.
%%%
%%% INSTALLATION:
%%%   Put this file where your TeX looks for inputs.
%%%
%%% DOCUMENTATION:
%%%  Compile docvector.tex.
%%%
%%% COPYING:
%%%   Copying of part or all of this file is allowed under the following
%%%   conditions only:
%%%   (1) You may freely distribute unchanged copies of the file. Please
%%%       include the documentation when you do so.
%%%   (2) You may modify a renamed copy of the file, but only for personal
%%%       use or use within an organization.
%%%   (3) You may copy fragments from the file, for personal use or for
%%%       distribution, as long as credit is given where credit is due.
%%%
%%%   You are NOT ALLOWED to take money for the distribution or use of
%%%   this file or modified versions or fragments thereof, except for
%%%   a nominal charge for copying etc.
%%%
%%%  }
%%% v 0.1
%%% v 0.2 15-MAY-96 added \newvector()[] command
%%% v 0.3 27-JULY-96 now \newvector[X,Y]{Z} accept commands for X, Y
%%% v 0.4-0.6 15-SEPT-06 make the commands more roboust and efficient
%%% v 0.7 22-SEPT-06 fixed an error in the warning message
%%% ====================================================================
%%%       ___    ____  ___   _   _      __    __    ____ ______
%%%      /   \  /     /   \  \  /      /  \  /  \  /       /
%%%     /____/ /__   /____/   \/       \    /   / /__     /
%%%    /   \  /     /  \      /         \  /   / /       /
%%%   /____/ /____ /    \    /       \__/  \__/ /       /
%%% ====================================================================
\typeout{Document Style `easyvector'  version 0.7 <22-SEPT-1996>.}
%% BEGIN easyvector.sty
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{easyvector}[1996/09/22 v0.7]
\let\@VET@separator=,

\def\newvector{\@ifnextchar(\@newvector\@@newvector}
\def\@newvector(#1)[#2]{%
\edef\@tempa{\noexpand\@@newvector[\noexpand\mathit{#1},\noexpand\mathbf{#1}]{#2}}
\@tempa}

\def\newvectora#1#2{\@@newvector[{#1},{#1}]{#2}}

\def\@@newvector[#1,#2]#3{\@VET@define@vector[#1,#2]{#3}\@VET@parse@start}

\def\@VET@setting#1#2{\def\@VET@@scalar{#1}\def\@VET@@vector{#2}}

\def\@VET@define@vector[#1,#2]#3#4{%
\@ifundefined{#3}{%
\expandafter\protect\expandafter\xdef\csname#3\endcsname{%
\noexpand\protect\noexpand\@VET@setting{\noexpand#1}{\noexpand#2}
\noexpand\protect\noexpand#4}
}{\PackageWarningNoLine{`easyvector'}%
{Command  \@backslashchar\expandafter\string#3\space already defined}}}

\def\newcustomvector[#1,#2]#3#4{%
\@VET@define@vector[#1,#2]{#3}%
{\@ifnextchar\noexpand[{\noexpand\@VET@@scalar\noexpand#4}{\noexpand\@VET@@vector}}}

\newcount\@VET@bracecnt

\long\def\@VET@addtoindices#1{%
{\toks@\expandafter{\@VET@indices#1}\xdef\@VET@indices{\the\toks@}}}



  
\def\@VET@parse@start{\futurelet\@tempb\@VET@parse}%
\def\@VET@parse{%
    \ifx[\@tempb\global\let\@VET@indices\@VET@@scalar\let\next\@VET@parsea%
    \else\global\let\@VET@indices\@VET@@vector%
       \ifx!\@tempb\let\next\@VET@test\else\let\next\@VET@@vector\fi%
    \fi\next}
\def\@VET@test#1{\@ifnextchar[{\@VET@parsea}{\@VET@indices#1}}

\def\@VET@parsea{\global\@VET@bracecnt\@ne\@VET@parseb}
\def\@VET@parseb{\futurelet\@tempb\@VET@parsec}
\def\@VET@parsec{%
    \let\next\@VET@eat%
    \ifx[\@tempb\let\next\@VET@open\else%
    \ifx]\@tempb\let\next\@VET@close\else%
    \ifx\bgroup\@tempb\let\next\@VET@bgroup\else%
    \ifnum\@VET@bracecnt=\tw@% can be morecommand
       \ifx,\@tempb\let\next\@VET@sep\else%
       \ifx;\@tempb\let\next\@VET@up\else%
       \fi\fi%
    \fi%
    \fi\fi\fi%
    \next}%
%
\def\@VET@open#1{%
     \ifnum\@VET@bracecnt=\@ne\@VET@addtoindices{_\bgroup}%
     \else\@VET@addtoindices[\fi%
     \global\advance\@VET@bracecnt\@ne\@VET@parseb}%
%
\def\@VET@close#1{%
      \global\advance\@VET@bracecnt\m@ne%
      \ifnum\@VET@bracecnt=\@ne%
         \@VET@addtoindices\egroup\expandafter\@VET@indices%
      \else%
         \@VET@addtoindices]\expandafter\@VET@parseb%
      \fi}%
%
\def\@VET@sep#1{\@VET@eat\@VET@separator}%
\def\@VET@up#1{\@VET@eat{\egroup^\bgroup}}%
\def\@VET@bgroup#1{\@VET@eat{\bgroup#1\egroup}}
\def\@VET@eat#1{\@VET@addtoindices{#1}\futurelet\@tempb\@VET@parsec}
%
\DeclareOption{definevectors}{%
  \global\let\oldaa=\aa \let\aa=\relax%
  \global\let\oldAA=\AA \let\AA=\relax%
  \global\let\oldgg=\gg \let\gg=\relax%
  \global\let\oldll=\ll \let\ll=\relax%
  \global\let\oldaa=\ss \let\ss=\relax%
  \global\let\oldaa=\SS \let\SS=\relax%
  \global\let\oldaa=\tt \let\tt=\relax%
  
  \@for \lettera:=A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z%
     \do { \newvector(\lettera)[\lettera\lettera] }

  \DeclareSymbolFont{boperators}{OT1}{cmr}{bx}{it}
  \DeclareSymbolFont{bsymbols}{OML}{cmr}{bx}{it}

  \@for \lettera:=a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z%
     \do { \newvector(\lettera)[\lettera\lettera] }

  \DeclareMathSymbol{\B@alpha}{\mathord}{bsymbols}{"0B}
  \DeclareMathSymbol{\B@beta}{\mathord}{bsymbols}{"0C}
  \DeclareMathSymbol{\B@gamma}{\mathord}{bsymbols}{"0D}
  \DeclareMathSymbol{\B@delta}{\mathord}{bsymbols}{"0E}
  \DeclareMathSymbol{\B@epsilon}{\mathord}{bsymbols}{"0F}
  \DeclareMathSymbol{\B@zeta}{\mathord}{bsymbols}{"10}
  \DeclareMathSymbol{\B@eta}{\mathord}{bsymbols}{"11}
  \DeclareMathSymbol{\B@theta}{\mathord}{bsymbols}{"12}
  \DeclareMathSymbol{\B@iota}{\mathord}{bsymbols}{"13}
  \DeclareMathSymbol{\B@kappa}{\mathord}{bsymbols}{"14}
  \DeclareMathSymbol{\B@lambda}{\mathord}{bsymbols}{"15}
  \DeclareMathSymbol{\B@mu}{\mathord}{bsymbols}{"16}
  \DeclareMathSymbol{\B@nu}{\mathord}{bsymbols}{"17}
  \DeclareMathSymbol{\B@xi}{\mathord}{bsymbols}{"18}
  \DeclareMathSymbol{\B@pi}{\mathord}{bsymbols}{"19}
  \DeclareMathSymbol{\B@rho}{\mathord}{bsymbols}{"1A}
  \DeclareMathSymbol{\B@sigma}{\mathord}{bsymbols}{"1B}
  \DeclareMathSymbol{\B@tau}{\mathord}{bsymbols}{"1C}
  \DeclareMathSymbol{\B@upsilon}{\mathord}{bsymbols}{"1D}
  \DeclareMathSymbol{\B@phi}{\mathord}{bsymbols}{"1E}
  \DeclareMathSymbol{\B@chi}{\mathord}{bsymbols}{"1F}
  \DeclareMathSymbol{\B@psi}{\mathord}{bsymbols}{"20}
  \DeclareMathSymbol{\B@omega}{\mathord}{bsymbols}{"21}
  \DeclareMathSymbol{\B@varepsilon}{\mathord}{bsymbols}{"22}
  \DeclareMathSymbol{\B@vartheta}{\mathord}{bsymbols}{"23}
  \DeclareMathSymbol{\B@varpi}{\mathord}{bsymbols}{"24}
  \DeclareMathSymbol{\B@varrho}{\mathord}{bsymbols}{"25}
  \DeclareMathSymbol{\B@varsigma}{\mathord}{bsymbols}{"26}
  \DeclareMathSymbol{\B@varphi}{\mathord}{bsymbols}{"27}
  \DeclareMathSymbol{\B@Gamma}{\mathalpha}{boperators}{"00}
  \DeclareMathSymbol{\B@Delta}{\mathalpha}{boperators}{"01}
  \DeclareMathSymbol{\B@Theta}{\mathalpha}{boperators}{"02}
  \DeclareMathSymbol{\B@Lambda}{\mathalpha}{boperators}{"03}
  \DeclareMathSymbol{\B@Xi}{\mathalpha}{boperators}{"04}
  \DeclareMathSymbol{\B@Pi}{\mathalpha}{boperators}{"05}
  \DeclareMathSymbol{\B@Sigma}{\mathalpha}{boperators}{"06}
  \DeclareMathSymbol{\B@Upsilon}{\mathalpha}{boperators}{"07}
  \DeclareMathSymbol{\B@Phi}{\mathalpha}{boperators}{"08}
  \DeclareMathSymbol{\B@Psi}{\mathalpha}{boperators}{"09}
  \DeclareMathSymbol{\B@Omega}{\mathalpha}{boperators}{"0A}

  \newvector[\alpha,\B@alpha]{Balpha}
  \newvector[\beta,\B@beta]{Bbeta}
  \newvector[\gamma,\B@gamma]{Bgamma}
  \newvector[\delta,\B@delta]{Bdelta}
  \newvector[\epsilon,\B@epsilon]{Bepsilon}
  \newvector[\zeta,\B@zeta]{Bzeta}
  \newvector[\eta,\B@eta]{Beta}
  \newvector[\theta,\B@theta]{Btheta}
  \newvector[\iota,\B@iota]{Biota}
  \newvector[\kappa,\B@kappa]{Bkappa}
  \newvector[\lambda,\B@lambda]{Blambda}
  \newvector[\mu,\B@mu]{Bmu}
  \newvector[\nu,\B@nu]{Bnu}
  \newvector[\xi,\B@xi]{Bxi}
  \newvector[\pi,\B@pi]{Bpi}
  \newvector[\rho,\B@rho]{Brho}
  \newvector[\sigma,\B@sigma]{Bsigma}
  \newvector[\tau,\B@tau]{Btau}
  \newvector[\upsilon,\B@upsilon]{Bupsilon}
  \newvector[\phi,\B@phi]{Bphi}
  \newvector[\chi,\B@chi]{Bchi}
  \newvector[\psi,\B@psi]{Bpsi}
  \newvector[\omega,\B@omega]{Bomega}
  \newvector[\varepsilon,\B@varepsilon]{Bvarepsilon}
  \newvector[\vartheta,\B@vartheta]{Bvartheta}
  \newvector[\varpi,\B@varpi]{Bvarpi}
  \newvector[\varrho,\B@varrho]{Bvarrho}
  \newvector[\varsigma,\B@varsigma]{Bvarsigma}
  \newvector[\varphi,\B@varphi]{Bvarphi}
  \newvector[\Gamma,\B@Gamma]{BGamma}
  \newvector[\Delta,\B@Delta]{BDelta}
  \newvector[\Theta,\B@Theta]{BTheta}
  \newvector[\Lambda,\B@Lambda]{BLambda}
  \newvector[\Xi,\B@Xi]{BXi}
  \newvector[\Pi,\B@Pi]{BPi}
  \newvector[\Sigma,\B@Sigma]{BSigma}
  \newvector[\Upsilon,\B@Upsilon]{BUpsilon}
  \newvector[\Phi,\B@Phi]{BPhi}
  \newvector[\Psi,\B@Psi]{BPsi}
  \newvector[\Omega,\B@Omega]{BOmega}
}
\DeclareOption{spacesep}{\let\@VET@separator=\smallskip}
\ProcessOptions

\endinput

%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
