Bytefield package

I am using bytefield as in the code below

\documentclass[]{beamer}

\usepackage[T1]{fontenc}
\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}

\usepackage{bytefield}

\begin{document}

\begin{frame}[fragile]
\begin{bytefield}{32}
\bitbox{1}{s} & \bitbox{8}{\textcolor{red}{E}} & \bitbox{23}{f - mantissa}
\end{bytefield}

\end{frame}

\end{document}


I want to change the command \bitheader to show {0, 51, 52, 62, 63} using the same size as the previous picture.

-

This feature is not provided by the package bytefield as far as I could see. There is a somewhat hackish solution. It catches the time, where the bit numbers are set and formatted via \bf@bitformatting. The bit number is stored in counter header@val. The hack changes the value locally for the numbers that should be replaced.

\documentclass[]{beamer}

\usepackage[T1]{fontenc}
\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}

\usepackage{bytefield}

\begin{document}

\begin{frame}[fragile]

\begin{bytefield}{32}
\bitbox{1}{s} & \bitbox{8}{\textcolor{red}{E}}
& \bitbox{23}{f - mantissa}
\end{bytefield}

\bigskip

\begingroup
\makeatletter
\let\saved@bf@bitformatting\bf@bitformatting
\renewcommand*{\bf@bitformatting}{%
\fi\fi\fi\fi
\saved@bf@bitformatting
}%
\begin{bytefield}{32}

Indeed, Heiko, bytefield assumes "all the bits are of equal width". –  Brent.Longborough Sep 21 '12 at 16:51