I'm trying to define a new environment for theorems and I'm using this code:
% Theorem box
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\tikzstyle{thmbox} = [inner sep=1em]
\tikzstyle{thmborder} = [draw=blue, fill=none,line width =1.pt, rounded corners=5pt]
\def\parchmentframe#1{
\tikz{
\node[thmbox] (A) {#1};
\begin{pgfonlayer}{background}
\fill[thmborder]
(A.south east) -- (A.south west) --
(A.north west) -- (A.north east) -- cycle;
\end{pgfonlayer}}}
\def\parchmentframetop#1{
\tikz{
\node[thmbox] (A) {#1};
\begin{pgfonlayer}{background}
\fill[thmborder]
(A.south west) -- (A.north west) --
(A.north east) -- (A.south east);
\end{pgfonlayer}}}
\def\parchmentframebottom#1{
\tikz{
\node[thmbox] (A) {#1};
\begin{pgfonlayer}{background}
\fill[thmborder]
(A.north west) -- (A.south west) --
(A.south east) -- (A.north east);
\end{pgfonlayer}}}
\def\parchmentframemiddle#1{
\tikz{
\node[thmbox] (A) {#1};
\begin{pgfonlayer}{background}
\fill[thmborder]
(A.north west) -- (A.south west);
\fill[thmborder]
(A.south east) -- (A.north east);
\end{pgfonlayer}}}
\newenvironment<>{myTheorem}{%
\def\FrameCommand{\parchmentframe}%
\def\FirstFrameCommand{\parchmentframetop}%
\def\LastFrameCommand{\parchmentframebottom}%
\def\MidFrameCommand{\parchmentframemiddle}%
\vskip\baselineskip
\MakeFramed{\FrameRestore}
\noindent\tikz\node[inner sep=1.2ex, draw=blue, fill=blue!10,
anchor=west, overlay, line width = 1.pt, rounded corners=4pt] at (0em, 1em)
{\color{LightBlue}{THEOREM}};\par\nobreak}%
{\endMakeFramed}
%%end theorem box
So, when I make the call \begin{myTheorem} I obtain a box with the word THEOREM on top. However when the theorem has a name I would like to have it in my box, maybe with a call like \begin{myTheorem}{Name of the theorem} (similarly to what happens with blocks, where I can decide to have the title or not). How can i modify the code in order to obtain this effect?
