1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 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
|