1

I created two bytefields with the package bytefield.

enter image description here

The code I used is the following:

\begin{bytefield}[endianness=little,bitwidth=0.077777\linewidth]{12}
\bitheader{0-11} \\
\bitbox{1}{82} & \bitbox{1}{70} &
\bitbox{1}{70} & \bitbox{1}{7} &
\bitbox{1}{23} & \bitbox{1}{34} &
\bitbox{1}{97} & \bitbox{1}{29} &
\bitbox{1}{16} & \bitbox{1}{44} &
\bitbox{1}{70} & \bitbox{1}{83}
\end{bytefield}

\begin{bytefield}[endianness=little,bitwidth=0.077777\linewidth]{6}
\bitbox{1}{82} & \bitbox{1}{70} &
\bitbox{1}{70} & \bitbox{1}{7} &
\bitbox{1}{23} & \bitbox{1}{34} & 
\end{bytefield}
\bigskip

The problem I have is that I would like to indent the lower bytefield by one field, that is, instead of aligning the lower bytefield with the fields 0-5 I would like to align it with 1-6. At the end of the bytefield I would like to add an arrow that points to the right side in order to indicate that the bytefield is moved from the left to the right. I guess the question is how to move two or more bytefields in relation to each other from left to right an vice versa.

P.S.:

Comment: The values at the second bytefield and the picture I uploaded do not match. That is because I changed the values in the meantime.

2 Answers2

1

You can make an empty bitbox with no borders.

\documentclass{article}
\usepackage{bytefield}

\begin{document}

\begin{bytefield}[endianness=little,bitwidth=0.077777\linewidth]{12}
\bitheader{0-11} \\
\bitbox{1}{82} & \bitbox{1}{70} &
\bitbox{1}{70} & \bitbox{1}{7} &
\bitbox{1}{23} & \bitbox{1}{34} &
\bitbox{1}{97} & \bitbox{1}{29} &
\bitbox{1}{16} & \bitbox{1}{44} &
\bitbox{1}{70} & \bitbox{1}{83} \\
\bitbox[]{1}{} & \bitbox{1}{82} & \bitbox{1}{70} &
\bitbox{1}{70} & \bitbox{1}{7} &
\bitbox{1}{23} & \bitbox{1}{34} &
\bitbox[]{1}{\makebox[0pt][l]{\makebox[6em]{\rightarrowfill}}}
\end{bytefield}

\end{document}

enter image description here

egreg
  • 1,121,712
0

Why don't you use TikZ for that?

\documentclass[tikz]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix[
    matrix of math nodes,
    row sep=-\pgflinewidth,
    column sep=-\pgflinewidth,
    nodes={draw,minimum width=1cm},
    row 1/.style={draw opacity=0,font=\tiny}% Can't figure out why draw=none doesn't work
] (m) {%
    0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11\\
    82 & 70 & 70 & 7 & 23 & 34 & 97 & 29 & 16 & 44 & 70 & 83\\
    & 10 & 20 & 30 & 40 & 50 & 60\\};
\draw[red,-stealth,thick] (m-3-7) -- ++ (4,0);
\end{tikzpicture}
\end{document}

enter image description here

You also have many other tools to do so (tables, etc.) but IMHO TikZ is the easiest option (it is also helpful when you try to add any kind of arrows).