This question is a direct follow-up to the question Can a \newcommand Definition Contain Braces as Substitution Text? I asked yesterday.
The following example is once again a counter-intuitive one, to demonstrate what I wish to achieve. I'm trying to split the parbox syntax across the begin code and end code of a newenvironment. Using begingroup and endgroup does not seem to work here, and is producing an error.
\newenvironment{mybox}{\parbox{10cm}\begingroup}{\endgroup}
Is this possible in LaTeX?
Just to elaborate a bit on my specific need, I need a lot of centered, framed boxes to highlight some "warnings" and "best practices". For this, I thought of the following environment:
\newenvironment{mybox}[2]%
{%
\begingroup \centering \fbox \begingroup \parbox{10cm} \begingroup #1 \hspace{5pt}
{\large \textbf{\textsf{#2}}} \hfill \\
}%
{%
\endgroup \endgroup \\ \endgroup \vspace{5pt} %
}
One of the arguments is for switching between the texts "Warning" and "Best Practices", and the other one is to provide a special symbol for each type (like a star or as shadowed box)
\begin{minipage}{10cm}and\end{minipage}– egreg Jun 19 '13 at 17:44parboxinside anfbox, and further, needed to center the framed box using{\centering .... \\}. – Chatterjee Jun 19 '13 at 17:48lrbox; please state more clearly the real problem, because your simplification was too, well, simple. ;-) – egreg Jun 19 '13 at 17:51mdframedpackage. – egreg Jun 19 '13 at 18:10