Eplain also provides for one level of substructure for equations. That is, you might want to define a related group of equations with numbers like `2.1' and `2.2', and then be able to refer to the group as a whole: "... in the system of equations (2)...".
The commands to do this are \eqsubdef
and
\eqsubdefn
.
They take one label argument like their counterparts above,
and generally behave in the same way. The difference is in how they
construct the equation number: instead of using just \eqnumber
,
they also use another counter, \subeqnumber
.
This counter is advanced by one at every \eqsubdef
or
\eqsubdefn
, and reset to zero at every \eqdef
or
\eqdefn
.
You use \eqref
to refer to subequations as well as main
equations.
To put the two together to construct the text that the label will
produce, they use a macro \eqsubreftext
.
This macros takes two arguments, the "main" equation number (which,
because the equation label can be defined as arbitrary text, as
described in the previous section, might be anything at all) and the
"sub" equation number (which is always just a number). Eplain's
default definition just puts a period between them:
\def\eqsubreftext#1#2{#1.#2}%
You can redefine \eqsubreftext
to print however you
like. For example, this definition makes the labels print as `2a',
`2b', and so on.
\newcount\subref \def\eqsubreftext#1#2{% \subref = #2 % The space stops a <number>. \advance\subref by 96 % `a' is character code 97. #1\char\subref }
Sadly, we must define a new count register, \subref
,
instead of using the scratch count register \count255
, because
`#1' might include other macro calls which use \count255
.