[log in to unmask] wrote:
> Now clearly this is another border case and i think nearly nobody
> would bother to actually type \ordinal{7} in the middle of the text
> normally. However one can see applications, eg referencing list items
> using special forms of \ref, the items themselves, etc. I have seen
> requests for such functionality
This and several other issues can be summarized under
"intelligent labelling and referencing". Another example is the varioref
package for intelligent page references.
I encountered another instance when referring to sections and theorems.
Suppose I have something like
\begin{theorem}\label{x}
\end{theorem}
In Theorem~\ref{x} ...
If at some point I decide to change the theorem to a corollary, lemma,
proposition etc, the reference becomes inappropriate and has to be changed.
Same (but less important) for sections becoming chapters and vice versa.
Ideally, with each such label should be associated a type
to determine the proper wording of the reference. The type cannot be part of the
label itself, otherwise changing the type would require to change the references
throughout the whole document. It could look like this:
\newtype{th}{Theorem}
\begin{theorem}\label[th]{x}
\end{theorem}
In \reftext{x}~\ref{x} ...
\reftext would look at the type of label "x" and choose a proper word, "Theorem"
in this case.
Of course, the question is where to stop. \reftext might be different at the
beginning of a sentence (concerning case), so one should maybe include markup
for the beginning of a sentence, \uppercase'ing the first letter in general?
Gernot
