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}
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}
|improve this answer|||||

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.