DEV Community

Cover image for Let's find something better than LaTeX
Peter Hoffmann
Peter Hoffmann

Posted on • Edited on

Let's find something better than LaTeX

Filling my need for a response to Nicky's pro LaTeX article I'd like to explain why LaTeX is a failed project to me. Yes, I have strong feelings about this documentation system, but - just for further reference - not towards its users as I am unfortunately one of them.

My history with LaTeX

Before I start to explain why I think one should get as many miles between them and this devilish system I need to tell you about my history with LaTeX so you can understand why my claim has evolved over years and is not just the result of a frustrated sunny afternoon. But please, you are free so skip this section.

My story starts even before my first semester a university: I remember how impressed I was by the fine layout of letters a supervisor during a school internship was able to print with the greatest of ease. He only edited the raw text, the important part, there was no formatting by hand, no clicking and searching, the antithesis of everything I had learned so far about word processing (it was the time of Microsoft Office 95).

Some years later I attended my first lecture in mathematics and had to do weekly assignments. But years of online chatting had regressed my handwriting to the look of indecipherable German runes. Being proud of my genius solutions I typeset every single page in most wonderful calligraphic formulas with the help of the even more genius power of LaTeX (thanks to D. Knuth and L. Lamport).

My next noteworthy experience were protocols of the practical training in physics that had to be conducted by two or three students. The team had to coordinate the gluing together of their pieces of text and numbers, measurements and conclusions, drawings and bibliography. Once again LaTeX to the rescue! Simple text was easily transferable from Windows to Linux to Mac, always looking the same, always looking good.

And even now my current employment includes LaTeX. We are automagicaly (actually rather in a not-to-complicated process of statistics and some text processing) generating umpteen documents containing the results of educational research for ten thousand schools, its teachers and students. Together millions of pages that no army of minions could ever put together even with the most sophisticated feature of MS Word series letters.

A short overview of the advantages of LaTeX

To conclude all the above I repeat all the advantages of the superior word processing system LaTeX.

  • Separation of content, automatic content and design: There is no need to think about page numbering, headline sizes, widows and orphans, table of contents, of figures, of tables, hyphenation, accentuation, font selection and figure placement. All that design stuff you don't know anyway is just taken care of in a professional manner. If you want to write a letter you start with "Dear Mrs. Receiver…" and even your final "My best wishes B." will be auto completed by your devoted servant LaTeX.
  • Typesetting of formulas: Superset two as square, integral or sum sign, naturally with super- and suberscript limits, these ancient Greek letters you still don't know how to pronounce (φ and ψ, ζ and ξ, can you even distinguish them in your own handwriting?) and fractions over fractions: LaTeX combines all of them to not a mayhem of numbers, letters and signs but a piece of typesetting art (still only understandable to the eye trained in arcane arts as differential calculus and algebraic geometry but nevertheless).
  • Text based: There is no format more open than the American Standard Code for Information Interchange, the base of all (computer based) writing, no raw binary code and everything well-defined and deductible. You can easily share your text, do a diff of all the changes your colleague made and easily spot the corrections of your proofreaders, version control the progress including all its advantages like branching, jumping in history, merging…. In short by using LaTeX you have everything we are used to and expect in software development.
  • Mass process able: Based on well-established software you can process thousands of documents in a reasonable time, each (as it is based on raw text) with small or large differences, generated by your favorable programming language and adjusted specifically to its purpose.

A longer overview of why I hate LaTeX so much

