tags:

views:

90

answers:

2

Hello,

This may be dumb or obvious, but I am learning to make sty files and I have been modifying some code from the beamerposter project. Anyway, I have this:

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

Obviously the \parbox command is commented out, but I want it to start there and end in the end block. In effect, I want this:

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

But naturally, this doesn't work because the compiler gets confused and thinks the \endpostercolumn section is closing. Is there some obvious way to get around that?

Thank you.

+2  A: 

You can try \bgroup and \egroup instead of { and }. Not sure however.

\bgroup is \let to {, so it's an implicit {. Thus it should not be considered as extra grouping command until getting to TeX's "stomach". The same about \egroup.


Edit: I tried it with the \parbox, it seems to be not working correctly (because \parbox seems to expand tokens too early). With \vtop it works:

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

Seems that this is what you need.


Edit: of course, you would need \hsize\textwidth instead of \hsize.5\textwidth

Vlad
A: 

Instead of using \parbox, you can use the minipage environment:

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

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

The minipage environment has the same options as the \parbox command:

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

where pos is one of c, t, or b (for center, top, and bottom, respectively); height is the desired height of the box, inner-pos is one of c, t, b, or s (for center, top, bottom, and stretch, respectively); and width is the desired width of the box.

If you choose s for the inner-pos value, the text be stretched to fill the vertical space in the box (extra space will be added between paragraphs). If you choose not to specify inner-pos, it will be set to the same as pos.

I haven't tested this with your code, but it should work. (I've used it when defining new environments before.)

godbyk