2

I'm working on a custom protocol, with custom frame lengths.

I'm drawing the frames using bytefield, and I have a problem, as the length of my frame isn't a multiple of 16 (or 32).

Here's my MWE :

\documentclass[10pt,a4paper]{article}
\usepackage[table, usenames,dvips, dvipsnames]{xcolor}
\usepackage{bytefield}

\begin{document}
    \begin{bytefield}{32}
        \bitheader{0,2,4,16, 31} \\
        \bitbox{2}{12} & \bitbox{2}{\textcolor{WildStrawberry}{65}} & \bitbox[lrt]{28}{}\\
        \wordbox[lr]{1}{\textcolor{WildStrawberry}{65}-bit EC Public Key}\\
        \bitbox[lrb]{5}{} & \bitbox[lrt]{27}{}\\
        \wordbox[lr]{3}{256-bit RSA Signature} \\
        \bitbox[lrb]{5}{} & \bitbox{27}{}\\
    \end{bytefield}
\end{document}

Which produces this : MWE result

How can I force the frame to end after the 256-bit RSA Signature block ? I had to draw an empty \bitbox in order to have a closed frame...

The length of this frame is 323 bytes, so it's impossible to change the line length to have a perfect multiple.

Any ideas ?

3isenHeim
  • 2,107

1 Answers1

3

Like this?

enter image description here

Just force not drawing bottom and right sides of last bitbox: \bitbox[lt]{27}{}.

\documentclass[10pt,a4paper]{article}
\usepackage[table, usenames,dvips, dvipsnames]{xcolor}
\usepackage{bytefield}

\begin{document}
    \begin{bytefield}{32}
        \bitheader{0,2,4,16, 31} \\
        \bitbox{2}{12} & \bitbox{2}{\textcolor{WildStrawberry}{65}} & \bitbox[lrt]{28}{}\\
        \wordbox[lr]{1}{\textcolor{WildStrawberry}{65}-bit EC Public Key}\\
        \bitbox[lrb]{5}{} & \bitbox[lrt]{27}{}\\
        \wordbox[lr]{3}{256-bit RSA Signature} \\
        \bitbox[lrb]{5}{} & \bitbox[lt]{27}{}\\ %<---- change here
    \end{bytefield}
\end{document}
Ignasi
  • 136,588