But why on earth, you ask, am I complaining about LaTeX even so until now I have only convinced you to de-install every word processor, scratch the DVDs, cancel your Office 365 subscription and live happily ever after?

  • Clumsy Syntax LaTeX depends on slashes, braces and square brackets. But you never know whether something is an environment or a function, which parameter is optional (hence square brackets) and which required, named or assigned by position. There is no previous knowledge you can build on neither for syntax nor the huge vocabulary. Be prepared for a livelong journey of learning and do never forget.
  • Package dependence The power of LaTeX (itself an extension of TeX) comes from some powerful packages that may localize your whole document, allow you to write chemical structural formulas of complicated organic molecules or just make really nice tables. But they have a downside. Rather than carefully extending its power, staring the most used and best supervised packages, pearls lie next to filth. The myriad of badly programmed, documented and abandoned packages that are the only way to archive that tiny feature MS Word would have handed you in the blink of an eye are bringing down the whole ecosystem. And as an icing: those packages might interact with each other producing either complete nonsense, some strange looking, fragile butterfly or just a broken document that won't compile. You will be that script kiddie just throwing together pieces of code someone recommended on Stack Overflow but never understood to reach your desired result.
  • Design abduction I never even heard of someone who could style a LaTeX document. Is there a designer that can really use this through and trough logical markup and make something beautiful of it? Don't get me wrong, LaTeX itself produces remarkable results but nothing fancy, nothing new. You will recognize a thesis typeset in LaTeX even by the scrap pieces coming out of a paper shredder. Every way I know to make something look different in LaTeX is brutally tearing down the barrier between content and design and not designing itself.
  • Objects floating away LaTeX promises to place all your non-text objects like tables, graphics and images at the exact right place so that text and non-text are balanced perfectly. The reality is that all that stuff will end up right at the end of each chapter like your weekend shopping hitting your windshield after you hit the brakes to hard. While the concept of floating objects might sound wise in reality, you most often just want to put your diagram next to the text describing it.
  • Spiderweb of Error(?)-Messages Like any (computer) language LaTeX is build on lexical rules defining how a command is written and which symbols are placed where as well as semantic rules about the placement of commands in or after each other. And naturally you will break these rules again and again. To make you learn faster LaTeX will punish you fiercely every time. The cryptic error message(s) will be hidden in a gibberish of debugging messages, meaningless outputs of page numbers, overfull \hboxs and nonsensical anecdotes of the compiler's childhood memories, spitting out text of every level of verbosity like a drunk toddler hitting keys on a toy piano (the cover image shows an complete output of an error message for one missing }). You will search for hours for forgotten braces, environments closed to early or to late and for elements that just won't work together. And that is not even considering external packages. You will cry, seriously think about rewriting your whole thesis on one of those mechanical typewriters and promise yourself to never ever ever touch LaTeX again.

Searching phoenix

So what is the solution, what is better, what is the least bad way to crowd edit, constantly review and mass produce long, beautiful document obeying to the serious rules of typesetting maybe even with formulas and graphics inside them?

There is are new generation of markup languages like markdown so much lighter
in syntax that I'm not ashamed to ask our employees to use. There are powerful systems like the HTML & CSS, scriptable by JS. Most of the big browsers have some sort of headless mode that could be converting HTML-documents to PDF with only some tiny features missing (like CSS regions, please?). A great introduction into the current state is the List of CSS features required for paged media.

I want to thank the creators of LaTeX because so much wisdom and so many thoughts went into this astonishing complex system. But only due to their generosity all that algorithms are free and open source. All that thirty year old code, balancing symbols in formulas, words in lines and lines in pages is not limited to LaTeX any more but already lives in modern Word Processors and can be still build into new, hopefully better software (e.g. MathJax).

We have all the tools we need for a new generation of documentation systems adjusted to current needs. Can we please let LaTeX be the tool of its time and move on to new ventures? Once again dwarfs on the shoulders of giants could be the new giants.

Top comments (26)

Collapse
 
carywreams profile image
Cary Reams

Question: w/r/t your education research deliverables, I'd be interested to hear more about that solution's implementation... Thinking we are headed down the same path, but for the purpose of producing large, customized downloadable books. Using PDFlib right now but I believe that will take its toll at scale.

Comment: As I read the post, couldn't help but think it would be nice to have something do for LaTeX what Typescript/Babel/etc are doing for Javascript.

Collapse
 
hoffmann profile image
Peter Hoffmann

Last things first: having another layer before LaTeX -> PDF would - in my eyes - not make LaTeX any better but increase the bloat. But this is just a spontaneous opinion.

About PDFlib I'd just like to add that a commercial (non-OSS) product with a lot of language bindings is hardly a solution for a problem which obviously should be solved using a domain specific language.

We are currently still using LaTeX but are always looking to migrate to something else. HTML is our favorite but not the winner.

Collapse
 
carywreams profile image
Cary Reams

Fair enough.

But, I'd still like to hear more about how you use LaTeX in your solution.

Collapse
 
chrispickard profile image
Chris Pickard

for me, "something better than latex" is org-mode

