# Drawing diagram in TikZ

I want to draw a scheme like the following using TikZ:

• Welcome to Tex.SX! Are you able to draw any part of it yourself? If so, which part of it is giving you problems? – Torbjørn T. Jun 15 '15 at 18:22
• Welcome, khaled hariz! This is not a "please do it for me" site so you should show some initiative yourself. – Svend Tveskæg Jun 15 '15 at 18:22
• Next time, please add a minimal example. A lot of people here love to help. But you should show some effort too. If you have read an introduction to latex and to tikz, you would be able to do some of the code. At least you could have wrote the preamble and the "begin document" and "end document". With a basics intro, you could write the formulars too. Maybe you could have wrote some of the tikz code too - at least you should have tried. Next time, please show some initiative. People here love to help, but "pls do it for me" isn't well seen ;-) – Basilius Sapientia Jun 15 '15 at 19:06

This is just to show one way of doing this with no explicit coordinates. I add both equations in the same node, and place the arrows relative to the corners of this node.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc}
\begin{document}

\begin{tikzpicture}[MyArrow/.style={-latex,shorten >= 0.1cm,shorten <=0.1cm,thick}]
\node (eq) [draw, inner sep=10pt,align=center] {$(a+b)^2=a^2+2ab+b^2$ \\[1ex]
$(a-b)^2=a^2-2ab+b^2$};

\draw [MyArrow] ($(eq.north west)!0.2!(eq.north east)$) -- ++(0,0.5) -| node[pos=0.25,fill=white,draw] {word}  ($(eq.north west)!0.8!(eq.north east)$);

\draw [MyArrow] ($(eq.south east)!0.2!(eq.south west)$) -- ++(0,-0.5) -| node[pos=0.25,fill=white,draw] {word}  ($(eq.south east)!0.8!(eq.south west)$);
\end{tikzpicture}

\end{document}


You can use this code where are used the \draw and the \path commands of the tikzpicture enviroment:

% Document
\begin{document}

\begin{tikzpicture}
% Formulas
\path (0,.25)    node{$(a+b)^2=a^2+2ab+b^2$} --
(0,-.25)   node{$(a-b)^2=a^2-2ab+b^2$} --
(-.5,1.3)  node{word}                  --
(-.5,-1.3) node{word}                 ;
% Rectangle
\draw[thick] (-2.2,-.7) rectangle (2.2,.7);
\draw[thick] (-1,.9)    rectangle (0,1.7) ;
\draw[thick] (-1,-.9)   rectangle (0,-1.7);
% Lines
\draw[thick]    (-1.5,.7)  -- (-1.5,1.3)  -- (-1,1.3) ;
\draw[thick,->] (0,1.3)    -- (1,1.3)     -- (1,.7)   ;
\draw[thick]    (-1.5,-.7) -- (-1.5,-1.3) -- (-1,-1.3);
\draw[thick,->] (0,-1.3)   -- (1,-1.3)    -- (1,-.7)  ;
\end{tikzpicture}

\end{document}


To get this diagram: