diff options
author | Karl Berry <karl@freefriends.org> | 2007-07-28 00:33:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-07-28 00:33:22 +0000 |
commit | 57814cd1a4f5be3ec8cb4211a58e34537f6b573c (patch) | |
tree | d3a819681f1da83a0a6d699745faf99411f3acb1 /Master/texmf-dist/doc/latex/program/program-demo.tex | |
parent | d0f2c6aa8b33d787b1bd35ca62e3c7fab2baae9d (diff) |
latex package "program" update (17jul07)
git-svn-id: svn://tug.org/texlive/trunk@4676 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/program/program-demo.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/program/program-demo.tex | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Master/texmf-dist/doc/latex/program/program-demo.tex b/Master/texmf-dist/doc/latex/program/program-demo.tex index eea77bf7fff..af7c3bcbe8a 100644 --- a/Master/texmf-dist/doc/latex/program/program-demo.tex +++ b/Master/texmf-dist/doc/latex/program/program-demo.tex @@ -1,4 +1,6 @@ \documentclass{article} +\usepackage{amsmath} +\usepackage{amssymb} \usepackage{newlfont} \usepackage{program} \setlength{\parskip}{1ex} @@ -16,18 +18,23 @@ % \end{program} % \end{figure} +% To use |foo_bar| in headings, set _ to be active. +% Not done by default as this clashes with \includegraphics +% if filenames have _ characters in them: + +\catcode`\_\active \begin{document} \title{A demonstration of the {\tt program} environment} \author{Martin Ward\\ -Centre for Software Maintenance\\ -University of Durham} +\tt{martin@gkc.org.uk}} \maketitle \tableofcontents \section{Example with |first_set| and $|first_set|$.} + The {\tt program} style defines two environments, {\tt program} and {\tt programbox} for typesetting programs and algorithms. Within the program environment: @@ -47,11 +54,10 @@ underscores (and other unusual characters). \verb:testing | in verbatim: \begin{verbatim} -testing | in verbatim +testing | and @ in verbatim \end{verbatim} - Here is a small program: \( |first_set|:= \set{x | x^2 + y_1 > 0 } \) It shows how to typeset mathematics as part of a program. Since each line is @@ -160,7 +166,7 @@ the algorithms within the sections. \WHERE \FUNCT |expt|(x,n) \BODY \EXP z:=1; - \WHILE n \ne 0 \DO + \WHILE n \neq 0 \DO \WHILE |even|(n) \DO n:=n/2; x:=x*x \OD; \label{foo} n:=n-1; z:=z*x \OD; @@ -271,9 +277,9 @@ And here's the transformed and corrected version: \end{program} \end{algorithm} -These are the same programs in a sans-serif style, using the command -\verb:\sfvariables:: -\sfvariables +Below are the same programs in a bold serif style with underlined keywords, using the command +\verb:\bfvariables:: +\bfvariables \begin{program} \VAR \seq{m := 0, p := 0, |last| := `` ''}; \ACTIONS |prog|: @@ -311,5 +317,9 @@ l \ACTIONEQ % |write|(|line|) \OD \end{program} +In my opinion, the \verb:\sfvariables: style looks much better. +The \verb:\bfvariables: style was the default, but this was changed with version 3.3.11. + + \end{document} |