[Tex/LaTex] how to write 1st 2nd 3rd … in siunitx

siunitx

The title says it all 😉

I would like to be able to something like

\SI[certain-number]{18}{\winner}

or something like that

and get
“18'th winner'' in return

Edit: added use case scenarios

I Think I should explain why one would want to do this, so I've added this section to my question.

If one would like to explain either placements or events in time (a different sort of placement i guess) it is nice to have the ordered number together with the unit. here are some examples:

First from Mico's answer:

“They watched in exitement, as the teacher turned up the current and after passing the 22nd A mark on the dial the circuit began to smoke.''

Or:

“In a 22 km run after the 15th km line a lot of runners gave up''

I don't know for sure if these examples works in English, but they do in my native tongue, so i thought it weird that siunitx did not support it.

thanks for the answers.

Best Answer

(A comment up front: I must confess that I have no idea what "18th A" or "220th V" -- where "A" and "V" stand for ampere and volt, naturally -- is supposed to mean.)

You could achieve your objective by (a) loading both the fmtcount and siunitx packages and (b) defining a dedicated macro as follows:

\newcommand{\ordunit}[2]{\ordinalnum{#1}\,\si{#2}}

Then, in the body of the text, write \ordunit{18}{\ampere} or \ordunit{220}{\volt}.

A full MWE:

\documentclass{article}
\usepackage{fmtcount,siunitx}
\newcommand{\ordunit}[2]{\ordinalnum{#1}\,\si{#2}}
\begin{document}
\ordunit{18}{\ampere}, \ordunit{220}{\volt}, \ordunit{21}{loser}
\end{document}