3

这可能是愚蠢或明显的,但我正在学习制作 sty 文件,并且我一直在修改 beamerposter 项目中的一些代码。无论如何,我有这个:

\def\postercolumn#1
{\begin{column}{#1\textwidth}
      \begin{beamercolorbox}[center,wd=\textwidth]{postercolumn}
        \begin{minipage}[T]{.95\textwidth}
            %\parbox[t][\columnheight]{\textwidth}
}

\def\endpostercolumn
{
        \end{minipage}
      \end{beamercolorbox}
    \end{column}
}

显然 \parbox 命令已被注释掉,但我希望它从那里开始并在 end 块中结束。实际上,我想要这个:

\def\postercolumn#1
{\begin{column}{#1\textwidth}
      \begin{beamercolorbox}[center,wd=\textwidth]{postercolumn}
        \begin{minipage}[T]{.95\textwidth}
            \parbox[t][\columnheight]{\textwidth}{
}

\def\endpostercolumn
{
        }
        \end{minipage}
      \end{beamercolorbox}
    \end{column}
}

但很自然,这不起作用,因为编译器感到困惑并认为 \endpostercolumn 部分正在关闭。有什么明显的方法可以解决这个问题吗?

谢谢你。

4

2 回答 2

2

您可以尝试\bgroupand\egroup代替{and }。不过不确定。

\bgroup\letto {,所以它是一个隐含 {的。因此,在到达 TeX 的“胃”之前,不应将其视为额外的分组命令。关于\egroup.


编辑:我尝试使用\parbox,它似乎无法正常工作(因为\parbox似乎过早地扩展令牌)。使用\vtop它:

\documentclass{minimal}

\newlength\columnheight \columnheight=5cm % needed to define \columnheight,
                                          % don't have it here

\def\postercolumn{
    \leavevmode
    \vtop to \columnheight\bgroup
    \hsize.5\textwidth
    \noindent
    \ignorespaces
}

\def\endpostercolumn{
    \egroup
}


\begin{document}

\begin{postercolumn}
   hello world hello world hello world hello world
   hello world hello world hello world hello world
\end{postercolumn}

\end{document}

似乎这就是你所需要的。


编辑:当然,你需要\hsize\textwidth而不是\hsize.5\textwidth

于 2010-02-28T01:09:04.760 回答
0

\parbox您可以使用minipage环境而不是 using :

\begin{minipage}[t]{\textwidth}
  % ...
\end{minipage}

% If you want to explicitly define the height:
\begin{minipage}[t][\columnheight]{\textwidth}
  % ...
\end{minipage}

minipage环境具有与命令相同的选项\parbox

\begin{minipage}[pos][height][inner-pos]{width}
  % ... text ...
\end{minipage}

其中posctb(分别代表中心、顶部和底部)之一;height是盒子的期望高度,inner-posctbs(分别代表中心、顶部、底部和拉伸)之一;并且width是框的所需宽度。

如果您选择sinner-pos值,则文本将被拉伸以填充框中的垂直空间(段落之间将添加额外的空间)。如果您选择不指定inner-pos,它将被设置为与 相同pos

我没有用你的代码测试过这个,但它应该可以工作。(我之前在定义新环境时使用过它。)

于 2010-03-01T13:59:20.513 回答