[texhax] Superscript ordinal indicators in dates?

E. Krishnan ekmath at asianetindia.com
Fri Jun 5 01:42:52 CEST 2009


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


More information about the texhax mailing list