I want to draw a bytefield. In its documentation there are two tricks, one for baseline text aligment and one for coloring a bitfield with a rule for unused fields. I wanted to put these two suggestions together. The baseline aligment works correctly, but now If I drive in a bitbox a rule with bitboxbox height and width, it has a wrong position:
How can I set correctly both basefield and line aligment?
This is the code:
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{color}
\usepackage{graphicx}
\usepackage{fourier}
\usepackage{epstopdf}
\usepackage{geometry}
\usepackage{bytefield}
%%% Colors %%%
\definecolor{niceblue}{rgb}{.047,.372,.478}
\definecolor{titlecolor}{rgb}{.749,.937,1.0}
\definecolor{reservedfield}{gray}{0.8}
%%% cigipacket environment %%%
% This environment is the bitfield one with some customization
\newlength{\wletterheight}
\setlength{\wletterheight}{\heightof{W}}
\newcommand{\baselinealign}[1]{%
\centering
\raisebox{0pt}[\wletterheight][0pt]{#1}%
}
\newenvironment{cigipacket}
{\begin{bytefield}[boxformatting=\baselinealign,endianness=big]{32}}
{\end{bytefield}}
\begin{document}
CIGI communication is based on packets. A packet is a byte stream of defined size, that can be fixed or variable according to packet type.
\begin{figure}
\centering
\begin{cigipacket}
\bitheader{0-31} \\
\bitbox{8}{Packet ID = 7}
\bitbox{8}{Packet Size = 16}
\bitbox{16}{Entity ID} \\
\bitbox{8}{Field 1}
\bitbox{8}{yyField 2}
\bitbox{1}{4}
\bitbox{1}{3}
\bitbox{3}{2}
\bitbox{3}{1}
\bitbox{8}{\color{reservedfield}\rule{\width}{\height}} \\
\bitbox{32}{DOF 1} \\
\bitbox{32}{DOF 2}
\end{cigipacket}
\caption{Packet example.}
\label{fig:packetexample}
\end{figure}
\end{document}

