%%%---Cut Here-------------------------------------------------------- %%% File: Fortran.TeX % This is a file of commands for printing out programs using TeX % -- see DIRTY TRICKS in TeXbook % % This version is designed to print source code at 9 point % fitting an 80 column line into a 6 true inch width with % 8 point line numbers before each line. % It handles TAB (^I) characters almost the same as DEC % % usage: % \input fortran % put this early in the file % \listing{file.ext} % use dev:[dir] if you wish % % B.H. Toby 8/86 % \newcount\lineno \font\Alisttt=cmtt9 at 9 truept \font\Alistrm=cmr8 at 8 truept \def\uncatcodespecials{\def\do##1{\catcode`##1=12 }\dospecials} \def\listing#1{\par\begingroup\setupverbatim\input#1 \endgroup} \def\setupverbatim{ \Alisttt\baselineskip= 8.5truept\lineskip=1truept \lineskiplimit=1truept\topskip=0pt \lineno=0 \def\par{\leavevmode\egroup\box0\endgraf} \obeylines \uncatcodespecials \obeyspaces \catcode`\`=\active \catcode`\^^I=\active \everypar{\advance\lineno by1 \llap{\Alistrm\the\lineno\ \ }\startbox}} \newdimen\w \setbox0=\hbox{\Alisttt\space} \w=8\wd0 \def\startbox{\setbox0=\hbox\bgroup} {\catcode`\^^I=\active \gdef^^I{\leavevmode\egroup \dimen0=\wd0 \divide\dimen0 by\w \multiply\dimen0 by\w \advance\dimen0 by\w \wd0=\dimen0 \box0 \startbox}} {\obeyspaces\global\let =\ } {\catcode`\`=\active \gdef`{\relax\lq}} %%%---Cut Here--------------------------------------------------------