summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/program/program-doc.tex
blob: 55f9cc52f8944060d82a25a878c62dd4fa123b68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
\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.11, dated~November 13, 2008.}}
\author{Martin Ward\thanks{\mail{Martin.Ward@durham.ac.uk}, \mail{martin@gkc.org.uk}\newline\url{http://www.cse.dmu.ac.uk/\~mward/}}}
\date{November 13, 2008}


\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}