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

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

  • Thanks, is there anyway for removing the vertical lines of box around B? They make the figure a little bit ugly. – m0_as Nov 24 '17 at 1:37
  • I found the solution to my question at the link you provided within your code. Thanks a lot! – m0_as Nov 24 '17 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 Nov 24 '17 at 8:54
  • @m0_as use arrownode defined here – marmot Nov 24 '17 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.