9

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.

3
  • 1
    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. Commented Mar 3, 2013 at 1:15
  • Thanks, just using \texttt is actually not that bad, looks ok. Commented Mar 3, 2013 at 10:27
  • 1
    I'd choose \mathtt, so not to risk the font comes out italic in an italic context. Commented Mar 6, 2013 at 11:41

1 Answer 1

9

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

2
  • 2
    Actually, I would like some alternative to this, in which the the digits look more like usual math numbers. Commented Jul 6, 2017 at 14:07
  • @einpoklum try \mathrm Commented Nov 27, 2017 at 10:26

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.