%%% ==================================================================== %%% @LaTeX-style-file{ %%% author = "Enrico Bertolazzi", %%% version = "0.6", %%% date = "23-SEPT-1996", %%% filename = "easyeqn.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 equations. %%% %%% INSTALLATION: %%% Put this file where your TeX looks for inputs. %%% %%% DOCUMENTATION: %%% Compile doceqn.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.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 %%% ==================================================================== %%% ___ ____ ___ _ _ __ __ ____ ______ %%% / \ / / \ \ / / \ / \ / / %%% /____/ /__ /____/ \/ \ / / /__ / %%% / \ / / \ / \ / / / / %%% /____/ /____ / \ / \__/ \__/ / / %%% ==================================================================== \typeout{Document Style `easyeqn' version 0.6 <23-SEPT-1996>.} %% BEGIN easyeqn.sty %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{easyeqn}[1996/09/23 v0.6] \let\@EQ@alleqnum\iffalse \let\if@EQ@warning\iffalse \def\equationcenter{\gdef\@EQ@indent{\tabskip\@centering}}% \def\equationleft{\gdef\@EQ@indent{\tabskip\@EQ@leftmargin}}% \def\eqspacing#1{\xdef\@EQ@surround{#1\noexpand\relax}} \def\eqcolumnsep#1{\@tempdima=#1\divide\@tempdima2\xdef\@EQ@colsep{\noexpand\hskip\the\@tempdima}} \def\eqleftmargin#1{\xdef\@EQ@leftmargin{#1\noexpand\relax}} \def\eqrowsep#1{\xdef\@EQ@rowsep{\noexpand\penalty\noexpand\@M\noexpand\vskip#1}} \eqspacing{6pt} \eqcolumnsep{2pt} \eqleftmargin\leftmargini \eqrowsep{7pt} \def\@EQ@NUM@LEFT{\llap{\hb@xt@\displaywidth{\@@eqnnum\hss}}} \def\@EQ@NUM@RIGHT{\llap{\@@eqnnum}} \def\numberleft{\global\let\@EQ@N@NUM\@EQ@NUM@LEFT} \def\numberright{\global\let\@EQ@N@NUM\@EQ@NUM@RIGHT} \DeclareOption{allnumber}{\global\let\@EQ@alleqnum\iftrue} \DeclareOption{warning}{\global\let\if@EQ@warning\iftrue} \DeclareOption{fleqn}{\equationleft} \DeclareOption{leqno}{\numberleft} \numberright \equationcenter \ProcessOptions \input{easy.sty} \if@EQ@warning \newcounter{@EQ@level} \setcounter{@EQ@level}{1} \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 braces for correct cross referencing}\@EQ@old@input}% } \gdef\@EQ@input#1{% \addtocounter{@EQ@level}{\@ne} \expandafter\xdef\csname @EQ@file@input\roman{@EQ@level}\endcsname{#1} \xdef\@EQ@file@input{\csname @EQ@file@input\roman{@EQ@level}\endcsname} \@EQ@old@input{#1}% \addtocounter{@EQ@level}{\m@ne} \xdef\@EQ@file@input{\csname @EQ@file@input\roman{@EQ@level}\endcsname} } \global\let\@EQ@old@input\input% \AtEndDocument{\global\let\input\@EQ@old@input}% \AtBeginDocument{\global\let\input\@EQ@input@shade}% \fi \def\@EQ@write@warning#1{% \edef\@temp{\noexpand\AtEndDocument{\noexpand\PackageWarningNoLine{`easyeqn'}% {#1, in \@EQ@file@input\space line \the\inputlineno}}}% \@temp% } \def\@EQ@warning@label{% \PackageWarning{`easyeqn'}% {you must use \string\eqlabel\space instead of \string\label\space in EQx environments} } \def\@EQ@warning@nolabel{% \PackageWarning{`easyeqn'}% {\string\label\space and \string\eqlabel\space disabled in EQx* environments} } \let\@EQ@old@label\label \def\eqlabel{\@ifnextchar[\@EQ@ll\@EQ@l} \def\@EQ@l{\@ifnextchar(\@EQ@lll\@EQ@label} \def\@EQ@ll[#1]#2{\@EQ@customlabel{#1}{#1}{#2}} \def\@EQ@lll(#1)#2{\@EQ@customlabel{(#1)}{#1}{#2}} \def\@EQ@customlabel#1#2#3{% \xdef\@@eqnnum{#1}\xdef\@currentlabel{#2}\@EQ@label{#3} \gdef\@currentlabel{\p@equation\theequation}} \def\@EQ@label#1{% \@ifundefined{r@eq@#1}{% \if@EQ@warning\@EQ@write@warning{Label `#1' may be not referenced}\fi% }{\global\let\if@EQ@numbering\iftrue}% \if@EQ@numbering\@EQ@old@label{#1}\fi } \let\@@eqnnum\@eqnnum% \def\@EQ@NUM{\if@EQ@numbering\@EQ@N@NUM% \ifx\@@eqnnum\@eqnnum\stepcounter{equation}%no custom label \else\global\let\@@eqnnum\@eqnnum\fi% custom label \fi} \def\@EQ@newreference#1{\expandafter\global\expandafter\let\csname r@eq@#1\endcsname\@empty} \def\@EQ@addreference#1{\@bsphack\protected@write\@auxout{}{\string\@EQ@newreference{#1}}\@esphack} \def\refeq#1{\protect\@EQ@addreference{#1}\ref{#1}} \def\eqref#1{\textrm{(\refeq{#1})}} \def\@EQ@CR{{\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% \global\let\if@EQ@numbering\@EQ@alleqnum\crcr\noalign{\@EQ@rowsep\vskip#1\relax}} \def\yesnumber{\global\let\if@EQ@numbering\iftrue} \long\def\eqbox{\@ifnextchar(\@eqbox{\@eqbox(.25pt,3pt)}} \long\def\@eqbox(#1,#2)#3{\fboxrule#1\fboxsep#2\fbox{$\displaystyle#3$}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Parser zone \def\@EQ@addcol{\g@addto@macro\@EQ@bformat{\tabskip\z@skip\@EQ@colsep&\@EQ@colsep}} \def\@EQ@parse{% \gdef\@EQ@bformat{% \everycr{}\@EQ@indent\halign to\displaywidth\bgroup}% \global\let\@EQ@cmdadd\@empty\@EQ@parsea} \def\@EQ@parsea{\futurelet\@tempb\@EQ@parseb} \def\@EQ@parseb{\ifx\end\@tempb\def\next##1{}\else\let\next\@EQ@cmd\fi\next}% \def\@EQ@cmd#1{% \@EQ@cmdadd\global\let\@EQ@cmdadd\@EQ@addcol% \ifx\@tempb l\else\g@addto@macro\@EQ@bformat{\hfil}\fi% \g@addto@macro\@EQ@bformat{$\displaystyle##$}% \ifx\@tempb r\else\g@addto@macro\@EQ@bformat{\hfil}\fi% \@EQ@parsea} \def\@EQ@ALIGN#1#2{\expandafter\@EQ@parse#1\end\let\\\@EQ@CR% $$\abovedisplayskip=\@EQ@surround\belowdisplayskip=\@EQ@surround% #2\bgroup\@EQ@bformat\tabskip\@centering\crcr} \def\end@EQ@ALIGN{\crcr\egroup\egroup\@EQ@NUM$$\global\@ignoretrue} % \def\@EQ@A@ALIGN#1{% \expandafter\@EQ@parse#1\end\let\\\@EQ@NL% $$\abovedisplayskip=\@EQ@surround\belowdisplayskip=\@EQ@surround% \@EQ@bformat\tabskip\@centering&\tabskip\z@skip\hb@xt@\z@{\hss##}\crcr} \def\end@EQ@A@ALIGN{&\@EQ@NUM\crcr\egroup$$\global\@ignoretrue} \def\@EQ@NUMBER{\let\label\@EQ@warning@label\global\let\if@EQ@numbering\@EQ@alleqnum% \gdef\@currentlabel{\p@equation\theequation}\addtocounter{equation}{\@ne}} \def\end@EQ@NUMBER{\addtocounter{equation}{\m@ne}} \def\@EQ@NO@NUMBER{\let\label\@EQ@warning@nolabel\let\eqlabel\@EQ@warning@nolabel} %%%%%%%%%%%%%%%%%%%%% EQS %%%%%%%%%%%%%%%%%%%%%%%%%% \def\EQS{\@ifnextchar[\@EQ@EQS{\@EQ@EQS[rl]}} \def\@EQ@EQS[#1]{\@EQ@NUMBER\@EQ@ALIGN{#1}\vcenter} \def\endEQS{\end@EQ@ALIGN\end@EQ@NUMBER} \@namedef{EQS*}{\@ifnextchar[\@EQ@EQSS{\@EQ@EQSS[rl]}} \def\@EQ@EQSS[#1]{\@EQ@NO@NUMBER\@EQ@ALIGN{#1}\vcenter} \@namedef{endEQS*}{\end@EQ@ALIGN} %%%%%%%%%%%%%%%%%%%%% EQA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\EQA{\@ifnextchar[\@EQ@EQA{\@EQ@EQA[rcl]}} \def\@EQ@EQA[#1]{\@EQ@NUMBER\@EQ@A@ALIGN{#1}} \def\endEQA{\end@EQ@A@ALIGN\end@EQ@NUMBER} %%%%%%%%%%%%%%%%%%%%% EQS %%%%%%%%%%%%%%%%%%%%%%%%%% \def\EQ{\@EQ@NUMBER\@EQ@ALIGN{c}\vbox} \let\endEQ\endEQS \@namedef{EQ*}{\@EQ@NO@NUMBER\@EQ@ALIGN{c}\vbox} \@namedef{endEQ*}{\end@EQ@ALIGN} \endinput