\documentclass[pagesize=auto, parskip=half, fontsize=12pt, DIV=9]{scrartcl}

\usepackage{fixltx2e}
\usepackage{etex}
\usepackage{xspace}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[svgnames]{xcolor}
\usepackage{latexsym}
\usepackage{listings}
\usepackage{microtype}
\usepackage{hyperref}

\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}}
\newcommand*{\pkg}[1]{\textsf{#1}}
\newcommand*{\cs}[1]{\texttt{\textbackslash#1}}
\makeatletter
\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}}
\makeatother
\newcommand*{\env}[1]{\texttt{#1}}

\addtokomafont{title}{\rmfamily}

\lstset{%
  language=[LaTeX]TeX,%
  columns=flexible,%
  upquote=true,%
  numbers=left,%
  basicstyle=\ttfamily,%
  keywordstyle=\color{Navy},%
  commentstyle=\color{DimGray},%
  stringstyle=\color{SeaGreen},%
  numberstyle=\scriptsize\color{SlateGray}%
}

\title{The \pkg{newproof} package}
\author{Mike Piff\thanks{\mail{M.Piff@shef.ac.uk}}}
\date{}


\begin{document}

\maketitle

\renewcommand*{\labelenumi}{\texttt{\#\theenumi}}

This package defines a \cmd{\newproof} command similar to \cmd{\newtheorem}.
Its arguments are
%
\begin{enumerate}
\item Name of proof environment, eg, \env{proof}.
\item Starting text, eg, \emph{Proof}.
\item Finishing text, eg, $\Box$ flushed right.
\end{enumerate}

The package goes on to define a \env{proof} environment with exactly the
above setup, but other unnumbered environments can be set up in the
same way.

The created environments take one optional argument, which, if present,
goes in brackets after \verb|#2|.   Eg,
%
\begin{lstlisting}
\begin{proof}
  A proof.
\end{proof}

\begin{proof}[B. L. User]
  A named proof.
\end{proof}

\begin{proof}[of Theorem \ref{thm}]
  Yet another.
\end{proof}
\end{lstlisting}

Command \cmd{\qed} is set up to flush \cmd{\qedtext} right; \cmd{\qedtext} defaults
to a square, but can be re-defined as ``QED'' or whatever.

\end{document}

%
% 
%
% This file is placed in the public domain.  No provision is made for
% support of the use of the facilities herein.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{newproof}
\newcommand{\newproof}[3]{
   \newenvironment{#1}[1][]%
   {%
      \begin{trivlist}%
         \item[\hspace{\labelsep}\textnormal{\textbf{#2%
            \def\op@@@arg{##1}%
            \ifx\op@@@arg\empty
            \else~(##1)\fi
         }}]%
   }%
   {%
      #3
      \end{trivlist}%
   }%
}
\newproof{proof}{Proof}{\qed}
\def\qed{{\ifhmode\unskip\nobreak\hfil\penalty50 \hskip1em \else\nobreak\fi
   \mbox{}\nobreak\hfil\qedtext%
   \parfillskip=0pt \finalhyphendemerits=0 \par}}

\def\qedtext{\ensuremath{\square}}
\RequirePackage{amsfonts}
\DeclareMathSymbol{\square}       {\mathord}{AMSa}{"03}


