Testing latest pari + WASM + node.js... and it works?! Wow.
License: GPL3
ubuntu2004
%%1%% INDEX (Macros)2%%3\ifsecondpass\else4\condwrite\index{The End}5\immediate\condwrite\toc{Index\string\dotfill\the\pageno}6\ifPDF \writesecnumbers \fi7\expandafter\end % stop here the first time (don't process index)8\fi910\ifPDF11% Add a bookmark entry for the index. CHB12\putchapdest13\pdfoutline goto name {pdfchap@\the\pdfchapcntr} {Index}14\fi1516\newdimen\fullhsize17\fullhsize=\hsize18\advance\hsize by -20pt19\divide\hsize by 22021\def\fullline{\hbox to\fullhsize}22\let\lr=L\newbox\leftcolumn2324\headline={\hfil\bf Index\hfil\global\headline={\hfil}}2526\def\makeheadline{\vbox to 0pt{\vskip-22.5pt27\fullline{\vbox to8.5pt{}\the\headline}\vss}28\nointerlineskip}2930\def\makefootline{\baselineskip=24pt\fullline{\the\footline}}3132\output={\if L\lr %cf. The TeXbook, p25733\global\setbox\leftcolumn=\columnbox\global\let\lr=R34\else\doubleformat\global\let\lr=L\fi35\ifnum\outputpenalty>-20000\else\dosupereject\fi}36\def\doubleformat{\shipout\vbox37{\makeheadline38\fullline{\box\leftcolumn\hfil\columnbox}39\makefootline}40\advancepageno}41\def\columnbox{\leftline{\pagebody}}4243\def\parse!#1#2!#3!#4!#5 {%44\uppercase{\def\theletter{#1}}%45\def\theword{#1#2}%46\def\thefont{#3}%47\def\thepage{#4}%48\def\thedest{#5}}4950\ifPDF51%% This puts the hyperlink command in the index, linked to the page52%% number. #1 is the usual page number, #2 the pdfcounter. CHB53\def\indxjump#1#2{\pdfstartlink attr {/Border [ 0 0 0 ] /H /O}54goto name {pdf@#2}\pushcolor{\linkcolor}#1\popcolor\pdfendlink}55\else56\def\indxjump#1#2{#1}57\fi5859\def\theoldword{}60\def\theoldletter{}61\def\theoldpage{}62\def\theend{The End }6364% more efficient to parse the glue specs once and keep them in registers65% for later use. These govern index lines with too many page numbers to66% fit in one line67% b: indentation for 2nd and further lines / a: compensation for same,68% and shrinkability for the normal word space69\newbox\dbox \setbox\dbox=\hbox to 3truemm{\hss.\hss}70\newskip\dfillskip \dfillskip=.5em plus .98\hsize71\def\dotfill{\leaders\copy\dbox\hskip\dfillskip\relax}72\newskip\interskipa \interskipa=-.4\hsize plus -1.5\hsize minus .11em73\newskip\interskipb \interskipb= .4\hsize plus 1.5\hsize7475% cf. The TeXbook, p393:76\def\interpage{,\penalty100\kern0.33em%normal space77\hskip\interskipa\vadjust{}\penalty10000 \hskip\interskipb\relax}7879\def\newword{\relax\endgraf%80{\csname\thefont\endcsname\theword}\dotfill\indxjump{\thepage}{\thedest}%81\let\theoldfont\thefont%82\let\theoldword\theword}8384%%85%% INDEX86%%87\parskip=0pt plus 1pt88\parindent=0pt89\parfillskip=0pt9091\catcode`\_=11 % make _ an ordinary char (frequent in function names)9293\def\li#1{\hbox to\hsize{#1\hfil}}94\li{\var{SomeWord} refers to PARI-GP concepts.}95\li{\kbd{SomeWord} is a PARI-GP keyword.}96\li{SomeWord is a generic index entry.}9798\checkfile{\jobname.std}99\newif\ifmore100\loop101\read\std to\theline102\ifx\theline\theend\morefalse\else\moretrue\fi103\ifmore104\expandafter\parse\theline105\ifx \theletter \theoldletter \else \endgraf106\vskip 10pt plus 10pt\centerline{\bf\theletter}107\vskip 6pt plus 7pt108\fi109\ifx \theword \theoldword110\ifx \thefont \theoldfont111\ifx \thepage \theoldpage112\else \interpage \indxjump{\thepage}{\thedest}\fi113\else \newword \fi114\else \newword \fi115\let\theoldletter\theletter116\let\theoldpage\thepage117\repeat%118119120