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.
> 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.
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.
> 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.
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.
> 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.
> 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.
> 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.
> 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.
> 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.
Le TeXnicien de surface <TeXnicien.de.surf...@chezmoi.invalid> writes:
> 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.
> 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.
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.