1

I want to format binary numbers by grouping them into blocks of four and adding leading zeros to fill 8, 16 or 32 bit numbers. E.g: 11001 -> 0001 1001.

I've already found the siunitx package, which makes number formatting possible, but it doesn't work as expected.

  • \num[group-four-digits=true]{00011001} gives 0001 1001(as expected)
  • \num[minimum-integer-digits=8]{11001} gives 00 001 001 (as expected)
  • \num[group-four-digits=true,minimum-integer-digits=8]{1001} gives 00 001 001 (the group-four-digits option is ignored).

How can I make siunitx use the group-four-digits switch in combination with minimum-integer-digits? Or is there a better way to format binary numbers in LaTeX? Thanks in advance.

LukeLR
  • 641
  • Which version of siunitx do you use? The reason I ask is that I'm not able to reproduce your stated results for items 1 and 3 with the most up-to-date version of the package, which is v2.6s (2016/09/02). – Mico Sep 25 '16 at 00:06
  • Separately, are you maybe laboring under a misunderstanding as to what the group-four-digits option stands for? For sure, it does not group long strings of digits into "blocks of four". If grouping is performed, it's always in blocks of three, not four. Usually, such grouping is performed only if the number contains at least 5 digits; the group-four-digits instructs siunitx to apply this grouping to 4-digit numbers as well. – Mico Sep 25 '16 at 00:06

0 Answers0