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'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}
share|improve this question
2  
As you say, columns is an environment available in beamer and not in book. Use minipage. –  egreg Feb 5 '12 at 21:34
add comment

1 Answer

up vote 6 down vote accepted

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.

share|improve this answer
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.