summaryrefslogtreecommitdiff
path: root/systems/tex-extensions/clasen/glue/glue.tex
blob: d124bf32b0a6000860a2e0f143f5240f90c8b1b0 (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
\documentclass[preprint]{ltugboat}
\usepackage{shortvrb}
\usepackage{url}

\providecommand{\meta}[1]{\ensuremath{\langle\textit{#1}\rangle}}
\makeatletter
\providecommand{\eTeX}{$\m@th\varepsilon$-\TeX}
\makeatother
\hyphenation{pa-ra-me-ter}

\emergencystretch=4mm
\title{Purging \TeX\ from floating-point arithmetic}
\author{Matthias Clasen}
%\address{}
\netaddress{maclas@gmx.de}
\setcounter{page}{1}

\begin{document}
\maketitle
\MakeShortVerb{\|}

\section{Introduction}

\TeX\ uses machine-dependent floating-point arithmetic for its
internal glue computations. This is the reason why a (undoubtly very useful) 
general |\lastnode| command cannot be added to \TeX\ without risking
the portability of documents.
 
A long time ago, Knuth demonstrated how to implement \TeX's glue computations
in fixed-point arithmetic\cite{Knuth:82,Knuth:91}. Knuth mentions that his
code would have to be slightly generalized before it can be used in \TeX. To
my knowledge, this has not been done before. 

After applying my change file, |tex.web| no longer contains any
variables of type |real|, proving that I was successful in removing all
floating-point arithmetic from \TeX. I have not implemented the (now possible)
|\lastnode| primitive. 

\section{Implementation}

The changes to \TeX{} the program sketched above are realized in the
change file |glue.ch|, which is a rewrite of Knuth's |glue.web|. 

\section{Installation}
 
 The change files are written for \TeX~3.1459. But it should need only
 cosmetic changes to get them to work with other versions of \TeX3.

 To make the change files for \TeX{} work, you have to apply the change file
 |pre.ch| first. I have only tried these files with |web2c|, and
 for that you need to surround the |web2c| change file with |pre-web2c.ch| and
 |post-web2c.ch|. You also need the additional change file 
 |glue-post-web2c.ch| and the patch file |glueratio.patch|.
 The patch file is necessary, since |web2c| fixes the type |glueratio|
 to be |double| in a file which is not subject to the |web| translation
 process. The patch file changes this to the new type |glueratio| if
 the |cpp| macro |HAVE_GLUERATIO_TYPE| is defined.

 All this boils down to the command line

\begin{verbatim}
mv tex.ch tex.ch.orig
tie -c tex.ch tex.web pre.ch glue.ch \ 
       pre-web2c.ch tex.ch.orig \
       post-web2c.ch glue-post-web2c.ch
patch < glueratio.ch
export XCFLAGS=-DHAVE_GLUERATIO_TYPE
\end{verbatim}

 \makesignature

 \bibliographystyle{plain}
 \bibliography{etex}

\end{document}