Is there a way to find the previously printed character in LaTeX? E.g:
\newcommand{\th}{%
\ifthenelse%
{\equal{\previouscharacter}{1}}%
{st}%
{th}%
}
4\th and 21\th % would like to yield "4thand 21st"
|
Is there a way to find the previously printed character in LaTeX? E.g:
|
||||
| show 1 more comment |
|
The answer, unfortunately, is no. TeX contains a few primitives that modify things before them ( In addition to the various packages which implement printing ordinal numbers, I wrote a fairly straightforward macro that does this here. |
|||||
|
|
As to the specific application in question, there's the engord package. Examples:
return 1st, 12th, and 123rd. For the specific question, I can't answer. |
|||
|
|
n\thlook better than\nth{n}? – Tim N Mar 13 '11 at 17:30n\thwould gobble any space that follows in the text, so ... probably not. ;-) – lockstep Mar 13 '11 at 17:33