Quad vs Latex

One of the things I do is teach, and part of that is providing text books to students and teachers. I’ve got a set of four text books which I built - back in the day - using Adobe InDesign. And then again Wordpress for the web. And I even exported it to Word for teachers who wanted to edit the text books before giving them to their own students. Imagine the joy.

When I find the time, which is hard, I’ve been migrating it all to Pollen. There is something crisp and delightful about this. From one source I can produce web pages which can flip, at the touch of a button, between a regular web textbook and a javascript slideshow presentation of the same topic. Or at the touch of another button, to go into teacher mode with additional explanations and ideas for exercises to do with the students. It’s still a work in progress, but it’s a very satisfying thing to be building, and long-term this will make it so much easier to maintain the different versions together.

Now I’m turning my attention more seriously to the PDF output, and wonder whether people would recommend using Quad or Latex. The layout needs I imagine will likely be simple, but there would need to be multiple versions (the teacher’s and students’ editions), and at some point I hope to be getting it printed professionally. Quad seems like the natural choice as it’s written in Racket, but given that Quad is a work in progress, am I going to be making life hard for myself by using it?

Quad is in an alpha state: even if it persists in something like its current form, it will be changing and breaking your projects in all kinds of ways between now and when it is ready. But it probably will not persist in its current state; in an email newsletter from MB Type earlier this year, Matthew said “I have started a second prototype in Racket. I would like to build this into a working system and then port it to Chez Scheme for maximum speed.” So there are maybe one or two more separate alphas of Quad before it reaches the point where you would want to start relying on it. In the same newsletter, and elsewhere on this forum he said all of that development is predicated on getting funding to the tune of $100–300k.

Latex is ugly but fully cooked, and has simple macros for things like verso/recto layout, keyword indexes, footnotes and endnotes, that would be either impossible or completely manual in Quad right now. If I had to choose between the two for a project due in the next year, I’d pick Latex.

A non-ugly option that is worth looking into is SILE. SILE is under active development and accepts an XML-like syntax as input, which makes it easy to generate from Racket/Pollen.

I have yet to try it, but if you have the budget, you could also look into Prince XML, which purports to do quality PDF layout using HTML and CSS. A single desktop license is $500 USD.

1 Like

An idea I’ve had, but done nothing about—that bucket is large—is creating a compiler to go from Pollen sources to Microsoft Word docx format, or maybe more virtuously, odf (which is also supported by Word). My reasoning is that as a path to PDF, Word is more common and tractable, and does 90% of what people use LaTeX for (roughly: cause text to be broken into lines and pages with simple formatting).

As for Quad, @joel is correct—it’s a long way from being a tool I would recommend anyone depend on.

2 Likes

Thanks very much @joel and @mbutterick for that very helpful advice. I was actually thinking Quad would be my number one choice, so I’ll need to revise that.

The idea of a direct path from Pollen to docx or odf seems like it would be a dream come true for me, giving both an editable file for teachers as well as a PDF for printing.

SILE looks interesting, but as a Windows user I don’t think it’s within reach for me without WSL, which I’d rather avoid.

For now it’ll be Latex. The bonus here is that there are plenty of examples to help me set it up, like @joel’s try pollen.

Is there any scenario where it would be more worthwhile to shift the time you would’ve spent hacking on LaTeX toward hacking on a Word compiler? I think it’s doable. I’m willing to work on it. Roping in others would add motivation, however.

1 Like

Is there any scenario where it would be more worthwhile to shift the time you would’ve spent hacking on LaTeX toward hacking on a Word compiler?

That sounds good, and I’d be very happy to be able to contribute to Pollen. There are a couple of barriers though, the first being that I’m working 6 days a week on a startup, which doesn’t leave much time for other things. The second is that my knowledge of Racket and programming skills in general are patchy.

What I’d like to do is study Beautiful Racket before getting started. Doing that would be two birds with one stone: improving my skills, while also being a test of whether I can actually find the time needed to work on this.

Hi! First of all @mbutterick thank you veeery much for providing Pollen and A Beautiful Racket! These are amazing tools! I worked through both of the books (although being a Racket newbie) and try to improve my workflow in an MS Office/Windows environment via Pollen and some DSLs. I also used LaTeX for preparing some scientific documents, but if you have to collaborate with collegues who mainly use Word, LaTeX is of no use.

So my use case is: Do calculations/read data/perform research and provide a report (avoiding Word) which can be inserted into a larger project report which itself is prepared in Word. Therefore, I would appreciate if Pollen could do ODF output (since it is open and is not controlled by Microsoft directly it is maybe the more appropriate format in comparison to DOCX).

I would like to contribute to such an opportunity, but due to family and full-time job, I doubt I could do it in the necessary manner.

My own thoughts on this matter were to perform a rendering into Python and use the libraries there which can write DOCX, but this is cumbersome and stupid. I have no idea how to do it in Racket directly. (OK, one can render all the files necessary files for ODF or DOCX, zip them together, and done. But this needs serious research on the specification of those formats. Is there a better way in Racket?) I only would need a simple output, does not have to have fancy styles.

Phew, this is a wall of text. I hope that this does not bother you.
(Btw.: Sorry for my English, it is not my mother tongue.)

Best wishes
Johannes

1 Like

It seems, that there is a simpler solution for ODF than to write out all the styles, metadata, content and so on. For ODF it seems to be possible to use a single XML file. Maybe this would simplify the implementation for Pollen very much, see:

https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part3-schema/OpenDocument-v1.3-os-part3-schema.html#__RefHeading__1414998_253892949

(One should really implement a reader for such specification documents :smile:)

Best wishes
Johannes

I would love to see a sample odf in single-XML-file format. I haven’t come across one though.

I think it is not used very often. I just generated one via Libre Office (format is “Flat XML-ODT”, extension .fodt which is in fact XML). The attached file shows an XML file sample. Hopefully, I leaked not too much personal details :smile:

libreoffice-single-file.xml (27.2 KB)

As you can see, it is mostly overhead, unfortunately. But maybe it is a good starting point for Pollen integration.

I updated the forum settings so you can upload an XML file.

Thank you very much for your fast response! I updated the post above with the XML file.

I “tested” which types of LibreOffice documents could be saved as a flat XML document, too. This is possible for:

  • Writer text document (which I uploaded above) (extension .fodt)
  • Calc spreadsheets (.fods)
  • Impress presentation (.fodp)
  • Draw drawing (.fodg)

It is not possible to use this flat XML format for:

  • Math formula
  • Base database

Although, I only see a use case for the Writer format together with Pollen, it may be useful to know that other media can be written in this flat XML format, too. For example, I could imagine that one can use a specific table export command to not embed the tables into a text document, but writing them into a dedicated spreadsheet. (Although I have the feeling that this is maybe against the Pollen philosophy. :smile:)