# How to put two images side by side and put some symbol in the center?

I want to put two images side by side and put a comparison symbol in between them. Here is the tikz code :

\documentclass{article}

\usepackage{tikz}

\usepackage[margin=15mm]{geometry}

\usepackage{calc}

\usetikzlibrary{matrix,arrows}

\usetikzlibrary{positioning,arrows}

\usetikzlibrary{shapes,arrows,fit,calc,positioning,automata}

\begin{document}

\begin{tikzpicture}[node distance=5cm,auto,>=latex', scale = 0.75, transform shape]

\coordinate (a1) [] {};
\node[rectangle] (a) [draw,minimum width=2cm,minimum height=1cm, below of=a1,node distance=1.5cm] { };
\node[rectangle] (b) [draw,minimum width=2cm,minimum height=1cm, below of=a,node distance=2cm] { };
\coordinate[below=1cm of b] (b1)  {};
\path[->] (a)  edge node {{$\gamma$} } (b);
\path[->] (a1) edge node {{$\alpha.\beta$} } (a);
\path[->] (b)  edge node {{$\delta$} } (b1);
\end{tikzpicture}

\begin{tikzpicture}[node distance=5cm,auto,>=latex', scale = 0.75, transform shape]
\coordinate (a1) [] {};
\node[rectangle] (a) [draw,minimum width=4cm,minimum height=1cm, below of=a1,node distance=1.5cm] {};
\coordinate[below=1cm of a] (b1)  {};

\path[->] (a1) edge node {  $\alpha.\beta$ } (a);
\path[->] (a) edge node {  $\delta$ } (b1);
\end{tikzpicture}

\end{document}


I want to put these to images side by side with an equality symbol in between them. How do I do that?

-
I suggest you to draw everything inside the same picture. Then you can use a horizontal virtual line to balance you draw and put something in the middle. But I guess that there are other better options using some library to draw chains. – Sigur Oct 1 '12 at 15:31

You can use minipage to do this; adjust the widths given in the following as you see fit.

Note that each \end{minipage} has a trailing % to prevent it from adding extra horizontal space. If this picture is going to be put in a figure environment, use \centering instead of \begin{center}...\end{center}

\documentclass{article}

\usepackage[margin=15mm]{geometry}
\usepackage{tikz}

\usetikzlibrary{arrows,positioning}

\begin{document}

\begin{center}
\begin{minipage}{.2\textwidth}
\begin{tikzpicture}[node distance=5cm,auto,>=latex', scale = 0.75, transform shape]
\coordinate (a1) [] {};
\node[rectangle] (a) [draw,minimum width=2cm,minimum height=1cm, below of=a1,node distance=1.5cm] { };
\node[rectangle] (b) [draw,minimum width=2cm,minimum height=1cm, below of=a,node distance=2cm] { };
\coordinate[below=1cm of b] (b1)  {};
\path[->] (a)  edge node {{$\gamma$} } (b);
\path[->] (a1) edge node {{$\alpha.\beta$} } (a);
\path[->] (b)  edge node {{$\delta$} } (b1);
\end{tikzpicture}
\end{minipage}%
\begin{minipage}{.2\textwidth}
\end{minipage}%
\begin{minipage}{.2\textwidth}
\begin{tikzpicture}[node distance=5cm,auto,>=latex', scale = 0.75, transform shape]
\coordinate (a1) [] {};
\node[rectangle] (a) [draw,minimum width=4cm,minimum height=1cm, below of=a1,node distance=1.5cm] {};
\coordinate[below=1cm of a] (b1)  {};

\path[->] (a1) edge node {  $\alpha.\beta$ } (a);
\path[->] (a) edge node {  $\delta$ } (b1);
\end{tikzpicture}
\end{minipage}%
\end{center}

\end{document}

-

As Sigur suggested, it's better to place both part inside the same tikzpicture. One possibility would be to use scopes. You can apply shiftings and special styles to every scope. In next code, once I've placed both diagrams it's easy to place the symbol between them. In this case I had to change second picture node's names.

\documentclass[border=3mm,tikz]{standalone}

\usetikzlibrary{matrix,arrows}

\usetikzlibrary{positioning,arrows}

\usetikzlibrary{shapes,arrows,fit,calc,positioning,automata}

\begin{document}

\begin{tikzpicture}[node distance=5cm,auto,>=latex', scale = 0.75, transform shape]

\coordinate (a1) [] {};
\node[rectangle] (a) [draw,minimum width=2cm,minimum height=1cm, below of=a1,node distance=1.5cm] { };
\node[rectangle] (b) [draw,minimum width=2cm,minimum height=1cm, below of=a,node distance=2cm] { };
\coordinate[below=1cm of b] (b1)  {};
\path[->] (a)  edge node {{$\gamma$} } (b);
\path[->] (a1) edge node {{$\alpha.\beta$} } (a);
\path[->] (b)  edge node {{$\delta$} } (b1);
%\end{tikzpicture}

%      \begin{tikzpicture}[node distance=5cm,auto,>=latex', scale = 0.75, transform shape]
\begin{scope}[xshift=5cm]
\coordinate (a1) [] {};
\node[rectangle] (a2) [draw,minimum width=4cm,minimum height=1cm, below of=a1,node distance=1.5cm] {};
\coordinate[below=1cm of a2] (b1)  {};

\path[->] (a1) edge node {  $\alpha.\beta$ } (a2);
\path[->] (a2) edge node {  $\delta$ } (b1);
\end{scope}
\path (a) -- node {$=$} (a2);
\end{tikzpicture}

\end{document}


-
+1: But I seem to require \usepackage{tikz}. – Peter Grill Oct 1 '12 at 17:59
@PeterGrill: standalone class already loads it with tikz option. – Ignasi Oct 2 '12 at 6:47
I seemed to have needed it on my PC version for some reason (perhaps the installation is corrupted), but seems to work fine as is on my Mac with TeXLive2012. – Peter Grill Oct 2 '12 at 7:40

another soluce with tikz

\documentclass{article}

\usepackage[margin=15mm]{geometry}
\usepackage{tikz}

\usetikzlibrary{arrows,positioning}

\begin{document}

\begin{center}
\hfill
\tikz[anchor=center,baseline] \node{
\begin{tikzpicture}[node distance=5cm,auto,>=latex', scale = 0.75, transform shape]
\coordinate (a1) [] {};
\node[rectangle] (a) [draw,minimum width=2cm,minimum height=1cm, below of=a1,node distance=1.5cm] { };
\node[rectangle] (b) [draw,minimum width=2cm,minimum height=1cm, below of=a,node distance=2cm] { };
\coordinate[below=1cm of b] (b1)  {};
\path[->] (a)  edge node {{$\gamma$} } (b);
\path[->] (a1) edge node {{$\alpha.\beta$} } (a);
\path[->] (b)  edge node {{$\delta$} } (b1);
\end{tikzpicture}%
};\hfill
\begin{tikzpicture}[shift={(0.33\textwidth,0)},anchor=center,baseline]
\end{tikzpicture}\hfill
\tikz[,anchor=center,baseline] \node{
\begin{tikzpicture}[shift={(0.66\textwidth,0)},node distance=5cm,auto,>=latex', scale = 0.75, transform shape,anchor=base,baseline]
\coordinate (a1) [] {};
\node[rectangle] (a) [draw,minimum width=4cm,minimum height=1cm, below of=a1,node distance=1.5cm] {};
\coordinate[below=1cm of a] (b1)  {};

\path[->] (a1) edge node {  $\alpha.\beta$ } (a);
\path[->] (a) edge node {  $\delta$ } (b1);

\end{tikzpicture}%
};
\hfill ~
\end{center}

\end{document}


the two figures are embedded in a \tikz \node with the option [anchor=center,baseline]

-