%%% ==================================================================== %%% @LaTeX-style-file{ %%% author = "Enrico Bertolazzi", %%% version = "1.94", %%% date = "18-MAR-2002", %%% filename = "easyeqn.sty", %%% address = "Dipatimento di Ingegneria %%% Meccanica e 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 equations." %%% %%% INSTALLATION: %%% Put this file where your TeX looks for inputs. %%% %%% DOCUMENTATION: %%% Compile doceqn.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.2 15/may/96 first release %%% v 0.3 27/july/96 %%% addedd fleq, leqno options %%% EQA environment %%% \numberright and \equationcenter commands %%% improved \label command %%% v 0.4 improved tracing algorithm %%% v 0.5 improved spacing in the formulae, added cosmetic commands %%% v 0.6 correct label alignment in single equation %%% v 0.7 added additional macros %%% v 0.8 \ParDer now work also with easyvector %%% v 0.9 \ParDer now work also with easyvector with indices %%% v 1.0 Added ~ convection for eqlabel fixed an error in showkeys %%% v 1.1 added additional macros %%% v 1.2 compatibility with hyper macros %%% v 1.3 chaged copyright %%% v 1.4 added commands \eqlabeltop, \eqlabelbot, \eqlabelcenter %%% v 1.5 fixed a bug on allnumber %%% v 1.6 fixed a bug on equation number alignment %%% v 1.7 fixed a bug on equation number vertical alignment %%% v 1.8 fixed a bad spacing with \baselinestretch %%% v 1.9 13-JUN-2001 changed \@roman with \romannumeral (thanks to Claudio Beccari) %%% v 1.91 19-JUN-2001 fixed a bug in \eqlabel introduced in version 1.9 %%% v 1.92 18-JULY-2001 improved equation spacing %%% v 1.93 23-AUG-2001 correct a bug with showkeys %%% v 1.94 18-MAR-2002 fixed a bug compatibility with hyperref %%% ====================================================================%%% %%% ___ ____ ___ _ _ ___ ____ ___ _ _ %%% %%% / \ / / \ \ / / \ / / \ \ / %%% %%% /____/ /__ /____/ \/ /____/ /__ /____/ \/ %%% %%% / \ / / \ / / \ / / \ / %%% %%% /____/ /____ / \ / /____/ /____ / \ / %%% %%% ====================================================================%%% \def\filedate{2002/03/18} \def\fileversion{v1.94} \typeout{Document Style `easyeqn' \fileversion\space<\filedate>.} %% BEGIN easyeqn.sty %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{easy} \ProvidesPackage{easyeqn}[\filedate\space\fileversion] \@easy@disable@space %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newdimen\@EQ@leftmargin\@EQ@leftmargin\leftmargini \newdimen\@EQ@col@sep\@EQ@col@sep=2pt \newcommand{\equationcenter}{\gdef\@EQ@indent{\tabskip\@centering}}% \newcommand{\equationleft}{\gdef\@EQ@indent{\tabskip\@EQ@leftmargin}}% % \newcommand{\eqspacing}[1]{\xdef\@EQ@surround{\noexpand\abovedisplayskip#1\noexpand\belowdisplayskip#1}} \newcommand{\eqleftmargin}[1]{\global\@EQ@leftmargin=#1} % \newcommand{\eqcolumnsep}[1]{\@tempdima=#1\divide\@tempdima2\global\@EQ@col@sep=\@tempdima} % \newcommand{\eqrowsep}[1]{\def\@tempa##1{% \gdef\@EQ@rowsep{\penalty\@M\vskip##1}} \expandafter\@tempa{#1}} % \newcommand{\numberleft}{\global\let\@EQ@NUM\@EQ@NUM@LEFT} \newcommand{\numberright}{\global\let\@EQ@NUM\@EQ@NUM@RIGHT} \def\@EQ@reset@numbering{\global\let\if@EQ@numbering\iffalse} \DeclareOption{allnumber}{% \gdef\@EQ@reset@numbering{\global\let\if@EQ@numbering\iftrue} \gdef\@EQ@eqnum{\refstepcounter{equation}\@EQ@base@eqnum} } \DeclareOption{fleqn}{\equationleft} \global\let\if@EQ@number@left\iffalse \DeclareOption{leqno}{\global\let\if@EQ@number@left\iftrue} \DeclareOption{math}{% \def\binom#1#2{{#1\atopwithdelims()#2}} \def\abs#1{\left\vert#1\right\vert} \def\norm#1{\left\Vert#1\right\Vert} \def\frac{\@ifnextchar[\@EQ@frac\@EQ@frac@} \def\@EQ@frac[#1]#2#3{{\begingroup#2\endgroup\above#1#3}} \def\@EQ@frac@#1#2{{\begingroup#1\endgroup\over#2}} \providecommand{\dfrac}{\@ifnextchar[\@EQ@dfrac\@EQ@dfrac@} \def\@EQ@dfrac[#1]#2#3{\displaystyle{\begingroup#2\endgroup\above#1#3}} \def\@EQ@dfrac@#1#2{\displaystyle{\begingroup#1\endgroup\over#2}} \providecommand{\tfrac}{\@ifnextchar[\@EQ@tfrac\@EQ@tfrac@} \def\@EQ@tfrac[#1]#2#3{\scriptstyle{\begingroup#2\endgroup\above#1#3}} \def\@EQ@tfrac@#1#2{\scriptstyle{\begingroup#1\endgroup\over#2}} \def\boxed#1{\fbox{$\displaystyle{#1}$}} \def\eqbox{\@ifnextchar(\@EQ@box{\@EQ@box(.25pt,3pt)}} \def\@EQ@box(#1,#2)#3{\fboxrule#1\fboxsep#2\fbox{$\displaystyle#3$}} \newcount\@EQ@DP@n\@EQ@DP@n=\z@ \newcount\@EQ@DP@nt\@EQ@DP@nt=\m@ne \def\ParDer[{% \global\@EQ@DP@n=\z@ \global\@EQ@DP@nt=\z@ \global\let\@EQ@DP@x\@empty \global\let\@EQ@DP@oldx\@empty \futurelet\@tempb\@EQ@DP@parsea} % \def\@EQ@DP@parsea{\futurelet\@tempb\@EQ@DP@parseb} \def\@EQ@DP@parseb{% \let\next\@EQ@DP@eat% \ifx]\@tempb\let\next\@EQ@DP@close\else% \ifx\bgroup\@tempb\let\next\@EQ@DP@bgroup\fi\fi% \next}% % \def\@EQ@DP@close#1#2{% \@EQ@DP@eat\end \ifnum\@ne=\@EQ@DP@nt\let\tmp\@empty\else\def\tmp{^{\the\@EQ@DP@nt}}\fi \frac{\partial\tmp#2}{\@EQ@DP@x}}% % \def\@EQ@DP@bgroup#1{\@EQ@DP@eat{#1}} \gdef\@EQ@DP@eat#1{% \let\@EQ@DP@tmpa\@empty \g@addto@macro\@EQ@DP@tmpa{#1} \ifx\@EQ@DP@oldx\@EQ@DP@tmpa \else% new symbol added \ifx\@EQ@DP@oldx\@empty\else \g@addto@macro\@EQ@DP@x{\partial\bgroup} \expandafter\g@addto@macro\expandafter\@EQ@DP@x\expandafter{\@EQ@DP@oldx\egroup} \ifnum\@ne=\@EQ@DP@n\else% \edef\@EQ@DP@tmpb{\noexpand\g@addto@macro\noexpand\@EQ@DP@x{^{\the\@EQ@DP@n}}} \@EQ@DP@tmpb \fi \global\advance\@EQ@DP@nt by \@EQ@DP@n\global\@EQ@DP@n=\z@ \fi \global\let\@EQ@DP@oldx\@EQ@DP@tmpa \fi \global\advance\@EQ@DP@n by \@ne \ifx#1\end\else\expandafter\@EQ@DP@parsea\fi } \newcommand{\DIV}[1]{\nabla\cdot#1} \newcommand{\GRAD}[1]{\nabla#1} \newcommand{\LAPLA}[1]{\Delta#1} \newcommand{\SUM}{\@ifnextchar[\@SUM\@@SUM} \def\@SUM[#1]#2#3{{\sum\limits_{#2}^{#3}\!\vphantom{\sum\limits_{#2}^{#3}}^{^{(#1)}}}} \def\@@SUM#1#2{\sum\limits_{#1}^{#2}} \newcommand{\PROD}{\@ifnextchar[\@PROD\@@PROD} \def\@PROD[#1]#2#3{{\prod\limits_{#2}^{#3}\!\vphantom{\prod\limits_{#2}^{#3}}^{^{(#1)}}}} \def\@@PROD#1#2{\prod\limits_{#1}^{#2}} \def\@EQ@parse@extra{% \gdef\@EQ@bformat{\vcenter\bgroup\normalbaselines\m@th\ialign\bgroup}% \global\let\@EQ@cmdadd\@empty\@EQ@parsea} \newenvironment{ARRAY}[1] {\expandafter\@EQ@parse@extra#1\end\let\@EQ@rowsep\smallskip\let\\\@EQ@CR\@EQ@bformat\crcr} {\crcr\egroup\egroup} \newenvironment{MATRIX} {\,\vcenter\bgroup\everycr{}\let\@EQ@rowsep\smallskip\let\\\@EQ@CR \halign\bgroup\hfil$\mathstrut##$\hfil&&\quad\hfil$\mathstrut##$\hfil\crcr} {\crcr\egroup\egroup\,} } \@easy@enable@space \let\@EQ@file@input\jobname \DeclareOption{warning}{% \newcount\@EQ@level\@EQ@level=\@ne% \xdef\@EQ@file@inputi{\jobname.tex} \xdef\@EQ@file@input{\jobname.tex} \global\let\@EQ@old@input\input \gdef\@EQ@input@shade{% \@ifnextchar\bgroup{\@EQ@input}{% \PackageWarning{`easyeqn'}% {you must use \string\input\space with file within braces for correct cross referencing}\@EQ@old@input}% } \gdef\@EQ@input#1{% \global\advance\@EQ@level by \@ne \expandafter\xdef\csname @EQ@file@input\romannumeral\@EQ@level\endcsname{#1} \xdef\@EQ@file@input{\csname @EQ@file@input\romannumeral\@EQ@level\endcsname} \@EQ@old@input{#1}% \global\advance\@EQ@level by \m@ne \xdef\@EQ@file@input{\csname @EQ@file@input\romannumeral\@EQ@level\endcsname} } \global\let\@EQ@old@input\input% \AtBeginDocument{\global\let\input\@EQ@input@shade}% \AtEndDocument{\global\let\input\@EQ@old@input}% \gdef\@EQ@write@warning#1{% \edef\@temp{\noexpand\AtEndDocument{\noexpand\PackageWarningNoLine{`easyeqn'}% {Label `#1' may be not referenced, in \@EQ@file@input\space line \the\inputlineno}}}% \@temp% } } \DeclareOption{easyold}{% \def\EQS{\@EQ@NUMBER\@easy@ifnextchar[\@EQ@ALIGN{\@EQ@ALIGN[rl]}} \let\endEQS\end@EQ@ALIGN \@easy@def(EQ*) {\@EQ@NO@NUMBER\@easy@ifnextchar[\@EQ@ALIGN{\@EQ@ALIGN[c]}} \@easy@def(EQS*){\@EQ@NO@NUMBER\@easy@ifnextchar[\@EQ@ALIGN{\@EQ@ALIGN[rl]}} \@easy@def(EQA*){\@EQ@NO@NUMBER\@easy@ifnextchar[\@EQ@A@ALIGN{\@EQ@A@ALIGN[rl]}} \@easy@let(EQ*) {end@EQ@ALIGN} \@easy@let(EQS*){end@EQ@ALIGN} \@easy@let(EQA*){end@EQ@A@ALIGN} } \def\@EQ@warning@nolabel{% \PackageWarning{`easyeqn'}% {\string\label\space and \string\eqlabel\space disabled in EQx* environments} } \@easy@disable@space \def\@EQ@newreference#1{\@easy@glet(r@eq@#1){@empty}} \def\@EQ@addreference#1{\@bsphack\protected@write\@auxout{}{\string\@EQ@newreference{#1}}\@esphack} \def\refeq#1{\protect\@EQ@addreference{#1}\@EQ@old@ref{#1}} \def\eqref#1{\hbox{\@EQ@base@format(\refeq{#1})}} \def\@EQ@write@warning#1{} \def\@EQ@NUMBER{\let\label\eqlabel\@EQ@reset@numbering} \def\@EQ@NO@NUMBER{\let\label\@EQ@warning@nolabel} \eqrowsep{7pt} \equationcenter \eqspacing{12pt plus 3pt minus 3pt} \ProcessOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\@EQ@base@format{\normalfont\normalcolor}% \def\@EQ@base@eqnum{\@EQ@base@format(\theequation)}% \def\@EQ@stepnumber{\refstepcounter{equation}} \newcommand{\yesnumber}{% \@EQ@stepnumber% \global\let\if@EQ@numbering\iftrue% \global\let\@EQ@eqnum\@EQ@base@eqnum} \newcommand{\eqlabel}{\global\let\@EQ@eqnum\@EQ@base@eqnum\@ifnextchar[\@EQ@a\@EQ@x} \def\@EQ@x{\@ifnextchar(\@EQ@b\@EQ@c} \def\@EQ@a[#1]{\@EQ@customlabel{#1}{#1}} \def\@EQ@b(#1){\@EQ@customlabel{(#1)}{#1}} \def\@EQ@customlabel#1#2{% \begingroup \def~{\theequation} \xdef\@EQ@eqnum{\noexpand\@EQ@base@format#1} \xdef\@currentlabel{#2} \endgroup \global\let\if@EQ@numbering\iftrue \@ifnextchar\bgroup{\@EQ@d}{}} \def\@EQ@c#1{% \@EQ@SK@label{#1} \@ifundefined{r@eq@#1}{\@EQ@write@warning{#1}} {\@EQ@stepnumber\global\let\if@EQ@numbering\iftrue\@EQ@old@label{#1}} } \def\@EQ@d#1{\@EQ@SK@label{#1}\@EQ@old@label{#1}} \def\@EQ@CR{\global\let\@EQ@eqbox@do\@EQ@eqbox{\ifnum0=`}\fi\@EQ@CR@} \def\@EQ@CR@{\@ifnextchar[\@EQ@CR@@{\@EQ@CR@@[\z@]}} \def\@EQ@CR@@[#1]{% \ifnum0=`{\fi} \crcr\noalign{\@EQ@rowsep\vskip#1\relax} } \def\@EQ@NL{{\ifnum0=`}\fi\@EQ@NL@} \def\@EQ@NL@{\@ifnextchar[\@EQ@NL@@{\@EQ@NL@@[\z@]}} \def\@EQ@NL@@[#1]{% \ifnum0=`{\fi}&\@EQ@NUM% \@EQ@reset@numbering\crcr\noalign{\@EQ@rowsep\vskip#1\relax} } \newcommand{\eqmulticol}[3]{% \multispan{#1} \ifx#2l\else\hfil\fi $\displaystyle#3$ \ifx#2r\else\hfil\fi} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Do Label \def\@EQ@SK@label#1{} \let\@EQ@SK@left\@empty \let\@EQ@SK@right\@empty \def\@EQ@NUM@LEFT{\llap{\hb@xt@\displaywidth{\@EQ@SK@left\if@EQ@numbering\@EQ@eqnum\fi\hss}}} \def\@EQ@NUM@RIGHT{\@EQ@SK@right\if@EQ@numbering\llap{\@EQ@eqnum}\fi} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Parser zone \def\@EQ@addcol{% \g@addto@macro\@EQ@bformat{\tabskip\z@skip\hskip\@EQ@col@sep&\hskip\@EQ@col@sep}} \def\@EQ@addcola{% \g@addto@macro\@EQ@bformat{\tabskip\z@skip&}} \def\@EQ@parse{% \gdef\@EQ@bformat{\everycr{}\@EQ@indent\halign to\displaywidth\bgroup}% \global\let\@EQ@cmdadd\@empty\@EQ@parsea} \def\@EQ@parsea#1{\ifx#1\end\else\@EQ@cmd{#1}\expandafter\@EQ@parsea\fi}% \def\@EQ@alignl{\g@addto@macro\@EQ@bformat{$\displaystyle##$\hfil}} \def\@EQ@alignr{\g@addto@macro\@EQ@bformat{\hfil$\displaystyle##$}} \def\@EQ@alignc{\g@addto@macro\@EQ@bformat{\hfil$\displaystyle##$\hfil}} \def\@EQ@cmd#1{% \ifx#1. \global\let\@EQ@cmdadd\@EQ@addcola% \else \@EQ@cmdadd \global\let\@EQ@cmdadd\@EQ@addcol% \expandafter\let\expandafter\@tempa\csname @EQ@align#1\endcsname \ifx\@tempa\relax\PackageWarningNoLine{`easyeqn'} {Alignment\space`#1'\space not \space defined \space `c'\space substituted,\space in \space \@EQ@file@input\space line\space \the\inputlineno} \@EQ@alignc \else \@tempa \fi \fi} \def\@EQ@skip{\vskip\baselinestretch\floatsep} \def\eqlabeltop{\def\@EQ@eqbox##1{\vtop{##1\@EQ@skip}}} \def\eqlabelbot{\def\@EQ@eqbox##1{\vbox{\@EQ@skip##1}}} \def\eqlabelcenter{\def\@EQ@eqbox##1{\vbox{\@EQ@skip}\vcenter{##1}\vbox{\@EQ@skip}}} \eqlabelcenter \newbox\@EQ@EQN@BOX % \def\@EQ@A@ALIGN[#1]{% \expandafter\@EQ@parse#1\end \let\\\@EQ@NL% $$\@EQ@surround\@EQ@bformat\tabskip\@centering&\tabskip\z@skip\hb@xt@\z@{\hss##}\crcr} % \def\end@EQ@A@ALIGN{&\@EQ@NUM\crcr\egroup$$\@ignoretrue} \def\@EQ@ALIGN[#1]{% \expandafter\@EQ@parse#1\end \let\\\@EQ@CR% % \def\@EQ@eqbox@do##1{\vbox{\@EQ@skip}\vbox{##1}\vbox{\@EQ@skip}} \let\@EQ@eqbox@do\vbox $$\@EQ@surround\setbox\@EQ@EQN@BOX\vbox\bgroup\@EQ@bformat\tabskip\@centering\crcr} % \def\end@EQ@ALIGN{\crcr\egroup\egroup\@EQ@eqbox@do{\unvbox\@EQ@EQN@BOX}\@EQ@NUM$$\@ignoretrue} \def\EQ{\@EQ@NUMBER\@easy@ifnextchar[\@EQ@ALIGN{\@EQ@ALIGN[c]}} \let\endEQ\end@EQ@ALIGN \def\EQA{\@EQ@NUMBER\@easy@ifnextchar[\@EQ@A@ALIGN{\@EQ@A@ALIGN[rcl]}} \let\endEQA\end@EQ@A@ALIGN \AtBeginDocument{% % \let\@EQ@old@ref\ref \let\@EQ@old@label\label % \@ifundefined{SK@label}{% }{% \def\@EQ@SK@left{\llap{\@EQ@SK@lab\kern\marginparsep}\global\let\SK@lab\@empty} \def\@EQ@SK@right{\rlap{\kern\marginparsep\@EQ@SK@lab}\global\let\SK@lab\@empty} \def\@EQ@SK@label#1{% \gdef\@EQ@SK@lab{% \edef\@tempa{#1} \smash{\SK@labelcolor\fbox{\normalfont\small\ttfamily\expandafter\strip@prefix\meaning\@tempa}}% } } \@ifundefined{ltx@label}{\let\@EQ@old@label\SK@label}{} } \if@EQ@number@left\numberleft\else\numberright\fi \let\if@EQ@number@left\relax } \@easy@enable@space \endinput