[Tex/LaTex] Two Pspictures beside each other

positioningpstricks

I'm trying to put two pspictures beside each other. I also checked the same question and tried the answer about defining two columns, but it didn't work and LaTeX considered those as undefined environments. I suppose that was because the answer which suggested columns was provided for the beamer class. What should I do to have these two beside each other ?

\documentclass{book}
\usepackage{caption}
\usepackage{pstricks,pst-plot}
\usepackage{pst-bezier}
\usepackage{pst-math}

\begin{document}

\begin{columns}
\begin{column}{0.45\textwidth}
\psset{xunit=0.5cm,yunit=0.5cm}
\centering%
\begin{pspicture}(4,4)
\psaxes[labels=none]{->}(0,0)(4,4)[$x$,0][$y$,90]
\end{pspicture}
\captionof{figure}{simple}
\end{column}
\begin{column}{0.45\textwidth}
\begin{pspicture}(4,4)
\psaxes[labels=none]{->}(0,0)(4,4)[$x$,0][$y$,90]
\end{pspicture}
\captionof{figure}{compund}
\end{column}
\end{columns}

\end{document}

Best Answer

As mentioned in the comments, you could use two minipages here. Note that each time you \end{minipage} you should put a % to avoid an extra piece of space being put in- this means that you can split the page in half exactly, and not have any overfull hboxes. Try removing them to see the difference.

screenshot

\documentclass{article}

\usepackage{pstricks}
\usepackage{pst-plot}
\usepackage{caption}

\begin{document}
\psset{xunit=0.5cm,yunit=0.5cm}

\begin{minipage}{.5\textwidth}
 \centering
 \begin{pspicture}(4,4)
 \psaxes[labels=none]{->}(0,0)(4,4)[$x$,0][$y$,0]
 \end{pspicture}
 \captionof{figure}{simple}
\end{minipage}%
\begin{minipage}{.5\textwidth}
 \centering
 \begin{pspicture}(4,4)
 \psaxes[labels=none]{->}(0,0)(4,4)[$x$,0][$y$,0]
 \end{pspicture}
 \captionof{figure}{compound}
\end{minipage}%

\end{document}

It's probably worth noting that some folks might recommend putting this in a floating figure environment. If you do so, then you don't need to use captionof{figure}{simple} and can simply use caption{simple} instead.