tikz add tag
J...S
I am trying to make a figure like this with tikz:

![picd.png](/image?hash=7d9e238184414f4440a55b0b9800c5b35b2b2aaa5ebca888a2d0b31cfe4fb65c)

So I did this:

```
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}

\begin{tikzpicture}[
       ->-/.style = {decoration={markings,
                                 mark=at position 0.5 with {\arrow{>}}},
                     postaction={decorate}}
  ]
  \node at (0,0) (inp) {(a, b, c)};
  \node[right of=inp, xshift=1cm] (inp-split) {};
  \node[right of=inp-split, xshift=3mm,
        draw, fill=gray!20, rectangle,
        minimum width=15mm, minimum height=2cm] (f) {\textbf{f}};
  \node[right of=f, xshift=0.5cm] (out-join) {};
  \node[right of=out-join, xshift=1cm,
        inner sep=0pt] (out) {(x, y)};

  \fill (inp-split) circle[radius=1pt];
  \fill (out-join) circle[radius=1pt];
  %
  \draw[->-] (inp) -- (inp-split);
  \draw[->] (out-join) -- (out);
  \draw[->] (inp-split) |- (f.140);
  \draw[->] (inp-split) |- (f.220);
  \draw[->] (inp-split) -- (f.west);
  %
  \draw[->] (f.30) -| (out-join);
  \draw[->] (f.330) -| (out-join);
\end{tikzpicture}
\end{document}
```

This gives this picture:

![pic.png](/image?hash=0a8cc926ead65a0465488d4fb75b8965127f6643b915d040c0c81c5fd26146d7)

I had meant for the arrows go through the 'dots' used to denote the merging and splitting of arrow. Without there being a break.

Also, I wanted the labels and `a`, `b`, etc above some of the arrows.
Along with the arrow head being in the middle of the arrow instead of being at the end.

