| 1 |
\documentclass[pagesize=auto]{scrartcl} |
| 2 |
|
| 3 |
\usepackage{fixltx2e} |
| 4 |
\usepackage{etex} |
| 5 |
\usepackage{lmodern} |
| 6 |
\usepackage[T1]{fontenc} |
| 7 |
\usepackage{textcomp} |
| 8 |
\usepackage{upquote} |
| 9 |
\usepackage{hologo} |
| 10 |
\usepackage{microtype} |
| 11 |
\usepackage{hyperref} |
| 12 |
|
| 13 |
\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}} |
| 14 |
\newcommand*{\pkg}[1]{\textsf{#1}} |
| 15 |
\newcommand*{\cs}[1]{\texttt{\textbackslash#1}} |
| 16 |
\makeatletter |
| 17 |
\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}} |
| 18 |
\makeatother |
| 19 |
\newcommand*{\env}[1]{\texttt{#1}} |
| 20 |
|
| 21 |
\addtokomafont{title}{\rmfamily} |
| 22 |
\deffootnote{1em}{1em}{\textsuperscript{\thefootnotemark}} |
| 23 |
\renewcommand*{\labelenumi}{(\theenumi)} |
| 24 |
|
| 25 |
\title{The \pkg{program} package\thanks{This manual corresponds to \pkg{program.sty}~v3.3.14, dated~May 5, 2017.}} |
| 26 |
\author{Martin Ward\thanks{\mail{[email protected]}, \mail{[email protected]}\newline\url{http://www.gkc.org.uk/}}} |
| 27 |
\date{May 5, 2017} |
| 28 |
|
| 29 |
|
| 30 |
\begin{document} |
| 31 |
|
| 32 |
\maketitle |
| 33 |
|
| 34 |
\noindent |
| 35 |
This is the ``\pkg{program}'' style option which sets up the |
| 36 |
\env{program} and \env{programbox} environments, |
| 37 |
keywords for programs and a few goodies. |
| 38 |
\emph{Note:} Within the program environment: |
| 39 |
% |
| 40 |
\begin{enumerate} |
| 41 |
\item Newlines are significant. |
| 42 |
\item Each line is in math mode, so for example spaces in the input |
| 43 |
file are not significant. |
| 44 |
\item \cmd{\\} within a line causes a linebreak in the output. |
| 45 |
\end{enumerate} |
| 46 |
|
| 47 |
We also define a ``\env{programbox}'' environment which typesets a program in a box. |
| 48 |
Useful for keeping a pice of code on one page or for typesetting small |
| 49 |
programs in running text. |
| 50 |
We also redefine \cmd{\(} and \cmd{\)} as \verb+\begin{programbox}+ and \verb+\end{programbox}+. |
| 51 |
The \cmd{\tab} and \cmd{\untab} commands are defined to have no effect while outside |
| 52 |
a \env{program} environment, hence a single-line program can be typeset in |
| 53 |
maths mode without the overhead associated with \env{programbox}. |
| 54 |
|
| 55 |
The notation \verb+|variable_name|+ can be used within normal text, |
| 56 |
maths expressions or programs to indicate a variable name. |
| 57 |
Use \cmd{\origbar} to get a normal \verb+|+ symbol in a program. |
| 58 |
The commands \cmd{\A}, \cmd{\B}, \cmd{\R}, \cmd{\T} and \cmd{\Z} typeset the corresponding bold |
| 59 |
letter with the next object as a substript (eg \verb+\S1+ typesets {\bf |
| 60 |
S$_1$} etc). They now cope with primes as well, (eg \verb+$\S2'''$+)\@. The |
| 61 |
\env{program.sty} file can be easily edited to reflect your favoured style. |
| 62 |
Typesetting a program is as easy as: |
| 63 |
% |
| 64 |
\begin{verbatim} |
| 65 |
\(\IF x \ne 0 \THEN |long_name|_{123} = x^y \FI\) |
| 66 |
\end{verbatim} |
| 67 |
% |
| 68 |
See the \texttt{program-demo.tex} file for examples. |
| 69 |
|
| 70 |
\bigskip\noindent |
| 71 |
The file should work with or without \hologo{AmSLaTeX}. |
| 72 |
|
| 73 |
\bigskip\noindent |
| 74 |
This work is released under the GPL version 3. |
| 75 |
|
| 76 |
\end{document} |