\documentclass[pagesize=auto]{scrartcl}

\usepackage{fixltx2e}
\usepackage{etex}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{upquote}
\usepackage{hologo}
\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}
\deffootnote{1em}{1em}{\textsuperscript{\thefootnotemark}}
\renewcommand*{\labelenumi}{(\theenumi)}

\title{The \pkg{program} package\thanks{This manual corresponds to \pkg{program.sty}~v3.3.14, dated~May 5, 2017.}}
\author{Martin Ward\thanks{\mail{martin@gkc.org.uk}, \mail{Martin.Ward@smltd.com}\newline\url{http://www.gkc.org.uk/}}}
\date{May 5, 2017}


\begin{document}

\maketitle

\noindent
This is the ``\pkg{program}'' style option which sets up the
\env{program} and \env{programbox} environments,
keywords for programs and a few goodies.
\emph{Note:} Within the program environment:
%
\begin{enumerate}
\item Newlines are significant.
\item Each line is in math mode, so for example spaces in the input
  file are not significant.
\item \cmd{\\} within a line causes a linebreak in the output.
\end{enumerate}

We also define a ``\env{programbox}'' environment which typesets a program in a box.
Useful for keeping a pice of code on one page or for typesetting small 
programs in running text.
We also redefine \cmd{\(} and \cmd{\)} as \verb+\begin{programbox}+ and \verb+\end{programbox}+.
The \cmd{\tab} and \cmd{\untab} commands are defined to have no effect while outside 
a \env{program} environment, hence a single-line program can be typeset in 
maths mode without the overhead associated with \env{programbox}.

The notation \verb+|variable_name|+ can be used within normal text,
maths expressions or programs to indicate a variable name.
Use \cmd{\origbar} to get a normal \verb+|+ symbol in a program.
The commands \cmd{\A}, \cmd{\B}, \cmd{\R}, \cmd{\T} and \cmd{\Z} typeset the corresponding bold
letter with the next object as a substript (eg \verb+\S1+ typesets {\bf
S$_1$} etc). They now cope with primes as well, (eg \verb+$\S2'''$+)\@. The
\env{program.sty} file can be easily edited to reflect your favoured style.
Typesetting a program is as easy as:
%
\begin{verbatim}
\(\IF x \ne 0 \THEN |long_name|_{123} = x^y \FI\)
\end{verbatim}
%
See the \texttt{program-demo.tex} file for examples.

\bigskip\noindent
The file should work with or without \hologo{AmSLaTeX}.

\bigskip\noindent
This work is released under the GPL version 3.

\end{document}
