Is there a way to control the width of a bit in pixels on a per-diagram basis ?
I have a word in a packet with a lot of fields, my text is becoming smaller and smaller. Is there a workaround other than editing bytefield for globally larger pixel widths?
Minimum working example
The code for the posted screenshot is here:
\begin{figure*}[ht!]
\centering
\begin{bytefield}{32}
\bitheader{31,24,23,16,15,8,7,0} \\
\begin{rightwordgroup}{Network Header}
\wordbox{1}{Destination} \\
\wordbox{1}{Source} \\
\wordbox{1}{Length}
\end{rightwordgroup} \\
\begin{rightwordgroup}{Payload}
\wordbox[lrt]{2}{$N$ data words} \\
\skippedwords \\
\wordbox[lrb]{2}{}
\end{rightwordgroup} \\
\begin{rightwordgroup}{Footer}
\wordbox{1}{Checksum}
\end{rightwordgroup}
\end{bytefield}
\caption{\label{fig:mwe_packet}Sample packet}
\end{figure*}
\begin{figure*}
\centering
\begin{bytefield}{32}
\bitheader{31,24,23,16,15,8,7,0} \\
\bitbox{1}{\tiny{M\\E\\M}} & \bitbox{3}{SEL} & \bitbox{23}{} & \bitbox{4}{Mem\\Type} & \bitbox{4}{ID} \\
\end{bytefield}
\caption{\label{fig:mwe_cmd}Cmd word}
\end{figure*}
My problem is that Figure 4 text is smaller and illegible.
Figure 3 and Figure 4 have the same width. This is okay in Figure 3 where there are no minuscule writings and fonts.
What would be cool, is to have the ability to control the width of the bit on a per-figure basis. This will give better control.
Let me know if I have been successful in explaining the problem.
Best Answer
bytefield
provides abitwidth
key that you can set. The default is the width of{\tiny 99i}
. You can use something like\begin{bytefield}[bitwidth=2em]{32}
and fine-tunebitwidth
to suit your needs.