# [texhax] Braces

Matthew Leingang leingang at math.harvard.edu
Sun Mar 2 21:40:11 CET 2008

On Mar 2, 2008, at 8:53 AM, Mark Bonnici wrote:

>
> Thanks for your reply but what if I need something like this
>
> \newenvironment{mybox}{%
>   \textbf {% \textbf opening brace
> }%
> { }% \textbf closing brace
> }
>
> \begin{mybox}
> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
> eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
> ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
> aliquip ex ea commodo consequat.
> \end{mybox}
>
> The text will not be in bold. Now, I know that I can use \bfseries
> instead of \textbf but I need a solution for any command which does
> not have a corresponding environment.
>
> Thanks.
>
>> -----Original Message-----
>> From: Lars Madsen [mailto:daleif at imf.au.dk]
>>
>> your question has already been answered on comp.text.tex, the
>> environment equivalent to \parbox is the minipage environment
>>
>> /daleif

Hi,

You can use \bgroup and \egroup instead:

\documentclass{article}
\newenvironment{myboldbox}{%
\begin{minipage}{5cm}\textbf\bgroup}{%
\egroup\end{minipage}}
\begin{document}
\begin{myboldbox}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
\end{myboldbox}
\end{document}

You would only have to do this if the command you wanted to use had
no declaration alternative, like \bfseries for \textbf.

HTH,
Matt

--
Matthew Leingang
Preceptor in Mathematics
Harvard University

http://www.math.harvard.edu/~leingang/vCard.vcf