I would like to create boxes with arbitrary combinations of incoming/outgoing triangles as in the following picture:

Boxes with incoming and outgoing triangles north/south/east/west

I thought about using a signal from the TikZ library shapes.symbols, but signal does not support the small incoming and outgoing triangles at the north and south of box "one". However, it has nice incoming/outgoing east/west triangles, as shown here:

Boxes with incoming and outgoing triangles east/west

The arrow box from shapes.arrows also caught my attention, but it does not support incoming triangles (as "three" shows), only outgoing ones.

My dream solution would be to use signal with incoming/outgoing east/west triangles, and to be able to specify with additional attributes when to have incoming north / outgoing south triangles. For example (inventing some syntax):

\node[signal to=east, innorth, outsouth] {one};
\node[signal from=west, signal to=east, innorth] {two};
\node[signal from=west] {three};

Is it possible to have such attributes innorth / outsouth? Or is there another nice way to obtain such boxes?

  • You can declare your own shape for that. This is a rather large effort, the more so since you need to define several parameters for keys like innorth such as the position, the length, perhaps the angles. Alternatively you could work with pics.
    – user194703
    Apr 30, 2020 at 13:18

1 Answer 1


This is a rather easy-to-code proposal, which however has the disadvantage that it overpaints stuff in white. If you only want to produce the nodes as you depict, you will be fine, if you put them on top of some nontrivial background, less so.

One can use the append after command hook to place a pic that is just an open triangle on the respective edges.

\begin{tikzpicture}[nodes={minimum width=6em,minimum height=2em},
     \fill[white]  (-1ex,\pgflinewidth) -- (-1ex,0) -- (0,-1ex) -- (1ex,0)
     -- (1ex,\pgflinewidth);
     \draw (-1.1ex,0) -- (-1ex,0) -- (0,-1ex) -- (1ex,0) -- (1.1ex,0);
    }},innorth/.style={append after command={
        ([yshift=-\pgflinewidth/2]\tikzlastnode.north west) -- 
        ([yshift=-\pgflinewidth/2]\tikzlastnode.north east)
    }},outnorth/.style={append after command={
        ([yshift=-\pgflinewidth/2]\tikzlastnode.north west) -- 
        ([yshift=-\pgflinewidth/2]\tikzlastnode.north east)
    }},insouth/.style={append after command={
        ([yshift=\pgflinewidth/2]\tikzlastnode.south west) -- 
        ([yshift=\pgflinewidth/2]\tikzlastnode.south east)
    }},outsouth/.style={append after command={
        ([yshift=\pgflinewidth/2]\tikzlastnode.south west) -- 
        ([yshift=\pgflinewidth/2]\tikzlastnode.south east)
\node[signal,signal from=west, signal to=east,draw,innorth] (one) {one};
\node[signal,signal from=west, signal to=east,draw,below=-\pgflinewidth of one,
    innorth] (two) {two};
\node[signal,signal from=west,signal to=none,right=4em of one,draw] (three) {three};
\node[signal,signal from=west, signal to=east,draw,innorth,outsouth,below=2em of two]
 (four) {four};  
\draw (one.east) -- (three.west); 

enter image description here

  • Thanks for your solution, this append after command trick is really nice! :)
    – Michael F
    May 1, 2020 at 7:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .