Debian Codegraph @

texmf-dist/tex/plain/base/list-latin.tex

raw
1 % Makes a listing of one or more files
2 % Extended to allow the Latin-1 accented characters in UTF-8 encoding
3 % Typical usage:
4 % tex list-latin *.txt \\end
5
6 \def\grabfile#1 {\setbox0=\lastbox\endgraf\doit{#1}}
7 \everypar{\grabfile}
8
9 \font\filenamefont= cmtt8 scaled\magstep3
10 \font\headlinefont= cmr8
11 \font\listingfont= cmtex10
12 \font\ttfont= cmtt10
13 \font\syttfont= cmsytt10
14 \font\eoffont= cmti8
15
16 \def\today{\ifcase\month\or
17 January\or February\or March\or April\or May\or June\or
18 July\or August\or September\or October\or November\or December\fi
19 \space\number\day, \number\year}
20 \newcount\m \newcount\n
21 \n=\time \divide\n 60 \m=-\n \multiply\m 60 \advance\m \time
22 \def\hours{\twodigits\n\twodigits\m}
23 \def\twodigits#1{\ifnum #1<10 0\fi \number#1}
24
25 \newlinechar=`@
26 \message{@\today\space at \hours}
27
28 \raggedbottom
29 \nopagenumbers
30
31 \newcount\n
32 \catcode`\^^c3=\active
33 \def\missing{{\syttfont\char15}}
34 \def^^c3#1{\n=`#1\advance\n by-128
35 {\ttfont\ifcase\n
36 \`A\or\'A\or\^A\or\~A\or\"A\or\AA\or\AE\or\c C\or
37 \`E\or\'E\or\^E\or\"E\or\`I\or\'I\or\^I\or\"I\or
38 \missing\or\~N\or\`O\or\'O\or\^O\or\~O\or\"O\or{\syttfont\char2}\or
39 \O\or\`U\or\'U\or\^U\or\"U\or\'Y\or\missing\or\ss\or
40 \`a\or\'a\or\^a\or\~a\or\"a\or\aa\or\ae\or\c c\or
41 \`e\or\'e\or\^e\or\"e\or\`\i\or\'\i\or\^\i\or\"\i\or
42 \missing\or\~n\or\`o\or\'o\or\^o\or\~o\or\"o\or{\syttfont\char4}\or
43 \o\or\`u\or\'u\or\^u\or\"u\or\'y\or\missing\or\"y\fi}}
44
45 \chardef\other=12
46 \def\doit#1{\message{@Listing #1@}
47 \begingroup \everypar{} \frenchspacing
48 \headline{\filenamefont#1\quad\headlinefont \today\ at \hours
49 \hfill Page \folio}
50 \def\do##1{\catcode`##1=\other}\dospecials
51 \catcode127=\other \catcode9=\other \catcode12=\other
52 \parindent 0pt \parfillskip=0pt plus 1fil minus 1in
53 \everypar{\hangindent 1in} \rightskip=0pt plus 2in
54 \def\par{\ifvmode\penalty-500\medskip\else\endgraf\fi}
55 \listingfont \obeylines \obeyspaces \global\pageno=1
56 \input #1 {\eoffont(end of\/ file)}\endgraf\vfill\eject\endgroup}
57 {\obeyspaces\global\let =\ }
58 \catcode`\_=\other % allow _ in file names
59
60 % A tab (^^I) prints as lowercase gamma.
61 % Character ^^M could be made visible, with a bit of work;
62 % at present, it's indistinguishable from newline (^^J).
63
64 % You can get up to 103 characters on a line without an overfull box.