1. 8
  1.  

  2. 3

    Troff preprocessors are a world full of wonder. pic(1) from around Eighth Edition UNIX, which generates graphs from a seemingly human-readable input language, takes the cake for me.

    1. 2

      …I wrote my own equation processor and driver for an ancient printer that had a typewriter like paper roller feed and a print head that zipped back and forth…

      …and printed my quantum mechanics project out on it….

      ..except I didn’t have time to optimise the print head path…

      ..so subscripts and superscripts and double line fonts made the poor thing shake and jiggle and twerk like it had St Vitus’s dance….

      …but it got the job done.

      Must have done horrible things to the expected lifespan of that printer.

      Sorry Uncle. (it was his printer).

      1. 1

        I think I once knew about this but had forgotten. I’ll have to play around with it, thanks for sharing!

        1. 1

          During my first semester at university, I submitted nearly all my homework using groff, and when the math part came up, I had to learn some eqn. It war really horrible, if the formula got slightly complicated, let alone when trying to write a mathematical proof.

          And then there’s the general problem that troff/groff has so little good documentation, which is kind of ironic.

          The good thing is that you don’t even need to know any of this to use groff, nowadays, which still produces smaller pdfs in less time. Since pandoc 2.0 has been released, a pdfroff exporter has been added that can parse TeX math and convert it to eqn syntax. Emacs calc mode can do a similar trick, but it more cumbersome.

          1. 7

            I’m a big fan of the eqn syntax: concise, powerful, easy to write, easy to read. TeX was heavily inspired by it, but has too many backslashes.

            eqn:

            x = {- b +- sqrt {b sup 2 - 4 a c}} over {2 a}
            

            TeX:

            x = {-b \pm \sqrt{b^2-4ac}} \over 2a
            

            Plain UTF‐8:

            𝑥 = (−𝑏 ± √(𝑏² − 4𝑎𝑐))⁄2𝑎
            

            MathML:

            <mrow>
             <mi>x</mi>
             <mo>=</mo>
             <mfrac>
              <mrow>
               <mo>−</mo>
               <mi>b</mi>
               <mo>±</mo>
               <msqrt>
                <mrow>
                 <msup>
                  <mi>b</mi>
                  <mi>2</mi>
                 </msup>
                 <mo>−</mo>
                 <mi>4ac</mi>
                </mrow>
               </msqrt>
              </mrow>
              <mi>2a</mi>
             </mfrac>
            </mrow>
            
            1. 1

              The square root formula is too simple, it’s not what I’d consider “complicated”. What I was thinking about was aligned equations, using other fonts or with symbols not included in the default.

              Take for example

              \[fa] n >= 0: \fCcn(n)\fP ~\[==]~ C sub n = { ( 2 n ) ! } over { ( n + 1 ) ! cdot n ! }
              

              or

              .EQ L
              wp(\fC\(dq df := df * x; x := x - 2\(dq\fI, I)
              .EN
              .EQ I
              \(== ~ wp(\fC\(dq df := df * x; x := x - 2\(dq\fI, df cdot x !! = n !! ~ \(AN ~ x >= 0)
              .EN
              .EQ I
              \(== ~ wp(\fC\(dq df := df * x\(dq\fI, df cdot ( x - 2 ) !! = n !! ~ \(AN ~ x - 2 >= 0)
              .EN
              .EQ I
              \(== ~ wp(\fC\(dq\(dq\fI, df cdot x cdot ( x - 2 ) !! = n !! ~ \(AN ~ x - 2 >= 0)
              .EN
              .EQ I
              \(== ~ df cdot x cdot ( x - 2 ) !! = n !! ~ \(AN ~ x >= 2
              .EN
              

              both which I remember took a white to correctly typeset.

            2. 2

              Eqn IMO has a cleaner syntax compared to main stream alternatives like MathML & MathJax.

              I am still not sure why it didn’t become popular

              1. 4

                I attribute it to Joe Ossanna’s untimely death and troff being proprietary to AT&T.