I was working on a new environment for the examples I explain for my lecture notes (fancy environment), but when I create an equation using the equation environment within my newly created example environment, this does not obey the indentation that I have placed on my environment. Is this possible?
\documentclass[letterpaper]{article}
\usepackage{fullpage}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.symbols}
\usepackage{lipsum}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Example Environment
\newcounter{boxnum}
\newenvironment{egenv}[1]{%
\begingroup\addvspace\medskipamount%
\stepcounter{boxnum}{\sffamily\bfseries\large EXAMPLE
\tikz [baseline=(char.base)] \node[shape=rectangle,draw=blue!50,inner sep=2.5pt,fill=Cerulean,text=white] (char) {\arabic{boxnum}};%
\quad{#1}\vskip0.75\baselineskip}
\setlength{\leftskip}{20pt}%
\setlength{\rightskip}{20pt}%
\setlength{\parfillskip}{0pt plus 2fil}
}{%
\par\hfill{\color{Cerulean}$\blacksquare$}%
\par\addvspace\medskipamount%
\endgroup
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\parindent0pt
\begin{document}
\lipsum[2]
\begin{equation}
(x-h)^2+(y-k)^2=r^2
\end{equation}
\begin{egenv}{Combined (double) Inequalities}
\lipsum[3]
\end{egenv}
\begin{egenv}{Combined (double) Inequalities}
\lipsum[3]
\begin{equation}\label{stdform}
(x-h)^2+(y-k)^2=r^2
\end{equation}
\begin{equation}\label{stdformnn}
(x-h)^2+(y-k)^2=r^2
\end{equation}
\lipsum[3]
\end{egenv}
\end{document}
This yields:

Of course I would like the equation numbering to restore its normal right indent outside my environment. I have looked at Changing the apperance of equation numbers with amsmath which seems to do what I want with:
\makeatletter
\let\mytagform@=\tagform@
\def\tagform@#1{\maketag@@@{\bfseries(\ignorespaces#1\unskip\@@italiccorr)}\hspace{20pt}}
\renewcommand{\eqref}[1]{\textup{\mytagform@{\ref{#1}}}}
\makeatother
But the above effect is global. Any help into the matter will greatly appreciated.

changepagepackage. – azetina May 26 '12 at 19:22ntheorempackage offersthmmarkswhich does the kind of thing that you want with your blue square. It's quite a complicated algorithm to get it to work for every scenario (e.g ending with an equation, or enumerate, or something else). Theamsthmpackage might also do it, but I'm not sure. – cmhughes May 27 '12 at 00:33