[Tex/LaTex] Bytefield – width of a single bit


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

enter image description here
The code for the posted screenshot is here:

    \bitheader{31,24,23,16,15,8,7,0} \\
    \begin{rightwordgroup}{Network Header}
      \wordbox{1}{Destination} \\
      \wordbox{1}{Source} \\
    \end{rightwordgroup} \\
      \wordbox[lrt]{2}{$N$ data words} \\
      \skippedwords \\
    \end{rightwordgroup} \\
  \caption{\label{fig:mwe_packet}Sample packet}

    \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} \\    
  \caption{\label{fig:mwe_cmd}Cmd word}

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 a bitwidth 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-tune bitwidth to suit your needs.

Related Question