Any tips as to how this may be achieved?
Thanks.
Top Answer
Qrr
This really feels very close to a circuit – and I'm sure `circuitikz` has a way to provide a rectangular shape with multiple inputs and outputs without having to misuse a built-in element – but in case you want a plain-ish TikZ solution, I'll add one with my tools, i.e. the ones from my [`tikz-ext` package](https://ctan.org/pkg/tikz-ext) – so much for *plain*.

Here, I'm using `ext.paths.ortho` and its `ext/horizontal vertical horizontal` key for the `-|-` path operation and `ext.arrows-plus` for adding arrow tips along path operation. Since you don't have any curved lines the `ext/arrow` pic is enough.

For a rectangle with multiple, evenly spaced inputs and output anchors, I'm using  a slight alteration to the `\pgfDeclareGenericAnchorsLinear` macro from [an answer on the other site](https://tex.stackexchange.com/a/247894/16595). There's also a [similar, less automatic version available](https://tex.stackexchange.com/a/691974/16595).

Basically, with
```
define linear anchors={north west}{south west}{3}{west}{funcHalfPadding}
```
three generic anchors
 * `west 1/3`,
 * `west 2/3` and
 * `west 3/3`
are defined that are placed according to the PGFMath function `funcHalfPadding` between a shape's `north west` and `south east` anchors.

Generic means that these are always available for every node and every shape (at least in the scope where this key/macro is used – which is the whole document in this case).

---

Both the `Triangle` arrow tip as well as the `Circle` are placed as arrow tips, the default settings makes it so that they are centered-ish along the line and not placed with their tip at the center which visually looks too offset. Technically, you don't need to use arrow tips here, you could just place a node, say `node[circle, fill]{}` for the circle, or a custom pic along a path. Unfortunately, the [manual's example](https://tikz.dev/tikz-pics) is a seagull which isn't very inspiring.

You could just draw your triangle yourself:
```
\tikzset{
  triangle/.pic={
    \draw[pic actions] (-5mm,-5mm) -- (5mm,0pt) -- (-5mm,5mm) -- cycle;}}
```

and wouldn't be constrained to the available arrow tips.

There can also be made an argument for the circle to be a node that is used to connect if it is a vertex in the graph sense and not just a annotation to the connection like the triangles. (This solution also draws the parts of the connections and some annotations twice or thrice which can be avoided by using the circular node as a vertex.)

---

If you find yourself, often needing to use these arrow tips on the `-|-` paths then you might want to define every
```
\tikzset{
  ->->-/.style={->-=very near start, ->-=very near end},
  ->---/.style={->-=very near start},
  --->-/.style={->-=very near end},
  -o--/.style={-o-=near start},
  --o-/.style={-o-=near end}
}
```

for all variations of these connections.

## Code
```
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows.meta, ext.arrows-plus, ext.paths.ortho, positioning, quotes}
\makeatletter % https://tex.stackexchange.com/a/247894/16595
\newcommand*\pgfDeclareGenericAnchorsLinear[5]{% #1 = anchor 1, #2 = anchor 2, #3 = max number (1 ... #3), #4 = name, #5 = function name
  \pgfmathloop
    \csname pgfmath#5@\endcsname{\pgfmathcounter}{#3}%
    \edef\pgf@temp{\noexpand\pgfdeclaregenericanchor{#4\space \pgfmathcounter/#3}{\noexpand\pgfpointlineattime{+\pgfmathresult}{\noexpand\pgf@sh@reanchor{########1}{#1}}{\noexpand\pgf@sh@reanchor{########1}{#2}}}}%
    \pgf@temp
    \ifnum\pgfmathcounter<#3\relax
  \repeatpgfmathloop}
\makeatother
\pgfset{
  define linear anchors/.code n args=5{\pgfDeclareGenericAnchorsLinear{#1}{#2}{#3}{#4}{#5}},
  declare function={funcNormalPadding(\i,\n)=\i/(\n+1); funcHalfPadding(\i,\n)=(\i-.5)/(\n);}}
\tikzset{
  define linear anchors={north west}{south west}{3}{west}{funcHalfPadding},
  define linear anchors={north east}{south east}{2}{east}{funcHalfPadding}}

\tikzset{
  ->-/.style={edge node={pic[#1]{ext/arrow=>     }}},
  -o-/.style={edge node={pic[#1]{ext/arrow=Circle}}}}
\begin{document}
\begin{tikzpicture}[>=Triangle, node distance=2cm]
\node                                                            (abc) {$(a, b, c)$};
\node[right=of abc, minimum width=2cm, minimum height=3cm, draw] (f)   {$\mathbf{f}$};
\node[right=of f]                                                (xy)  {$(x, y)$};

\path[ext/horizontal vertical horizontal] % -|-
  (abc) foreach[count=\i] \abc in {a, b, c}{
    edge[
      ->-=very near start,
      ->-=very near end,
      -o-=near start,
      "$\abc$" very near end] (f.west \i/3)
  }
  foreach[count=\i] \xy in {x, y}{
    (f.east \i/2) edge[
      ->,
      ->-=very near start,
      -o-=near end,
      "$\xy$" very near start] (xy)
  }
;
\end{tikzpicture}
\end{document}
```

## Output
![top8113-1.png](/image?hash=30fce73596cb52d7d6f1989e3d9d24c11cd291a9d308d4bf186eddb0a6ab6506)
Answer #2
Skillmon
I'd use `circuitikz` for this drawing, it already comes with easy to place arrows in the middle of a path (`short,i>=label`), easy to place line joins (`-*` or `*-`).

```
\documentclass{article}
\usepackage{circuitikz}

\begin{document}

\begin{tikzpicture}
  \node at (0,0) (inp) {(a, b, c)};
  \coordinate[right of=inp, xshift=1cm] (inp-split);
  \node[right of=inp-split, xshift=3mm,
        draw, fill=gray!20, rectangle,
        minimum width=15mm, minimum height=2cm] (f) {\textbf{f}};
  \coordinate[right of=f, xshift=0.5cm] (out-join);
  \node[right of=out-join, xshift=1cm] (out) {(x, y)};

  \draw (inp.east) to[short,i>=\relax,-*] (inp-split);
  \draw (out-join) to[short,*-]node[currarrow,pos=1]{} (out);
  \draw (inp-split) -- (inp-split|-f.140) to[short,i>=a] (f.140);
  \draw (inp-split) -- (inp-split|-f.220) to[short,i>=c] (f.220);
  \draw (inp-split) to[short,i>=b] (f.west);
  %
  \draw (f.30) to[short,i>=\relax] (f.30-|out-join) -- (out-join);
  \draw (f.330) to[short,i>=y] (f.330-|out-join) -- (out-join);
\end{tikzpicture}
\end{document}
```

![foo.png](/image?hash=b78c58ccb82126a899cf1568e3ff37e63136ed58d501dce01ee09232c15bd428)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.