[Tex/LaTex] how to put two pictures side by side

formattingtikz-pgftikz-trees

I try to put the two pictures side by side using the following code, however, the size of the two pictures are very small like the picture.

enter image description here

However, the picture looks like if I don't put them together.
enter image description here

I don't know why.

\usepackage[latin1]{inputenc}
\usetikzlibrary{trees}
\usepackage{verbatim}

\begin{figure}[htbp]
\begin{minipage}{0.5\linewidth}
\centering
\resizebox{.6\textwidth}{!}{
\tikzset{level 1/.style={level distance=0.7cm, sibling distance=4.5cm}}
\tikzset{level 2/.style={level distance=0.7cm, sibling distance=5cm}}

\tikzset{bag/.style={text width=20em, text centered,yshift=-0.2cm}}
\begin{tikzpicture}[grow=down, -stealth,  edge from parent/.style={draw,decorate,decoration={snake, post=lineto, post length=3mm}}]
{\node[bag]{$S_0{:}(A{<}a{=1}{>}B,G_{t_{i_1}},0)$}
    child{ edge from parent node[right=0.1cm]{$$}; \node[bag]{$S_{n-1}{:}(stop_{good},t_{i_1}{\geq}2,0)$}
    }
    child{edge from parent node{$\times$}; \node[bag]{$S_n{:}(stop_{good},t_{i_3}{\geq}3,0)$}
    };
}
\end{tikzpicture}}
\caption{A Circle}
\label{fig:circle}
\end{minipage}%
\begin{minipage}{0.5\linewidth}
\centering
\resizebox{.6\textwidth}{!}{
\tikzset{level 1/.style={level distance=0.7cm, sibling distance=4.5cm}}
\tikzset{level 2/.style={level distance=0.7cm, sibling distance=5cm}}

\tikzset{bag/.style={text width=20em, text centered,yshift=-0.2cm}}
\begin{tikzpicture}[grow=down, -stealth,  edge from parent/.style={draw,decorate,decoration={snake, post=lineto, post length=3mm}}]
{\node[bag]{$S_0{:}(A{<}a{=1}{>}B,G_{t_{i_1}},0)$}
    child{ edge from parent node[right=0.1cm]{$$}; \node[bag]{$S_{n-1}{:}(stop_{good},t_{i_1}{\geq}2,0)$}
    }
    child{edge from parent node{$\times$}; \node[bag]{$S_n{:}(stop_{good},t_{i_3}{\geq}3,0)$}
    };
}
\end{tikzpicture}}
\caption{A Rectangle}
\label{fig:rectangle}
\end{minipage}
\end{figure}

Best Answer

You've resized the images with \resizebox. Part of the reason they're so small, is that within a minipage, \textwidth is set to the width of the minipage. Hence, when you set the width to be 0.6\textwidth within a minipage that is 0.5\linewidth, the width of the resizebox will be 0.3 of the \linewidth for the whole page.

In addition, because you've set the text width of the bag nodes to 20em, there is some whitespace on the sides of each tree, and the size of the \resizebox includes this whitespace.

Also, please include full examples, including all packages and libraries. Makes it easier for trying to help, not having to figure out which decorations library is missing.

See if this is a little better:

\documentclass{article}
\usepackage{tikz}
\usepackage[latin1]{inputenc}
\usetikzlibrary{trees,decorations.pathmorphing}
\tikzset{bag/.style={text width=10em, text centered,yshift=-0.2cm}}

\usepackage{verbatim}
\begin{document}
\the\textwidth
\begin{figure}[htbp]
\begin{minipage}{0.5\linewidth}
\the\textwidth
\centering
\resizebox{\textwidth}{!}{
\tikzset{level 1/.style={level distance=0.7cm, sibling distance=4.5cm}}
\tikzset{level 2/.style={level distance=0.7cm, sibling distance=5cm}}


\begin{tikzpicture}[grow=down, -stealth,  edge from parent/.style={draw,decorate,decoration={snake, post=lineto, post length=3mm}}]
{\node[bag]{$S_0{:}(A{<}a{=1}{>}B,G_{t_{i_1}},0)$}
    child{ edge from parent node[right=0.1cm]{$$}; \node[bag]{$S_{n-1}{:}(stop_{good},t_{i_1}{\geq}2,0)$}
    }
    child{edge from parent node{$\times$}; \node[bag]{$S_n{:}(stop_{good},t_{i_3}{\geq}3,0)$}
    };
}
\end{tikzpicture}}
\caption{A Circle}
\label{fig:circle}
\end{minipage}%
\begin{minipage}{0.5\linewidth}
\centering
\resizebox{\textwidth}{!}{
\tikzset{level 1/.style={level distance=0.7cm, sibling distance=4.5cm}}
\tikzset{level 2/.style={level distance=0.7cm, sibling distance=5cm}}

\begin{tikzpicture}[grow=down, -stealth,  edge from parent/.style={draw,decorate,decoration={snake, post=lineto, post length=3mm}}]
{\node[bag]{$S_0{:}(A{<}a{=1}{>}B,G_{t_{i_1}},0)$}
    child{ edge from parent node[right=0.1cm]{$$}; \node[bag]{$S_{n-1}{:}(stop_{good},t_{i_1}{\geq}2,0)$}
    }
    child{edge from parent node{$\times$}; \node[bag]{$S_n{:}(stop_{good},t_{i_3}{\geq}3,0)$}
    };
}+
\end{tikzpicture}}
\caption{A Rectangle}
\label{fig:rectangle}
\end{minipage}
\end{figure}
\end{document}
Related Question