3

I want to join two shapes in TikZ, like in the example below. As it can be seen, I use an arrow and a rectangle to create an arrow with "two inputs". I did not find a simple way to achieve this in LaTeX using predefined shapes, is there any? The black color in below image is simply for visualisation, I would like to have a white fill and a black outline.

I am looking for something like the following pseudo code:

\node (a) [arrow, draw] at (0,0);
\node (r) [rectangle, draw] at (0,0);
\join {a,r};

enter image description here

3
  • 2
    Welcome! This won't be easy. Does it need to be a node shape (i.e. something that fits around text) or do you just want to have a symbol of a straight arrow with an outline? It might be easier to draw this manually. What is your usecase? Commented Jun 10, 2023 at 14:09
  • What IS easy is to point non-white fills over each other. E.g. set color and fill color to something else than white.
    – MS-SPO
    Commented Jun 10, 2023 at 14:32
  • You could use separate draws and fills, altough putting the fill after the draw will erase half of the line width. Commented Jun 11, 2023 at 16:16

1 Answer 1

10

Here is a manual approach that finds the intersection between the paths of two nodes and then draws the outline again by removing the overlapping parts.

Code

\documentclass[tikz]{standalone}
\usetikzlibrary{intersections, shapes.arrows, spath3}
\begin{document}
\begin{tikzpicture}
\node [rectangle,    minimum height=1cm,   above] [spath/save global=rect] (a)  {};
\node [single arrow, minimum height=1.5cm]        [spath/save global=arro] (r)  {};
\tikzset{spath/.cd,
  split at intersections={rect}{arro},
  remove components={rect}{2},
  remove components={arro}{1},
}
\draw[thick, spath/.cd, use=rect, use={arro, weld}, adjust and close=current];
\end{tikzpicture}
\end{document}

Output

enter image description here

2
  • 1
    Great as always +1
    – MS-SPO
    Commented Jun 10, 2023 at 14:32
  • I was just thinking, that looks like a good fit for spath3! Commented Jun 10, 2023 at 22:25

You must log in to answer this question.

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