[texhax] framing a newenvironment?

Anna Medvedovsky medved at gmail.com
Tue May 17 18:10:13 CEST 2005


Hello -- 

I'm trying to define an environment that will put a frame around its
contents, which may be more than one paragraph long -- something not
unlike a graybox in a book.

I can do this manually, by putting the contents inside a minipage and
using \frame:

\frame{
     \begin{minipage}{4in}
          This is my text. This is more text.

          Some more text in a box.
     \end{minipage}
}


But I have trouble defining a new environment -- I suspect because the
\frame{...} command has to be broken up. For example, this crashes
("You can't use \hrule here except with leaders."):

\newenvironment{textinbox}
     {\frame{ \begin{minipage}{4in}}
     {\end{minipage}}}

...

\begin{textinbox}
     This is my text. This is more text.

     Some more text in a box.
\end{textinbox}


I've tried using \begin{frame} ... \end{frame} in the environment
definition instead of \frame{...} to get around this issue, but no go
("Missing \encsname inserted.").

This is such a simple problem that there must be a solution! What
could it be?! I'm inexperienced with boxes; perhaps there's another
command I should use? Perhaps I need to draw the box manually? Perhaps
I should use a table environment?

Any advice would be much appreciated. Thanks!



More information about the texhax mailing list