summaryrefslogtreecommitdiff
path: root/dviware/dvgtk/doc/guidemacs.tex
blob: 11f556ae9f056cfe022f32babf07901496ae4a3b (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
% guidemacs.tex - 14:31 GMT +10:00 Sun 23 May 1993 - modifier Geoffrey Tobin.
% I don't have the original Andrew Trevorrow guidemacs.
% This will have to do. -- Ian Dall

\def \dvgt {{dvgt 3.5}}
\font\bigbf=cmbx12
\font\Bigbf=cmbx12 scaled \magstep1
\font\title=cmbx10 scaled \magstep5
\font\smallrm=cmr8
\def \subhead #1{\bigskip\leftline{\Bigbf #1}\medskip}
\let \;=\unskip
\def \finishline{}
\parskip=10pt


% Macros for verbatim TeX (from MANMAC.TEX):
% After \inputing this file you can use the following macros:
%
% 1. |<verbatim horizontal mode text in \tt>|
%
% 2. \begintt <optional stuff here>
%    <boxed lines of verbatim text in \tt; | is temporary escape character>
%    \endtt
%
% 3. \begindisplay
%    <off-centred display of aligned columns; typical row follows:>
%    |text in \tt|& |text in \tt|& text in current font\cr
%    \enddisplay
%
% 4. \listing{foo}
%    foo.tex will be \input and set verbatim in \tt; \parskip must be non-zero
%    if you want to see any empty lines

\catcode`@=11   % borrow some PLAIN macros which use @ as a letter

\newskip\ttglue
\ttglue=0.5em plus.25em minus.15em

\chardef\other=12
\def\ttverbatim{\begingroup
  \catcode`\\=\other
  \catcode`\{=\other
  \catcode`\}=\other
  \catcode`\$=\other
  \catcode`\&=\other
  \catcode`\#=\other
  \catcode`\%=\other
  \catcode`\~=\other
  \catcode`\_=\other
  \catcode`\^=\other
  \obeyspaces \obeylines \tt}
{\obeyspaces\gdef {\ }}           % active space = \ , not \space

\outer\def\begintt{$$\let\par=\endgraf \ttverbatim \parskip=\z@
  \catcode`\|=\other
  \rightskip-5pc \ttfinish}
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
  |obeylines % end of line is active
  |gdef|ttfinish#1^^M#2\endtt{#1|dimen0=|hsize|advance|dimen0 by -|hangindent%
                              |hsize=|dimen0|vbox{#2}|endgroup$$}}
% \begintt ... \endtt will now work in a paragraph with \hangindent, such
% as an \item

\catcode`\|=\active
{\obeylines \gdef|{\ttverbatim \spaceskip\ttglue \let^^M=\ \let|=\endgroup}}

\catcode`@=12    % return @ its normal category of "other"

% Macros for non-centered displays:
% Note that we turn \ttglue off so |stuff| spaces will all be equal.
\outer\def\begindisplay{\obeylines\startdisplay}
{\obeylines\gdef\startdisplay#1
  {\catcode`\^^M=5$$\ttglue=0em#1\halign to\hsize%
\bgroup\indent##\hfil\tabskip 0pt plus 1000pt&&\qquad##\hfil\cr}}
\outer\def\enddisplay{\crcr\egroup$$}

% MACROS FOR VERBATIM LISTINGS (ADAPTED FROM TEXBOOK APPENDIX D, P380)

\def\uncatcodespecials{\def\do##1{\catcode`##1=12 }\dospecials}


\def\setupverbatim{\tt % \lineno=0
  \def\par{\leavevmode\egroup\box0\endgraf}
  \obeylines \uncatcodespecials \obeyspaces
  \catcode`\`=\active \catcode`\^^I=\active
  \everypar{ % \advance  \lineno by1 \llap{\sevenrm\the\lineno\ \ }
  \startbox}}
\newdimen\w \setbox0=\hbox{\tt\space} \w=8\wd0 % tab amount
% \newcount\lineno
\def\startbox{\setbox0=\hbox\bgroup}
{\catcode`\^^I=\active
  \gdef^^I{\leavevmode\egroup
    \dimen0=\wd0 % the width so far, or since the previous tab
    \divide\dimen0 by\w
    \multiply\dimen0 by\w % compute previous multiple of \w
    \advance\dimen0 by\w  % advance to next multiple of \w
    \wd0=\dimen0 \box0 \startbox}}

\def\listing#1{\par\begingroup\parindent0pt \parskip0pt
               \vskip\baselineskip
               \setupverbatim
               \catcode`\|=\other  % allow | in listing file
               \input#1
               \vskip\baselineskip\endgroup}