6

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:

\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.

  • 2
    I think it would be helpful to create and add here a minimal working example (MWE) that illustrates your problem. – Mensch Oct 22 '12 at 22:26
  • That worked. getting the right width will be a matter of fine tuning. Please post this as the answer and I will accept it. Thanks again. – boffin Oct 23 '12 at 15:38
7

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.