# Typeset a number in hexdecimal format (preferably math mode)

Is there a macro for formatting numbers in programming style 0x hex notation, e.g. instead of -1155484576 have 0xbb20b460. I would like to embed these numbers in a math mode context.

E.g. if I just type

$\langle 0xbb20b460, 0xd4d95138, 0x3d93cb7a \rangle$


the numbers aren't properly displayed.

-
Put \text{} around them (amstext or amsmath packages). Also, since the notation 0x is used in programming, perhaps you could also use a monospaced font. Use \texttt{} in this case. – JLDiaz Mar 3 '13 at 1:15
Thanks, just using \texttt is actually not that bad, looks ok. – Emit Taste Mar 3 '13 at 10:27
I'd choose \mathtt, so not to risk the font comes out italic in an italic context. – egreg Mar 6 '13 at 11:41

Ok, so using \texttt or \mathtt is fine.