This is the literate source for TeX, what LaTeX is based on: https://tug.ctan.org/systems/knuth/dist/tex/tex.web

These are just comments for the WEB literate file. Here’s the first ‘funny’ thing you’ll see in the source file:

% Version 3.0 fixed unusual displays; was more \output robust (March 1990).
% Version 3.1 fixed nullfont, disabled \write{\the\prevgraf} (September 1990).
% Version 3.14 fixed unprintable font names and corrected typos (March 1991).
% Version 3.141 more of same; reconstituted ligatures better (March 1992).
% Version 3.1415 preserved nonexplicit kerns, tidied up (February 1993).
% Version 3.14159 allowed fontmemsize to change; bulletproofing (March 1995).
% Version 3.141592 fixed \xleaders, glueset, weird alignments (December 2002).
% Version 3.1415926 was a general cleanup with minor fixes (February 2008).
% Version 3.14159265 was similar (January 2014).
% Version 3.141592653 was similar but more extensive (January 2021).

And it’s not even that! The source code quotes the Good Book! Wanna see? Here’s the literate source, as weave’d to PDF by me:

https://drive.google.com/file/d/1AmWx0qgorW3zviXXBefVXbRDop8a3app/view?usp=sharing

So how does this work?

  • You weave the literate source into a TeX file, then use many of the TeX engines to compile it to PDF, PS, DVI, etc
  • You tangle the literate soure into a .p file, a Pascal-H file which sadly no compiler exists for! A whole host of tools exist to turn this Pascal-H code into compilable code, for example, web2c, which is the basis of TeXLive. Now, there are rewrites of TeX, such as LuaTeX and MikTeX.

So what is LaTeX? It’s a ‘format’ for TeX. You might have used it in high school to write a paper if you were a super-nerd like me, or you may still use it to write scholarly papers. I’m currently using LaTeX to write several papers, write is doing heavy lifting here, these are just ideas (one of them is a review of LISP; the other, a shell with contracts similar to SHILL).

Enjoy.

  • Endmaker@ani.social
    link
    fedilink
    English
    arrow-up
    33
    ·
    edit-2
    30 days ago

    Since we are on the topic of funny stuff in code, here’s one encounter I had earlier:

    do not use or you will be fired

  • edinbruh@feddit.it
    link
    fedilink
    arrow-up
    30
    ·
    30 days ago

    You forgot the part where TeX was created by a CS professor because he didn’t like how his editor printed the formulas in his book

  • Carighan Maconar@lemmy.world
    link
    fedilink
    arrow-up
    11
    ·
    30 days ago

    This is smart. As pi is a non-repeating, you can even at some point start showing just the “current” digits if it ever gets too much, and will always be able to find a finite length of digits that does not match a previously user version number.

    • vithigar@lemmy.ca
      link
      fedilink
      arrow-up
      12
      arrow-down
      1
      ·
      30 days ago

      Not necessarily. Non-repeating doesn’t mean the are no repeated sections. For example, in the first hundred million digits “1412” is found three times.

      • For practical purposes, it’s probably good enough. You could write a program to check whether it’s non-repeating up to N digits, so just set N high enough that it will last you for a few thousand releases…

  • grue@lemmy.world
    link
    fedilink
    English
    arrow-up
    10
    ·
    30 days ago

    When Knuth dies, the version number of TeX will become π (and the version number of METAFONT, currently 2.71828182, will become e) and all remaining bugs will become features.

    • SamiDena@programming.devOP
      link
      fedilink
      arrow-up
      2
      ·
      29 days ago

      Bro he’ll never die. Chomsky will never die too. I’m serious. If Chomsky ‘stops living in his body’ his ideas for linguistics (not his political shit-flinging) will still be alive. When Knuth dies his programs and his algorithms and his books (especially his books) will still be alive. This is true about every single scientist or scholar. I did not even know Dijkstra was dead! He died when I was 9! But I just found it out, even though I love his works with C.A.R. Hoare, especially “Structured Programming”. I just might write a simple guide on the Hoare triple! So no scientists never die. Ken Thompson won’t die either. Bro will live in shell forever.

    • SamiDena@programming.devOP
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      30 days ago

      I have not looked at METAFONT. I really wanna design a font with it one day. It was the first font creation software I hear.

  • Aedis@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    30 days ago

    I used to work in a really big project written in C and C++ (and even some asm in there) and the build was non-deterministic. However the funky part was there was a C file in all of this that had a couple dozen of commented nee lines with a line at the top saying: ‘don’t remove this or the build will fail’ That remains my favorite code comment to this day.

  • ramble81@lemm.ee
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    30 days ago

    Technically each version does increment numerically since

    3.0000

    3.1000

    3.1400

    3.1410

    3.1415

    At least until you get to the first 0 which would be the 32nd release.

    • panicnow@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      29 days ago

      That’s why you can’t just use the version as a string. You need to use the API which correctly uses string length as a tie breaker.