~pbatch/patchwerk

patchwerk/macros.tex -rw-r--r-- 1.6 KiB
9c265356 — paul plan9 additions from Sigrid 3 months ago
                                                                                
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
% Alan U. Kennington's macros:
% This \PreHatch macro to prefix a text string with a hatch character.
{\catcode`\^=6 \catcode`\#=12 \gdef\PreHatch^1{#^1}}

% Anchor points for cross-reference hyperlinks.
\def\LinkNameText#1#2{%
\special{html:<a name="#1">}#2\special{html:</a>}}
\def\LinkNamePRE#1{\special{html:<a name="#1">}}
\def\LinkNamePOST{\special{html:</a>}}
\def\LinkName#1{\LinkNameText{#1}{}}

% Cross-reference hyperlinks to defined anchor points.
\def\LinkHrefText#1#2{%
\special{html:<a href="\PreHatch{#1}">}#2\special{html:</a>}}

% Pre-text and post-text macros.
\def\LinkHrefPRE#1{\special{html:<a href="\PreHatch{#1}">}}
\def\LinkHrefPOST{\special{html:</a>}}

% External hyperlinks.
\def\LinkHrefExtText#1#2{%
\special{html:<a href="#1">}#2\special{html:</a>}}
\def\LinkHrefExt#1{\LinkHrefExtText{#1}{#1}}
\def\LinkHrefExtTT#1{\LinkHrefExtText{#1}{{\tt#1}}}

\font\linkfont=cmss10

\def\linkref#1#2{\LinkHrefText{#2}{{\linkfont [#1]}}}
\def\mkref#1{\LinkName{#1}}

\def\con{\par\vfill\eject % finish the section names
% \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
  \rightskip 0pt \hyphenpenalty 50 \tolerance 200
  \setpage \output={\normaloutput\page\lheader\rheader}
  \titletrue % prepare to output the table of contents
  \pageno=\contentspagenumber
  \def\grouptitle{TABLE OF CONTENTS}
  \mkref{toc}
  \message{Table of contents:}
  \topofcontents \startpdf
  \line{\hfil Section\hbox to3em{\hss Page}}
  \let\ZZ=\contentsline
  \readcontents\relax % read the contents info
  \botofcontents \end} % print the contents page(s) and terminate