it can create beautiful latex pdfs (with citations, bibtex support, formulas...) it also supports tables and rudimentary spreadsheets, and it's entirely legible as plaintext (which latex isn't unless you understand latex)

Collapse
 
arnebab profile image
Arne Babenhauserheide

same here -- and one of its strengths is that it can effortlessly go down to full LaTeX where needed.

Collapse
 
nickp60 profile image
Nick W

Here here! For those interested, watch this video:
youtube.com/watch?v=SzA2YODtgK4

There are also extensions for VS, vi, and atom, so its not just for emacs...

Collapse
 
matthras profile image
Matthew Mack

I don't disagree that LaTeX needs an overhaul, but part of the problem is that since it's been around so long you run into the same problem with effectively any code-rewrite. It's going to take ages and some kind of standard needs to be agreed upon.

I will say, though, Microsoft has been doing an excellent job in making the effort to make maths easier to type in Word and OneNote. There's still a few clumsy unintuitive syntax things e.g. A matrix, if purely typed from text, needs to be written as [\matrix( row11 @ row12 & row21 & row22)] as opposed to \begin{bmatrix} row11 & row12 \ row21 & row22 \end{bmatrix}, but I'm positive a happy medium will be achieved.

I don't think it's infeasible to take some ideas from LaTeX and integrate them with e.g. markdown to provide additional functionality to a general markdown editor. In all honesty though, I have no clue how difficult such a task would be, and whether the 'taking care of the unimportant stuff' needs to be reintegrated from scratch or not.

Collapse
 
steshaw profile image
Steven Shaw

You might find the SILE typesetting system of interest 1. I went searching for something better after rewriting my CV in LaTeX. It's written in Lua, which I think is a mistake but still is fast (according to the author).

My thinking is that an improved typesetting system should be written in a fast, safe language — particularly Rust but Haskell or OCaml may more elegantly express the algorithms. It could certainly start life as an FFI wrapper around existing TeX/LuaTeX/XeTeX libraries. Techtonic seems like a project with that goal — although it is intended for processing .tex files 2.

The document language ought to be a programming language — in the vain of the unmaintained Scribe/Skribe Scheme based markup language 3 — but statically typed for easy maintenance (e.g. when upgrading "macro" packages/libraries) and better editor/IDE integration (i.e. LSP for documents).

Lout was a lazily-evaluated programming language and typesetting system that has unfortunately become an unmaintained GNU project. It was an excellent, thought-provoking idea 4.

Pollen 5 is a document preparation system written in Racket along with a typesetter called Quad 6. These projects are somewhat aligned with my thoughts, though not statically typed.

There's a couple of active typesetting system written in OCaml: Patoline 7 and SATySFi ("satisfy") 8. These projects seem very much aligned with my thinking but are quite young.

[1] sile-typesetter.org/
[2] tectonic-typesetting.github.io/
[3] www-sop.inria.fr/mimosa/fp/Skribe/
[4] en.wikipedia.org/wiki/Lout_(software)
[5] docs.racket-lang.org/pollen/
[6] docs.racket-lang.org/quad/
[7] patoline.org/
[8] github.com/gfngfn/SATySFi

Collapse
 
digitalheir profile image
Maarten • Edited

Completely agree. I decided to write my master thesis in HTML to see if I could produce something of high quality. Sort of successfully. I was disappointed by CSS print features, such as printing page numbers. Although we're getting there.

I have dedicated some open source projects to be able to use LaTeX stuff on the web, most notably latex-to-unicode-converter and BibTeX.js. KaTeX is a wonderful project for math typesetting on the web.

A big problem with LaTeX syntax is that the language is actually very poorly defined. There is no BNF and parsing general LaTeX is at least weakly context sensitive. Basically the only complete syntax definition is the source code, which is pretty much unintelligible.

Collapse
 
tusf profile image
TUSF

I was disappointed by CSS print features, such as printing page numbers.

CSS can allow you to format pages with borders, page numbers and the like. The problem is that web browsers don't implement many of the paged media features from the CSS spec. You need to use specialized software to properly generate PDFs from HTML and CSS.

You can check out print-css.rocks for tools available for the job. PrinceXML seems to be the most popular option, but WeasyPrint is the only Free and Open Source alternative. It's not as feature complete, and a tad buggy, but I haven't had too many issues with it so far.

