summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/misc/scmac202.tex
blob: cf838a320eacd70e2feec6659b62a5893fae0b8c (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
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
%% scmac.tex
%% TeX macros for typesetting scripts version 2.02
%% Copyright (C) 1989 by Na Choon Piaw
%% This file may be freely used, distributed, and modified provided
%% credit is given to the original author.  You can even try to sell it,
%% assuming someone's willing to pay for this, of course.

%% \begin documentation

%% 2.02 Alpha
%% There never was a 2.00 release.
%% Changes from the documentation are found here:

%% Syntax change:
%% From the beginning of the file we have:
%%	\input scmac.tex
%%	\Style=
%%	\FootNoteStyle=

%% For the \Style, you may choose from:
%%	\OldStyle			(pre 2.00)
%%	\NewStyle			(post 2.00)

%% \OldStyle is fully compatible with version 1.xx
%% \NewStyle is fully compatible with version 2.00

%% For \FootNoteStyle, you may choose from:
%%	\EndNotes			(Put footnotes at the end)
%%	\FootNotes			(Put footnotes at the bottom)

%% Note that these are now the ONLY supported ways of specifying styles.
%% If you put in numbers directly, they might work in this version, but
%% if I change the macros in anyway in the next, they will no longer
%% work.

%% \end documentation

%% macros proper

%% tell user what version
\message{Loading scmac version 2.01 Alpha ...}

%% fonts --- Use Computer Modern.  Substitute these with local
%%           equivalents if no Computer Modern.
\message{fonts.}
\font\bigtenrm=cmr10 scaled\magstep2	%% big font for title
\font\rm=cmr10				%% standard roman text
\font\bf=cmbx10				%% for bold
\font\sl=cmsl10				%% slanted text
\font\it=cmti10				%% italics

%% variable declarations
\message{counters.}
\newcount\fnotecnt
\newcount\FootNoteStyle
\newcount\EndNotes
\newcount\FootNotes
\EndNotes=0
\FootNotes=1
\newcount\Style
\newcount\OldStyle
\newcount\NewStyle
\OldStyle=1
\NewStyle=2
\newwrite\auxfile
\newread\auxrfile
\fnotecnt=1
\FootNoteStyle=\FootNotes		%% "true" footnotes
\Style=\NewStyle

%% preamble handling
\message{preamble.}
\def\Title{}
\def\transl{}
\def\oth{}
\def\cpmessage{}
\def\heading#1{\global\headline={\bf #1 \hfil Page \folio}}
\def\translator#1{\edef\transl{\noindent\it Translation by #1.\hfil}}
\def\others#1{\edef\oth{\noindent\it #1.\hfil}}
\footline={\hfil}

%% open auxilary file.
\message{output files.}
\immediate\openout\auxfile=\jobname.aux

%% little patch to let me do the \let in side \beginscript
%% now, when i rewrite this, i'd better use @s in them just like
%% in plain.tex
\message{macros.}
\gdef\Styleone#1#2{
			\centerline{\bf \noexpand#1}
			{
			\parindent=1in
			\rm\narrower\raggedright\noindent
			\noexpand#2
			\par
			}
			\bigskip\goodbreak
		}
\gdef\Styletwo#1:#2\par{
	\centerline{\bf #1}
		{
			\parindent=1in
			\rm\narrower\raggedright\noindent
			\noexpand
			\hskip -1em\relax #2
			%% horizontal skip to combat the speech-offset
			%% problem.  Remove it if the problem
			%% disappears.
			\par
		}
		\bigskip\goodbreak
	}

%% global \say --- in standard old style --- to warn people that
%% the \style is not set

\def\say#1#2{\message{! scmac Fatal Error: You must start the script with \string\beginscript and
end it with \string\endscript!} \end}

% Environments
\def\beginscript{
	\Title
	\cpmessage
	\transl
	\oth
%%	Remember to recode in case format after I get the TeXbook back from
%%	Case. (Yech!  Just realized the horrible pun)
	\ifnum\Style=\OldStyle
		%% old style: version 1.xx
		\let\say=\Styleone
		\let\errcheck=\relax
	\else
		\ifnum\Style=\NewStyle
			%% version 2.xx
			\let\say=\Styletwo
			\let\errcheck=\relax
		\else
			\message{!Scmac Fatal Error: Style \the\Style is not supported!}
			\let\errcheck=\end
		\fi
	\fi
	\errcheck
}

\def\endscript{
\immediate\closeout\auxfile
\ifnum\FootNoteStyle=\FootNotes
	\relax
\else 
	\ifnum\FootNoteStyle=\EndNotes
		%% read in from aux file.
		\bigskip
		\filbreak
		\line{\bf Footnotes\hfil}
		\openin\auxrfile = \jobname.aux
		\readfootnotes
	\else
		\message{scmac Warning: \the\FootNoteStyle is not supported}
	\fi
\fi
}

%% songs
\def\beginsong{\bigskip\begingroup\obeylines\narrower}
\def\endsong{\par\endgroup\bigskip}

\def\readfootnotes{
%% recursive TeX macro!  Can WordPerfect do this?
\def\temp{}
\ifeof 1
	\relax
\else
	\read \auxrfile to \temp
	\ifeof \auxrfile
		\relax
	\else
		\item{[\temp]}
		\read \auxrfile to \temp
		\temp
		\readfootnotes
	\fi
\fi
}

%% describe and desc are unchanged.
\def\describe#1{\sl #1 \medskip\goodbreak}
\def\desc#1{\it (#1\/)\rm}

%% footnoting
\def\fnote#1{\ifnum\FootNoteStyle=1				
%% footnotes at bottom of page
 	\footnote{$^{\the\fnotecnt}$}{\rm #1}
\else 
%% new-style typeinto aux file  for readback
%% remember to change the \hskip value for different fonts!
	$^{\the\fnotecnt}$ \hskip -0.15in
	\immediate\write\auxfile{\the\fnotecnt}
	\immediate\write\auxfile{#1}
\fi
\global\advance\fnotecnt by 1
}
\message{done.}