7

It is possible to re-declare/redefine existing siunitx units in general. However, this seems to fail for the binary units \bit (and \byte) as shown in the MWE below.

Only if the declaration is done after the preamble via \AtBeginDocument the declaration works.

\documentclass{article}

\usepackage[
  binary-units,
]{siunitx}

% \AtBeginDocument{
\DeclareSIUnit\bit{b}
% }

\begin{document}

\SI{8}{\bit}

\end{document}

Why is this the case? Is this a bug? Why is \bit defined as bit in the first place while \byte is simply B? This produces rather unreadable output with IEC prefixes like Gibit.

I am using version 2.7a (2017-01-01) from TexLive 2016.

2
  • 1
    The change only works in \AtBeginDocument because siunitx itself only loads siunitx-binary.cfg \AtBeginDocument. If you declare the unit before your declaration is overwritten. Why \bit is bit is another story... Jul 23, 2019 at 22:24
  • 2
    To answer my own question regarding the bit bit: that's the official IEC/ISO unit symbol (while b was/is promoted by IEEE). @PhelypeOleinik, if you make your explanation a true answer (and maybe include your opinion on bug-worthyness and/or how siunitx could unify the behavior) I'd very much accept it...
    – stefanct
    Jul 23, 2019 at 22:32

1 Answer 1

5

The time of loading is certainly intentional. The binary-units option code (for true) is:

binary-units / true .code:n = { \AtBeginDocument { \__siunitx_load_binary: } },

which as the code suggests, does basically \AtBeginDocument{\input{siunitx-binary.cfg}} (with a little more work to have the file be loaded as a package).

It isn't clear why this is loaded \AtBeginDocument and not at the time of loading siunitx (I didn't find any hint in the source, at least). But there's this:

\changes{v2.5m}{2012/11/27}{Modified loading of \opt{binary-units}}

but it doesn't say what changed...
Only Joseph knows :-)


As for the representation of \bit, the SI brochure, which is used as reference for siunitx, doesn't say anything about digital storage units, so it's probably down to what you said:

That [bit] is the official IEC/ISO unit symbol (while b was/is promoted by IEEE)

so it's basically a matter of choice between the two. Although I think that in written text 8 bit is clearer than 8 b, the former becomes weird when combined with prefixes/other units, so it's a tough pick...

1
  • Should it be 8 bits, though? The question of the plural s is usually irrelevant because of abbreviations. 8 bit feels odd to me.
    – Tom
    Apr 15 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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