TeX/number

From Wikibooks, open books for an open world
< TeX
Jump to navigation Jump to search

Synopsis[edit | edit source]

\number<number>

Description[edit | edit source]

Typeset the decimal representation of <number>, where <number> may be either an octal, decimal, or hexadecimal integer; or a register or parameter that contains an integer. Leading zeros are removed.

Examples[edit | edit source]

Recall that octals are represented by placing a ' (right quote) in front of the number, and hexadecimal are represented by placing a " (quotation mark) in front of the number, for example, '10 is the octal representation of 8, while "10 is the hexadecimal representation of 16. So

\number'10

will typeset 8, while

\number"10

will typeset 16.

The parameter \day contains the current day of the current month, unless it has been set otherwise. If today is, say, June 30th, then normally \day should contain 30, and

\number\day

will typeset 30.

This functionality of \number overlaps with the command \the.