Currently I am using the following code to achieve my Example environment, but I can't figure out how to center it. I have searched this forum, but haven't found any solutions, so any help would be appreciated.
Code: Select all
%create the lrbox with a yellow background to hold the example
\definecolor{PWY}{rgb}{1.00,1.00,0.80}
\makeatletter\newenvironment{pwybox}[1]
{
\begin{lrbox}{\@tempboxa}
\begin{minipage}{#1}
}
{
\end{minipage}
\end{lrbox}
\colorbox{PWY}{\usebox{\@tempboxa} }
}
\makeatother
%create the new style for examples
\newtheoremstyle{myex}{\topsep}{\topsep}%
{}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{ :: }% Punctuation after thm head
{0in}% Space after thm head (\newline = linebreak)
{\underline{\thmname{#1}\thmnumber{ #2}}\thmnote{ #3}}% Thm head spec
\theoremstyle{myex}
\newtheorem{myex}{Example}[section]
%create the final command for starting and ending an example
\newcommand{\bex}[1][\bexlength]{\begin{pwybox}{#1}\begin{myex}}
\newcommand{\eex}{\end{myex}\end{pwybox}}