\documentclass[a4paper]{article} % \usepackage{times} \usepackage[warning]{easyeqn} \let\package\texttt % so \package{foo} comes out in \tt \let\envname\textsf % so \envname{foo} comes out as \sf \newbox\tempbox \def\BOX{\setbox\tempbox\hbox\bgroup\begin{minipage}{0.9\textwidth}} \def\endBOX{\end{minipage}\egroup\par\bigskip% \begin{center}\fboxsep=10pt\fbox{\box\tempbox}\end{center}\bigskip\par} \title{The package \package{easyeqn}} \author{Enrico Bertolazzi\\\\ Laboratorio di Matematica Applicata\\ Dipartimento di Ingegneria Civile ed Ambientale\\ Universit\`a degli Studi di Trento\\ Mesiano, Trento, Italy\\\\ \texttt{bertolaz@ing.unitn.it}} \date{} \begin{document} \maketitle \begin{abstract} The package \package{easyeqn} introduces some equation environments that simplify writing of equations. It uses a syntax similar to the array environment to define the column alignment. A package option cases only those equations that were \emph{labeled and referenced} to be numbered. \end{abstract} \tableofcontents \section{Some examples with \package{easyeqn}} Load the package using the usual syntax: \begin{BOX} \begin{verbatim} \documentclass{article} . . \usepackage[allnumber,warning,fleqn,leqno]{easyeqn} . . \end{verbatim} \end{BOX} The package introduces the \envname{EQ}, \envname{EQS}~and \envname{EQA}~environments. The package options are: \begin{description} \item[allnumber] means that all of the \envname{EQ}, \envname{EQS}~and \envname{EQA}~environments are numbered. Without that option, only those \envname{EQ}, \envname{EQS}~and \envname{EQA}~environment that are \emph{labeled} and \emph{referenced} are numbered. \item[warning] causes equations that are labeled but \emph{not referenced} to be flagged. \item[fleqn] flushes equation on the left margin. \item[leqno] writes equation number on the left. \end{description} \section{Use of the \envname{EQ} environment} The following input: \begin{BOX} \begin{verbatim} \begin{EQ}\eqlabel{eq:1} \frac{x}{y} = z \end{EQ} \begin{EQ}\eqlabel{eq:2} \frac{x}{y} = z \end{EQ} I will refer only to \eqref{eq:1} or, in the old style, \refeq{eq:1}. \end{verbatim} \end{BOX} produces the following output: \begin{BOX} \begin{EQ}\eqlabel{eq:1} \frac{x}{y} = z \end{EQ} \begin{EQ}\eqlabel{eq:2} \frac{x}{y} = z \end{EQ} I will refer only to \eqref{eq:1} or, in the old style, \refeq{eq:1}. \end{BOX} Note that the command \verb+\eqlabel+ is used instead of \verb+\label+ and the reference is done by \verb+\eqref+ or \verb+\refeq+. The command \verb+\refeq+ produces the same output as \verb+\ref+, while \verb+\eqref+ uses \texttt{( )} for the output. \textbf{Remark:} Due to the algorithm, in order to obtain the right cross reference, you need to recompile the file 3~times. The use \verb+\label+ is not permitted inside \envname{EQx} environments and if you use \verb+\ref+ for referencing equations the results are unpredictable. \section{Use of \envname{EQS} environment} The following commands: \begin{BOX} \begin{verbatim} \begin{EQS}[rcll] \nabla\cdot(\rho\nabla u)&=&f \qquad &\mbox{on $\Omega$} \\ u&=&u_{0}&\mbox{on $A\subset\partial\Omega$} \\ (\rho\nabla u)\cdot n&=&u_{1} &\mbox{on $B\subset\partial\Omega$} \end{EQS} \end{verbatim} \end{BOX} produces \begin{BOX} \begin{EQS}[rcll] \nabla\cdot(\rho\nabla u)&=&f \qquad &\mbox{on $\Omega$} \\ u&=&u_{0}&\mbox{on $A\subset\partial\Omega$} \\ (\rho\nabla u)\cdot n&=&u_{1} &\mbox{on $B\subset\partial\Omega$} \end{EQS} \end{BOX} Note that between \verb+[...]+ you can specify the column alignment in the same way as in the \envname{array} or \envname{tabular} environment. The permitted alignment are \verb+l+ for left alignment, \verb+r+ for right alignment and \verb+c+ for centering. \section{The \texttt{\char`\\yesnumber} command} If you want to number an equation without reference it, use the \verb+\yesnumber+ command as this example shows: \begin{BOX} \begin{verbatim} \begin{EQ}\yesnumber \nabla\cdot(\rho\nabla u) = 0 \end{EQ} \end{verbatim} \end{BOX} produces \begin{BOX} \begin{EQ}\yesnumber \nabla\cdot(\rho\nabla u) = 0 \end{EQ} \end{BOX} \section{The \texttt{\char`\\eqlabel} command} It is possible to use custom label by \verb+\eqlabel+ command. The syntax is the following \begin{verbatim} \eqlabel`[*]'{labelname} or \eqlabel`(*)'{labelname} \end{verbatim} where \verb+`[*]'+ is an optional argument. If \verb+`[*]'+ is defined, equation displays \verb+`*'+ instead of \verb+`("equation number")'+. The equation counter is not advanced and \verb+`labelname'+ will refer to \verb+`*'+. If we use \verb+`[*]'+ the result is similar but the equation number is substituted by \verb+`(*)'+ instead of \verb+`*'+. Look at this example: \begin{BOX} \begin{verbatim} \begin{EQA}[c] \nabla\cdot(\rho\nabla u) = 0 \eqlabel(eq.1){eq:custom:a} \\ \nabla\cdot(\rho\nabla u) = 0 \eqlabel[eq.2]{eq:custom:b} \end{EQA} I will refer to \eqref{eq:custom:a} and \eqref{eq:custom:b} \end{verbatim} \end{BOX} produces \begin{BOX} \begin{EQA}[c] \nabla\cdot(\rho\nabla u) = 0 \eqlabel(eq.1){eq:custom:a} \\ \nabla\cdot(\rho\nabla u) = 0 \eqlabel[eq.2]{eq:custom:b} \end{EQA} I will refer to \eqref{eq:custom:a} and \eqref{eq:custom:b} \end{BOX} \section{Use of \envname{EQA} environment} The following commands: \begin{BOX} \begin{verbatim} \begin{EQA}[rcll] \nabla\!\cdot\!(\rho\nabla u)&=&f \qquad &\mbox{on $\Omega$} \yesnumber \\ u&=&u_{0}&\mbox{on $A\subset\partial\Omega$} \eqlabel{eq:3} \\ (\rho\nabla u)\!\cdot\!n&=&u_{1} &\mbox{on $B\subset\partial\Omega$} \eqlabel($*$){eq:4} \end{EQA} it is referenced only \eqref{eq:4}!! \end{verbatim} \end{BOX} produce \begin{BOX} \begin{EQA}[rcll] \nabla\!\cdot\!(\rho\nabla u)&=&f \qquad &\mbox{on $\Omega$} \yesnumber \\ u&=&u_{0}&\mbox{on $A\subset\partial\Omega$} \eqlabel{eq:3} \\ (\rho\nabla u)\!\cdot\!n&=&u_{1} &\mbox{on $B\subset\partial\Omega$} \eqlabel($*$){eq:4} \end{EQA} it is referenced only \eqref{eq:4}!! \end{BOX} Note that only the referenced lines or the lines with \verb+\yesnumber+ are numbered. \section{Use of \envname{fleqn} and \envname{leqno} option} You can use \envname{fleqn} to flux left the equations or \envname{leqno} to number equations on the left. If for example we have used \begin{BOX} \begin{verbatim} \documentclass{article} . . \usepackage[fleqn,leqno]{easyeqn} . . \end{verbatim} \end{BOX} the effect with this example: \begin{BOX} \begin{verbatim} \begin{EQA}[rcll] \nabla\cdot(\rho\nabla u)&=&f \qquad &\mbox{on $\Omega$}\yesnumber \\ u&=&u_{0}&\mbox{on $A\subset\partial\Omega$} \yesnumber\\ (\rho\nabla u)\!\cdot\!n&=&u_{1} &\mbox{on $B\subset\partial\Omega$} \eqlabel{eq:5} \end{EQA} it is referenced only \eqref{eq:5}!! \end{verbatim} \end{BOX} is the following \begin{BOX} \equationleft\numberleft \begin{EQA}[rcll] \nabla\cdot(\rho\nabla u)&=&f \qquad &\mbox{on $\Omega$}\yesnumber \\ u&=&u_{0}&\mbox{on $A\subset\partial\Omega$} \yesnumber\\ (\rho\nabla u)\!\cdot\!n&=&u_{1} &\mbox{on $B\subset\partial\Omega$} \eqlabel{eq:5} \end{EQA} it is referenced only \eqref{eq:5}!! \equationcenter\numberright \end{BOX} \sloppy The same effect can be obtained everywhere using the commands \verb+\equationleft+ and \verb+\numberleft+ before defining the equation. To restore the default use \verb+\equationcenter+ and \verb+\numberright+ after the equation. % \section{Cosmeting changes} It is possible to modify a little the appearance of the equations. There are three parameter that it is possible to change \begin{description} \item[left indent] When the equations are fluxed left, the left indent (default \verb+\leftmargini+) can be changed by the command \begin{verbatim} \eqleftmargin{new indent} for example \eqleftmargin{1cm} \end{verbatim} \item[equation spacing] The spacing around a formula, (default \verb+7pt+) can be changed by the command \begin{verbatim} \eqspacing{new spacing} for example \eqspacing{4pt} \end{verbatim} \item[column spacing] The spacing between column in multicolumn equations (default \verb+4pt+) can be changed by the command \begin{verbatim} \eqcolumnsep{new spacing} for example \eqcolumnsep{10pt} \end{verbatim} \item[row spacing] The spacing between rows in multiple equations (default \verb+7pt+) can be changed by the command \begin{verbatim} \eqrowsep{new spacing} for example \eqrowsep{10pt} \end{verbatim} \end{description} for example \begin{BOX} \begin{verbatim} \eqrowsep{20pt} \eqcolumnsep{10pt} \begin{EQS}[rcll] \nabla\cdot(\rho\nabla u)&=&f \qquad &\mbox{on $\Omega$} \\ u&=&u_{0}&\mbox{on $A\subset\partial\Omega$} \\ (\rho\nabla u)\cdot n&=&u_{1} &\mbox{on $B\subset\partial\Omega$} \end{EQS} \end{verbatim} \end{BOX} produces \begin{BOX} \eqrowsep{20pt} \eqcolumnsep{10pt} \begin{EQS}[rcll] \nabla\cdot(\rho\nabla u)&=&f \qquad &\mbox{on $\Omega$} \\ u&=&u_{0}&\mbox{on $A\subset\partial\Omega$} \\ (\rho\nabla u)\cdot n&=&u_{1} &\mbox{on $B\subset\partial\Omega$} \end{EQS} \end{BOX} \end{document}