Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

3 Answers

up vote 6 down vote accepted

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}

screenshot

\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}
your symbol here
\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} 
share|improve this answer
add comment

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]
\node{your symbol};
\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]

enter image description here

share|improve this answer
add comment

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} 

enter image description here

share|improve this answer
    
+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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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