Beamer,\column,pspicture:这是一个错误吗?我做错了什么?

Beamer,\column,pspicture:这是一个错误吗?我做错了什么?

这是我的两个示例,都无法正确呈现:两个版本中文本相对于图片的位置都是错误的。[编辑:] 更准确地说,文本和图片的顶部边缘应该 对齐,但事实并非如此。[编辑:] 原文中的上一句是错误的,请参阅答案以了解解释。在非最小化的示例中,错误会变得更大。

这是一个最小化的例子,在我的实际使用中,这给我带来了很大的麻烦(已经撞墙2个多小时了):

使用 pdflatex --shell-escape 进行编译

例1:

\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}

示例2:(与上面相同,仅添加了一行):

\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}

附上按照示例1、示例2的顺序排列的最终结果。发生了什么?

例1:

在此处输入图片描述

例2:

在此处输入图片描述

答案1

这不是一个错误。

您可以使用\begin{columns}[T]而不是\begin{columns}[t]

T与选项类似t,但T对齐第一行的顶部,而t对齐第一行的所谓基线。(第 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}

答案2

环境pspicture是当前基线上的 TeX 框。在您的示例中,框宽 2.4 厘米,高 2.4 厘米。它是内部的原点(在 PostScript 级别)距离 TeX 框左侧 1.2 厘米,距离底部 1.2 厘米。比较:

\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}

在此处输入图片描述

相关内容