Collapse
 
soulkathi profile image
Kathii

Thanks for this great article. Last semester I had to do a course on LaTeX at university and it was terrible. We all got lost in package chaos and complicated errors we didn't understood. The professor neither understood our problems and feelings about LaTeX nor did he really help us. We all felt so lost. So it's great to hear that others have such problems with LaTeX, too.

Collapse
 
jonw profile image
jonw

I have never seen a university lecturer who was conversant in LaTeX. Academics are already not-the-best coders. Getting them to move from server-heavy SVN to Git is more difficult than stopping global warming. LaTeX is so much more difficult than Git; there is no chance any average academic can master LaTeX intimately.

Collapse
 
arnebab profile image
Arne Babenhauserheide

That sounds like a bad course -- similar to the first course I had on C++ …

Collapse
 
hoffmann profile image
Peter Hoffmann

I wonder why people keep saying that

For professional printing, LaTeX is the best you can get.

Is there some professional publisher/printer that can confirm that, indeed, anybody is still using LaTeX. From the people I talked to I heard that Adobe GUI Products are pretty much the standard. If you want to talk OSS you might consider Scribus. Any other experience from anybody?

Collapse
 
clsource profile image
Camilo • Edited

I think a good replacement for LaTeX is bookdown.org/
It´s perfect for any book. Technical or Non Technical.

The bookdown package is a free and open-source R package built on top of R Markdown to make it really easy to write books and long-form articles/reports. Markdown is a very simple language but made powerful thanks to Pandoc, and bookdown has added a few important missing features related to writing books, such as figure/table caption numbering and cross-references, and embedding HTML widgets or Shiny apps. We have tried hard to make everything work for all output formats (PDF, HTML, and EPUB, etc), so your readers can choose their favorite file format to read. Although the bookdown package was developed using R, it does not mean your book have to be related to R at all. You can certainly write poems or novels with bookdown!

:D

Collapse
 
hoffmann profile image
Peter Hoffmann

Bookdown contains some nice extensions of Markdown but lacks a style language, table support and is bound too tightly to R (which itself contains some strange constructs by itself)

Collapse
 
clsource profile image
Camilo

Bookdown is a wraper to pandoc and rmarkdown. You can choose to use simple tables or advanced tables using latex or R code.

pandoc.org/MANUAL.html#tables

bookdown.org/yihui/bookdown/tables...

When you do not want a table to float in PDF, you may use the LaTeX package longtable, which can break a table across multiple pages. To use longtable, pass longtable = TRUE to kable(), and make sure to include \usepackage{longtable} in the LaTeX preamble (see Section 4.1 for how to customize the LaTeX preamble). Of course, this is irrelevant to HTML output, since tables in HTML do not need to float.

knitr::kable(
  iris[1:55, ], longtable = TRUE, booktabs = TRUE,
  caption = 'A table generated by the longtable package.'
)

For styling you can use themes bookdown.org/yihui/bookdown/themin...

I know that it can be seen odd that even using a powerful tool like bookdown you still need LaTex for certain operations. But I think using LaTex in certain areas that excells, it's better to use LaTeX for everything

:)

Collapse
 
nicotupe profile image
Baptiste Coulange

Thanks for this article.

I think there is still an application where LaTeX doesn't have a better replacement : generating big pdf documents / documents to print.

You can argue pdf documents and print documents are from the past (and I would agree) but since a large part of the industries are still using pdf, there will be a need for a "language" to generate big pdf documents with a good layout and which print well (particularly with a good handling of page management, not cutting the document anywhere since it was thought to be a web document not a pages-based document.)

Collapse
 
hoffmann profile image
Peter Hoffmann

I agree, there is a need for printable documents, preferably in PDF-format. But I don't think they are something from the past. And I agree that HTML is not the solution. Instead of printing webpages one can optimise HTML for printout but some viable parts are (still) missing.
I just think there should be something better than LaTeX which could be based on HTML. We should not settle (any more).

Collapse
 
kaddourkardio profile image
🄺🄰🄳🄳🄾🅄🅁 🄺🄰🅁🄳🄸🄾

For those who want/need full control of the layout and disposition of their documents, a more consistent syntax as the system is monolithic without giving up the beauty of TeX typography I suggest to give ConTeXT a try.