I'm trying to create a new numbered environment called 'example'. I would like to be able to reference the examples I create from other places in the document. I'm not sure how to do it...
What I have at the moment is
Code: Select all
\newcounter{theexample} \setcounter{theexample}{1}
\newenvironment{example}[1][]{\medskip\noindent {\textbf{Example
\arabic{theexample}. #1} \stepcounter{theexample} \rm}{\medskip}}
Code: Select all
\begin{example}[My Example]\label{MyExample}
yada yada yada
\end{example}
Does anyone know how that can be done (or something cleverer, that does what I'm interested in)?
Thanks in advance for any help.
Pawel