I want to make Examples in the book as in the following book
http://www.analogmachine.org/Books/Chapter1.pdf
See Page 2…
Also shaded box as in the page 3… Pictures can be seen below.
Minimal Code for the First part of the Question.
\documentclass{book}
\usepackage{amsthm,color}
\theoremstyle{definition}
\newtheorem{exinn}{Example}[chapter]
\newenvironment{example}
{\clubpenalty=10000
\begin{exinn}%
\mbox{}%
{\color{blue}\leaders\hrule height .8ex depth \dimexpr-.8ex+0.8pt\relax\hfill}%
\mbox{}\linebreak\ignorespaces}
{\par\kern2ex\hrule\end{exinn}}
\begin{document}
\chapter{Chapter One}
\section{Section One}
\begin{example}
What is $a^2 - b^2$?
$a^2 - b^2 = (a - b) \times (a + b)$
\end{example}
\end{document}
Best Answer
Have a look at the
mdframed
package.The manual shows an example putting the title on the frame …