Go to the first, previous, next, last section, table of contents.

Formatting equation references

Both defining an equation label and referring to it should usually produce output. This output is produced with the \eqprint macro, which takes one argument, the equation number being defined or referred to. By default, this just produces `(number)', where number is the equation number. To produce the equation number in a different font, or with different surrounding symbols, or whatever, you can redefine \eqprint. For example, the following definition would print all equation numbers in italics. (The extra braces define a group, to keep the font change from affecting surrounding text.)

\def\eqprint#1{{\it (#1)}}

In addition to changing the formatting of equation numbers, you might to add more structure to the equation number; for example, you might want to include the chapter number, to get equation numbers like `(1.2)'. To achieve this, you redefine \eqconstruct. For example:

\def\eqconstruct#1{\the\chapternumber.#1}

(If you are keeping the chapter number in a count register named \chapternumber, naturally.)

The reason for having both \eqconstruct and \eqprint may not be immediately apparent. The difference is that \eqconstruct affects the text that cross-reference label is defined to be, while \eqprint affects only what is typeset on the page. The example just below might help.

Usually, you want equation labels to refer to equation numbers. But sometimes you might want a more complicated text. For example, you might have an equation `(1)', and then have a variation several pages later which you want to refer to as `(1*)'.

Therefore, Eplain allows you to give an optional argument (i.e., arbitrary text in square brackets) before the cross-reference label to \eqdef. Then, when you refer to the equation, that text is produced. Here's how to get the example just mentioned:

$$...\eqdef{a-eq}$$
...
$$...\eqdef[\eqrefn{a-eq}*]{a-eq-var}$$
In \eqref{a-eq-var}, we expand on \eqref{a-eq}, ...

We use \eqrefn in the cross-reference text, not \eqref, so that \eqprint is called only once.


Go to the first, previous, next, last section, table of contents.