TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
up vote 5 down vote accepted

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.