[Tex/LaTex] siunitx – distinguish unit with prefix and without

siunitx

I would like to distinguish two cases when using the unit \byte:

  1. if used without prefix it should be written as "Byte" in the text
  2. if used with prefix, e.g. \kilo\byte, I would like to get "kB"

Do I need to declare different units for use with/without prefix or can this
be handled by the package?

Best Answer

\documentclass[preview,border=12pt,varwidth]{standalone}
\usepackage[binary-units]{siunitx}
\DeclareSIUnit\mybyte{Byte}

\begin{document}

One thousand bytes is \SI{1}{\kibi\byte}

One byte is \SI{1}{\mybyte}

\end{document}

enter image description here

Suggestion:

  • Use byte instead of Byte when the unit is not abbreviated.