# Beamer, \column, pspicture: is this a bug, what am I doing wrong?

Here are my two examples, both don't render correctly: the position of the text relative to the pspicture is wrong in both versions. [Edit:] More precisely, the text and the picture are supposed to have their top edges aligned, but they are not. [Edit:] The preceding sentence from the original is wrong, see the answer for explanation. The error grows bigger in a non-minimized example.

This is a minimized example, in my actual use case this causes me big trouble (been banging head against wall for 2+hours):

Compiling with pdflatex --shell-escape

Example1:

\documentclass{beamer}
\usepackage {auto-pst-pdf}
\begin{document}
\begin{frame}[t]
\begin{columns}[t]
\column{0.25\textwidth}%try inserting a blank line immediately after this comment
\begin{pspicture}(-1.2,-1.2)(1.2,1.2)%
\psline(-1.2,0)(1.2,0)
\psline(0,-1.2)(0,1.2)
\end{pspicture}
\column{0.75\textwidth}
$1+1=2$
\end{columns}
\end{frame}
\end{document}


Example2: (same as above, only one extra line has been added):

\documentclass{beamer}
\usepackage {auto-pst-pdf}
\begin{document}
\begin{frame}[t]
\begin{columns}[t]
\column{0.25\textwidth}%try inserting a blank line immediately after this comment

\begin{pspicture}(-1.2,-1.2)(1.2,1.2)%
\psline(-1.2,0)(1.2,0)
\psline(0,-1.2)(0,1.2)
\end{pspicture}
\column{0.75\textwidth}
$1+1=2$
\end{columns}
\end{frame}
\end{document}


The end results in the order Example1, Example2 are attached. What is going on?

Example1:

Example2:

• Try with \begin{columns}[T]. – Paul Gaborit Aug 9 '15 at 7:46
• Works like a charm, many thanks! Out of curiosity, what is going on? – Todor Milev Aug 9 '15 at 7:51
• @PaulGaborit Please make that an answer [with explanation :-)] – Joseph Wright Aug 9 '15 at 7:53

It is not a bug.

You may use \begin{columns}[T] instead of \begin{columns}[t].

T is similar to the t option, but T aligns the tops of the first lines while t aligns the so-called baselines of the first lines. (p.125, beameruserguide)

\documentclass{beamer}
\usepackage {auto-pst-pdf}
\begin{document}
\begin{frame}[t]
\begin{columns}[T]
\column{0.25\textwidth}%try inserting a blank line immediately after this comment
\begin{pspicture}(-1.2,-1.2)(1.2,1.2)%
\psline(-1.2,0)(1.2,0)
\psline(0,-1.2)(0,1.2)
\end{pspicture}
\column{0.75\textwidth}
$1+1=2$
\end{columns}
\end{frame}
\end{document}

• Perhaps note also that this applies to all boxes, not just pspicture (I'd use a \rule to show this). – Joseph Wright Aug 9 '15 at 8:41
• You are right, It is not a PSTricks problem! – user2478 Aug 9 '15 at 8:49

The pspicture environment is a TeX box on the current baseline. In your example the box is 2.4cm wide and 2.4cm high. It's internal origin (on PostScript level) is 1.2cm from the left and 1.2cm from the bottom of the TeX box. Compare:

\documentclass{beamer}
\usepackage{pstricks,calc}
\usepackage{auto-pst-pdf}
\begin{document}
\begin{frame}[t,allowframebreaks]
\fboxsep=0pt
\begin{columns}[t]
\column{0.25\textwidth}
\fbox{\begin{pspicture}(-1.2,-1.2)(1.2,1.2)
\psline{->}(-1.2,0)(1.2,0)
\psline{->}(0,-1.2)(0,1.2)
\end{pspicture}}
\column{0.75\textwidth}
$1+1=2$
\end{columns}

\begin{columns}[t]
\column{0.25\textwidth}
\fbox{\begin{pspicture}[shift=*](-1.2,-1.2)(1.2,1.2)
\psline{->}(-1.2,0)(1.2,0)
\psline{->}(0,-1.2)(0,1.2)
\end{pspicture}}
\column{0.75\textwidth}
$1+1=2$
\end{columns}

\setbox1=\hbox{1}
\begin{columns}[t]
\column{0.25\textwidth}
\fbox{\begin{pspicture}[shift=\dimexpr-2.4cm+\ht1](-1.2,-1.2)(1.2,1.2)
\psline{->}(-1.2,0)(1.2,0)
\psline{->}(0,-1.2)(0,1.2)
\end{pspicture}}
\column{0.75\textwidth}
$1+1=2$
\end{columns}

\framebreak
\begin{columns}[T]
\column{0.25\textwidth}
\fbox{\begin{pspicture}[shift=-2.4cm](-1.2,-1.2)(1.2,1.2)
\psline{->}(-1.2,0)(1.2,0)
\psline{->}(0,-1.2)(0,1.2)
\end{pspicture}}
\column{0.75\textwidth}
$1+1=2$
\end{columns}
\end{frame}
\end{document}