Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Testing latest pari + WASM + node.js... and it works?! Wow.

28495 views
License: GPL3
ubuntu2004
1
%%
2
%% INDEX (Macros)
3
%%
4
\ifsecondpass\else
5
\condwrite\index{The End}
6
\immediate\condwrite\toc{Index\string\dotfill\the\pageno}
7
\ifPDF \writesecnumbers \fi
8
\expandafter\end % stop here the first time (don't process index)
9
\fi
10
11
\ifPDF
12
% Add a bookmark entry for the index. CHB
13
\putchapdest
14
\pdfoutline goto name {pdfchap@\the\pdfchapcntr} {Index}
15
\fi
16
17
\newdimen\fullhsize
18
\fullhsize=\hsize
19
\advance\hsize by -20pt
20
\divide\hsize by 2
21
22
\def\fullline{\hbox to\fullhsize}
23
\let\lr=L\newbox\leftcolumn
24
25
\headline={\hfil\bf Index\hfil\global\headline={\hfil}}
26
27
\def\makeheadline{\vbox to 0pt{\vskip-22.5pt
28
\fullline{\vbox to8.5pt{}\the\headline}\vss}
29
\nointerlineskip}
30
31
\def\makefootline{\baselineskip=24pt\fullline{\the\footline}}
32
33
\output={\if L\lr %cf. The TeXbook, p257
34
\global\setbox\leftcolumn=\columnbox\global\let\lr=R
35
\else\doubleformat\global\let\lr=L\fi
36
\ifnum\outputpenalty>-20000\else\dosupereject\fi}
37
\def\doubleformat{\shipout\vbox
38
{\makeheadline
39
\fullline{\box\leftcolumn\hfil\columnbox}
40
\makefootline}
41
\advancepageno}
42
\def\columnbox{\leftline{\pagebody}}
43
44
\def\parse!#1#2!#3!#4!#5 {%
45
\uppercase{\def\theletter{#1}}%
46
\def\theword{#1#2}%
47
\def\thefont{#3}%
48
\def\thepage{#4}%
49
\def\thedest{#5}}
50
51
\ifPDF
52
%% This puts the hyperlink command in the index, linked to the page
53
%% number. #1 is the usual page number, #2 the pdfcounter. CHB
54
\def\indxjump#1#2{\pdfstartlink attr {/Border [ 0 0 0 ] /H /O}
55
goto name {pdf@#2}\pushcolor{\linkcolor}#1\popcolor\pdfendlink}
56
\else
57
\def\indxjump#1#2{#1}
58
\fi
59
60
\def\theoldword{}
61
\def\theoldletter{}
62
\def\theoldpage{}
63
\def\theend{The End }
64
65
% more efficient to parse the glue specs once and keep them in registers
66
% for later use. These govern index lines with too many page numbers to
67
% fit in one line
68
% b: indentation for 2nd and further lines / a: compensation for same,
69
% and shrinkability for the normal word space
70
\newbox\dbox \setbox\dbox=\hbox to 3truemm{\hss.\hss}
71
\newskip\dfillskip \dfillskip=.5em plus .98\hsize
72
\def\dotfill{\leaders\copy\dbox\hskip\dfillskip\relax}
73
\newskip\interskipa \interskipa=-.4\hsize plus -1.5\hsize minus .11em
74
\newskip\interskipb \interskipb= .4\hsize plus 1.5\hsize
75
76
% cf. The TeXbook, p393:
77
\def\interpage{,\penalty100\kern0.33em%normal space
78
\hskip\interskipa\vadjust{}\penalty10000 \hskip\interskipb\relax}
79
80
\def\newword{\relax\endgraf%
81
{\csname\thefont\endcsname\theword}\dotfill\indxjump{\thepage}{\thedest}%
82
\let\theoldfont\thefont%
83
\let\theoldword\theword}
84
85
%%
86
%% INDEX
87
%%
88
\parskip=0pt plus 1pt
89
\parindent=0pt
90
\parfillskip=0pt
91
92
\catcode`\_=11 % make _ an ordinary char (frequent in function names)
93
94
\def\li#1{\hbox to\hsize{#1\hfil}}
95
\li{\var{SomeWord} refers to PARI-GP concepts.}
96
\li{\kbd{SomeWord} is a PARI-GP keyword.}
97
\li{SomeWord is a generic index entry.}
98
99
\checkfile{\jobname.std}
100
\newif\ifmore
101
\loop
102
\read\std to\theline
103
\ifx\theline\theend\morefalse\else\moretrue\fi
104
\ifmore
105
\expandafter\parse\theline
106
\ifx \theletter \theoldletter \else \endgraf
107
\vskip 10pt plus 10pt\centerline{\bf\theletter}
108
\vskip 6pt plus 7pt
109
\fi
110
\ifx \theword \theoldword
111
\ifx \thefont \theoldfont
112
\ifx \thepage \theoldpage
113
\else \interpage \indxjump{\thepage}{\thedest}\fi
114
\else \newword \fi
115
\else \newword \fi
116
\let\theoldletter\theletter
117
\let\theoldpage\thepage
118
\repeat%
119
120