Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ordinals and cardinals spelled out from counters and references

47 views
Skip to first unread message

Peter Flynn

unread,
Feb 11, 2012, 12:16:52 PM2/11/12
to
The packages nth (Donald Arseneau) and engord (Heiko Oberdiek) handle
the formatting of LaTeX counters as ordinal numbers (1st, 2nd, 3rd,
etc). Raymond Chen's (obsolete?) inwords package* will format counters
as spelled-out cardinal numbers (forty two), but not ordinals.

However, many English-language publishers use the principle that values
up to and including 10 must be spelled in full, both for cardinal and
ordinal use; and the numbers over 10 use the digits (and for ordinals,
the ordinal suffixes). Some set the boundary at 12, not 10.

This means:

1 one first
2 two second
3 three third
4 four fourth
... ... ...
9 nine ninth
10 ten tenth
11 11 11th
12 12 12th
13 13 13th
...etc

When generating LaTeX from (eg) XML, it would be useful to be able to
represent counter values in a way that would be formatted to this kind
of requirement.

I haven't found a package that does this. If I have missed it, does
anyone have a pointer?

Otherwise, might I ask if the developers of current packages could
consider adding this as an option?

Bonus points if it also works with the refcount and calc packages :-)

Use case:

Think of a long description list with the end of the list set as
\label{finalitem} and the item you want to reference, known to be close
to the end, as \label{mine}; then

...as can be seen in the \ordinwords{\refcount{finalitem} -
\refcount{mine} + 1} item from last in the list ending on
p.\pageref{finalitem}..."

Chocolate cake for implementing a \distance function the will take any
item in a list, especially an itemized or description list, where
enumeration is not visible, and express it as the nth _or_ the
nth-from-last, according to its proximity to the start or end of the list...

///Peter

* My copy of inwords.sty has comments and code by Donald and "RmS",
implementing suggestions due to Bernd Raichle; and also quotes a c.t.t
posting from Georg Kraml in a thread "Counting in words" on Wed, 23 Jan
2002 23:43:39 +0100, with alternative code.

Peter Wilson

unread,
Feb 11, 2012, 2:03:05 PM2/11/12
to
The memoir class can spell out ordinals. It can produce either `1st' or
`first' or `First', etc., but you have to tell it which form you want.

Peter W.

Peter W.

Le TeXnicien de surface

unread,
Feb 11, 2012, 3:27:07 PM2/11/12
to
Le 11/02/2012 18:16, Peter Flynn a écrit :
> The packages nth (Donald Arseneau) and engord (Heiko Oberdiek) handle
> the formatting of LaTeX counters as ordinal numbers (1st, 2nd, 3rd,
> etc). Raymond Chen's (obsolete?) inwords package* will format counters
> as spelled-out cardinal numbers (forty two), but not ordinals.

There is also numname.sty
http://www.ctan.org/tex-archive/macros/latex/contrib/numname
which seems to do at least partially what you require.

I think I've met a package by Nicola Talbot, the name of which (the
package) escapes me at the moment, which could be of use. If ever the
aformentioned name is kind enough to pop up once more in my head, I'll
tell you.

Hih

--
Yvon Henel, TeXnicien de surface

Le TeXnicien de surface

unread,
Feb 11, 2012, 3:33:58 PM2/11/12
to

Peter Flynn

unread,
Feb 11, 2012, 3:54:22 PM2/11/12
to
On 11/02/12 19:03, Peter Wilson wrote:
> On 11/02/12 17:16, Peter Flynn wrote:
[snip]
> The memoir class can spell out ordinals. It can produce either `1st' or
> `first' or `First', etc., but you have to tell it which form you want.

Unfortunately the immediate application is to generate .dtx package and
class files, and I don't think there is an equivalent for ltxdoc in
memoir (is there?). But thank you, that's a very useful contribution.

///Peter

Peter Flynn

unread,
Feb 11, 2012, 6:46:13 PM2/11/12
to
On 11/02/12 20:27, Le TeXnicien de surface wrote:
> Le 11/02/2012 18:16, Peter Flynn a écrit :
>> The packages nth (Donald Arseneau) and engord (Heiko Oberdiek) handle
>> the formatting of LaTeX counters as ordinal numbers (1st, 2nd, 3rd,
>> etc). Raymond Chen's (obsolete?) inwords package* will format counters
>> as spelled-out cardinal numbers (forty two), but not ordinals.
>
> There is also numname.sty
> http://www.ctan.org/tex-archive/macros/latex/contrib/numname
> which seems to do at least partially what you require.

Aha!

> I think I've met a package by Nicola Talbot, the name of which (the
> package) escapes me at the moment, which could be of use. If ever the
> aformentioned name is kind enough to pop up once more in my head, I'll
> tell you.
[...]
> Found it: http://www.ctan.org/tex-archive/macros/latex/contrib/fmtcount

Thank you very much: that's just what I needed. I obviously wasn't using
search terms that occurred in the names or descriptions :-)

///Peter


Robin Fairbairns

unread,
Feb 11, 2012, 7:10:58 PM2/11/12
to
the package doc of nicola's fmtcount package describes macros
\numberstring and \ordinalstring (both come in several variants). quite
whether this helps is beyond me.

(i thought i had read that doc, but these functions either managed to
duck under my gaze, or my recollection is wrong.)
--
Robin Fairbairns, Cambridge
my address is @cl.cam.ac.uk, regardless of the header. sorry about that.
0 new messages