TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to TikZ, and I'm having a terrible time figuring out how to create an image similar to this.

enter image description here

So far I am able to create all the rectangles, but there are two things I cannot figure out how to do:

  1. I'd like to replace the B symbols region with an ellipses in the center to show continuation, and
  2. Is there an elegant way to specify positioning for the labels, beyond just coordinates, so that moving around the rectangle regions moves the associated labels?
share|improve this question
You should show the code you have produced until now to provide a starting point to who can help you – Spike Oct 9 '12 at 14:49
You could have a look at the bytefield package. – Tom Bombadil Oct 9 '12 at 21:55
@TomBombadil : You may find the bytefield package isn't quite up to this level of elegance... – Brent.Longborough Oct 10 '12 at 15:39
up vote 9 down vote accepted

Here's one possibility (I wasn't sure of the desired layout for the central region):


% the styles for short and long nodes
short/.style={draw,rectangle,text height=3pt,text depth=13pt,
  text width=7pt,align=center,fill=gray!30},
long/.style={short,text width=1.5cm}


% the short nodes \shnode{<label>}{<right of>}{<text>}
  \node[short,right=of #1] (#2) {\rotatebox{270}{#3}}}

% the long nodes \lnode{<label>}{<right of>}
  \node[long,right=of #1] (#2) {}}

\noindent\begin{tikzpicture}[node distance=-\pgflinewidth]

\node[short,fill=black] (a) {};
\node[long,draw=none,fill=none,right=of f,text height=0pt,text depth=0pt,text width=1cm] (g) {$\ldots$};
\node[long,right=of g,label=center:$b$ bits] (h) {};
\node[short,fill=black,right=of l] (m) {};

\node[above right=1cm of a] (ppre) {Packet preamble};
\node[above left=1cm of m] (ppos) {Packet postamble};

\draw[decorate,decoration={brace,raise=2pt}] (b.north west) -- node[above=4pt] {Header} (d.north east);
\draw[decorate,decoration={brace,raise=2pt}] (j.north west) -- node[above=4pt] {Trailer} (l.north east);
\draw[decorate,decoration={brace,raise=2pt}] (h.north west) -- node[above=4pt] {Codeword} (h.north east);
\draw (ppre.west) -- +(-20pt,0pt) -- (a.north);
\draw (ppos.east) -- +(20pt,0pt) -- (m.north);
\draw (a.south east) -- +(0,-1.2cm);
\draw (m.south west) -- +(0,-1.2cm);
\draw[<->] ( $ (a.south east) +(0,-0.6cm) $ ) -- node[fill=white] {$S/B$ Codewords} ( $ (m.south west) +(0,-0.6cm) $ );
\draw[,dotted] (f.north east) -- (h.north west);
\draw[dotted] (f.south east) -- (h.south west);



enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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