summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/progkeys
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/progkeys
Initial commit
Diffstat (limited to 'macros/latex/contrib/progkeys')
-rw-r--r--macros/latex/contrib/progkeys/README172
-rw-r--r--macros/latex/contrib/progkeys/demo/demo.tex72
-rw-r--r--macros/latex/contrib/progkeys/demo/prog1.tex13
-rw-r--r--macros/latex/contrib/progkeys/demo/prog2.tex13
-rw-r--r--macros/latex/contrib/progkeys/demo/prog3.tex57
-rw-r--r--macros/latex/contrib/progkeys/keywords.dtx1016
-rw-r--r--macros/latex/contrib/progkeys/keywords.ins51
-rw-r--r--macros/latex/contrib/progkeys/keywords.pdfbin0 -> 303949 bytes
-rw-r--r--macros/latex/contrib/progkeys/programs.dtx1227
-rw-r--r--macros/latex/contrib/progkeys/programs.ins51
-rw-r--r--macros/latex/contrib/progkeys/programs.pdfbin0 -> 348753 bytes
11 files changed, 2672 insertions, 0 deletions
diff --git a/macros/latex/contrib/progkeys/README b/macros/latex/contrib/progkeys/README
new file mode 100644
index 0000000000..3b4d82d1d3
--- /dev/null
+++ b/macros/latex/contrib/progkeys/README
@@ -0,0 +1,172 @@
+This directory contains files that allow to generate two style
+files: 'programs.sty' and 'keywords.sty'.
+
+The 'demo' subdirectory contains an example of what can be done with
+these two styles ('demo.tex' can be compiled either with LaTeX or with
+LaTeX2.09 -- see the corresponding directory under macros/latex209/contrib).
+
+The two files in this archive may be used independently or in
+conjunction, according to your wish.
+The file 'programs.sty' is intended to allow a parameterized way of
+typesetting programs with TeX/LaTeX commands inside.
+The file 'keywords.sty' allows use and define sets of keywords that
+will be typeset with different fonts, according to the wish of the
+user.
+The purpose of these two files, when used in conjunction, is to allow
+a user to write only one program and to print it differently,
+according to the document where it must be put (ex: keywords in
+english/french, keywords underlined, boldfaced, programs
+indented, no indented, numbered, unnumbered, etc). Of course, the
+algorithm will be written only once.
+
+Below I give a short description of the files and the way to generate
+them.
+
+------------
+programs.sty
+------------
+I have written a style file for typesetting programs.
+Its particularities are:
+
+- TABS are replaced by simple SPACES as in the 'astyped.sty' style
+- and you can use emphasized fonts, math formulae, etc.
+- programs may be numbered or unnumbered
+- line numbers may appear in the left side or right side margin,
+ or in both sides, or inside the text body (on the left of the text)
+- line numbers may be refered to with \label / \ref
+- the first line of a numbered program is by default 1, but it is
+ possible to change this first value in two manners:
+ o by specifying a particular first number
+ o by indicating that the next program will start at the line
+ number that follows the last line of the last previous
+ program typed
+- programs may be globally indented, but a particular occurrence may
+ have a different indentation
+
+By default, 7 environments are provided, according to the font size:
+
+ program normal size
+ programs small size
+ programf footnote size
+ programsc scriptsize
+ programt tiny size
+ programl large size
+ programL Large size
+
+For each environment, there exist to file inclusion commands that work
+in a manner similar to the \verbatimfile and \verbatimlisting commands
+of the 'verbatimfiles.sty' file:
+
+ \fprogram? inclusion of unnumbered program
+ \lprogram? inclusion of numbered program
+
+where '?' stands for nothing, or for one string in "s", "f", "sc",
+"t", "l" and "L", according to the font size desired.
+
+It is possible to define new environments. For instance
+
+ \NewProgram{FOO}{LARGE}
+
+will define the environment FOO with font size set to LARGE, and to
+file inclusion commands: \fFOO and \lFOO.
+
+Extract the package file from its '.dtx' file as follows:
+
+ latex programs.ins
+
+And get the documented source by:
+
+ latex programs.drv
+ latex programs.drv
+ latex programs.drv
+ makeindex -s programs.ist programs.idx
+ latex programs.drv
+
+------------
+keywords.sty
+------------
+As a companion to the style programs.sty, here follows a style called
+keywords.sty whose main purpose is to provide a parameterized way to
+typeset keywords. This style may be used in conjunction with the
+programs.sty file, but this is not necessary.
+
+What you can do is, for instance, to type a program where keywords
+will appear boldfaced. It suffices to issue the \ProgKeywords command
+(global scope), and then to type the text, for instance:
+
+ \BEGIN
+ \FOR I := 1 \TO 10 \DO
+ ....
+ \ENDDO
+ \END
+
+In this example, the keywords are commands defined in the second part
+of the keywords.sty file. If the environment is such that spaces are
+obeyed (like in the verbatim environment or by using the programs.sty
+file), then keywords can be typed as is; otherwise (i.e. in normal
+text) they must be typed followed by a "\" character
+(e.g.: \BEGIN\ ...).
+
+Assume now, that you want that the program above is typed with
+keywords written with an emphazised font and underlined, and that
+words appear in French instead of English.
+Then take the same program, but just change the "\ProgKeywords"
+command that precedes it to "\UFAlgoKeywords" (for: Underlined French
+AlgoKeywords).
+
+I have sorted keywords in lexicographic order.
+If you need to change or add a definition go anywhere among the
+keywords and type (e.g. definition of the keyword FOO):
+
+#1{\FOO}{this is an example}[bla bla]%
+
+Then if you chose commands where the 'F' does not appear in the
+beginning of the name, any occurrence of "\FOO" is replaced by the
+sentence "this is an example"; otherwise, the sentence "bla bla" will
+be used.
+
+If your wish is that the same expansion is performed for all the
+commands, the omit tht fourth parameter:
+
+#1{\FOO}{this is an example}
+
+
+The commands provided are:
+
+ -------------------------------------------------------------------------
+ English keywords French keywords
+ -------------------------------------------------------------------------
+ \tt BOLDFACE DISPLAY \ProgKeywords \FProgKeywords
+ \tt NORMAL DISPLAY \ttKeywords \FttKeywords
+ \em DISPLAY \AlgoKeywords \FAlgoKeywords
+ underlined \em DISPLAY \UAlgoKeywords \UFAlgoKeywords
+ normal (\rm) DISPLAY \NormalKeywords \FNormalKeywords
+ -------------------------------------------------------------------------
+
+As I am French, I have used English and French languages; however you
+can use any couple of languages you want. I recall that if parameter 4
+in keyword definition is omitted, then only the first language is
+used.
+
+The file terminates by a command that selects the default mode (in the
+current case this is \UFAlgoKeywords).
+
+Extract the package file from its '.dtx' file as follows:
+
+ latex keywords.ins
+
+And get the documented source by:
+
+ latex keywords.drv
+ latex keywords.drv
+ latex keywords.drv
+ makeindex -s keywords.ist keywords.idx
+ latex keywords.drv
+
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Miguel ALABAU
+LaBRI, Universite BORDEAUX I
+351, cours de la Liberation 33405 TALENCE Cedex (FRANCE)
+e-mail: Miguel.Alabau@labri.u-bordeaux.fr
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/macros/latex/contrib/progkeys/demo/demo.tex b/macros/latex/contrib/progkeys/demo/demo.tex
new file mode 100644
index 0000000000..712f4eb295
--- /dev/null
+++ b/macros/latex/contrib/progkeys/demo/demo.tex
@@ -0,0 +1,72 @@
+\ifx\documentclass\undefined
+\documentstyle[fr,programs,keywords]{article}
+\else
+\documentclass{article}
+\usepackage{CheckForDef}
+\usepackage{fr}
+\usepackage{programs}
+\usepackage{keywords}
+\fi
+
+\def\p#1{{\bf{}#1}}
+
+\def\wideoutput{%
+\setlength{\topmargin}{-1.54cm}%
+\setlength{\headsep}{0cm}%
+\setlength{\textwidth}{17.5cm}%
+\setlength{\textheight}{25.5cm}%
+\setlength{\oddsidemargin}{-1cm}%
+\setlength{\evensidemargin}{-1cm}}
+\wideoutput
+
+\InBodyLeftNumberLine
+
+\ProgKeywords
+
+\begin{document}
+
+Dans le programme suivant, quel est le type de \p{A}?
+celui de~\p{B}?
+\p{A} et~\p{B} ont-ils m\^eme type?
+Les instructions des
+lignes~\ref{progFORTTYPAGEinstruction1}--\ref{progFORTTYPAGEinstruction3}
+sont-elles correctes?
+Pourquoi?
+
+\input{prog1.tex}
+
+La variable \p{A} est d'un type anonyme tableau \`a une
+dimension de \p{COULEURS}.
+Il en est de m\^eme pour \p{B}.
+Bien que la description des deux types soit identique, ils sont
+diff\'erents.
+
+L'instruction de la ligne~\ref{progFORTTYPAGEinstruction1} est
+correcte (affectation d'une valeur de type \p{COULEURS} dans une
+variable du m\^eme type).
+Les instructions des lignes~\ref{progFORTTYPAGEinstruction2}
+et~\ref{progFORTTYPAGEinstruction3} sont ill\'egales (les types
+sont diff\'erents).
+Par contre, si l'on avait \'ecrit le programme comme suit
+
+\NewKeyword{\BEGIN}{this is the beginning}[ceci est le d\'ebut]
+\FUAlgoKeywords
+
+\input{prog2.tex}
+
+\noindent%
+il n'y aurait pas eu d'erreur.
+Dans ce cas, en effet, \p{A} et \p{B} appartiennent au m\^eme
+sous-type initial, et un contr\^ole sera mis en place pour
+v\'erifier les bornes des intervalles \`a l'ex\'ecution.
+
+\bigskip
+
+Un exercice de num\'erotation:
+
+\NewKeyword{\END}{this IS the real end}
+\AlgoKeywords
+
+\input{prog3.tex}
+
+\end{document}
diff --git a/macros/latex/contrib/progkeys/demo/prog1.tex b/macros/latex/contrib/progkeys/demo/prog1.tex
new file mode 100644
index 0000000000..8fb99fe635
--- /dev/null
+++ b/macros/latex/contrib/progkeys/demo/prog1.tex
@@ -0,0 +1,13 @@
+\begin{programs}[0.5cm]
+\PROCEDURE FORT\_TYPAGE \IS
+ \TYPE COULEURS \IS
+ (ROUGE, ORANGE, JAUNE, VERT, BLEU, INDIGO, VIOLET);
+ A : \ARRAY (1..5) \OF COULEURS
+ := (BLEU, ROUGE, VERT, JAUNE, VIOLET);
+ B : \ARRAY (1..5) \OF COULEURS;
+\BEGIN
+ B(1) := A(1); \label{progFORTTYPAGEinstruction1}
+ B(1..5) := A(1..5); \label{progFORTTYPAGEinstruction2}
+ B := A; \label{progFORTTYPAGEinstruction3}
+\END FORT\_TYPAGE;
+\end{programs} \ No newline at end of file
diff --git a/macros/latex/contrib/progkeys/demo/prog2.tex b/macros/latex/contrib/progkeys/demo/prog2.tex
new file mode 100644
index 0000000000..2fcbf9be32
--- /dev/null
+++ b/macros/latex/contrib/progkeys/demo/prog2.tex
@@ -0,0 +1,13 @@
+\begin{programs}[0.5cm]
+\PROCEDURE FORT\_TYPAGE \IS
+ \TYPE COULEURS \IS
+ (ROUGE, ORANGE, JAUNE, VERT, BLEU, INDIGO, VIOLET);
+ \TYPE T \IS \ARRAY (INTEGER \RANGE <>) \OF COULEURS;
+ A : T(1..5) := (BLEU, ROUGE, VERT, JAUNE, VIOLET);
+ B : T(1..5);
+\BEGIN
+ B(1) := A(1);
+ B(1..5) := A(1..5);
+ B := A;
+\END FORT\_TYPAGE;
+\end{programs} \ No newline at end of file
diff --git a/macros/latex/contrib/progkeys/demo/prog3.tex b/macros/latex/contrib/progkeys/demo/prog3.tex
new file mode 100644
index 0000000000..df33fd7d26
--- /dev/null
+++ b/macros/latex/contrib/progkeys/demo/prog3.tex
@@ -0,0 +1,57 @@
+\begin{programs}*
+ \WITH TEXT\_IO; \USE TEXT\_IO;
+ \PROCEDURE NUMEROTATION
+ (FICHIER\_ENTREE : \IN STRING;
+ FICHIER\_SORTIE : \IN STRING := "") IS
+ \SUBTYPE LONGUEUR\_LIGNE \IS INTEGER
+ \RANGE 1..255;
+ FICHIER\_IN : FILE\_TYPE;
+ FICHIER\_OUT : FILE\_TYPE;
+ COMPTEUR : NATURAL := 0;
+ LIGNE : STRING (LONGUEUR\_LIGNE);
+ FIN\_DE\_LIGNE : NATURAL;
+ \BEGIN
+ OPEN (FILE => FICHIER\_IN,
+ MODE => IN\_FILE,
+ NAME => FICHIER\_ENTREE);
+ \IF FICHIER\_SORTIE = "" \THEN
+ CREATE (FILE => FICHIER\_OUT,
+ MODE => OUT\_FILE,
+ NAME => FICHIER\_ENTREE \& ".num");
+ \ELSE
+ CREATE (FILE => FICHIER\_OUT,
+ MODE => OUT\_FILE,
+ NAME => FICHIER\_SORTIE);
+ \END \IF;
+ RESET (FICHIER\_IN);
+ \WHILE \NOT END\_OF\_FILE (FICHIER\_IN) \LOOP
+ GET\_LINE (FILE => FICHIER\_IN,
+ ITEM => LIGNE,
+ LAST => FIN\_DE\_LIGNE);
+ COMPTEUR := COMPTEUR + 1;
+ PUT\_LINE (FILE => FICHIER\_OUT,
+ ITEM => NATURAL'IMAGE (COMPTEUR) \&
+ " " \& LIGNE (1..FIN\_DE\_LIGNE));
+ \END \LOOP;
+ CLOSE (FILE => FICHIER\_IN);
+ CLOSE (FILE => FICHIER\_OUT);
+ \END NUMEROTATION;
+
+ \WITH TEXT\_IO; \USE TEXT\_IO;
+ \WITH NUMEROTATION;
+ \PROCEDURE TEST\_NUMEROTATION \IS
+ CARACTERES : NATURAL;
+ NOM\_FICHIER : STRING (1..50);
+ \BEGIN
+ PUT ("quel fichier voulez-vous ");
+ PUT ("numeroter ? ");
+ GET\_LINE (NOM\_FICHIER,CARACTERES);
+ NUMEROTATION (NOM\_FICHIER (1..CARACTERES));
+ PUT\_LINE ("C'est fini");
+ \END TEST\_NUMEROTATION;
+\end{programs}
+
+% Local Variables:
+% mode: latex
+% TeX-master: t
+% End:
diff --git a/macros/latex/contrib/progkeys/keywords.dtx b/macros/latex/contrib/progkeys/keywords.dtx
new file mode 100644
index 0000000000..88b75d85fa
--- /dev/null
+++ b/macros/latex/contrib/progkeys/keywords.dtx
@@ -0,0 +1,1016 @@
+% \iffalse meta-comment
+%
+% 'keywords.dtx'
+%
+% Copyright (C) 1993,1994,1995 by Miguel Alabau. All rights reserved.
+%
+% COMMANDS FOR TYPESETTING KEYWORDS
+%
+% **WARNING** If the file 'keywords.ins' does not accompany the file
+% 'keywords.dtx', then you must strip this last file by hand.
+% (1) Run 'latex docstrip' on 'keywords.dtx' and indicate 'drv' as
+% suffix file and 'driver' as selector for extraction.
+% (2) Run 'latex docstrip' on 'keywords.dtx' and indicate 'sty' as
+% suffix file and 'style' as selector for extraction.
+% (3) Run 'latex docstrip' on 'keywords.dtx' and indicate 'ist' as
+% suffix file and 'index' as selector for extraction.
+% Then, if you want to produce the documentation, proceed as follows:
+% latex keywords.drv; latex keywords.drv; latex keywords.drv
+% makeindex -s keywords.ist keywords.idx
+% latex keywords.drv
+%
+%<style>\NeedsTeXFormat{LaTeX2e}
+%<style>\ProvidesPackage{keywords}
+%
+% \fi
+%
+%
+% \def\fileversion{v1.0}
+% \def\filedate{95/04/01}
+% \def\docdate {96/01/31}
+%
+%
+% ^^A -*-LaTeX-*-
+%
+%\catcode`\<=12
+
+% \CheckSum{564}
+%% \CharacterTable
+%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%%
+%
+% \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
+% \DoNotIndex{\@flushglue,\@gobble,\@input}
+% \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
+% \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
+% \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
+% \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
+% \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
+% \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
+% \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
+% \DoNotIndex{\cal,\csname,\def,\documentstyle,\dospecials,\edef}
+% \DoNotIndex{\documentclass}
+% \DoNotIndex{\egroup}
+% \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
+% \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
+% \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
+% \DoNotIndex{\ifcase}
+% \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
+% \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
+% \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
+% \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
+% \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
+% \DoNotIndex{\strutbox}
+% \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
+% \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
+% \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
+% \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
+% \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
+% \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
+% \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
+% \DoNotIndex{\nopagebreak}
+% \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
+% \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
+% \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
+% \DoNotIndex{\[,\{,\},\]}
+% \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
+% \DoNotIndex{\baselineskip,\begin,\tw@}
+% \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
+% \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
+% \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
+% \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
+% \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
+% \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
+% \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
+% \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
+% \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
+% \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
+% \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
+% \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
+% \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
+% \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
+% \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
+% \DoNotIndex{\bfdefault}
+%
+% \DoNotIndex{\addtocounter,\baselinestretch,\em,\noindent}
+% \DoNotIndex{\linewidth,\columnwidth,\newcounter,\newif,\newlength}
+% \DoNotIndex{\normalsize,\refstepcounter,\rlap,\rule}
+% \DoNotIndex{\@@tempa,\@@tempb,\@ifnextchar,\@nameuse}
+%
+% \title{The ``{\sf{}keywords.sty}'' style file\thanks{%
+% This file has version number \fileversion{} dated \filedate{}.
+% The documentation was last revised on \docdate{}.}}
+%
+% \author{Miguel Alabau\\
+% {\small{}LaBRI, Universit\'e Bordeaux~I (France)}\\
+% {\small{\em{}e-mail\/}: {\tt{}Miguel.Alabau@labri.u-bordeaux.fr}}}
+%
+% \maketitle
+%
+% \begin{abstract}
+% This style file contains a set of definitions that allow keywords
+% to be defined and printed in several convenient ways.
+% For each keyword two definitions may be provided. This is to
+% allow the use of keywords in two contexts (for instance
+% English/French translation of the keywords).
+% At the same time, keyword can be printed in roman, teletype,
+% boldfaced or underlined.
+% The user can define other styles for printing keywords.
+% A set of keywords is provided by default. Of course a user can
+% define new keywords or redefine existing ones without modifying
+% the style file.
+% \end{abstract}%
+%
+% \newif\ifmulticols
+% \makeatletter
+% \ifhave@multicol\multicolstrue\else\multicolsfalse\fi
+% \makeatother
+%
+% \begin{footnotesize}
+% \ifmulticols \begin{multicols}{2} \fi
+% \tableofcontents
+% \ifmulticols \end{multicols} \fi
+% \end{footnotesize}
+%
+%
+% \ifmulticols
+% \begin{multicols}{2}[\section{Introduction}]
+% \else \section{Introduction} \fi
+%
+% When typing programs or algorithms, it often happens for a same
+% text to appear as an algoritm (pseudo-code) or as a program. In such
+% cases different fonts are used. For instance, algorithms may appear
+% with keywords italicised or underlined, while the same keywords
+% appear boldfaced in the program text.
+% Moreover algorithms are often typed with keywords belonging to the
+% native language of the writer while program keywords appear usually
+% to be english ones.
+%
+% The file {\em{}keywords.sty\/} provides simple solutions to both of
+% these problems by giving the user capability to define each keyword
+% in two simultaneaous different manners and by providing different
+% printing styles.
+%
+% Keywords are commands to be issued in text. Hence this style file is
+% origimally intended to be used in conjunction with the features
+% provided by the {\em{}programs.sty\/} style file~\cite{alabau95-d}.
+% However, it can be used independently.
+%
+% \ifnoprogsfile \relax\else
+%
+% For instance, let be the following piece of program:
+%
+% \begin{verbatim}
+% \BEGIN
+% statements
+% \END
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% \noindent%
+% where \verb+\BEGIN+ and \verb+\END+ are two predefined commands in
+% this style file.
+% If we issue the command \verb+\ProgKeywords+, then we get:
+%
+% \ProgKeywords
+% \begin{programf}*
+% \BEGIN
+% statements
+% \END
+% \end{programf}
+%
+% \vspace{-\baselineskip}
+% \noindent%
+% If we prefer to use the second language, we can issue the
+% \verb+\FProgKeywords+:
+%
+% \FProgKeywords
+% \begin{programf}*
+% \BEGIN
+% statements
+% \END
+% \end{programf}
+%
+% \vspace{-\baselineskip}
+% \noindent%
+% We can also use other typesetting rules, like underlined emphasized
+% fonts (\verb+UAlgoKeywords+):
+%
+% \UAlgoKeywords
+% \begin{programf}*
+% \BEGIN
+% statements
+% \END
+% \end{programf}
+%
+% \vspace{-\baselineskip}
+% \noindent%
+% It is also possible to define new keywords or to redefine existing
+% ones, by issuing a command like:
+%
+% \begin{verbatim}
+% \NewKeyword{\BEGIN}{this is the beginning}
+% \NewKeyword{\END}{this is the end}
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% \noindent%
+% which leads to the following piece of code (default typesetting used
+% is the last one specified, i.e. \verb+UAlgoKeywords+):
+%
+% \NewKeyword{\BEGIN}{this is the beginning}
+% \NewKeyword{\END}{this is the end}
+% \begin{programf}*
+% \BEGIN
+% statements
+% \END
+% \end{programf}
+%
+% \fi
+%
+% \ifmulticols\end{multicols}\fi
+%
+% ^^A **********************************************
+% ^^A ** USERS's MANUAL **
+% ^^A **********************************************
+%
+% \section{User's Manual}
+%
+% A set of default keywords is provided in this file (see
+% section~\ref{default-keywords}). For each keyword, two definitions
+% are provided: the first one in english, and the second one in french
+% (because I am French).
+% The switch between the two languages is performed by global commands
+% wich serve also to define the font used for printing.
+%
+% \subsection{Selecting a printing style}
+% \label{user:selecting-printing-styles}
+%
+% \DescribeMacro{\ProgKeywords}
+% \DescribeMacro{\FProgKeywords}
+% \DescribeMacro{\ttKeywords}
+% \DescribeMacro{\FttKeywords}
+% \DescribeMacro{\AlgoKeywords}
+% \DescribeMacro{\FAlgoKeywords}
+% \DescribeMacro{\NormalKeywords}
+% \DescribeMacro{\FNormalKeywords}
+%
+% The following printing styles are provided:
+%
+% \begin{center}
+% \begin{tabular}{lll}
+% \hline
+% \multicolumn{1}{c}{style}
+% & \multicolumn{1}{c}{definition~1}
+% & \multicolumn{1}{c}{definition~2}\\
+% \hline\hline
+% \verb+\bf+ & \verb+\ProgKeywords+ & \verb+\FProgKeywords+\\
+% \verb+\tt+ & \verb+\ttKeywords+ & \verb+\FttKeywords+\\
+% \verb+\em+ & \verb+\AlgoKeywords+ & \verb+\FAlgoKeywords+\\
+% \verb+\rm+ & \verb+\NormalKeywords+ & \verb+\FNormalKeywords+\\
+% \hline
+% \end{tabular}
+% \end{center}
+%
+% \DescribeMacro{\UAlgoKeywords}
+% \DescribeMacro{\UFAlgoKeywords}
+% \DescribeMacro{\FUAlgoKeywords}
+% There are also two underlined styles:
+%
+% \begin{center}
+% \begin{tabular}{lll}
+% \hline
+% \multicolumn{1}{c}{style}
+% & \multicolumn{1}{c}{definition~1}
+% & \multicolumn{1}{c}{definition~2}\\
+% \hline\hline
+% underlined \verb+\em+ & \verb+\UAlgoKeywords+ & \verb+\FUAlgoKeywords+\\
+% \hline
+% \end{tabular}
+% \end{center}
+%
+% For compatability with previous versions of keywords.sty, the
+% command \verb+\UFAlgoKeywords+ has been defined as a synonym for
+% \verb+\FUAlgoKeywords+.
+%
+% \subsection{Defining and Re-defining keywords}
+% \label{user:program-keywords}
+%
+% \DescribeMacro{\NewKeyword}
+% The command
+%
+% \begin{verbatim}
+% \NewKeyword{\WORD}{SENTENCE1}[SENTENCE2]
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% defines the command \verb+\WORD+ to issue the text in
+% \verb+SENTENCE1+ or in \verb+SENTENCE2+ when it is typed, according
+% to the style currently in use.
+%
+% For instance, one could use \verb+SENTENCE1+ for defining english
+% keywords and \verb+SENTENCE2+ for defining their french translation.
+%
+% If ``\verb+[SENTENCE2]+'' is omitted, all happens as if the
+% following command had been issued:
+%
+% \begin{verbatim}
+% \NewKeyword{\WORD}{SENTENCE1}[SENTENCE1]
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% The command \verb+\NewKeyword+ serves also to redefine existing
+% keywords.
+%
+% \subsection{Defining a printing style}
+% \label{user:defining-printing-styles}
+%
+% \DescribeMacro{\DefineKeywordsStyles}
+% The command
+%
+% \begin{verbatim}
+% \DefineKeywordsStyles{MODE}{\STYLE}
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% allows for the user to define particular printing modes.
+% Its main effect is to define the commands \verb+\MODEs+ and
+% \verb+\FMODEs+ that will lead to print respectively the
+% \verb+SENTENCE1+ part or the \verb+SENTENCE2+ part of the
+% \verb+\NewKeyword+ definitions.
+% For instance, the commands \verb+\ProgKeywords+ and
+% \verb+\FProgKeywords+ have been automatically defined from a
+% \verb+\DefineKeywordsStyles{ProgKeyword}{\bf}+ command.
+%
+% \DescribeMacro{\DefineUnderlinedKeywordsStyles}
+% \ \\
+% For \verb+SENTENCE+$_i$ to be underlined, it is necessary to issue a
+%
+% \begin{verbatim}
+% \DefineUnderlinedKeywordsStyles{MODE}{\STYLE}
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% command, instead of the ``\verb+\DefineKeywordsStyles+'' described
+% above.
+% This is how the \verb+\UAlgoKeywords+ and \verb+\FUAlgoKeywords+
+% commands have been defined, by issuing a
+% \verb+\DefineUnderlinedKeywordsStyles{UAlgoKeyword}{\em}+ command.
+%
+% \subsection{The Index File}
+%
+% In order for the processing of this file to be complete, an index
+% format file is required. Let us assume that it is named
+% \verb+keywords.ist+, then the following command must be run and then
+% another compilation of the current file:
+%
+% \begin{macrocode}
+%<index>
+%<index>%% -----------------------------------------------------------
+%<index>%% Assuming this file is named "keywords.ist" (after being
+%<index>%% generated from "keywords.dtx" by running "latex docstrip"),
+%<index>%% the following command will produce a well formated index:
+%<index>%%
+%<index>%% makeindex -s keywords.ist keywords.idx
+%<index>%% -----------------------------------------------------------
+%<index>
+% \end{macrocode}
+%
+% Another possibility is to set the environment variable
+% \verb+INDEXSTYLE+ to a directory name where the ``.ist'' files
+% (index format files) may be found.
+%
+% A possible index file is given below\footnote{It can be generated by
+% invoquing the compilation of ``docstrip'' with the ``index''
+% option.}:
+%
+% \begin{macrocode}
+%<index>actual '='
+%<index>quote '!'
+%<index>level '>'
+%<index>preamble
+%<index>"\n \\begin{theindex} \n \\makeatletter\\scan@allowedfalse\n"
+%<index>postamble
+%<index>"\n\n \\end{theindex}\n"
+%<index>item_x1 "\\efill \n \\subitem "
+%<index>item_x2 "\\efill \n \\subsubitem "
+%<index>delim_0 "\\pfill "
+%<index>delim_1 "\\pfill "
+%<index>delim_2 "\\pfill "
+%<index>% The next lines will produce some warnings when
+%<index>% running Makeindex as they try to cover two different
+%<index>% versions of the program:
+%<index>lethead_prefix "{\\bf\\hfil "
+%<index>lethead_suffix "\\hfil}\\nopagebreak\n"
+%<index>lethead_flag 1
+%<index>heading_prefix "{\\bf\\hfil "
+%<index>heading_suffix "\\hfil}\\nopagebreak\n"
+%<index>headings_flag 1
+% \end{macrocode}
+%
+% \subsection{The Driver File}
+%
+% There is also a driver file, called {\em{}programs.drv\/}, that is
+% included in the distribution.
+% It is devoted to control the latex compilation of the documentation.
+% Its code is given below.
+%
+% \begin{macrocode}
+%<*driver>
+\newif\ifnoprogsfile
+\openin1 programs.sty
+\ifeof1 \noprogsfiletrue\else\noprogsfilefalse\fi\closein1
+\ifnoprogsfile \relax\else
+\openin1 keywords.sty
+\ifeof1 \noprogsfiletrue\else\noprogsfilefalse\fi\closein1
+\fi
+\ifnoprogsfile
+ \typeout{*************************************************************}
+ \typeout{To get a more complete documentation, you should:}
+ \typeout{(1) generate the file 'programs.sty'(see 'programs.dtx'), and}
+ \typeout{(2) copy the current file into 'keywords.sty'}
+ \typeout{*************************************************************}
+\fi
+\ifnoprogsfile
+ \documentclass{ltxdoc}
+\else
+ \documentclass{ltxdoc}
+ \usepackage{programs}
+ \usepackage{keywords}
+\fi
+\MakePercentIgnore%
+%
+\setlength{\textwidth}{31pc}%
+\setlength{\textheight}{54pc}%
+\setlength{\parindent}{0pt}%
+\setlength{\parskip}{2pt plus 1pt minus 1pt}%
+\setlength{\oddsidemargin}{8pc}%
+\setlength{\marginparwidth}{8pc}%
+\setlength{\topmargin}{-2.5pc}%
+\setlength{\headsep}{20pt}%
+\setlength{\columnsep}{1.5pc}%
+\setlength{\columnwidth}{18.75pc}%
+%%
+\setcounter{IndexColumns}{2}%
+\EnableCrossrefs%
+\RecordChanges
+\CodelineIndex
+%\OldMakeindex % use if your MakeIndex is pre-v2.9%
+\begin{document}%
+ \DocInput{keywords.dtx}
+\end{document}
+%</driver>
+% \end{macrocode}
+%
+% \subsection{Extracting the documents included in the file keywords.dtx}
+%
+% There are three documents included in the {\em{}keywords.dtx\/} file:
+% the style file ({\em{}keywords.sty}),
+% the index style file for printing a cross-referenced document
+% ({\em{}keywords.ist}),
+% and the driver file for printing the document: {\em{}keywords.drv\/}.
+%
+% For file extraction it is necessary to use the \verb"docstrip"
+% utility, which is part of the \verb"doc"
+% distribution~\cite{art:doc}.
+% Normally, a file \verb"docstrip.tex" should exist on the \LaTeX\
+% style files directory.
+% Extraction is performed by typing:
+%
+% \begin{verbatim}
+% latex docstrip
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% This is an interactive program, and the dialogue for generating the
+% style file should be:
+%
+% \begin{verbatim}
+% **********************************************************
+% * This program converts documented macro-files into fast *
+% * loadable files by stripping off (nearly) all comments! *
+% **********************************************************
+%
+% ****************************************************
+% * First type the extension of your input file(s): *
+% \infileext=doc
+% ****************************************************
+%
+% ****************************************************
+% * Now type the extension of your output file(s) : *
+% \outfileext=sty
+% ****************************************************
+%
+% ****************************************************
+% * Now type the name(s) of option(s) to include : *
+% \Options=style
+% ****************************************************
+%
+% ****************************************************
+% * Finally give the list of input file(s) without *
+% * extension seperated by commas if necessary : *
+% \filelist=Programs
+% ****************************************************
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% For generating the index file it suffices to rerun the
+% \verb"docstrip" utility and to answer ``ist/index'' instead of
+% ``sty/style'' int the above steps~2 and~3.
+%
+% \medskip
+%
+% The three files may be produced in a single pass, by simply latexing
+% the file {\em{}keywords.ins\/} which goes along with the file
+% {\em{}keywords.dtx\/}.
+%
+% \medskip
+%
+% Generation of the documentation is then simply performed as follows
+% (the {\em{}keywords.dtx\/} file includes its own driver):
+%
+% \begin{verbatim}
+% latex keywords.dtx
+% latex keywords.dtx
+% latex keywords.dtx
+% makeindex -s keywords.ist keywords.idx
+% latex keywords.dtx
+% \end{verbatim}
+%
+% \StopEventually{
+% \begin{thebibliography}{1}
+% \bibitem{book:KnuthA} {\sc D.E. Knuth}.
+% \newblock Computers \& Typesetting (The \TeX book).
+% \newblock Addison-Wesley, Vol. A, 1986.
+% \bibitem{lamport86}{\sc L. Lamport}.
+% \newblock {\em {\LaTeX}: a Document Preparation System}.
+% \newblock Addison-Wesley Publishing Company, 1986.
+% \bibitem{art:doc} {\sc F. Mittelbach}.
+% \newblock The {\tt doc}-option.
+% \newblock {\sl TUGboat}, Vol.~10(2), {\it pp}.~245--273, July
+% 1989.
+% \bibitem{alabau95-d} {\sc M. Alabau}.
+% \newblock The ``{\sf{}programs.sty}'' style file.
+% \newblock March 1995.
+% {\em{}e-mail:\/} {\tt{}Miguel.Alabau@labri.u-bordeaux.fr}
+% \end{thebibliography}
+%
+% } ^^A end \StopEventually
+%
+% \begin{macrocode}
+%<*style>
+% \end{macrocode}
+%
+
+% ^^A **********************************************
+% ^^A ** TECHNICAL DESCRIPTION **
+% ^^A **********************************************
+
+\typeout{Document style `keywords.sty' <1993,1994,1995>}
+
+% \section{Description of Macros}
+%
+% \begin{macro}{\AlreadyDefined@@Keywords}
+% This macro can be tested by any style file to know if the file
+% ``{\sf{}keywords.sty}'' has been input. But it allows a modular
+% programming style similar to the one used with the C~header
+% files.
+% Hence, the first time the ``{\sf{}keywords.sty}'' style file is
+% included all of its body will be included; the second time, the
+% body will not be included.
+% \begin{macrocode}
+\expandafter\ifx\csname AlreadyDefined@@Keywords\endcsname\relax%
+\expandafter\def\csname AlreadyDefined@@Keywords\endcsname{}%
+\else\endinput\fi
+% \end{macrocode}
+% \end{macro}%
+%
+% A test for the existence of this macro is performed for
+% compatability with ancient versions of \LaTeX.
+% \begin{macrocode}
+\@ifundefined{reset@font}{\global\let\reset@font\relax}{}
+% \end{macrocode}
+
+% \subsection{Defining and Re-defining keywords}
+%
+% \begin{macro}{\NewKeyword}
+% \begin{macro}{\@@newkwrd}
+% The \verb+\NewKeyword+ command has three parameters, but the
+% third one is optional. By default it is assumed to be equal to
+% the second one:
+% \begin{macrocode}
+\def\NewKeyword#1#2{\@ifnextchar[{\@@newkwrd{#1}{#2}}{\@@newkwrd{#1}{#2}[#2]}}
+% \end{macrocode}
+% \end{macro}
+%
+% The \verb+\@@newkwrd+ performs the real work. It calls the
+% command \verb+\@@KeywordsCurrentStyle+ whose effect is to define
+% the command \verb+\@@kwrd+ and then invokes this last command.
+% \begin{macrocode}
+\def\@@newkwrd#1#2[#3]{\def#1{\@@KeywordsCurrentStyle{\@@kwrd}{#2}{#3}\@@kwrd}}
+% \end{macrocode}
+% \end{macro}
+
+% \subsection{Defining printing styles}
+%
+% \begin{macro}{\@@TypeStyle}
+% This command is expected to be called with a command name as
+% first parameter. Its effect is to define \verb+#1+ as the
+% command that print \verb+#3+ with style \verb+#2+~:
+% \begin{macrocode}
+\def\@@TypeStyle#1#2#3{\def#1{\mbox{\reset@font#2{}#3\/}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DefineKeywordsStyles}
+% The macro \verb+\DefineKeywordsStyles+ has two parameters, let
+% them be \verb+toto+ and \verb+bf+. Its effect is to define
+% two commands called \verb+\@@toto+ and \verb+\F@@toto+. Each of
+% these two new commands has three parameters: the first one must
+% be the name of a command (the keyword to be defined) and the
+% other two must be two texts associated to the keyword. The
+% \verb+\@@toto+ command will select the first text while the
+% \verb+\F@@toto+ command will select the second text.
+% \begin{macrocode}
+\newif\if@@underline \@@underlinefalse
+\def\DefineKeywordsStyles#1#2{
+ \if@@underline
+ \@namedef{@@#1}##1##2##3{\@@TypeStyle{##1}{#2}{\underline{##2}}}
+ \@namedef{F@@#1}##1##2##3{\@@TypeStyle{##1}{#2}{\underline{##3}}}
+ \else
+ \@namedef{@@#1}##1##2##3{\@@TypeStyle{##1}{#2}{##2}}
+ \@namedef{F@@#1}##1##2##3{\@@TypeStyle{##1}{#2}{##3}}
+ \fi
+% \end{macrocode}
+% A boolean switch is used to select underlined fonts. By default
+% non underlined fonts are used, and a reset to non boolean fonts
+% is performed after every definition of keyword:
+% \begin{macrocode}
+ \@@underlinefalse
+% \end{macrocode}
+% At last two commands are provided to the user: \verb+\totos+ and
+% \verb+\Ftotos+ whose effect is to set the command
+% \verb+\@@KeywordsCurrentStyle+ respectively to \verb+\@@toto+ or
+% \verb+\F@@toto+~:
+% \begin{macrocode}
+ \@namedef{#1s}{\def\@@KeywordsCurrentStyle{\@nameuse{@@#1}}}
+ \@namedef{F#1s}{\def\@@KeywordsCurrentStyle{\@nameuse{F@@#1}}}
+}
+% \end{macrocode}
+% By this way when a command
+%
+% \begin{verbatim}
+% \NewKeyword{\WORD}{SENTENCE1}[SENTENCE2]
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% is issued, then \verb+\WORD+ is defined to
+%
+% \begin{verbatim}
+% \@@KeywordsCurrentStyle{\@@kwrd}{SENTENCE1}{SENTENCE2}\@@kwrd}
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% Hence, every time the command \verb+\WORD+ is issued by the
+% user in the text of its programs, \verb+\@@kwrd+ is redefined
+% and invoked under the running definition of
+% \verb+\@@KeywordsCurrentStyle+.
+% This complicated trick ensures that every keyword, even if it is
+% not defined in the style file (e.g. if it is defined in the text
+% typed by the user) will be typed with the correct font selection.
+% \end{macro}
+
+% \begin{macro}{\DefineUnderlinedKeywordsStyles}
+% This macro serves to switch to underlined fonts:
+% \begin{macrocode}
+\def\DefineUnderlinedKeywordsStyles#1#2{
+ \@@underlinetrue
+ \DefineKeywordsStyles{#1}{#2}
+}
+% \end{macrocode}
+% \end{macro}
+
+% \subsection{Predefined printing styles}
+%
+% The commands in the margin are automatically generated (see above and
+% section~\ref{user:selecting-printing-styles}) by issuing the
+% following commands:
+%
+% \begin{macro}{\ProgKeywords}
+% \begin{macro}{\FProgKeywords}
+% \
+% \begin{macrocode}
+\DefineKeywordsStyles{ProgKeyword}{\bf}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\ttKeywords}
+% \begin{macro}{\FttKeywords}
+% \
+% \begin{macrocode}
+\DefineKeywordsStyles{ttKeyword}{\tt}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\AlgoKeywords}
+% \begin{macro}{\FAlgoKeywords}
+% \
+% \begin{macrocode}
+\DefineKeywordsStyles{AlgoKeyword}{\em}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\UAlgoKeywords}
+% \begin{macro}{\FUAlgoKeywords}
+% \
+% \begin{macrocode}
+\DefineUnderlinedKeywordsStyles{UAlgoKeyword}{\em}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\NormalKeywords}
+% \begin{macro}{\FNormalKeywords}
+% \
+% \begin{macrocode}
+\DefineKeywordsStyles{NormalKeyword}{\relax}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \
+% \begin{macro}{\UFAlgoKeywords}
+% This macro is defined for compatability with previous versions
+% of the style:
+% \begin{macrocode}
+\let\UFAlgoKeywords\FUAlgoKeywords
+% \end{macrocode}
+% \end{macro}
+
+% \subsection{Predefined keywords}
+% \label{default-keywords}
+%
+% The macros below are sorted alphabetically:
+% \begin{macrocode}
+%<style>%% DEFAULT KEYWORDS
+\NewKeyword{\ABORT}{abort}[avorter]
+\NewKeyword{\ABS}{abs}
+\NewKeyword{\ABSTRACT}{abstract}[abstrait]
+\NewKeyword{\ACCEPT}{accept}[accepter]
+\NewKeyword{\ACCESS}{access}[acc\`es]
+\NewKeyword{\ALIASED}{aliased}[alias\'e]
+\NewKeyword{\ALL}{all}[tout]
+\NewKeyword{\ALT}{alt}
+\NewKeyword{\AND}{and}[et]
+\NewKeyword{\APPEND}{append}[ajouter\_\-en\_\-fin]
+\NewKeyword{\ARRAY}{array}[tableau]
+\NewKeyword{\ASSERT}{assert}[assertion]
+\NewKeyword{\ASSIGN}{:=}
+\NewKeyword{\AT}{at}
+\NewKeyword{\BEGIN}{begin}[d\'ebut]
+\NewKeyword{\BLOCK}{block}[bloc]
+\NewKeyword{\BOOLEAN}{boolean}[bool\'een]
+\NewKeyword{\BODY}{body}
+\NewKeyword{\BOT}{$\bot$}
+\NewKeyword{\BOX}{$<>$}
+\NewKeyword{\BY}{by}[pas]
+\NewKeyword{\CASE}{case}[choix]
+\NewKeyword{\CATINDEX}{catindex}
+\NewKeyword{\CHAN}{chan}[canal]
+\NewKeyword{\CHANNEL}{channel}[canal]
+\NewKeyword{\CHAR}{char}[car]
+\NewKeyword{\CHARACTER}{character}[caract\`ere]
+\NewKeyword{\CLOSE}{close}[fermer]
+\NewKeyword{\CO}{co}
+\NewKeyword{\COBEGIN}{cobegin}
+\NewKeyword{\COEND}{coend}
+\NewKeyword{\COMMUTATIVE}{commutative}[commutatif]
+\NewKeyword{\COMPLEX}{complex}[complexe]
+\NewKeyword{\COMPUTE}{compute}[calculer]
+\NewKeyword{\CONNECT}{$\longrightarrow$}
+\NewKeyword{\CONNECTB}{$\Longrightarrow$}
+\NewKeyword{\CONST}{const}
+\NewKeyword{\CONSTANT}{constant}[constante]
+\NewKeyword{\CONSTRAINTS}{constraints}[contraintes]
+\NewKeyword{\CONTINUE}{continue}
+\NewKeyword{\DATA}{data}[donn\'ee]
+\NewKeyword{\DECLARE}{declare}
+\NewKeyword{\DECOMPOSE}{decompose}
+\NewKeyword{\DELAY}{delay}[d\'elai]
+\NewKeyword{\DELTA}{delta}
+\NewKeyword{\DEPTH}{depth}[profondeur]
+\NewKeyword{\DIGITS}{digits}[chiffres]
+\NewKeyword{\DIMENSION}{dimension}
+\NewKeyword{\DIST}{dist}
+\NewKeyword{\DISTRIBUTE}{distribute}[r\'epartir]
+\NewKeyword{\DIV}{div}
+\NewKeyword{\DO}{do}[faire]
+\NewKeyword{\DOALL}{doall}[faire en parall\`ele]
+\NewKeyword{\DOM}{dom}
+\NewKeyword{\DOMAIN}{domain}[domaine]
+\NewKeyword{\DOMAINS}{domains}[domaines]
+\NewKeyword{\DONE}{done}[fait]
+\NewKeyword{\DOPAR}{dopar}[faire en parall\`ele]
+\NewKeyword{\DOWNTO}{downto}[jusqu'\`a]
+\NewKeyword{\DYNAMIC}{dynamic}[dynamique]
+\NewKeyword{\EACH}{each}[chaque]
+\NewKeyword{\EGO}{MyId}[EGO]
+\NewKeyword{\ELSE}{else}[sinon]
+\NewKeyword{\ELSIF}{elsif}[sinon si]
+\NewKeyword{\END}{end}[fin]
+\NewKeyword{\ENDCASE}{end case}[fin choix]
+\NewKeyword{\ENDIF}{end if}[finsi]
+\NewKeyword{\ENDDO}{end do}[fait]
+\NewKeyword{\ENDLOOP}{end loop}[fait]
+\NewKeyword{\ENTRY}{entry}[entr\'ee]
+\NewKeyword{\EOT}{eot}
+\NewKeyword{\EQ}{$=$}
+\NewKeyword{\EXCEPTION}{exception}
+\NewKeyword{\EXIT}{exit}[sortir]
+\NewKeyword{\EXTERNAL}{external}[externe]
+\NewKeyword{\FI}{fi}[finsi]
+\NewKeyword{\FILE}{file}[fichier]
+\NewKeyword{\FIRST}{first}[premier]
+\NewKeyword{\FOR}{for}[pour]
+\NewKeyword{\FORALL}{forall}[pour tout]
+\NewKeyword{\FOREACH}{foreach}[pour chaque]
+\NewKeyword{\FORWARD}{forward}
+\NewKeyword{\FUNCTION}{function}[fonction]
+\NewKeyword{\GE}{$\geq$}
+\NewKeyword{\GENERIC}{generic}[g\'en\'erique]
+\NewKeyword{\GETNODE}{getnode}[prendre\_\-noeud]
+\NewKeyword{\GOTO}{goto}[aller\_\-\`a]
+\NewKeyword{\GRAPH}{graph}[graphe]
+\NewKeyword{\GT}{$>$}
+\NewKeyword{\IF}{if}[si]
+\NewKeyword{\IMPLICATION}{$\Rightarrow$}
+\NewKeyword{\IMPLY}{$\Rightarrow$}
+\NewKeyword{\IMPORT}{import}[importer]
+\NewKeyword{\IN}{in}[dans]
+\NewKeyword{\IND}{ind}
+\NewKeyword{\INDEX}{index}
+\NewKeyword{\INIT}{init}
+\NewKeyword{\INOUT}{inout}
+\NewKeyword{\INPORT}{inport}
+\NewKeyword{\INPUT}{input}
+\NewKeyword{\INTEGER}{integer}[entier]
+\NewKeyword{\INTO}{into}
+\NewKeyword{\IS}{is}[est]
+\NewKeyword{\LABEL}{label}[\'etiquette]
+\NewKeyword{\LAST}{last}[dernier]
+\NewKeyword{\LE}{$\leq$}
+\NewKeyword{\LENGTH}{length}[longueur]
+\NewKeyword{\LIMITED}{limited}[limit\'e]
+\NewKeyword{\LOOP}{loop}[faire]
+\NewKeyword{\LT}{$<$}
+\NewKeyword{\MAP}{map}[placer]
+\NewKeyword{\MOD}{mod}
+\NewKeyword{\MODULE}{module}
+\NewKeyword{\MODULO}{modulo}
+\NewKeyword{\MULTIPLE}{multiple}
+\NewKeyword{\MYID}{MyId}[EGO]
+\NewKeyword{\NE}{$\neq$}
+\NewKeyword{\NEIGHBOUR}{neighbour}[voisin]
+\NewKeyword{\NEIGHBOURS}{neighbours}[voisins]
+\NewKeyword{\NEW}{new}[nouveau]
+\NewKeyword{\NEWBLOCK}{newblock}
+\NewKeyword{\NIL}{nil}
+\NewKeyword{\NODE}{node}[noeud]
+\NewKeyword{\NOT}{not}[non]
+\NewKeyword{\NUL}{nul}
+\NewKeyword{\NULL}{null}[nul]
+\NewKeyword{\OD}{od}[fait]
+\NewKeyword{\ODPAR}{odpar}[fait]
+\NewKeyword{\OF}{of}
+\NewKeyword{\ON}{on}
+\NewKeyword{\OPEN}{open}[ouvrir]
+\NewKeyword{\OR}{or}[ou]
+\NewKeyword{\OTHERS}{others}
+\NewKeyword{\OUT}{out}
+\NewKeyword{\OUTPORT}{outport}
+\NewKeyword{\OUTPOUT}{outpout}
+\NewKeyword{\PACKAGE}{package}[paquetage]
+\NewKeyword{\PARALLEL}{parallel}
+\NewKeyword{\PARFOR}{parfor}[en parall\`ele: pour]
+\NewKeyword{\PAR}{par}[en parall\`ele]
+\NewKeyword{\PERCENT}{\%}
+\NewKeyword{\PLACE}{place}[placer]
+\NewKeyword{\PORT}{port}
+\NewKeyword{\PRAGMA}{pragma}
+\NewKeyword{\PRI}{pri}
+\NewKeyword{\PRIVATE}{private}[priv\'e]
+\NewKeyword{\PROCEDURE}{procedure}[proc\'edure]
+\NewKeyword{\PROCESS}{process}[processus]
+\NewKeyword{\PROGRAM}{program}[programme]
+\NewKeyword{\PROTECTED}{protected}[prot\'eg\'e]
+\NewKeyword{\RAISE}{raise}[lever]
+\NewKeyword{\RANGE}{range}[intervalle]
+\NewKeyword{\READ}{read}[lire]
+\NewKeyword{\READY}{ready}[pr\^et]
+\NewKeyword{\REAL}{real}[r\'eel]
+\NewKeyword{\RECORD}{record}[enregistrement]
+\NewKeyword{\RECV}{recv}[recevoir]
+\NewKeyword{\RECEIVE}{receive}[recevoir]
+\NewKeyword{\REM}{rem}
+\NewKeyword{\RENAMES}{renames}[renomme]
+\NewKeyword{\REPEAT}{repeat}[r\'ep\'eter]
+\NewKeyword{\REQUEUE}{requeue}
+\NewKeyword{\RESET}{reset}
+\NewKeyword{\RETURN}{return}[retour]
+\NewKeyword{\REVERSE}{reverse}
+\NewKeyword{\REWIND}{rewind}
+\NewKeyword{\REWRITE}{rewrite}
+\NewKeyword{\ROOT}{root}[racine]
+\NewKeyword{\SELECT}{select}
+\NewKeyword{\SEND}{send}[\'emettre]
+\NewKeyword{\SENDEOT}{sendeot}[\'emettre eot]
+\NewKeyword{\SEPARATE}{separate}[s\'epar\'ement]
+\NewKeyword{\SEQ}{seq}
+\NewKeyword{\SET}{set}
+\NewKeyword{\SIZE}{size}[taille]
+\NewKeyword{\SKIP}{skip}[sauter]
+\NewKeyword{\STRING}{string}[cha\^{\i}ne de caract\`eres]
+\NewKeyword{\SUBTYPE}{subtype}[sous\_\-type]
+\NewKeyword{\SWITCH}{switch}
+\NewKeyword{\TAGGED}{tagged}[\'etiquett\'e]
+\NewKeyword{\TASK}{task}[t\^ache]
+\NewKeyword{\TERMINATE}{terminate}[terminer]
+\NewKeyword{\THEN}{then}[alors]
+\NewKeyword{\TO}{to}[jusqu'\`a]
+\NewKeyword{\TOWARDS}{towards}[vers]
+\NewKeyword{\TRANSMIT}{transmit}[\'emettre]
+\NewKeyword{\TUPLE}{tuple}[n\_\-uplet]
+\NewKeyword{\TYPE}{type}
+\NewKeyword{\UNDEF}{undef}[ind\'efini]
+\NewKeyword{\UNTIL}{until}[jusqu'\`a]
+\NewKeyword{\USE}{use}
+\NewKeyword{\VAR}{var}
+\NewKeyword{\VARIABLE}{variable}
+\NewKeyword{\WHEN}{when}[si]
+\NewKeyword{\WHERE}{where}[si]
+\NewKeyword{\WHILE}{while}[tant que]
+\NewKeyword{\WITH}{with}[avec]
+\NewKeyword{\WRITE}{write}[\'ecrire]
+\NewKeyword{\XOR}{xor}
+%<style>%%
+%<style>%% French syntax
+%<style>%%
+\NewKeyword{\EMETTRE}{send}[\'emettre]
+\NewKeyword{\RECEVOIR}{receive}[recevoir]
+\NewKeyword{\POUR}{for}[pour]
+\NewKeyword{\FAIRE}{do}[faire]
+\NewKeyword{\FAIT}{end do}[fait]
+\NewKeyword{\SI}{if}[si]
+\NewKeyword{\ALORS}{then}[alors]
+\NewKeyword{\SINON}{else}[sinon]
+\NewKeyword{\FINSI}{end if}[fin si]
+\NewKeyword{\DEBUT}{begin}[d\'ebut]
+\NewKeyword{\FIN}{end}[fin]
+% \end{macrocode}
+% Then we terminate by instructing \LaTeX\ to switch to the default
+% font for typing keywords (which, in the current implementation is
+% underlined \verb+\em+).
+% \begin{macrocode}
+\FUAlgoKeywords
+% \end{macrocode}
+
+% \begin{macrocode}
+%</style>
+% \end{macrocode}
+
+% ^^A The four commented lines below may be used to output an index on
+% ^^A a page layout greater than the one used till now.
+% ^^A -----
+% ^^A \newpage
+% ^^A \setlength{\oddsidemargin}{0pt}
+% ^^A \setlength\textwidth{15cm}
+% ^^A \normalsize
+% ^^A -----
+%
+% \IndexPrologue{%
+% \section*{Index}%
+% \markboth{Index}{Index}%
+% {\it{}The italic numbers denote the pages where the
+% corresponding entry is described,
+% numbers underlined point to the definition,
+% all others indicate the places where it is used
+% (ie. the line numbers where it appears).
+% }}
+% \Finale
+% \newpage
+% \PrintIndex \PrintChanges
diff --git a/macros/latex/contrib/progkeys/keywords.ins b/macros/latex/contrib/progkeys/keywords.ins
new file mode 100644
index 0000000000..6a3e5da4af
--- /dev/null
+++ b/macros/latex/contrib/progkeys/keywords.ins
@@ -0,0 +1,51 @@
+\def\ifToplevel#1{#1}
+
+%%
+%% This file will generate fast loadable files and documentation
+%% driver files from the doc files in this package when run through
+%% LaTeX2e.
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+\def\batchfile{keywords.ins}
+\input docstrip.tex
+\preamble
+
+Copyright: Miguel Alabau, 1995 \space\space\space Miguel.Alabau@labri.u-bordeaux.fr
+
+\endpreamble
+\keepsilent
+
+\Msg{\space\space\space\space *******************************************}
+\Msg{\space\space\space\space ** keywords utility}
+\Msg{\space\space\space\space *******************************************}
+\Msg{}
+
+\Msg{*** Generating the driver file ***}
+\generateFile{keywords.drv}{f}{\from{keywords.dtx}{driver}}
+
+\Msg{*** Generating the document package file ***}
+\generateFile{keywords.sty}{f}{\from{keywords.dtx}{style}}
+
+\Msg{*** Generating the index files for producing the documentation crossrefs ***}
+\generateFile{keywords.ist}{f}{\from{keywords.dtx}{index}}
+
+\ifToplevel{
+\Msg{***********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* files into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space\space\space keywords.sty}
+\Msg{*}
+\Msg{* To produce the documentation of the 'keywords' utility,}
+\Msg{* perform as follows:}
+\Msg{* \space\space\space\space - run three times keywords.drv through LaTeX2e}
+\Msg{* \space\space\space\space - then run 'makeindex -s keywords.ist keywords.idx'}
+\Msg{* \space\space\space\space - then run once keywords.drv through LaTeX2e}
+\Msg{*}
+\Msg{* Happy TeXing}
+\Msg{***********************************************************}
+}
+
+\endinput
diff --git a/macros/latex/contrib/progkeys/keywords.pdf b/macros/latex/contrib/progkeys/keywords.pdf
new file mode 100644
index 0000000000..00482d5d4a
--- /dev/null
+++ b/macros/latex/contrib/progkeys/keywords.pdf
Binary files differ
diff --git a/macros/latex/contrib/progkeys/programs.dtx b/macros/latex/contrib/progkeys/programs.dtx
new file mode 100644
index 0000000000..42d80d8ce6
--- /dev/null
+++ b/macros/latex/contrib/progkeys/programs.dtx
@@ -0,0 +1,1227 @@
+% \iffalse
+%
+% 'programs.dtx'
+%
+% Copyright (C) 1993,1994,1995 by Miguel Alabau. All rights reserved.
+%
+% ENVIRONMENTS FOR EASILY TYPESETTING PROGRAMS
+%
+% **WARNING** If the file 'programs.ins' does not accompany the file
+% 'programs.dtx', then you must strip this last file by hand.
+% (1) Run 'latex docstrip' on 'programs.dtx' and indicate 'drv' as
+% suffix file and 'driver' as selector for extraction.
+% (2) Run 'latex docstrip' on 'programs.dtx' and indicate 'sty' as
+% suffix file and 'style' as selector for extraction.
+% (3) Run 'latex docstrip' on 'programs.dtx' and indicate 'ist' as
+% suffix file and 'index' as selector for extraction.
+% Then, if you want to produce the documentation, proceed as follows:
+% latex programs.drv; latex programs.drv; latex programs.drv
+% makeindex -s programs.ist programs.idx
+% latex programs.drv
+%
+%<style>\NeedsTeXFormat{LaTeX2e}
+%<style>\ProvidesPackage{programs}
+%
+% \fi
+%
+%
+% \def\fileversion{v1.0}
+% \def\filedate{95/04/01}
+% \def\docdate {96/01/31}
+%
+%
+% ^^A -*-LaTeX-*-
+%
+%\catcode`\<=12
+
+% \CheckSum{393}
+%% \CharacterTable
+%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%
+% \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
+% \DoNotIndex{\@flushglue,\@gobble,\@input}
+% \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
+% \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
+% \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
+% \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
+% \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
+% \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
+% \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
+% \DoNotIndex{\cal,\csname,\def,\documentstyle,\dospecials,\edef}
+% \DoNotIndex{\documentclass}
+% \DoNotIndex{\egroup}
+% \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
+% \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
+% \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
+% \DoNotIndex{\ifcase}
+% \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
+% \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
+% \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
+% \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
+% \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
+% \DoNotIndex{\strutbox}
+% \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
+% \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
+% \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
+% \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
+% \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
+% \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
+% \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
+% \DoNotIndex{\nopagebreak}
+% \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
+% \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
+% \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
+% \DoNotIndex{\[,\{,\},\]}
+% \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
+% \DoNotIndex{\baselineskip,\begin,\tw@}
+% \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
+% \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
+% \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
+% \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
+% \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
+% \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
+% \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
+% \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
+% \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
+% \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
+% \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
+% \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
+% \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
+% \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
+% \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
+% \DoNotIndex{\bfdefault}
+%
+% \DoNotIndex{\addtocounter,\baselinestretch,\em,\noindent}
+% \DoNotIndex{\linewidth,\columnwidth,\newcounter,\newif,\newlength}
+% \DoNotIndex{\normalsize,\refstepcounter,\rlap,\rule}
+% \DoNotIndex{\@@tempa,\@@tempb,\@ifnextchar,\@nameuse}
+%
+% \title{The ``{\sf{}programs.sty}'' style file\thanks{%
+% This file has version number \fileversion{} dated \filedate{}.
+% The documentation was last revised on \docdate{}.}}
+%
+% \author{Miguel Alabau\\
+% {\small{}LaBRI, Universit\'e Bordeaux~I (France)}\\
+% {\small{\em{}e-mail\/}: {\tt{}Miguel.Alabau@labri.u-bordeaux.fr}}}
+%
+% \maketitle
+%
+% \begin{abstract}
+% This style file contains a set of definitions that allow a fairly
+% easy pretty-printing of programs.
+% In particular, text alignement is obtained by simply typing
+% {\tt{}space} characters.
+% Emphasized characters, mathematical symbols and commands are
+% directly taken into account.
+% \end{abstract}%
+%
+% \newif\ifmulticols
+% \makeatletter
+% \ifhave@multicol\multicolstrue\else\multicolsfalse\fi
+% \makeatother
+%
+% \begin{footnotesize}
+% \ifmulticols \begin{multicols}{2} \fi
+% \tableofcontents
+% \ifmulticols \end{multicols} \fi
+% \end{footnotesize}
+%
+%
+% \ifmulticols
+% \begin{multicols}{2}[\section{Introduction}]
+% \else \section{Introduction} \fi
+%
+% The \LaTeX\ \verb"verbatim" environment allows for easy typesetting
+% of text. However it is sometimes convenient to type programs that
+% involve some mathematics, some emphasized text or some boldfaced
+% keywords.
+% \LaTeX\ provides the \verb"tabbing" environment for freely
+% typesetting programs. But a cumbersome aspect of this environment is
+% the way tabs are specified: their presence makes the text to be
+% obscured.
+% The file {\em{}programs.sty\/} provides different environments and
+% commands for typesetting programs. Spaces are interpreted as in the
+% \verb"verbatim" environment, avoiding the user to type \verb"\=" and
+% \verb"\>" control characters.
+% Accents, mathematical symbols, emphasized and boldface fonts can be
+% used. Another useful feature is the capability
+% to number lines and to put labels on lines (and, of course, to refer
+% to them).
+%
+% \ifnoprogsfile \relax\else
+%
+% For instance, you may type something like
+% \InBodyLeftNumberLine
+%
+% \begin{verbatim}
+% \begin{programf}
+% function sqrt(x: integer): integer;
+% (* sqrt(x) = $\sqrt{x}$ *)
+% function pow(x,y: real): real;
+% (* pow(x,y) = $x^y$ *)
+% \end{programf}
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% \noindent%
+% which leads to the following output
+%
+% \begin{programf}
+% function sqrt(x: integer): integer;
+% (* sqrt(x) = $\sqrt{x}$ *)
+% function pow(x,y: real): real;
+% (* pow(x,y) = $x^y$ *)
+% \end{programf}
+%
+% \fi
+%
+% It is also possible to typeset the same program in a smaller font,
+% enclosed within two horizontal lines, and with the lines unnumbered.
+%
+% \ifnoprogsfile \relax\else
+%
+% \begin{verbatim}
+% \programsurround
+% \begin{programt}*
+% function sqrt(x: integer): integer;
+% (* sqrt(x) = $\sqrt{x}$ *)
+% function pow(x,y: real): real;
+% (* pow(x,y) = $x^y$ *)
+% \end{programt}
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% \noindent%
+% yielding to the following output:\\
+%
+% \programsurround
+% \begin{programt}*
+% function sqrt(x: integer): integer;
+% (* sqrt(x) = $\sqrt{x}$ *)
+% function pow(x,y: real): real;
+% (* pow(x,y) = $x^y$ *)
+% \end{programt}
+%
+% \fi
+%
+% A set of other options is provided, together with two file inclusion
+% capabilities.
+%
+% \ifmulticols\end{multicols}\fi
+%
+% ^^A **********************************************
+% ^^A ** USERS's MANUAL **
+% ^^A **********************************************
+%
+% \section{User's Manual}
+%
+% In this section, we describe the environments and commands provided by
+% this style file (section~\ref{user:program-environments}).
+% We indicate also three sets of control commands:
+%
+% \begin{itemize}
+% \item{} Global commands, i.e. global switches for the
+% commands/environments of section~\ref{user:program-environments}
+% (section~\ref{user:global-commands}).
+% \item{} Commands whose scope is the next program only
+% (section~\ref{user:running-commands}).
+% \item{} Commands that are used {\em{}within\/} a program environment
+% (section~\ref{user:local-commands}).
+% \end{itemize}
+%
+% The user is provided with two {\em{}meta-commands\/} that allow to
+% define new program environments for some other fonts, or to redefine
+% existing program environments.
+%
+% This section terminates by indicating how to proceed for extracting
+% the different archives from the file {\em{}programs.dtx}.
+%
+% \subsection{Environments for typesetting programs}
+% \label{user:program-environments}
+%
+% The following environments are provided, every one of them
+% corresponding to one of the \LaTeX\ predefined font sizes:
+%
+% \begin{center}
+% \begin{tabular}{ll}
+% \hline
+% \multicolumn{1}{c}{environments} & \multicolumn{1}{c}{sizes}\\
+% \hline\hline
+% program & normalsize \\
+% programl & large \\
+% programL & Large \\
+% programs & small \\
+% programf & footnotesize \\
+% programsc & scriptsize \\
+% programt & tiny \\
+% \hline
+% \end{tabular}
+% \end{center}
+%
+% These environments are to be used like the \verb"verbatim"
+% environment. However they work differently, since the usual \LaTeX\
+% escapes are allowable from within the environment. For instance,
+% math mode as well as emphasized characters may be used.
+%
+% By default, lines are numbered. If someone wants to type an
+% unnumbered text, it is necessary to put a \verb"*" just after the
+% beginning of the environment.
+% \ifnoprogsfile \relax\else
+% For instance:
+%
+% \begin{verbatim}
+% \begin{programL}*
+% <unnumbered text>
+% \end{programL}
+% \end{verbatim}
+% \fi
+%
+% Program indentation obey to the variable \verb"\ProgramIndent" (see
+% section~\ref{user:global-commands}). However, it is possible, for
+% one given environment, not to obey to the global indentation of
+% programs. This is done by indicating another indentation between
+% square braces just after entering the environment.
+% \ifnoprogsfile \relax\else
+% For instance, an unnumbered program indented 2cm from the left
+% margin of the text is:
+%
+% \begin{verbatim}
+% \begin{programL}[2cm]*
+% <unnumbered text>
+% \end{programL}
+% \end{verbatim}
+% \fi
+%
+% There is also a set of inclusion commands similar to the
+% \verb"\verbatimfile" (verbatim inclusion of a file) and
+% \verb"\verbatimlisting" (verbatim inclusion of a file, with
+% numbered lines) commands of the ``{\em{}verbatimfiles.sty\/}'' by
+% Chris Rowley.
+% Of course, the files input by these commands are subject to the same
+% permisive syntax as for the environments above (math syntax,
+% emphasized text, {\em{}etc.\/}).
+%
+% \begin{center}
+% \begin{tabular}{lll}
+% \hline
+% \multicolumn{3}{c}{program inclusion commands} \\
+% \hline
+% \multicolumn{1}{c}{unnumbered programs}
+% & \multicolumn{1}{c}{numbered programs}
+% & \multicolumn{1}{c}{sizes}\\
+% \hline\hline
+% \verb"\"fprogram & \verb"\"lprogram & normalsize \\
+% \verb"\"fprograml & \verb"\"lprograml & large \\
+% \verb"\"fprogramL & \verb"\"lProgramL & Large \\
+% \verb"\"fprograms & \verb"\"lprograms & small \\
+% \verb"\"fprogramf & \verb"\"lprogramf & footnotesize \\
+% \verb"\"fprogramsc & \verb"\"lprogramsc & scriptsize \\
+% \verb"\"fprogramt & \verb"\"lprogramt & tiny \\
+% \hline
+% \end{tabular}
+% \end{center}
+%
+% We describe in section~\ref{user:meta-commands} how to define new
+% program environments.
+%
+% \subsection{Global commands}
+% \label{user:global-commands}
+%
+% \DescribeMacro{\ProgramIndent}
+% This command serves to control the default indentation of the
+% programs.
+% It is used as described below:
+% \begin{verbatim}
+% \ProgramIndent{1cm}
+% \end{verbatim}
+% \vspace{-\baselineskip}
+% and has the effect to make all the programs to be indented by
+% default one centimeter from the left margin, unless this value is
+% changed by another \verb"\ProgramIndent" command.
+% Default is no indentation at all.
+%
+% \DescribeMacro{\programindent}
+% This macro redefines the macro \verb+\ProgramIndent+.
+% It is present here for compatibility with previous versions of the
+% {\em{}programs.sty\/} style.
+%
+% \DescribeMacro{\LeftMarginNumberLine}
+% \DescribeMacro{\RightMarginNumberLine}
+% \DescribeMacro{\BothMarginsNumberLine}
+% \DescribeMacro{\InBodyLeftNumberLine}
+% These four commands are self-explanatory.
+% They allow the user to specify that line numbers must be put in
+% either the left or the right margin, or in both margins, or that lines
+% must appear inside the body of the text on the left of the program.
+% These options may be put anywhere in the text, in the preamble as
+% well as in the body.
+% The effect of one of these commands stands until it is changed by
+% another one of them.
+% Of course, different commands may be put in several parts of the text,
+% if the user wants its programs to be numbered differently.
+% The default is for the lines to appear in the left margin of the
+% text (\verb"\LeftMarginNumberLine").
+%
+% \DescribeMacro{\BothMarginNumberLine}
+% This macro redefines the macro \verb+\BothMarginsNumberLine+.
+% It is present here for compatibility with previous versions of the
+% {\em{}programs.sty\/} style.
+%
+% \DescribeMacro{\ttProgram}
+% \DescribeMacro{\rmProgram}
+% \DescribeMacro{\emProgram}
+% Text of programs are usually typed with a teletype font (like in the
+% \verb"verbatim" environment). The user has the ability to change
+% this default font to one of the three predefined fonts: teletype,
+% roman, italicized roman.
+%
+% \DescribeMacro{\ProgramDefaultFont}
+% The command \verb"\ProgramDefaultFont" serves to reset the printing
+% to the default font.
+%
+% \subsection{Commands to be used before a program environment}
+% \label{user:running-commands}
+%
+% \DescribeMacro{\ProgramSurround}
+% Programs are usually typeset as they are.
+% However a user can specify that the next program to be printed will
+% be surrounded by two horizontal lines, as long as the width of the
+% text.
+% This is done by putting this command in the body of the text before
+% the program appears.
+%
+% \DescribeMacro{\programsurround}
+% This macro redefines the macro \verb+\ProgramSurround+.
+% It is present here for compatibility with previous versions of the
+% {\em{}programs.sty\/} style.
+%
+% \DescribeMacro{\SetProgramCounter}
+% By default, program lines are counted from~$1$.
+% It is possible to change the value of the first line number of the
+% next program by issuing the following command before the program is
+% included:
+%
+% \begin{verbatim}
+% \SetProgramCounter{6}
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}
+% In this example, the lines of the next program will start from~$6$.
+%
+% \DescribeMacro{\setprogramcounter}
+% This macro redefines the macro \verb+\SetProgramCounter+.
+% It is present here for compatibility with previous versions of the
+% {\em{}programs.sty\/} style.
+%
+% \DescribeMacro{\NoResetProgramCounter}
+% If the user desires that the number of the first line of the next
+% program is equal to the number of the last line of the last previous
+% program, he must issue the command \verb"\NoResetProgramCounter"
+% before the next program.
+% This command has no effect if issued before the first program.
+%
+% \DescribeMacro{\noresetprogramcounter}
+% This macro redefines the macro \verb+\NoResetProgramCounter+.
+% It is present here for compatibility with previous versions of the
+% {\em{}programs.sty\/} style.
+%
+% \subsection{Commands to be used inside a program environment}
+% \label{user:local-commands}
+%
+% \DescribeMacro{\UnnumLine}
+% \label{user:unnumline}
+% This command is to be used only {\em{}within\/} programs.
+% It must appear at the end of a line and has the effect not to number
+% the following line.
+% It serves when the user wants to keep only one unique line number for
+% long statements that span accross several lines.
+%
+% \DescribeMacro{\unnumline}
+% This macro redefines the macro \verb+\UnnumLine+.
+% It is present here for compatibility with previous versions of the
+% {\em{}programs.sty\/} style.
+%
+% \subsection{Meta-Commands: how to define new program environments}
+% \label{user:meta-commands}
+%
+% \DescribeMacro{\NewProgram}
+% \DescribeMacro{\RenewProgram}
+% \label{user:newprogram}
+% The \verb"\NewProgram" command serves to define a new program
+% environment.
+% The \verb"\RenewProgram" command is to be used for redefining already
+% defined program environments.
+% These commands must be used as below:
+% \begin{quote}
+% \verb"\NewProgram"\{{\em{}name\/}\}\{{\em{}font\_name\/}\} \\
+% \verb"\RenewProgram"\{{\em{}name\/}\}\{{\em{}font\_name\/}\}
+% \end{quote}
+%
+% The command \verb"\NewProgram" defines one environment and two
+% commands. Let us assume that the user issues the following command:
+%
+% \begin{verbatim}
+% \NewProgram{LittleProg}{smallsize}
+% \end{verbatim}
+%
+% \vspace{-\baselineskip}%
+% then an environment called \verb"LittleProg" will be generated for
+% direct typesetting of programs, and two commands will be created:
+% \verb"fLittleProg" and \verb"lLittleProg" for inclusion of
+% unnumbered (resp. numbered) text.
+%
+% \DescribeMacro{\newprogram}
+% \DescribeMacro{\renewprogram}
+% These two macros are old names present here for compatibility with
+% previous versions of the {\em{}programs.sty\/} style.
+% \verb+\newprogram+ redefines \verb+\NewProgram+, and
+% \verb+\renewprogram+ redefines \verb+\RenewProgram+.
+%
+% \subsection{The Index File}
+%
+% In order for the processing of this file to be complete, an index
+% format file is required. Let us assume that it is named
+% \verb+programs.ist+, then the following command must be run and then
+% another compilation of the current file:
+%
+% \begin{macrocode}
+%<index>
+%<index>%% -----------------------------------------------------------
+%<index>%% Assuming this file is named "programs.ist" (after being
+%<index>%% generated from "programs.dtx" by running "latex docstrip"),
+%<index>%% the following command will produce a well formated index:
+%<index>%%
+%<index>%% makeindex -s programs.ist programs.idx
+%<index>%% -----------------------------------------------------------
+%<index>
+% \end{macrocode}
+%
+% Another possibility is to set the environment variable
+% \verb+INDEXSTYLE+ to a directory name where the ``.ist'' files
+% (index format files) may be found.
+%
+% A possible index file is given below\footnote{It can be generated by
+% invoquing the compilation of ``docstrip'' with the ``index''
+% option.}:
+%
+% \begin{macrocode}
+%<index>actual '='
+%<index>quote '!'
+%<index>level '>'
+%<index>preamble
+%<index>"\n \\begin{theindex} \n \\makeatletter\\scan@allowedfalse\n"
+%<index>postamble
+%<index>"\n\n \\end{theindex}\n"
+%<index>item_x1 "\\efill \n \\subitem "
+%<index>item_x2 "\\efill \n \\subsubitem "
+%<index>delim_0 "\\pfill "
+%<index>delim_1 "\\pfill "
+%<index>delim_2 "\\pfill "
+%<index>% The next lines will produce some warnings when
+%<index>% running Makeindex as they try to cover two different
+%<index>% versions of the program:
+%<index>lethead_prefix "{\\bf\\hfil "
+%<index>lethead_suffix "\\hfil}\\nopagebreak\n"
+%<index>lethead_flag 1
+%<index>heading_prefix "{\\bf\\hfil "
+%<index>heading_suffix "\\hfil}\\nopagebreak\n"
+%<index>headings_flag 1
+% \end{macrocode}
+%
+% \subsection{The Driver File}
+%
+% There is also a driver file, called {\em{}programs.drv\/}, that is
+% included in the distribution.
+% It is devoted to control the latex compilation of the documentation.
+% Its code is given below.
+%
+% \begin{macrocode}
+%<*driver>
+\newif\ifnoprogsfile
+\openin1 programs.sty
+\ifeof1 \noprogsfiletrue\else\noprogsfilefalse\fi\closein1
+\ifnoprogsfile
+ \typeout{*******************************************************}
+ \typeout{To get a more complete documentation, you should}
+ \typeout{copy the current file into 'programs.sty'}
+ \typeout{*******************************************************}
+\fi
+\ifnoprogsfile
+ \documentclass{ltxdoc}
+\else
+ \documentclass{ltxdoc}
+ \usepackage{programs}
+\fi
+\MakePercentIgnore%
+%
+\setlength{\textwidth}{31pc}%
+\setlength{\textheight}{54pc}%
+\setlength{\parindent}{0pt}%
+\setlength{\parskip}{2pt plus 1pt minus 1pt}%
+\setlength{\oddsidemargin}{8pc}%
+\setlength{\marginparwidth}{8pc}%
+\setlength{\topmargin}{-2.5pc}%
+\setlength{\headsep}{20pt}%
+\setlength{\columnsep}{1.5pc}%
+\setlength{\columnwidth}{18.75pc}%
+%%
+\setcounter{IndexColumns}{2}%
+\EnableCrossrefs%
+\RecordChanges
+\CodelineIndex
+%\OldMakeindex % use if your MakeIndex is pre-v2.9%
+\begin{document}%
+ \DocInput{programs.dtx}
+\end{document}
+%</driver>
+% \end{macrocode}
+%
+% \subsection{Extracting the documents included in the file programs.dtx}
+%
+% There are three documents included in the {\em{}programs.dtx\/} file:
+% the style file ({\em{}programs.sty}),
+% the index style file for printing a cross-referenced document
+% ({\em{}programs.ist}),
+% and the driver file for printing the document: {\em{}programs.drv\/}.
+%
+% For file extraction it is necessary to use the \verb"docstrip"
+% utility, which is part of the \verb"doc"
+% distribution~\cite{art:doc}.
+% Normally, a file \verb"docstrip.tex" should exist on the \LaTeX\
+% style files directory.
+% Extraction is performed by typing:
+%
+% \begin{verbatim}
+% latex docstrip
+% \end{verbatim}
+%
+% This is an interactive program, and the dialogue for generating the
+% style file should be:
+%
+% \begin{verbatim}
+% **********************************************************
+% * This program converts documented macro-files into fast *
+% * loadable files by stripping off (nearly) all comments! *
+% **********************************************************
+%
+% ****************************************************
+% * First type the extension of your input file(s): *
+% \infileext=doc
+% ****************************************************
+%
+% ****************************************************
+% * Now type the extension of your output file(s) : *
+% \outfileext=sty
+% ****************************************************
+%
+% ****************************************************
+% * Now type the name(s) of option(s) to include : *
+% \Options=style
+% ****************************************************
+%
+% ****************************************************
+% * Finally give the list of input file(s) without *
+% * extension seperated by commas if necessary : *
+% \filelist=programs
+% ****************************************************
+% \end{verbatim}
+%
+% For generating the index file it suffices to rerun the
+% \verb"docstrip" utility and to answer ``ist/index'' instead of
+% ``sty/style'' int the above steps~2 and~3, and in another run to
+% answer "drv/driver".
+%
+% \medskip
+%
+% The three files may be produced in a single pass, by simply latexing
+% the file {\em{}programs.ins\/} which goes along with the file
+% {\em{}programs.dtx\/}.
+%
+% \medskip
+%
+% Generation of the documentation is then simply performed as follows:
+%
+% \begin{verbatim}
+% latex programs.drv
+% latex programs.drv
+% latex programs.drv
+% makeindex -s programs.ist programs.idx
+% latex programs.drv
+% \end{verbatim}
+%
+% \StopEventually{
+% \begin{thebibliography}{1}
+% \bibitem{book:KnuthA} {\sc D.E. Knuth}.
+% \newblock Computers \& Typesetting (The \TeX book).
+% \newblock Addison-Wesley, Vol. A, 1986.
+% \bibitem{lamport86}{\sc L. Lamport}.
+% \newblock {\em {\LaTeX}: a Document Preparation System}.
+% \newblock Addison-Wesley Publishing Company, 1986.
+% \bibitem{art:doc} {\sc F. Mittelbach}.
+% \newblock The {\tt doc}-option.
+% \newblock {\sl TUGboat}, Vol.~10(2), {\it pp}.~245--273, July
+% 1989.
+% \bibitem{art:docstrip} {\sc F. Mittelbach, D. Duchier and
+% J. Braams}.
+% \newblock {\tt docstrip.dtx}~.
+% \newblock The file is part of the DOC package.
+% \end{thebibliography}
+%
+% } ^^A end \StopEventually
+%
+% \begin{macrocode}
+%<*style>
+% \end{macrocode}
+%
+
+% ^^A **********************************************
+% ^^A ** TECHNICAL DESCRIPTION **
+% ^^A **********************************************
+
+\typeout{Document style `programs.sty' <1993,1994,1995>}
+
+% \section{Description of Macros}
+%
+% \begin{macro}{\AlreadyDefined@@Programs}
+% This macro can be tested by any style file to know if the file
+% ``{\sf{}programs.sty}'' has been input. But it allows a modular
+% programming style similar to the one used with the C~header
+% files.
+% Hence, the first time the ``{\sf{}programs.sty}'' style file is
+% included all of its body will be included; the second time, the
+% body will not be included.
+% \begin{macrocode}
+\expandafter\ifx\csname AlreadyDefined@@Programs\endcsname\relax%
+\expandafter\def\csname AlreadyDefined@@Programs\endcsname{}%
+\else\endinput\fi
+% \end{macrocode}
+% \end{macro}%
+
+% \subsection{Controlling program indentation}
+%
+% \begin{macro}{\ProgramIndent}
+% \begin{macro}{\@@programindent}
+% \verb"\@@programindent" is the amount of program indentation for
+% the left margin of the text.
+% Initially, it is set to \verb"\z@"\ :
+% \begin{macrocode}
+%<style>%% CONTROLLING PROGRAM INDENTATION
+\newdimen\@@programindent
+\@@programindent=\z@
+% \end{macrocode}
+% \end{macro}
+%
+% The \verb"\ProgramIndent" has the only effect to set the variable
+% of \verb"\@@programindent" to the value indicated by its
+% parameter:
+% \begin{macrocode}
+\def\ProgramIndent#1{\@@programindent=#1}
+% \end{macrocode}
+% \end{macro}
+
+% \subsection{Surrounding programs by rules}
+%
+% \begin{macro}{\ProgramSurround}
+% \begin{macro}{\if@@surround}
+% By default, a program is printed as is, but it is possible to
+% indicate that it is going to be enclosed within two
+% \verb"\hrule":
+% \begin{macrocode}
+%<style>%% SURROUNDING PROGRAMS BY RULES
+\newif\if@@surround\@@surroundfalse
+\def\ProgramSurround{\@@surroundtrue}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@@progline}
+% \begin{macro}{\@@noprogline}
+% These two macros define the shape of the surrounding lines.
+% The definition of \verb"\@@progline" is such that the surrounding
+% lines lengths are always equal to the width of the current line
+% (even if it is changed from one program to another).
+% \begin{macrocode}
+\def\@@progline{\def\@@prgln{\rule{\linewidth}{0.1mm}}\@@prgln}
+\def\@@noprogline{\rule{0pt}{0pt}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+
+% \subsection{Line numbering}
+%
+% \begin{macro}{\@@defaultindent}
+% The purpose of this macro is to keep space enough for printing
+% the line numbers of the programs.
+% I have defined its length for make it easy printing long
+% programs (thousands of lines).
+% \begin{macrocode}
+%<style>%% LINE NUMBERING
+\newlength{\@@defaultindent}
+\settowidth{\@@defaultindent}{{\tt{}12345}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\if@@resetlineno}
+% \begin{macro}{\if@@unnumline}
+% \begin{macro}{\if@@CurrentProgIsUnnumbered}
+% These three conditions serve to indicate the printing status of
+% the current program.
+% More precisely, \verb"\if@@resetlineno" is a boolean flag to
+% specify if line numbering must be reset for the next program.
+% It defaults to true.
+% \verb"\if@@unnumline" is a boolean flag to specify that the next
+% line to be printed is not to be numbered.
+% It defaults to false (i.e. every line is numbered, by default).
+% \verb"\if@@CurrentProgIsUnnumbered" is a global flag for the
+% program, that indicates if the program being printed is numbered
+% or not.
+% It defaults to false (i.e. programs are numbered, by default).
+% \begin{macrocode}
+\newif\if@@resetlineno \@@resetlinenotrue \newif\if@@unnumline
+\@@unnumlinefalse
+\newif\if@@CurrentProgIsUnnumbered \@@CurrentProgIsUnnumberedfalse
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+
+% \begin{macro}{\NoResetProgramCounter}
+% This macro is provided to the user to specify that the first line
+% number of the next program must be equal to the last line number
+% of the previous program.
+% More precisely, lines for the next program will be numbered from
+% \verb"\@@lineno + 1".
+% \begin{macrocode}
+\def\NoResetProgramCounter{\@@resetlinenofalse}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\UnnumLine}
+% As said in section~\ref{user:unnumline}, this macro must appear
+% at the end of a program line.
+% Its effect is to set on the boolean flag \verb"\@@unnumlinetrue"
+% to prevent the macro \verb"\@@xnewprog" from numbering the next line
+% of the program.
+% The ``\verb"\ "'' that appears ahead of the macro serves to make
+% the command valid even if issued on an empty line.
+% \begin{macrocode}
+\def\UnnumLine{\ \@@unnumlinetrue}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{@@lineno}
+% \begin{macro}{\SetProgramCounter}
+% This is the definition of a counter for the program lines.
+% Once the macro \verb"\SetProgramCounter" called, its effect is to
+% make lines starting from the value indicated as param \verb"#1".
+% Of course, if the user issues a \verb"\SetProgramCounter"
+% command, it is implicitly assumed that he wants the lines to be
+% numbered.
+% That is why the condition \verb"\if@@resetlineno" is set to
+% false.
+% \begin{macrocode}
+\newcounter{@@lineno}\setcounter{@@lineno}{1}
+\def\SetProgramCounter#1{\setcounter{@@lineno}{#1}\@@resetlinenofalse}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+
+% \begin{macro}{@@dummylineno}
+% This little trick is an internal line counter for the unnumbered
+% programs.
+% It is necessary for making it possible to put labels on
+% lines in unnumbered programs, and refer to them.
+% Internal numbering of unnumbered programs always begins at~$1$.
+% \begin{macrocode}
+\newcounter{@@dummylineno}\setcounter{@@dummylineno}{1}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\LeftMarginNumberLine}
+% \begin{macro}{\RightMarginNumberLine}
+% \begin{macro}{\BothMarginsNumberLine}
+% \begin{macro}{\InBodyLeftNumberLine}
+% \begin{macro}{\@@PlaceOfNumbers}
+% The first four commands are provided to the user for
+% indicating line number placement.
+% They have the only effect to change the value of
+% \verb"\@@PlaceOfNumbers" which is an internal value whose purpose
+% is to define where the line numbers are to appear on the text.
+% It is used by the macro \verb"\@@xnewprog".
+% \begin{macrocode}
+\def\LeftMarginNumberLine{\let\@@PlaceOfNumbers\@@LeftMarginNumberLine}
+\def\RightMarginNumberLine{\let\@@PlaceOfNumbers\@@RightMarginNumberLine}
+\def\BothMarginsNumberLine{\let\@@PlaceOfNumbers\@@BothMarginsNumberLine}
+\def\InBodyLeftNumberLine{\let\@@PlaceOfNumbers\@@InBodyLeftNumberLine}
+\def\@@LeftMarginNumberLine{0} \def\@@RightMarginNumberLine{1}
+\def\@@BothMarginsNumberLine{2}
+\def\@@InBodyLeftNumberLine{3}
+% \end{macrocode}
+%
+% For more readability, a
+% \begin{macrocode}
+\LeftMarginNumberLine
+% \end{macrocode}
+% command is issued, in order to initialize
+% \verb"\@@PlaceOfNumbers".
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+
+% \subsection{Program default fonts}
+%
+% \begin{macro}{\@@DefaultProgramFont}
+% Text of programs is usually typed with a teletype font (like in
+% the \verb"verbatim" environment).
+% Default font printing is controlled by this counter.
+% Its value is used in the macro \verb"\@@astyped" described
+% elsewhere in this document.
+% \begin{macrocode}
+%<style>%% PROGRAM DEFAULT FONTS
+\def\@@DefaultProgramFont{0}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ttProgram}
+% \begin{macro}{\rmProgram}
+% \begin{macro}{\emProgram}
+% \begin{macro}{\ProgramDefaultFont}
+% These commands allow the user to change the default font of the
+% programs. This is performed by redefining the running macros
+% \verb"\@@astyped" and \verb"\@@program".
+% \begin{macrocode}
+\def\ttProgram{\def\@@DefaultProgramFont{0}\def@@astyped\def@@program}
+\def\rmProgram{\def\@@DefaultProgramFont{1}\def@@astyped\def@@program}
+\def\emProgram{\def\@@DefaultProgramFont{2}\def@@astyped\def@@program}
+\def\ProgramDefaultFont{\ttProgram}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+
+% \subsection{The real environment}
+%
+% \begin{macro}{\@@vobeyspaces}
+% \begin{macro}{\@@xobeysp}
+% We first begin by redefining the space character that will be
+% used in the \verb"@@astyped" environment.
+% It is important to let a space after the occurrence of
+% \verb"\let" below, since at this point space characters are
+% become active.
+% If \verb"\@@xobeysp" had been issued on a different line, a risk
+% would have existed to have space redefined to empty space.
+% \begin{macrocode}
+%<style>%% THE REAL ENVIRONMENT
+{\catcode`\ =\active\gdef\@@vobeyspaces{\catcode`\ \active\let \@@xobeysp}}
+\def\@@xobeysp{\leavevmode\penalty10000\ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\def@@astyped}
+% \begin{macro}{\@@astyped}
+% \begin{macro}{\end@@astyped}
+% Then, we define the \verb"@@astyped" environment by the means of
+% its two macros \verb"\@@astyped" and \verb"\end@@astyped".
+% It is very strongly related to the \verb"astyped"
+% environment~\cite{astyped88}. However, rather than directly using
+% the \verb"astyped" environment, I have prefered to make the
+% {\em{}programs.sty\/} style file independent.
+%
+% \verb"\def@@astyped" causes the \verb"@@astyped" environment
+% to be defined. This is because we want a different
+% \verb"@@astyped" environment to be defined for every new
+% \verb"program" environment, because fonts may have changed, hence
+% spacing may differ from one environment to another one.
+% \begin{macrocode}
+\def\def@@astyped{%
+ \def\@@astyped{%
+ \partopsep\z@%
+ \topsep\z@%
+ \trivlist \item[]%
+ \leftskip\@totalleftmargin%
+ \rightskip\z@%
+ \parindent\z@%
+ \parfillskip\@flushglue%
+ \parskip\z@%
+ \@tempswafalse%
+ \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par}%
+ \obeylines%
+ \ifcase\@@DefaultProgramFont \tt\or \rm\or \em\else \tt\fi
+ \catcode``=13 \@noligs%
+ \let\do\@makeother \do\ \do\^^K\do\^^A%
+ \frenchspacing\@@vobeyspaces%
+ \noindent\hspace{\parindent}%
+ \if@@surround\@@progline\else\@@noprogline\fi%
+ \nopagebreak%
+ }
+ \def\end@@astyped{%
+ \nopagebreak%
+ \noindent\hspace{\parindent}%
+ \if@@surround\@@progline\else\@@noprogline\fi%
+ \endtrivlist%
+ }
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+
+% \subsection{Meta-commands for defining new program environments}
+%
+% \begin{macro}{\NewProgram}
+% \begin{macro}{\RenewProgram}
+% \begin{macro}{\@@newprog}
+% The command \verb"\NewProgram" (resp. \verb"\RenewProgram") can
+% be used to define (resp. redefine) new program environments. The
+% first parameter is the name of a program environment to be
+% created, and the second one is the name of a size for the police
+% (e.g. {\em{}smallsize}, {\em{}tiny}, {\em{}etc}.).
+% See section~\ref{user:meta-commands} for an example.
+%
+% I have defined \verb"\RenewProgram" same as \verb"\NewProgram"
+% because I am too lazzy, but it should test if the environment to
+% be redefined has been previously defined.
+% \begin{macrocode}
+%<style>%% META-COMMANDS FOR DEFINING NEW PROGRAM ENVIRONMENTS
+\def\NewProgram#1#2{\@@newprog{#1}{#2}}
+\def\RenewProgram#1#2{\@@newprog{#1}{#2}}
+\def\@@newprog#1#2{%
+ \@namedef{#1}{%
+ \begingroup\def\@@tempa{\@nameuse{#2}}%
+ \def\@@tempb{\baselinestretch}\def\baselinestretch{1}%
+ \@ifundefined{@@tempa}{\normalsize}{\@@tempa}%
+ \def@@astyped\@@astyped%
+ \@ifnextchar[{\@@xnewprog}{\@@xnewprog[\@@programindent]}%
+ }%
+ \@namedef{end#1}{%
+ \everypar{}%
+% \end{macrocode}
+% The little trick below is necessary because \verb"\@@lineno" is
+% incremented by 1 at the beginning of every \verb"program"
+% environment (see \verb"\@@xnewprog" below).
+% Hence, when \verb"\NoResetProgramCounter" is used, the line
+% numbers of the last line of the previous program and the first
+% line of the new program would be the same.
+% The condition below avoids this drawback.
+% \begin{macrocode}
+ \if@@CurrentProgIsUnnumbered \relax%
+ \else%
+ \addtocounter{@@lineno}{1}%
+ \fi%
+ %
+ \end@@astyped%
+ \let\baselinestretch=\@@tempb\endgroup%
+ \global\@@resetlinenotrue%
+ \global\ProgramDefaultFont%
+ \global\@@surroundfalse%
+ }%
+% \end{macrocode}
+% At last, if actual value of parameter \verb+#1+ is \verb+FOO+, we
+% define two file inclusion commands: \verb+\fFOO+ and \verb+lFOO+
+% for inclusion of unnumbered and numbered programs
+% (see section~\ref{user:program-environments}).
+% \begin{macrocode}
+ \@namedef{f#1}##1{\@nameuse{#1}*\par\input##1\@nameuse{end#1}}%
+ \@namedef{l#1}##1{\@nameuse{#1}\par\input##1\@nameuse{end#1}}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+
+% \begin{macro}{\@@numlinelength}
+% \begin{macro}{\@@xnewprog}
+% The macro \verb"\@@xnewprog" performs the printing of the lines.
+% \begin{macrocode}
+\newlength{\@@numlinelength}
+\def\@@xnewprog[#1]{%
+% \end{macrocode}
+% If the first character is the symbol \verb+*+ then no line
+% numbers are printed.
+% \begin{macrocode}
+ \@ifstar{%
+ \@@CurrentProgIsUnnumberedtrue
+ \setcounter{@@dummylineno}{0}%
+ \leavevmode%
+ \everypar{%
+ \refstepcounter{@@dummylineno}%
+ \@@unnumlinefalse%
+ \noindent\hspace{#1}}%
+ }%
+% \end{macrocode}
+% Otherwise, this is the normal case:
+% \begin{macrocode}
+ {%
+ \@@CurrentProgIsUnnumberedfalse
+ \if@@resetlineno%
+ \setcounter{@@lineno}{0}%
+ \else%
+ \addtocounter{@@lineno}{-1}%
+ \fi%
+ \leavevmode%
+ \everypar{%
+ \if@@unnumline%
+% \end{macrocode}
+% I decided to make a default indentation on the left side of the
+% unnumbered program if the user has requested a numbering on the
+% left side of the page for the numbered programs.
+% This is to keep an homogeneous layout.
+% \begin{macrocode}
+ \ifx \@@PlaceOfNumbers\@@InBodyLeftNumberLine%
+ \hspace{\@@defaultindent}%
+ \rule{0pt}{0pt}%
+ \fi
+% \end{macrocode}
+% Otherwise, for numbered programs, we begin by incrementing the
+% line counter and making it possible a reference to the line
+% number to be done (see the {\em{}latex.tex\/}\footnote{This file
+% is part of the \LaTeX\ distribution.} file for explanations on
+% \verb"\refstepcounter").
+% \begin{macrocode}
+ \else%
+ \refstepcounter{@@lineno}%
+% \end{macrocode}
+% Then, we look at the placement of the line numbers, which is
+% controlled by the variable \verb"\@@PlaceOfNumbers":
+% \begin{macrocode}
+ \ifx \@@PlaceOfNumbers\@@LeftMarginNumberLine%
+ \llap{{\rm\the@@lineno\ \ }}%
+ \else \ifx \@@PlaceOfNumbers\@@RightMarginNumberLine%
+ \noindent\hspace{\columnwidth}%
+ \rlap{{\rm\ \ \the@@lineno}}%
+ \noindent\hspace{-\columnwidth}%
+ \else \ifx \@@PlaceOfNumbers\@@BothMarginsNumberLine%
+ \noindent\hspace{\columnwidth}%
+ \rlap{{\rm\ \ \the@@lineno}}%
+ \noindent\hspace{-\columnwidth}%
+ \llap{{\rm\the@@lineno\ \ }}%
+ \else \ifx \@@PlaceOfNumbers\@@InBodyLeftNumberLine%
+ \hspace{\@@defaultindent}%
+ \rule{0pt}{0pt}%
+ \llap{{\rm\the@@lineno\ \ }}%
+ \else
+% \end{macrocode}
+% Otherwise (default case), numbers are printed on the left margin
+% of the page:
+% \begin{macrocode}
+ \llap{{\rm\the@@lineno\ \ }}%
+ \fi\fi\fi\fi
+% \end{macrocode}
+% Then we reset the boolean flag
+% {\makeatletter\verb"\@@unnumlinefalse"} in order
+% to make the next line to be numbered (of course, this is useful
+% only if the program is numbered), and we indent the program
+% according to what was requested by the user.
+% \begin{macrocode}
+ \fi\@@unnumlinefalse%
+ \noindent\hspace{#1}%
+ }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+
+% \subsection{Predefined environments and commands}
+%
+% \begin{macro}{\def@@program}
+% \begin{macro}{\ProgramDefaultFont}
+% This command serves to define the environments and commands
+% described in section~\ref{user:program-environments}.
+% It is invoked by the \verb"\ProgramDefaultFont" command.
+% \begin{macrocode}
+%<style>%% PREDEFINED ENVIRONMENTS AND COMMANDS
+\def\def@@program{%
+ \NewProgram{program}{normalsize}
+ \NewProgram{programl}{large}
+ \NewProgram{programL}{Large}
+ \NewProgram{programs}{small}
+ \NewProgram{programf}{footnotesize}
+ \NewProgram{programsc}{scriptsize}
+ \NewProgram{programt}{tiny}
+}
+% \end{macrocode}
+% Then we terminate by instructing \LaTeX\ to switch to the default
+% font for typing programs (which, in the current implementation is
+% \verb+\tt+ in order to have a behaviour consistent with the
+% \verb+verbatim+ environment).
+% \begin{macrocode}
+\ProgramDefaultFont
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+
+% \subsection{Old macro names present here for compatibility reasons}
+%
+% \begin{macro}{\newprogram}
+% \begin{macro}{\renewprogram}
+% \begin{macro}{\noresetprogramcounter}
+% \begin{macro}{\programindent}
+% \begin{macro}{\programsurround}
+% \begin{macro}{\setprogramcounter}
+% \begin{macro}{\unnumline}
+% \begin{macro}{\BothMarginNumberLine}
+% These macro names are simple redefinitions of macros defined
+% elsewhere in this document style.
+% They are present here because they had been defined in previous
+% versions of this style.
+% \begin{macrocode}
+%<style>%% OLD MACRO NAMES PRESENT HERE FOR COMPATIBILITY REASONS
+\let\newprogram=\NewProgram \let\renewprogram=\RenewProgram
+\let\noresetprogramcounter=\NoResetProgramCounter
+\let\programindent=\ProgramIndent
+\let\programsurround=\ProgramSurround
+\let\setprogramcounter=\SetProgramCounter \let\unnumline=\UnnumLine
+\let\BothMarginNumberLine=\BothMarginsNumberLine
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+
+% \begin{macrocode}
+%</style>
+% \end{macrocode}
+
+% ^^A The four commented lines below may be used to output an index on
+% ^^A a page layout greater than the one used till now.
+% ^^A -----
+% ^^A \newpage
+% ^^A \setlength{\oddsidemargin}{0pt}
+% ^^A \setlength\textwidth{15cm}
+% ^^A \normalsize
+% ^^A -----
+%
+% \IndexPrologue{%
+% \section*{Index}%
+% \markboth{Index}{Index}%
+% {\it{}The italic numbers denote the pages where the
+% corresponding entry is described,
+% numbers underlined point to the definition,
+% all others indicate the places where it is used
+% (ie. the line numbers where it appears).
+% }}
+% \Finale
+% \newpage
+% \PrintIndex \PrintChanges
diff --git a/macros/latex/contrib/progkeys/programs.ins b/macros/latex/contrib/progkeys/programs.ins
new file mode 100644
index 0000000000..1a7f43c503
--- /dev/null
+++ b/macros/latex/contrib/progkeys/programs.ins
@@ -0,0 +1,51 @@
+\def\ifToplevel#1{#1}
+
+%%
+%% This file will generate fast loadable files and documentation
+%% driver files from the doc files in this package when run through
+%% LaTeX2e.
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+\def\batchfile{programs.ins}
+\input docstrip.tex
+\preamble
+
+Copyright: Miguel Alabau, 1995 \space\space\space Miguel.Alabau@labri.u-bordeaux.fr
+
+\endpreamble
+\keepsilent
+
+\Msg{\space\space\space\space *******************************************}
+\Msg{\space\space\space\space ** programs utility}
+\Msg{\space\space\space\space *******************************************}
+\Msg{}
+
+\Msg{*** Generating the driver file ***}
+\generateFile{programs.drv}{f}{\from{programs.dtx}{driver}}
+
+\Msg{*** Generating the document package file ***}
+\generateFile{programs.sty}{f}{\from{programs.dtx}{style}}
+
+\Msg{*** Generating the index files for producing the documentation crossrefs ***}
+\generateFile{programs.ist}{f}{\from{programs.dtx}{index}}
+
+\ifToplevel{
+\Msg{***********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* files into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space\space\space programs.sty}
+\Msg{*}
+\Msg{* To produce the documentation of the 'programs' utility,}
+\Msg{* perform as follows:}
+\Msg{* \space\space\space\space - run three times programs.drv through LaTeX2e}
+\Msg{* \space\space\space\space - then run 'makeindex -s programs.ist programs.idx'}
+\Msg{* \space\space\space\space - then run once programs.drv through LaTeX2e}
+\Msg{*}
+\Msg{* Happy TeXing}
+\Msg{***********************************************************}
+}
+
+\endinput
diff --git a/macros/latex/contrib/progkeys/programs.pdf b/macros/latex/contrib/progkeys/programs.pdf
new file mode 100644
index 0000000000..085581520c
--- /dev/null
+++ b/macros/latex/contrib/progkeys/programs.pdf
Binary files differ