Why is it so hard to find TeX sources in C? I know the full source code is included in the tex.web
and pdftex.web
files, but isn't there any way to convert them to plain C code?
[Tex/LaTex] Finding TeX Sources in C
sourcecodetex-core
sourcecodetex-core
Why is it so hard to find TeX sources in C? I know the full source code is included in the tex.web
and pdftex.web
files, but isn't there any way to convert them to plain C code?
Best Answer
It's hard to find them because they don't exist. TeX is written in Pascal (one of the many flavors of it), but the source is interspersed with description of the code in the Web system devised by Knuth and others as part of a "literate programming" project.
The commented source is in
tex.web
(andtex.ch
, a supplementary file where adaptations for specific operating systems are defined); one can get atex.tex
file by runningand then compiling the file with
tex
orpdftex
. The program code is obtained by runningthat produces
tex.p
.Modern distributions translate the Pascal code into C with a helper program, but I don't think that the C code is particularly readable. If you have available a TeX Live distribution, you can say
which will open a PDF file with the commented Pascal code.