DEV Community

Cover image for Let's find something better than LaTeX

Let's find something better than LaTeX

Peter Hoffmann on September 21, 2017

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 ab...
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
 
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
 
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
 
thyringer profile image
Thyringer

For professional printing, LaTeX is the best you can get. As an alternative, I use Typora, where you can format very well with CSS. For elaborations, documentations it is ideal; especially since numerous output formats are available. But at Typora I realized that Markdown is not really a substitute for LaTeX; it would be better if the developers of the program had taken HTML, which is simply more complete. One would then only have to use the LaTeX algorithms somehow, in order to get HTML + CSS professional text set. But then mathematical formulas would be problematic, because here HTML or MathML would be much too unwieldy again; therefore, I think the best thing would be a completely new markup language with LaTeX-like syntax, but similar to HTML formatable by CSS; and in the background the nice TeX-Algorthimen, controllable via CSS commands and certain structural elements to professional print set

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
 
thyringer profile image
Thyringer

I meant more related to private users: seminar papers, Bachelore Thesis etc; most of them work here with Word, or just LaTeX. At the latest with elaborate source work or many mathematical illustrations LaTeX is simply unbeatable.
Of course there are still commercial variants here; I do not know if Adobe has a product, which is especially for scientific work.

Scribus is more for magazines, things like that; and not for scientific publications.

As I said, I can only recommend Typora because you can even directly enter LaTeX math formulas or HTML; the PDF output is acceptable if you refine something;

But as I said, a real alternative for home users I do not see when it comes to scientific work.
Companies / publishers use different software depending on their focus.

Collapse
 
jonw profile image
jonw • Edited

You made me ponder what I want from LaTeX. I'm a heavy user of LaTeX at school and work. I guess LaTeX has become to some of my work circles (especially schools) what Markdown is to me --- a convenient common language to converse in. LaTeX can be really concise if you're not trying to get really creative with layouts.

I personally believe that LaTeX and its packages are a lot of value. Many packages are updated constantly, even in 2018. Yes, these packages basically patch problems in LaTeX. I think it's mainly because the LaTeX community is quite toxic, and doesn't receive corrections very well.

(tex.meta.stackexchange.com/questio...) (tex.meta.stackexchange.com/questio...).

The toxicity of the community is very likely directly shaped by the frustration that LaTeX causes the users (the community itself).

I had been compiling quite a list of "Hello World" LaTeX know-how with MWEs (minimal working examples), replete with the precise packages needed for each MWE. You can also look at my recommended starter (tex.stackexchange.com/a/471072/152148).

If anyone is interested to learn LaTeX together, and brave the toxicity of the LaTeX community together, let me know. I'll get you started quickly. (UPDATE: Sorry, I can't now. Work instructions.)

Collapse
 
lgallindo profile image
Lucas Gallindo

Just don't use something Javascript-based as replacement, please.

Collapse
 
arnebab profile image
Arne Babenhauserheide • Edited

Most of the problems here sound like they are about support from the development environment, not the system itself.

  • Error messages: Compiler (just compare GCC 6 vs. GCC 2 -- latex could become as good)
  • Packages: Organization of information and recommendation of tools to use.

(well, objects floating away means you need \FloatBarrier -- and most times I used wrapfig, the caption evolved and at the end I realized a float fit better)

I found that I cannot hack with LaTeX without internet, and that’s pretty worrying. But it’s because I have no neat local documentation. Too much expert knowledge, too little clear and structured documentation (except for the documentation which is restricted to single packages). That does not sound like something which needs a rewrite.

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.

Collapse
 
jj profile image
Juan Julián Merelo Guervós

I pretty much agree with everything you've said. LaTeX is really terrible conveying error messages, and it's very difficult to get stuff right if your way is not LaTeX's way.
However.
Given the humongous amount of plugins and related developments (like Knitr, which I love) I don't see a replacement coming soon. Some simpler markups like markdown or org-mode can go part of the way, covering simple articles and even whole books; I wouldn't write a book now in LaTeX if I can avoid it. But for some niches there's nothing that beats LaTeX.
Besides, there's some stuff there that's pretty interesting: XeLaTeX, for instance, biber as a replacement for bibtex... I think that eventually a better LaTeX will simply be... a better LaTeX.
This is an issue that arises from time to time, and I seem to remember to have seen some articles that even provide PoC for replacements. None of them got to fly. So I guess it's LaTeX (or LaTeX++) for the foreseeable future.

Collapse
 
tigersbyte profile image
Peter Danckwerts

You've summed up my feeling of conflict about LaTeX. The difficulty of designing books has made be give up using it but I love the way that it automates page make-up.