diff options
Diffstat (limited to 'Master/texmf-dist/source/eplain/base/test/eqref.tex')
-rw-r--r-- | Master/texmf-dist/source/eplain/base/test/eqref.tex | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/eplain/base/test/eqref.tex b/Master/texmf-dist/source/eplain/base/test/eqref.tex new file mode 100644 index 00000000000..8f0d4f8bb59 --- /dev/null +++ b/Master/texmf-dist/source/eplain/base/test/eqref.tex @@ -0,0 +1,141 @@ +% This file is public domain. +% +% Test symbolic equation references. +% +\ifx\eplain\undefined \input eplain \fi + +\loggingall +\leftdisplays + +An equation with a number in its name: +$$ a+b=1\eqdef{line1}$$ +\line{did we mess up plain's line in equation \eqref{line1}?\hfil} + +\bye + +The first equation: +$$x + y = 1 \eqdef{first}$$ + +In equation \eqref{first}, we said that $x+y=1$. +Now, in equation \eqref{second}, we say that $a+b=2$. + +$$a + b = 2 \eqdef{second}$$ + +The next equation is unlabeled in the output, but we can still refer to +it. +$$c + d = 3 \eqdefn{*}$$ + +And here's an equation whose text references another equation, namely, +\eqref{first}: +$$c=3\eqdef[\eqrefn{first}*]{first-star}$$ +And a reference to it: \eqref{first-star}. + +Here is the first of a group of equations: \eqdefn{group} +$$a = 1\eqsubdef{group-1}$$ +and the invisible second, then the third of the group \eqsubdefn{group-invis}: +$$b = 2\eqsubdef{group-2}$$ +We refer to the group as \eqref{group}, to the first as +\eqref{group-1}, the third as \eqref{group-2}, and the invisible second +as \eqref{group-invis}. + +Here's an equation labeled strangely: +$$a=1\eqdef[\rm strange*]{foo}$$ +And let's refer to \eqref{foo}. + +Let's do subequations off that: +$$b=2\eqsubdef{foo-1}$$ +And refer to it: \eqref{foo-1}. + +% We can't use \count255, since #1 might involve contortions which +% trample it. +\newcount\subrefcount +\def\eqsubreftext#1#2{% + \subrefcount = #2 + \advance\subrefcount by 96 + #1\char\subrefcount +} + +Let's try another group, with a different labelling scheme. Here is the +first of this group2: \eqdefn{group2} +$$a = 1\eqsubdef{group2-1}$$ +and the second of the group2 \eqsubdefn{group2-invis}: +$$b = 2\eqsubdef{group2-2}$$ +We refer to the group2 as \eqref{group2}, to the first as +\eqref{group2-1}, the third as \eqref{group2-2}, and the invisible second +as \eqref{group2-invis}. + +Here is one done with displaylines: +% The \hfill's and \llap make the equation numbers come out in the right +% place if we are not doing \leftdisplays. (See the TeXbook, p.194.) +%$$\displaylines{ +% \hfill x=1\hfill\llap{\eqdef{displayline-1}}\cr +% \hfill y=2\hfill\llap{\eqdef{displayline-2}}\cr +%}$$ +$$\displaylines{ + x=1\eqdef{displayline-1}\cr + y=2\eqdef{displayline-2}\cr +}$$ + +Let's refer to each of the equations in the displaylines: +\eqref{displayline-1}, \eqref{displayline-2}. + +And one with eqalignno: +$$ +\eqalignno{ + a+b&=c&\eqdef{eqalign-1}\cr + d+e&=f&\eqdef{eqalign-2}\cr +} +$$ + +And one with leqalignno, and indented more: +{\leftdisplayindent = 1in +$$\leqalignno{ + a+b &=c&\eqdef{leqalign-1}\cr + dt+eg&=f&\eqdef{leqalign-2}\cr +}$$ +} + +And now let's refer to those: \eqref{eqalign-1}, \eqref{eqalign-2}, +\eqref{leqalign-1}, \eqref{leqalign-2}. + + + +\def\eqprint#1{[\rm A.#1]} + +From now on, all equation labels should be in brackets and preceded +by `A.'. In \eqref{*}, we said that $c+d=3$. And in equation +\eqref{undefined}, we say that $1+1=2$. + +\eqdefn{*x} +\eqdefn{*y} + +We defined equation \eqref{*y}, although we didn't give an equation for +it. +This is a forward reference to equation \eqref{forward}. + +$$e + f = 4 \eqdef{forward}$$ + +That equation above defines \eqref{forward}. + + +\newcount\sectionnum \sectionnum = 1 +\def\eqconstruct#1{\the\sectionnum.#1} + +And now equation numbers should have a section number (which we start at +one) preceding them. + +$$a+b=1 \eqdef{s-ab}$$ + +That equation is \eqref{s-ab}. The one we'll define in the next section +is \eqref{s-cd}. + + +\advance\sectionnum by 1 +The equation in the previous section was \eqref{s-ab}. Let's define one +in this section: + +$$c+d=3 \eqdef{s-cd}$$ + +And refer to it: \eqref{s-cd}. + +\bye |