Drawing "bus width"-like markers with number on arrows

As percusse mentions in his comment, adding the slash can be done using a decoration (in this case, using the decorations.markings library); the number (if it's not part of the decoration) can be added in the path, using a node; something like:

\draw (<coord1>) -- node[below] {<text>} (<coord2>);

I also fixed the dashed arrows using the perpendicular coordinate system to guarantee that they are horizontal.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings}

\begin{document}

\begin{tikzpicture}[
inverter/.style={rectangle,draw,inner sep=2pt,minimum size=6mm},
dot/.style={circle,inner sep=0pt,minimum size=0.5mm,draw,fill=black},
decoration={
  markings,
  mark= at position 0.5 with {\node[font=\footnotesize] {/};}
  }
]
\node (x) at (0,0) {$x$};
\node (delta) at (1,0) [shape=rectangle,draw,minimum height=18mm,minimum width=6mm] {$\delta$};
\node (ah)  at ( 2,  0.5) [inverter] {$a_h$};
\node (al)   at ( 2, -0.5) [inverter] {$a_l$};

\draw [->] (x) -- (delta);
\draw [->,dashed,dash pattern=on 1pt off 1pt,postaction={decorate}] (delta.58.75) -- node[below=1pt] {\tiny 4} (ah.west|-delta.58.75);
\draw [->,dashed,dash pattern=on 1pt off 1pt,postaction={decorate}] (delta.-58.75) -- node[below=1pt] {\tiny 4} (al.west|-delta.-58.75);
\end{tikzpicture}

\end{document}

enter image description here

As suggested by percusse, another, perhaps better way, to use the perpendicular coordinate system to have the arrows horizontal is to use:

\draw [->,dashed,dash pattern=on 1pt off 1pt,postaction={decorate}] (delta.east|-ah) -- node[below=1pt] {\tiny 4} (ah);
\draw [->,dashed,dash pattern=on 1pt off 1pt,postaction={decorate}] (delta.east|-al) -- node[below=1pt] {\tiny 4} (al);

There is actually a \BusWidth symbol in the milstd package. How it might be used in your application could be given below. I don't know tikz, or I'd thicken up the dashed lines to match the thickness of the scaled \BusWidth.

The nice thing about the 45 degree inclination is that it can be used on vertical wires, as well. Of course, in that case, you would want to stick the bus width off to the side. Something similar was asked at Bussymbol for tikz circuit lib.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{milstd}
\usepackage{stackengine}
\newcommand\Bussymbol[1]{%
  \raisebox{-1.1em}{\scalebox{.7}{\stackunder{\BusWidth}{#1}}}%
}
\begin{document}

\begin{tikzpicture}
    [
        inverter/.style={rectangle,draw,inner sep=2pt,minimum size=6mm},
        dot/.style={circle,inner sep=0pt,minimum size=0.5mm,draw,fill=black}
    ]
    \node (x) at (0,0) {$x$};
    \node (delta) at (1,0) [shape=rectangle,draw,minimum height=18mm,minimum width=6mm] {$\delta$};

    \node(ah)     at ( 2,  0.5) [inverter] {$a_h$};
    \node(al)     at ( 2, -0.5) [inverter] {$a_l$};

    \draw [->] (x) -- (delta);

    \draw [->,dashed,dash pattern=on 1pt off 1pt] (delta.58.75) -- (ah);
    \node at ($ (ah) - (0.55, 0) $) {\Bussymbol{4}};
    \draw [->,dashed,dash pattern=on 1pt off 1pt] (delta.-58.75) -- (al);
    \node at ($ (al) - (0.55, 0) $) {\Bussymbol{4}};
\end{tikzpicture}

\end{document}

enter image description here


I happened to need this recently myself. Here is what I use:

  \newcommand{\buswidth}[4][]{\draw (#2) node [#4=.6ex,#1] {#3} +(45:-.8ex) -- +(45:.8ex)}

  % usage:  \buswidth{<coordinate>}{<label>}{<left|right>};
  % Example:
  \buswidth{p1}{$x$}{left}

It's not terribly generic, but it can be tweaked easily to your liking.