0

I searched to find a simple way of drawing something like the figure below using tikz, but I couldn't find. Can someone help me with this?

enter image description here

1 Answer 1

1

All one has to do is too search within this site...

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings,arrows.meta}
\begin{document}
\begin{tikzpicture}
% from https://tex.stackexchange.com/questions/276565/positioning-arrowheads-at-beginning-and-end-of-double-line-in-tikz
\node[draw, minimum width=2cm, minimum height=1cm] at (0,0) (A) {A}; 
\node[draw, minimum width=2cm, minimum height=1cm] at (4,0) (C) {C}; 
\draw[double distance=15, thick,
        postaction={decorate, decoration={markings, mark=at position 0 with {\arrow[xshift=5mm]{Straight Barb[reversed,length=2pt 0.7]}}}},
        postaction={decorate, decoration={markings, mark=at position 1 with {\arrow[xshift=7mm]{Straight Barb[length=2pt 0.7]}}}}
    ] ([xshift=1em] A.east) -- node {B} ([xshift=-1em] C.west);
\end{tikzpicture}
\end{document}

enter image description here

Or

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\begin{document}
\begin{tikzpicture}
% from https://tex.stackexchange.com/questions/276565/positioning-arrowheads-at-beginning-and-end-of-double-line-in-tikz
\node[draw, minimum width=2cm, minimum height=1cm] at (0,0) (A) {A}; 
\node[draw, minimum width=2cm, minimum height=1cm] at (6,0) (C) {C}; 
\node[double arrow,draw, text width=3.2cm,align=center] at (3,0) (B) {B};
\end{tikzpicture}
\end{document}

enter image description here

4
  • Thanks, is there anyway for removing the vertical lines of box around B? They make the figure a little bit ugly.
    – m0_as
    Commented Nov 24, 2017 at 1:37
  • I found the solution to my question at the link you provided within your code. Thanks a lot!
    – m0_as
    Commented Nov 24, 2017 at 1:40
  • And what if we want to only have -> on one side of the arrow? I mean instead of <-->, we want -->. How can we do that?
    – m0_as
    Commented Nov 24, 2017 at 8:54
  • @m0_as use arrownode defined here
    – user121799
    Commented Nov 24, 2017 at 15:14

You must log in to answer this question.

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