[texhax] Superscript ordinal indicators in dates?

Yannis Haralambous yannis.haralambous at telecom-bretagne.eu
Fri Jun 5 09:31:48 CEST 2009


I would suggest not to use \hbox but \text instead (using the amstext  
package), so that you get the right font in the right size everywhere:

\def\mydate{\ifcase\day\or
   1$^{\text{st}}$\or 2$^{\text{nd}}$\or 3$^{\text{rd}}$\or
   4$^{\text{th}}$\or 5$^{\text{th}}$\or 6$^{\text{th}}$\or
   7$^{\text{th}}$\or 8$^{\text{th}}$\or 9$^{\text{th}}$\or
   10$^{\text{th}}$\or 11$^{\text{th}}$\or 12$^{\text{th}}$\or
   13$^{\text{th}}$\or 14$^{\text{th}}$\or 15$^{\text{th}}$\or
   16$^{\text{th}}$\or 17$^{\text{th}}$\or 18$^{\text{th}}$\or
   19$^{\text{th}}$\or 20$^{\text{th}}$\or 21$^{\text{st}}$\or
   22$^{\text{nd}}$\or 23$^{\text{rd}}$\or 24$^{\text{th}}$\or
   25$^{\text{th}}$\or 26$^{\text{th}}$\or 27$^{\text{th}}$\or
   28$^{\text{th}}$\or 29th$^{\text{\or}}$ 30$^{\text{th}}$\or
   31$^{\text{st}}$\fi~\ifcase\month\or
   January\or February\or March\or April\or May\or June\or
   July\or August\or September\or October\or November\or
   December\fi,\space \number\year}

Le 5 juin 09 à 01:42, E. Krishnan a écrit :

> On Thu, 4 Jun 2009, Joel C. Salomon wrote:
>
>> How can I get the date in my LaTeX article to display the ordinal
>> indicator in superscript?  E.g., July 4<sup>th</sup>, 1776
>> ...............................
>> I'd like to know how to get the effect automatically.
>
> Please try
>
> \def\mydate{\ifcase\day\or
>   1$^{\hbox{st}}$\or 2$^{\hbox{nd}}$\or 3$^{\hbox{rd}}$\or
>   4$^{\hbox{th}}$\or 5$^{\hbox{th}}$\or 6$^{\hbox{th}}$\or
>   7$^{\hbox{th}}$\or 8$^{\hbox{th}}$\or 9$^{\hbox{th}}$\or
>   10$^{\hbox{th}}$\or 11$^{\hbox{th}}$\or 12$^{\hbox{th}}$\or
>   13$^{\hbox{th}}$\or 14$^{\hbox{th}}$\or 15$^{\hbox{th}}$\or
>   16$^{\hbox{th}}$\or 17$^{\hbox{th}}$\or 18$^{\hbox{th}}$\or
>   19$^{\hbox{th}}$\or 20$^{\hbox{th}}$\or 21$^{\hbox{st}}$\or
>   22$^{\hbox{nd}}$\or 23$^{\hbox{rd}}$\or 24$^{\hbox{th}}$\or
>   25$^{\hbox{th}}$\or 26$^{\hbox{th}}$\or 27$^{\hbox{th}}$\or
>   28$^{\hbox{th}}$\or 29th$^{\hbox{\or}}$ 30$^{\hbox{th}}$\or
>   31$^{\hbox{st}}$\fi~\ifcase\month\or
>   January\or February\or March\or April\or May\or June\or
>   July\or August\or September\or October\or November\or
>   December\fi,\space \number\year}
>
>
>
>
> -- 
> Krishnan
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
>
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
>

--
+ 
-----------------------------------------------------------------------+
| Yannis Haralambous, Ph.D.      yannis.haralambous at telecom- 
bretagne.eu |
| Directeur d'Études                      http://omega.enstb.org/ 
yannis |
|                                             Tel. +33  
(0)2.29.00.14.27 |
|                                             Fax  +33  
(0)2.29.00.12.82 |
| Département  
Informatique                                              |
| Télécom  
Bretagne                                                      |
| Technopôle de Brest Iroise, CS 83818, 29238 Brest Cedex 3,  
France     |
| Coordonnées Google-Earth : 48°21'31.57"N  
4°34'16.76"W                 |
+ 
-----------------------------------------------------------------------+
                             ...pour distinguer l'extérieur d'un  
aquarium,
                                            mieux vaut n'être pas  
poisson

                            ...the ball I threw while playing in the  
park
                                           has not yet reached the  
ground

               Es gab eine Zeit, wo ich nur ungern über Schubert  
sprechen,
            nur Nächtens den Bäumen und Sternen von ihm vorerzählen  
mögen.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Yannis Haralambous.vcf
Type: text/directory
Size: 508 bytes
Desc: not available
URL: <http://tug.org/pipermail/texhax/attachments/20090605/e7e2c586/attachment.bin>
-------------- next part --------------




More information about the texhax mailing list