5 ms·
tex.web – Version 3.141592653
- hoten 5y agoCopying the introduction text: @* \[1] Introduction. This is \TeX, a document compiler intended to produce typesetting of high quality. The \PASCAL\ program that follows is the definition of \TeX82, a standard @:PASCAL}{\PASCAL@> @!@:TeX82}{\TeX82@> version of \TeX\ that is designed to be highly portable so that identical output will be obtainable on a great variety of computers. The main purpose of the following program is to explain the algorithms of \TeX\ as clearly as possible. As a result, the program will not necessarily be very efficient when a particular \PASCAL\ compiler has translated it into a particular machine language. However, the program has been written so that it can be tuned to run efficiently in a wide variety of operating environments by making comparatively few changes. Such flexibility is possible because the documentation that follows is written in the \.{WEB} language, which is at a higher level than \PASCAL; the preprocessing step that converts \.{WEB} to \PASCAL\ is able to introduce most of the necessary refinements. Semi-automatic translation to other languages is also feasible, because the program below does not make extensive use of features that are peculiar to \PASCAL.
- deleted 5y ago[deleted]
- dhosek 5y agoIn September 1990 when tex.web 3.1 and mf.web 2.7 were released there was great confusion in the TeX world. Had DEK made a typo when he updated the version numbers of the files? It was sometime between that release and the next in March 1991 when he revealed the plan for the version numbers to converge to π and e. The bugs that have been found in the past couple decades have been rather esoteric. The one that was most likely to actually occur in real use was raised if someone responded e (edit the source at the error location) when no file had occurred (I think it had to happen on the first line of input as well). Most related to extreme edge cases that would be difficult or impossible to raise in a production TeX system.
- hardwaregeek 5y agoIt's wild to me that we're still using a program written in a custom programming language that is in turn implemented in Pascal. It does speak to Knuth's programming ability that tex has lasted so long with so few bugs. That said, I would love to have a successor at some point with a little more usability and a little better interoperability.
- smitty1e 5y agoTeX is like the Latin language. Its esoteric nature keeps out the riff-raff.
- plafl 5y agoIt requires a lot of skill to write TeX, but the key is declaring it feature frozen for almost 40 years. I like Knuth's approach to open source: "Here is the code, I wrote it because I needed it, I hope you find it useful. Now, if you don't mind I have things to do. I no longer use email but I read snail mail every six months"
- jhoechtl 5y agoThe successor is there: Sile https://sile-typesetter.org https://sile-typesetter.org
- jfk13 5y agoWhile SILE is an interesting project, it's some way from being ready to be "the successor to TeX".
- NelsonMinar 5y agoThe responses here think you are talking about the TeX programming language. But you're talking about Web, which dating to 1987 long predates the WWW. The key feature of it is "literate programming", the idea that you'd write an essay interspersed with the working code. It's not an idea that caught on. https://en.wikipedia.org/wiki/Web_(programming_system) https://en.wikipedia.org/wiki/Web_(programming_system)
- 5y ago
- cxr 5y agoI've been thinking a lot about literate programming, and I'm positive that Knuth-style LP's worst enemy is TeX. Realistically, an LP system is going to need to prioritize the reading experience of the input format itself, not just the output format after running it through a typesetting system (no matter how powerful the typesetting system might be). Consider Gruber on Markdown, and this 2014 blog post about (what became) CommonMark: > A Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions (Gruber)[...] forks of Markdown, such as GitHub Flavored Markdown and MultiMarkdown extend standard Markdown in various ways, and are targeted for their particular use cases. GitHub’s implementation for code blocks, for example, looks like something a group of programmers would want to have; it looks more like code than text <http://shindoisshin.net/blog/2014/9/6/standard-markdown-controversy http://shindoisshin.net/blog/2014/9/6/standard-markdown-cont...> Consider this file. Those who are expected to interact with it in this form includes Knuth and his collaborators—the few who have sent in corrections—and nobody else. You aren't expected to read a literate program like this. In an ideal world, where we had computing better figured out, Knuth wouldn't interact with it like this, either. The second thing to address would be the use of "static" target languages like C and Pascal. A literate programming work should aim to be more like the experience of programming by configuring program entities (I hesitate to say "objects")—like Self, except powered by the written word. Among the negative ways to react to the last remark would be to say, "'Self, except powered by the written word'? So pretty much the opposite of Self, then. Basically, what we already have." But this is too superficial. Consider Jef Raskin on "the woes of IDEs": <https://queue.acm.org/detail.cfm?id=864034 https://queue.acm.org/detail.cfm?id=864034>
- svat 5y agoI actually agree with your main point — in fact I would go further and say that in an ideal LP system, the (or at least a) source format would just simply be valid files in the target language, with any LP-related markup or whatever in the comments. The reason is so that LP programs can get contributions from "mainstream" programmers. (It's ok if the LP users have an alternative format they can write in, as long as edits to the source file can be incorporated back.) So the following correction is not intended as disagreement but simply to share some history / facts: > Consider this file. Those who are expected to interact with it in this form […] You aren't expected to read a literate program like this. In an ideal world, where we had computing better figured out, Knuth wouldn't interact with it like this, either. Actually, even in the world we live in, no one is expected to read a literate program like this (Knuth has comments to that effect somewhere), and everyone is "supposed" to read the typeset program (today that would be tex.pdf or whatever). Knuth reads it off the printed book. He navigates the program using the indexes in the book, and as recently as this year he raved about how good his system was (https://tug.org/TUGboat/tb42-1/tb130knuth-tuneup21.pdf https://tug.org/TUGboat/tb42-1/tb130knuth-tuneup21.pdf): > While I was preparing this round of updates, I was overjoyed to see how well the philosophy of literate programming has facilitated everything. This multifaceted program was written 40 years ago, yet I could still get back into TeX’s darkest corners without trouble, just by rereading [B] and using its index and mini-indexes! I can’t help but ascribe most of TeX’s success to the fact that it has enabled literate programming. This works for him, because he started programming in the days when program "listings"—printouts of source code—were the most common way to read programs, and it's also how he wrote TeX (https://news.ycombinator.com/item?id=10172924 https://news.ycombinator.com/item?id=10172924: “Knuth wrote the entirety of the first version of TeX on yellow legal note pads, and then typed it all in, and then started debugging” — he worked full-time on the program, writing it with pencil on paper, over several months, before typing a single word of it into a computer). And of course, he's a professional book-reader and book-writer (and book-tweaker, as his books keep getting newer editions and updates), so it comes naturally to him.
- ilaksh 5y agoIf anyone is like me and doesn't use these programs and couldn't figure out what to do with it on Ubuntu: https://www.docdroid.net/9OBjfK8/tex-pdf https://www.docdroid.net/9OBjfK8/tex-pdf sudo apt install texlive # maybe download other files from that dir weave tex.web dvipdfm tex.dvi # output is tex.pdf
- jpfr 5y agoNotice that the TeX you have installed locally is many conversion steps removed from the WEB source. Pascal code is extracted from the WEB. Then the Pascal is translated into C. Afterwards, years of development have accumulated on that C source to handle utf-8, modern fonts, PDF output, etc. Most work nowadays happens on top of LuaTeX that replaces and extends pdfTeX. There are shockingly few people maintaining that core of the TeX environment. The source control is mirrored here: https://github.com/TeX-Live/luatex/tree/experimental https://github.com/TeX-Live/luatex/tree/experimental
- svat 5y agoMinor correction: C code is extracted directly from the WEB. (web2c doesn't use `tangle`, the program that converts WEB to Pascal.) (Unless there's something I've missed…)
- jfk13 5y agoActually, the Web2C build process normally used these days (e.g. in TeX Live) does first run tangle, to convert the WEB source to Pascal. Then the web2c tool (along with a few helpers) translates that Pascal to C.
- smnrchrds 5y agoAre LuaTeX and pdfTeX forks? Or are they programs built on top of TeX itself? Will the changes in this new version make their way to the engines we use?
- jfk13 5y agopdfTeX was an extension to TeX (as was XeTeX), for a long time maintained as a collection of change-files applied to the canonical TeX source, although nowadays they're managed as separate WEB files. LuaTeX was in turn an extension of pdfTeX, but I think at this point it would be better described as a fork rather than an extension. (Though it's not clear to me exactly how to distinguish these concepts.) Anyhow, I believe the 3.141592653 updates have already been ported to all these engines.
- deleted 5y ago
- asdjfhasdhf 5y agowhy pi version?
- grzm 5y ago> Since version 3, TeX has used an idiosyncratic version numbering system, where updates have been indicated by adding an extra digit at the end of the decimal, so that the version number asymptotically approaches π. This is a reflection of the fact that TeX is now very stable, and only minor updates are anticipated. https://en.wikipedia.org/wiki/TeX#TeX82 https://en.wikipedia.org/wiki/TeX#TeX82
- owenmarshall 5y agoOne sad day in the future it will cease to merely approach pi and instead become pi.
- sohkamyung 5y agoBy then, maybe the version number will encode the program itself. :-)
- asddubs 5y agoprobably not as only donald knuth is allowed to modify it
- jfk13 5y agoHe documented this plan already in 1990: > At the time of my death, it is my intention that the then-current versions of TeX and METAFONT be forever left unchanged, except that the final version numbers to be reported in the “banner” lines of the programs should become > TeX, Version $\pi$ > and > METAFONT, Version $e$ > respectively. From that moment on, all “bugs” will be permanent “features.” (See http://www.ntg.nl/maps/05/34.pdf http://www.ntg.nl/maps/05/34.pdf)
- smnrchrds 5y agoFor those who are not aware, it's a sad day because changing the version to pi and freezing it is Knuth's will when he dies.
- dunham 5y agoI had this sitting in my dropbox a few years ago, and Dropbox decided (from the extension) that it was now a special file that I wasn't allowed to delete or move.
- svat 5y agoI made some attempts a few years ago to read this program in its entirety. I managed only the faintest glimpse and had grand plans of making it easier. I wrote down some of it: https://shreevatsa.net/tex/program https://shreevatsa.net/tex/program (Actually, a while after that I got more used to the style and I can now mostly read the program without the difficulties that used to bother me earlier, and I haven't gone back and updated the page. But I think chronicling my early difficulties arising was useful, as I suspect other new people may face them too: and I wouldn't be able to do it now: the "curse of knowledge".) More recently, I tried to connect some people who may be interested in making this program more readable, converting it into other languages/formats, etc: https://github.com/shreevatsa/webWEB https://github.com/shreevatsa/webWEB — please join if you're interested or can help or have already done something along these lines.
- owenmarshall 5y ago% A reward of $327.68 will be paid to the first finder of any remaining bug. 2^15, for those playing along at home.
- thangalin 5y agoFor anyone interested in how to install TeX itself: https://tex.stackexchange.com/a/576314/2148 https://tex.stackexchange.com/a/576314/2148 I forked and optimized a version of JMathTeX to provide plain TeX rendering in Java: https://github.com/DaveJarvis/JMathTeX https://github.com/DaveJarvis/JMathTeX