diff options
Diffstat (limited to 'macros/latex/contrib/easy/easyvector.sty')
-rw-r--r-- | macros/latex/contrib/easy/easyvector.sty | 236 |
1 files changed, 236 insertions, 0 deletions
diff --git a/macros/latex/contrib/easy/easyvector.sty b/macros/latex/contrib/easy/easyvector.sty new file mode 100644 index 0000000000..39cac6029f --- /dev/null +++ b/macros/latex/contrib/easy/easyvector.sty @@ -0,0 +1,236 @@ +%%% ==================================================================== +%%% @LaTeX-style-file{ +%%% author = "Enrico Bertolazzi", +%%% version = "0.9", +%%% date = "16-MAR-99", +%%% filename = "easyvector.sty", +%%% address = "Laboratorio di Matematica Applicata +%%% e Meccanica Strutturale, +%%% Trento University, +%%% Via Mesiano, Trento, Italy", +%%% FAX = "+39 (461) 882599", +%%% email = "enrico.bertolazzi@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. +%%% +%%% Copyright 1999 Enrico Bertolazzi +%%% +%%% This program can be redistributed and/or modified under the terms +%%% of the LaTeX Project Public License Distributed from CTAN +%%% archives in directory macros/latex/base/lppl.txt; either +%%% version 1 of the License, or any later version. +%%% +%%% } +%%% 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-96 make the commands more roboust and efficient +%%% v 0.7 22-OCT-97 fixed an error in the warning message +%%% v 0.8 28-OCT-97 fixed an incompatibility with easyeqn +%%% v 0.9 11-NOV-97 added @ command +%%% v 1.0 16-MAR-99 changed copyright +%%% ====================================================================%%% +%%% ___ ____ ___ _ _ ___ ____ ___ _ _ %%% +%%% / \ / / \ \ / / \ / / \ \ / %%% +%%% /____/ /__ /____/ \/ /____/ /__ /____/ \/ %%% +%%% / \ / / \ / / \ / / \ / %%% +%%% /____/ /____ / \ / /____/ /____ / \ / %%% +%%% ====================================================================%%% +\def\filedate{1999/03/16} +\def\fileversion{v1.0} +\typeout{Document Style `easyvector' \fileversion\space<\filedate>.} +%% BEGIN easyvector.sty +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{easyvector}[\filedate\space\fileversion] + +\catcode`\ =9\endlinechar=-1 + +\let\@VET@separator=, +\let\@VET@dot@symbol=\bullet +\newcount\@VET@bracecnt + +\begingroup + \makeatother + \let\tmp=@ + \makeatletter + \global\let\@VET@at\tmp +\endgroup + +\let\@VET@bold\mathbf +\let\@VET@nobold\mathit + +\def\newvector{\@ifnextchar(\@newvector\@@newvector} +\def\@newvector(#1)[#2]{\@@newvector[\@VET@nobold{#1},\@VET@bold{#1}]{#2}} +\def\@@newvector[#1,#2]#3{\@@@newvector[#1,#2]{#3}\@VET@parse@start{}} +\def\@@@newvector[#1,#2]#3#4#5{% + \@ifundefined{#3}{% + \edef\@tempb{% + \noexpand\DeclareRobustCommand{\csname#3\endcsname}{% + \noexpand\gdef\noexpand\@VET@indices{% + \noexpand\if@VET@scal\noexpand#1 + \noexpand\else\noexpand#2\noexpand\fi} + \noexpand#4\noexpand#5}} + \@tempb + }{% + \PackageWarningNoLine{`easyvector'}% + {Command\space\@backslashchar\expandafter\string#3\space already\space defined}}} + +\def\newvectora#1#2{\@@newvector[#1,#1]{#2}} + +\def\newcustomvector[#1,#2]#3#4{\@@@newvector[#1,#2]{#3}\@VET@parse@custom{#4}} + +\def\@VET@addtoindices#1{% +{\toks@\expandafter{\@VET@indices#1}\xdef\@VET@indices{\the\toks@}}} + +\def\@VET@parse@custom#1{% + \@ifnextchar[{\let\if@VET@scal\iftrue\@VET@indices#1} + {\let\if@VET@scal\iffalse\@VET@indices}} + +\def\@VET@parse@start{% + \global\let\if@VET@scal\iffalse% + \@ifnextchar!{\@VET@test}{% + \@ifnextchar[{\global\let\if@VET@scal\iftrue\@VET@parsea}{\@VET@indices}}} + +\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% + \ifx\@VET@at\@tempb\let\next\@VET@dot\else% + \fi\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} +\def\@VET@dot#1{\global\let\if@VET@scal\iffalse\@VET@eat\@VET@dot@symbol} +% + +\DeclareOption{boldcm}{% + \let\@VET@bold\relax + \let\@VET@nobold\relax + \DeclareMathAlphabet{\@VET@bold}{OML}{cmm} {b}{it} + \DeclareMathAlphabet{\@VET@nobold}{OML}{cmm}{m}{it} +} + +\DeclareOption{boldcc}{% +% \RequirePackage{concmath} + \let\@VET@bold\relax + \let\@VET@nobold\relax + \DeclareMathAlphabet{\@VET@bold}{OT1}{ccr}{bx}{it} + \DeclareMathAlphabet{\@VET@nobold}{OT1}{ccr}{m}{it} +} + +\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% + + \@tfor\lettera:=ABCDEFGHIJKLMNOPQRSTUVWXYZ% + \do { \newvector(\lettera)[\lettera\lettera] } + + \@tfor\lettera:=abcdefghijklmnopqrstuvwxyz% + \do { \newvector(\lettera)[\lettera\lettera] } + + \DeclareSymbolFont{boperators}{OT1}{cmr}{bx}{it} + \DeclareSymbolFont{bsymbols}{OML}{cmr}{bx}{it} + + \def\@VET@def@symbol#1#2{% + \expandafter\DeclareMathSymbol\csname B@#1\endcsname\mathord{bsymbols}{#2} + \newvector[\csname#1\endcsname,\csname B@#1\endcsname]{B#1} + } + + \@VET@def@symbol{alpha}{"0B} + \@VET@def@symbol{beta}{"0C} + \@VET@def@symbol{gamma}{"0D} + \@VET@def@symbol{delta}{"0E} + \@VET@def@symbol{epsilon}{"0F} + \@VET@def@symbol{zeta}{"10} + \@VET@def@symbol{eta}{"11} + \@VET@def@symbol{theta}{"12} + \@VET@def@symbol{iota}{"13} + \@VET@def@symbol{kappa}{"14} + \@VET@def@symbol{lambda}{"15} + \@VET@def@symbol{mu}{"16} + \@VET@def@symbol{nu}{"17} + \@VET@def@symbol{xi}{"18} + \@VET@def@symbol{pi}{"19} + \@VET@def@symbol{rho}{"1A} + \@VET@def@symbol{sigma}{"1B} + \@VET@def@symbol{tau}{"1C} + \@VET@def@symbol{upsilon}{"1D} + \@VET@def@symbol{phi}{"1E} + \@VET@def@symbol{chi}{"1F} + \@VET@def@symbol{psi}{"20} + \@VET@def@symbol{omega}{"21} + \@VET@def@symbol{varepsilon}{"22} + \@VET@def@symbol{vartheta}{"23} + \@VET@def@symbol{varpi}{"24} + \@VET@def@symbol{varrho}{"25} + \@VET@def@symbol{varsigma}{"26} + \@VET@def@symbol{varphi}{"27} + + \def\@VET@def@symbol#1#2{ + \expandafter\DeclareMathSymbol\csname B@#1\endcsname\mathalpha{boperators}{#2} + \newvector[\csname#1\endcsname,\csname B@#1\endcsname]{B#1} + } + + \@VET@def@symbol{Gamma}{"00} + \@VET@def@symbol{Delta}{"01} + \@VET@def@symbol{Theta}{"02} + \@VET@def@symbol{Lambda}{"03} + \@VET@def@symbol{Xi}{"04} + \@VET@def@symbol{Pi}{"05} + \@VET@def@symbol{Sigma}{"06} + \@VET@def@symbol{Upsilon}{"07} + \@VET@def@symbol{Phi}{"08} + \@VET@def@symbol{Psi}{"09} + \@VET@def@symbol{Omega}{"0A} + + \let\@VET@def@symbol=\relax +} + +\DeclareOption{spacesep}{\global\let\@VET@separator=\smallskip} +\ProcessOptions + +\catcode`\ =10\endlinechar=`\^^M +\endinput + +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |