LaTex: start the command at the beginning of the environment and complete it in determining the end

It may be silly or obvious, but I am involved in creating style files and I modified the 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 final block. Essentially, 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 does not work, because the compiler gets confused and thinks that the \ endpostercolumn section is closing. Is there an obvious way around this?

Thank.

+3
source share
2 answers

You can try \bgroupand \egroupinstead of {and }. However not sure.

\bgroup - \let {, {. , , 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

+2

\parbox minipage:

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

pos c, t b ( , , ); height - , inner-pos - c, t, b s ( , , ); width - .

s inner-pos, , ( ). inner-pos, , pos.

, . ( .)

0

Source: https://habr.com/ru/post/1734726/


All Articles