I am having an issue with a project in LaTeX and would be very happy to find help here.
I am writing a book for my math class. As with many scripts, the content consists of theorems and related things. The definition of my theorem environments seems to be a little bit off, which results in the following problem:
Inspired by an artice on this website, I have defined my theorem environments as follows
\usepackage{ifmtarg} % http://ctan.org/pkg/ifmtarg
\usepackage{xifthen} % http://ctan.org/pkg/xifthen
\usepackage{environ} % http://ctan.org/pkg/environ
\usepackage{multido} % http://ctan.org/pkg/multido
\makeatletter%
% top theorem decoration
\newcommand{\theoremhang}[1]{
\begingroup%
\setlength{\unitlength}{.005\linewidth}% \linewidth/200
\begin{picture}(0,0)(1.5,0)%
\linethickness{1.5pt} \color{#1!50}%
\put(-3,2){\line(1,0){206}}% Top line
\multido{\iA=2+-1,\iB=50+-10}{5}{% Top hangs
\color{#1!\iB}%
\put(-3,\iA){\line(0,-1){1}}% Top left hang
\put(203,\iA){\line(0,-1){1}}% Top right hang
}%
\end{picture}%
\endgroup%
}%
% bottom theorem decoration
\newcommand{\theoremhung}[1]{
\nobreak
\begingroup%
\setlength{\unitlength}{.005\linewidth}% \linewidth/200
\begin{picture}(0,0)(1.5,0)%
\linethickness{1.5pt} \color{#1!50}%
\put(-3,0){\line(1,0){206}}% Bottom line
\multido{\iA=0+1,\iB=50+-10}{5}{% Bottom hangs
\color{#1!\iB}%
\put(-3,\iA){\line(0,1){1}}% Bottom left hang
\put(203,\iA){\line(0,1){1}}% Bottom right hang
}%
\end{picture}%
\endgroup%
}%
%Theorem counter
\newcounter{theorem} %Counter for theorems
\counterwithin{theorem}{chapter} %Resets counter for each chapter
\renewcommand{\thetheorem}{\arabic{theorem}}
With the environment "Satz" as
\NewEnviron{satz}[1][]{%
\par\noindent\theoremhang{black}\par\nobreak\noindent%\addvspace{-.5ex}
\refstepcounter{theorem}\postdisplaypenalty=10000 %
{\sffamily\bfseries\upshape Satz \thechapter.\thetheorem\@ifnotmtarg{#1}{\ (#1)}}\ \ \itshape\ignorespaces%
\label{\thechapter.\thetheorem}\label{#1}
\BODY % Typeset theorem body/content
\par\addvspace{-1ex}\nobreak\noindent\theoremhung{black}\par\addvspace{.4ex}%
}
Could anybody help me resolve this issue? I wish to use these theorem environments and not the onces available with packages.
