5

Is there something special that needs to be done to overwrite a binary prefix using the siunitx package? Overriding the SI prefixes is no problem. The MWE with \sisetup{binary-units=true} yields:

enter image description here

but with \sisetup{binary-units=false} I obtain:

enter image description here

Note that I was able to easily redefine \kilo, but am unable to redefine \bit:

Reference:

MWE:

\documentclass{article}
\usepackage{siunitx}
\usepackage{xcolor}

%% https://tex.stackexchange.com/questions/88848/how-do-i-typeset-units-like-mb-gb-megabytes-gigabytes \sisetup{binary-units=true}%

\DeclareSIUnit\bit{\textcolor{red}{bit}}% \DeclareSIUnit\kilo{\textcolor{red}{k}}%

\begin{document} \si{\bit} \si{\kilo} \end{document}

Peter Grill
  • 223,288

1 Answers1

7

As the units here are optionally loaded, and as there is a need to allow compatibility with v1, the actual loading is done at the start of the document. Thus you need

\documentclass{article}
\usepackage{siunitx}
\usepackage{xcolor}


\sisetup{binary-units=true}%  
\AtBeginDocument{
  \DeclareSIUnit\bit{\textcolor{red}{bit}}%
  \DeclareSIUnit\kilo{\textcolor{red}{k}}%
}
\begin{document}
    \si{\bit}
    \si{\kilo}
\end{document}
Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036