From 57814cd1a4f5be3ec8cb4211a58e34537f6b573c Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 28 Jul 2007 00:33:22 +0000 Subject: latex package "program" update (17jul07) git-svn-id: svn://tug.org/texlive/trunk@4676 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/program/program.sty | 90 ++++++++++++++++++------- 1 file changed, 65 insertions(+), 25 deletions(-) (limited to 'Master/texmf-dist/tex/latex/program') diff --git a/Master/texmf-dist/tex/latex/program/program.sty b/Master/texmf-dist/tex/latex/program/program.sty index c87af6498b7..49d1e2ae9ae 100644 --- a/Master/texmf-dist/tex/latex/program/program.sty +++ b/Master/texmf-dist/tex/latex/program/program.sty @@ -1,4 +1,4 @@ -% program.sty, Version 3.3.8 +% program.sty, Version 3.3.11 % Version History: % 3.3.1: Fix name clash with new AmsTeX (\@prime) % 3.3.2: Minor spacing tweaks. Added \sfvariables for a different style. @@ -10,15 +10,21 @@ % 3.3.6: Minor bugfix: added \do\@ to \dospecials (for AmsTeX) % 3.3.7: Restore catcode of _ (due to clash with \includegraphics) % 3.3.8: Save/restore \@currentlabel when \ifNumberPrograms is true +% 3.3.9: Added \bigcaps command (submitted by Matteo Corti ) +% 3.3.10: Changed \www command to use normal text rather than typewriter +% Changed \FOREACH \ATEACH to use \@typename +% Added \boldsubm (uses \boldsymbol instead of text \bf) +% 3.3.11: Changed the default style to \sfvariables, old style is \bfvariables +% % % A LaTeX2e style file for typesetting algorithms. -% Copyright 1991 Martin Ward -% Email: Martin.Ward@durham.ac.uk -% or: Martin.Ward%DURHAM.AC.UK@CUNYVM.CUNY.EDU +% Copyright 1991, 2007 Martin Ward +% Martin.Ward@durham.ac.uk, martin@gkc.org.uk +% http://www.cse.dmu.ac.uk/~mward/ % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by -% the Free Software Foundation; either version 2 of the License, or +% the Free Software Foundation; either version 3 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, @@ -27,8 +33,7 @@ % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License -% along with this program; if not, write to the Free Software -% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +% along with this program; if not, see . % % % This is the "program" style option which sets up the @@ -188,7 +193,7 @@ \def\@printlineno{\ifNumberPrograms \global\def\@currentlabel{\theprogramline}% \hskip\leftmargini - \llap{{\prognumstyle\theprogramline}\hskip\labelsep}\fi} + \llap{{\prognumstyle(\theprogramline)}\hskip\labelsep}\fi} \def\prognumstyle{\scriptsize\em} @@ -294,10 +299,12 @@ \gdef\DO{\@marginspace\keyword{do}\ \global\let\DO=\@oldDO}} \def\FOR{\keyword{for}\ \tab \gdef\DO{\@marginspace\keyword{do}\ \global\let\DO=\@oldDO}} -\def\FOREACH{\qtab\keyword{foreach}\ % - \gdef\DO{\@marginspace\keyword{do}\ \global\let\DO=\@oldDO}} -\def\ATEACH{\qtab\keyword{ateach}\ % - \gdef\DO{\@marginspace\keyword{do}\ \global\let\DO=\@oldDO}} +\def\FOREACH{\qtab\keyword{foreach}% + \gdef\DO{\keyword{do}\ \global\let\DO=\@oldDO}% + \ \@typename} +\def\ATEACH{\qtab\keyword{ateach}% + \gdef\DO{\keyword{do}\ \global\let\DO=\@oldDO}% + \ \@typename} \def\STEP{\@marginspace\keyword{step}\ } \def\TO{\@marginspace\keyword{to}\ } % \BEGIN, \REP, \ACTIONEQ and \WHERE @@ -307,8 +314,8 @@ \def\REP{\qtab\hbox{\keyword{rep}}\ }% \def\ACTIONEQ{\ \equiv\\\quad\tab}% \def\WHERE{\@marginspace\untab\qtab\hbox{\keyword{where}}\ }% -\def\IFMATCH#1#2{\qtab\keyword{ifmatch}\ #1{#2}\ } -\def\FILL#1#2{\keyword{fill}\ \tab#1{#2}\ \savetab} +\def\IFMATCH{\qtab\keyword{ifmatch}\ \@typename} +\def\FILL{\keyword{fill}\ \tab\savetab\@typename} \def\ENDFILL{\@marginspace\restoretab\untab\keyword{endfill}} \def\EDIT{\keyword{edit}\ \tab} \def\EDITPARENT{\qtab\keyword{editparent}\ } @@ -346,6 +353,10 @@ \def\COMMENT#1{\keyword{comment}\mbox{: #1}} \def\C#1{\keyword{C}:\ \mbox{#1}} \def\ARRAY{\keyword{array}\ } +\def\LIKE{\@marginspace\keyword{array}\ } +\def\TYPEDEF{\@marginspace\keyword{typedef}\ } + +\def\@typename#1{\mbox{#1}\ } % The symbols used in programs: \def\BODY{\EQsymbol} @@ -383,8 +394,6 @@ \def\lowundertext#1{\ifmmode\underline{\vphantom{y}\mbox{#1}}\else $\underline{\vphantom{y}\mbox{#1}}$\fi} -\def\boldvar#1{{\mbox{\normalshape\bf #1}}} - % The Boolean values: \def\true{\boldvar{true}} \def\false{\boldvar{false}} @@ -427,16 +436,19 @@ % First we define the default \variablefont, \variablefontend and \keyword: -% Default variable font is slanted, so \variablefontend adds italic correction: \newif\if@corr -\let\variablefont=\sl% -\def\variablefontend#1{\begingroup\futurelet\temp\@corr}% gobble the \egroup \def\no@corr{\do{.}\do{,}} \def\@corr{\def\do##1{\ifx\temp##1\@corrfalse\fi}\@corrtrue\no@corr \if@corr\/\else\fi\endgroup\egroup} % put back the \egroup -% Default keyword style is bold underlined: -\def\keyword#1{\mbox{\underbar{\normalshape\bf #1}}} +% The old default keyword style is bold underlined: +% The old default variable font is slanted, so \variablefontend adds italic correction: +\def\bfvariables{% + \let\variablefont=\sl% + \def\variablefontend##1{\begingroup\futurelet\temp\@corr}% gobble the \egroup + \def\keyword##1{\mbox{\underbar{\normalshape\bf ##1}}} + \def\boldvar##1{{\mbox{\normalshape\bf ##1}}} +} % For sans-serif variables and keywords (no underbar): \def\sfvariables{% @@ -446,6 +458,22 @@ \def\boldvar##1{\mbox{\normalshape\bf\sf ##1}}% } +% For sans-serif variables and keywords in CAPITALS +% (As required for Oberon and Modula) +% This command was submitted by Matteo Corti : +\def\bigcaps{% + \def\variablefont{\normalshape\sf}% + \def\variablefontend{}% + \def\keyword##1{\mbox{\uppercase{##1}}}% + \def\boldvar##1{\mbox{\normalshape\bf\sf ##1}}% +} + + +% The new default is \sfvariables: + +\sfvariables + + % Use \scriptvar|foo| for sub/super-script variables: \def\scriptvariablefont{\scriptsize\@variablefont}% \def\scriptvar{\let\@variablefont=\variablefont% @@ -553,6 +581,17 @@ \@boldsub } +\def\boldsubm#1{% + \relax% to fool array and other alignments + \ifmmode + \Mmodetrue + \else + $\Mmodefalse + \fi + \boldsymbol{#1}% + \@boldsub +} + % Use \mathchoice (typesets all 4) if this is needed for % subscripts or superscripts (costs ~0.5 seconds per symbol!): % NB use of \text should fix this with AMSLaTeX. @@ -621,7 +660,7 @@ \def\sub[#1/#2|#3]{\left[\left.#1\,/\,#2\,\right\origbar\,#3\,\right]} \def\bigsub[#1/#2|#3]{\bigl[#1\,\bigm/\,#2\,\bigm\origbar\,#3\,\bigr]} % Use \modbar{x} for |x|: -\def\modbar#1{\origbar #1\origbar} +\def\modbar#1{\left\origbar #1\right\origbar} % Notation for a sequence in angle brackets: % \bigseq uses big size of brackets: @@ -657,8 +696,9 @@ \def\Exists#1.{\exists #1.\,} \let\EQspace=\ % default space around \EQ \EQT and \LE -\def\EQT{\mathrel{\EQspace\approx\EQspace}} % program equivalence. -\def\LE{\mathrel{\EQspace\le\EQspace}} % program refinement. +\def\EQT{\mathrel{\EQspace\approx\EQspace}} % program equivalence. +\def\LE{\mathrel{\EQspace\le\EQspace}} % program refinement. +\def\SLE{\mathrel{\EQspace\preccurlyeq\EQspace}} % semi-refinement. \def\NOT{\neg} % \AND and \OR relations have an extra thin space around them: \def\AND{\mathrel{\,\wedge\,}} @@ -949,5 +989,5 @@ %% \www{http://~ws-mj3.~dur.~ac.~uk/~martin/~papers/~ref-ws-5.ps.gz} \def\www{\bgroup\def~{\hskip 1pt plus 3pt minus 1pt\relax}\www@} -\def\www@#1{$\langle$\tt #1$\rangle$\egroup} +\def\www@#1{$\langle$#1$\rangle$\egroup} -- cgit v1.2.3