While preparing my lecture notes, I decide to create a command, possibly a new environment, that highlights when I am presenting a worked example. I came up with the following code. The code does kinda satisfy my general use and its purpose but I am looking for a possible better code that includes the following:
The environment should use the entire textwidth and expand vertically as text is added. The table kinda does that feature for it expands vertically as you add text. If you notice in my code I forced the textwidth of the table so that it more or else seems to fit the page. I am still working on that.
That the environment possibly expands to a next page by saying where "Example 1" is "Contd. Example 1." I hope this not too hard to figure out.
I forced tikzpicture to be aligned with the table border but I know this is not the best way. Any assistance into the matter will be highly appreciated.
\documentclass[letterpaper]{article}
\usepackage{fullpage,color}
\usepackage{array,tikz}
\parindent0pt
\definecolor{mblue}{rgb}{0,0.6,0.8}
\newcounter{mEgnum}
\newcommand{\eg}[1]{%
\par\vspace*{0.5cm}\stepcounter{mEgnum}
\begin{tabular}{p{15cm}l|}
\hline\setlength\parindent{-2.17mm}
\begin{tikzpicture}
\draw [color=mblue,fill=mblue](0,0) rectangle (0.25,0.75);
\draw [color=mblue!20,fill=mblue!20](0.25,0) rectangle (3.5,0.75);
\draw (0.5,0.375) node [right] {\large\textbf{ Example \arabic{mEgnum}}};
\end{tikzpicture}
& \tabularnewline
#1
&\tabularnewline\cline{2-2}
\end{tabular}\par\vspace{0.5cm}\noindent%
}
\begin{document}
\eg{Solve the following inequalities and represent the solution set in Set-Builder, Interval Notations and on the Number Line.&\tabularnewline}
\end{document}



mdframed? – Peter Grill Jan 29 '12 at 03:43