I just found out about the bytefield
package and read the documentation to customize the default layout a bit.
I followed the documentation to make sure the baselines of all fields match:
\newcommand{\baselinealign}[1]{% \centering \small \raisebox{0pt}[\bitboxmaxheight][0pt]{#1}% }
I want background colors for some fields so I copied the code for
\colorbitbox
from the documentation.\newcommand{\colorbitbox}[3]{% \rlap{\bitbox{#2}{\color{#1}\rule{\width}{\height}}}% \bitbox{#2}{#3} }
However, combining them both, prints the colored background too high.
\newlength{\bitboxmaxheight}
\setlength{\bitboxmaxheight}{\heightof{W}}
\newcommand{\baselinealign}[1]{%
\centering
\small
\raisebox{0pt}[\bitboxmaxheight][0pt]{#1}%
}
\newcommand{\colorbitbox}[3]{%
\rlap{\bitbox{#2}{\color{#1}\rule{\width}{\height}}}%
\bitbox{#2}{#3}
}
\begin{bytefield}[boxformatting={\baselinealign}]{32}
\bitheader{0,3,4,7,8,15,16,31} \\
\bitbox{4}{Version} & \bitbox{4}{Type} & \colorbitbox{lightgray}{8}{Unused} & \bitbox{16}{Checksum} \\
\bitbox{32}{Group Address}
\end{bytefield}
How can I solve this issue?