summaryrefslogtreecommitdiff
path: root/macros/lamstex/inputs/lithl.tex
blob: e27833e6370bbb3c587ab1a37f8945e60c28133e (plain)
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
% LITHL.TEX  VERSION 2.0
% COPYRIGHT (C) 1991 BY THE TEXPLORATORS CORPORATION
% ALL RIGHTS RESERVED

% THIS FILE SHOULD NOT BE CHANGED IN ANY WAY. 

\catcode`\@=11
\let\alloc@\alloc@@
\expandafter\newbox\csname lit@0\endcsname
\expandafter\newbox\csname lit@1\endcsname
\expandafter\newbox\csname lit@2\endcsname
\expandafter\newbox\csname lit@3\endcsname
\expandafter\newbox\csname lit@4\endcsname
\expandafter\newbox\csname lit@5\endcsname
\expandafter\newbox\csname lit@6\endcsname
\expandafter\newbox\csname lit@7\endcsname
\expandafter\newbox\csname lit@8\endcsname
\expandafter\newbox\csname lit@9\endcsname
\newwrite\tempwrite@
\newread\tempread@
\newcount\litbackslashno@
\litbackslashno@\m@ne
\def\litbackslash#1{%
 \edef\next@{\litbackslashno@`\string#1}\next@
 \edef\litbs@{\catcode`\string#1=\z@
 \def\noexpand\litbs@@{\def\expandafter\noexpand\csname\string#1\endcsname
  {\char`\string#1}}}}
\def\litdelimiter#1{%
 \edef\litdelim@{\char`#1}%
 \def\lit##1{\ifx##1#1\let\next@\lit@\else\count@##1\relax
  \def\next@{\FN@\lit@@}\fi\next@}%
 \def\lit@{\leavevmode\begingroup\litcodes@\litdefs@
  \tt\hyphenchar\tentt\m@ne\lit@@@}%
 \def\lit@@@##1#1{##1\endgroup\null}%
 \def\lit@@{\ifx\next#1\let\next@\lit@@@@\else
  \def\next@{\unhcopy\csname lit@\number\count@\endcsname\null}\fi\next@}%
 \def\lit@@@@#1{\prevanish@
  \begingroup\litcodes@\ifnum\litbackslashno@=\m@ne\else
  \catcode\litbackslashno@=12 \fi\lit@@@@@}%
 \def\lit@@@@@##1#1{\toks@{##1}%
  \iftoc@
  \edef\next@{\write\toc@{\noexpand\noexpand
   \noexpand\lit\number\count@#1\the\toks@#1}}\next@
  \fi
  \ifnum\litbackslashno@=\m@ne\def\next@{\the\toks@}\else
   \immediate\openout\tempwrite@\jobname.tmp
   \immediate\write\tempwrite@{\the\toks@#1}%
   \immediate\closeout\tempwrite@
   \catcode\litbackslashno@=\z@\litdefs@
   \immediate\openin\tempread@\jobname.tmp
   \read\tempread@ to\next@
   \immediate\closein\tempread@
   \def\nextiii@####1#1####2\nextiii@{\def\next@{####1}}%
   \expandafter\nextiii@\next@\nextiii@
  \fi
  \global\expandafter\setbox\csname lit@\number\count@\endcsname
   \hbox{\tt\next@}%
  \endgroup\postvanish@}%
 \def\Lit#1{\ifhmode$$\abovedisplayskip\bigskipamount
  \abovedisplayshortskip\bigskipamount
  \belowdisplayskip\z@\belowdisplayshortskip\z@
  \postdisplaypenalty\@M
  $$\vskip-\baselineskip\else\bigskip\fi
  \begingroup\litlines@\z@
  \catcode`#1=\active\activate@0#1\Next@
  \def\displaybreak{\egroup\break\litlines@\z@\Lit@}%
  \def\allowdisplaybreak{\egroup\allowbreak\litlines@\z@\Lit@}%
  \def\allowdisplaybreaks{\egroup\allowbreak\interlitpenalty@\z@
   \litlines@\z@\Lit@}%
  \litcodes@\tt\catcode`\^^I=\active\letTAB@
  \obeylines\letM@\Lit@}%
 \def\Litbox##1=#1{\begingroup\ifodd##1\relax\aftergroup\global\fi
  \aftergroup\setbox\aftergroup##1\aftergroup\box\aftergroup\Litbox@
  \def\allowdisplaybreak{\egroup\allowbreak\litlines@\z@\Lit@}%
  \def\allowdisplaybreaks{\egroup\allowbreak\interlitpenalty@\z@
   \litlines@\z@\Lit@}%
  \catcode`#1=\active\activate@1#1\Next@
  \litcodes@\tt\catcode`\^^I=\active\letTAB@
  \obeylines\letM@\global\setbox\Litbox@\vbox\bgroup\litindent\z@%
  \litlines@\z@\Lit@}%
}
\def\alloc@#1#2#3#4#5{\global\advance\count1#1by\@ne
 \ch@ck#1#4#2\allocationnumber=\count1#1
 \global#3#5=\allocationnumber
 \wlog{\string#5=\string#2\the\allocationnumber}}
\catcode`\@=\active