# siunitx - distinguish unit with prefix and without

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?

• Just a friendly reminder, we usually don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. (See Welcome to TeX.SX! for more awesome info.) Jun 24, 2013 at 19:45
• If it's not mentioned in the manual (I haven't read it), then it isn't so provided. The best way to find out is to skim through it (Ctrl/Cmd+F is your friend ;)). I don't think it is, but this behaviour can probably be tacked on. Jun 24, 2013 at 19:46
• Units are symbols, not abbreviations. If you don't want the symbol, spell out the name: “10~bytes”. Jun 24, 2013 at 20:19

\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}


## Suggestion:

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

The second case you mention:

if used with prefix, e.g. \kilo\byte, I would like to get "kB"

Is the default behavior with siunitx, so you shouldn't worry about it. E.g.

\SI{1}{\kilo\byte}


For the first one:

if used without prefix it should be written as "Byte" in the text

I would suggest you define your own macro named \mybyte at your preamble. E.g.

\newcommand{mybyte}{Byte}


So when you want to have the prefix, just type:

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


or alternatively:

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


Code example:

\documentclass{article}

\usepackage{siunitx}

\newcommand{\mybyte}{Byte}

\begin{document}

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

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

\end{document}


Result:

• Wouldn't it be better to define \mybyte as a proper unit using \declareSIUnit, instead of using \newcommand?
– Jake
Jun 24, 2013 at 20:18
• @Jake Could be, but I don't know if when using \SI{1}{\kilo\byte} would work Jun 24, 2013 at 20:20
• Since Byte is not an abbreviation, the space between 1 and Byte should be a normal text space, not a thin space. Jun 25, 2013 at 9:02