ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Adam Lindsay <atl@comp.lancs.ac.uk>
Subject: Re: th nd and rd
Date: Wed, 04 Jan 2006 17:31:59 +0000	[thread overview]
Message-ID: <43BC068F.7010700@comp.lancs.ac.uk> (raw)
In-Reply-To: <200601031834.05632.john@wexfordpress.com>

John R. Culleton wrote:
> On Friday 30 December 2005 04:35 pm, Mojca Miklavec wrote:
> 
>>\def\enordinalnumber#1%
>>  {#1\ifnum\lasttwodigits{#1}=11
>>     \highordinalstr{th}%
>>   \else\ifcase\lastdigit{#1}%
>>     \highordinalstr{th}%
>>   \or % 1
>>     \highordinalstr{st}%
>>   \or % 2
>>     \highordinalstr{nd}%
>>   \or % 3
>>     \highordinalstr{rd}%
>>   \else
>>     \highordinalstr{th}%
>>   \fi\fi}
>>
>>And use it as:
>>
>>\enordinalnumber{1}
>>\enordinalnumber{2}
>>\enordinalnumber{3}
>>\enordinalnumber{4}
>>\enordinalnumber{5}
>>\enordinalnumber{100}
>>...
> 
> 
> It is stored now as part of my "standard macro pack" for Context.
> Thanks to all. 

As I was just reminded by a British Telecom website (which confirmed 
that I was moving on the "13rd"), I'm used to two more exceptions 
(suggested as a patch):

\def\enordinaldaynumber#1%
   {#1\ifnum\lasttwodigits{#1}=11
      \highordinalstr{th}%
    \else\ifnum\lasttwodigits{#1}=12
      \highordinalstr{th}%
    \else\ifnum\lasttwodigits{#1}=13
      \highordinalstr{th}%
    \else\ifcase\lastdigit{#1}%
      \highordinalstr{th}%
    \or % 1
      \highordinalstr{st}%
    \or % 2
      \highordinalstr{nd}%
    \or % 3
      \highordinalstr{rd}%
    \else
      \highordinalstr{th}%
    \fi\fi\fi\fi}


-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Adam T. Lindsay, Computing Dept.     atl@comp.lancs.ac.uk
  Lancaster University, InfoLab21        +44(0)1524/510.514
  Lancaster, LA1 4WA, UK             Fax:+44(0)1524/510.492
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  reply	other threads:[~2006-01-04 17:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-29 22:56 John R. Culleton
2005-12-30  0:52 ` Aditya Mahajan
2005-12-30  3:09 ` Idris Samawi Hamid
2006-01-02  8:55   ` Hans Hagen
2005-12-30 21:35 ` Mojca Miklavec
2006-01-02  9:53   ` Hans Hagen
2006-01-03 23:34   ` John R. Culleton
2006-01-04 17:31     ` Adam Lindsay [this message]
2006-01-04 18:16       ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43BC068F.7010700@comp.lancs.ac.uk \
    --to=atl@comp.lancs.ac.uk \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).