News for hackers. Stuff that matters.
Re:LaTeX.css – Make your website look like a LaTeX document by esperent on Monday December 02, 2024 @08:16AM (#42295885)
How long does a fast latex renderer take on a large document? It's been a few years since I worked with latex, but it's on the order of multiple seconds, right?
Re:LaTeX.css – Make your website look like a LaTeX document by setopt on Monday December 02, 2024 @11:58AM (#42298020)
For a book, it can take minutes. For a short document, seconds.

Texpresso looks promising though, but I haven’t tried it yet.

Re:LaTeX.css – Make your website look like a LaTeX document by chrismorgan on Monday December 02, 2024 @09:08PM (#42302375)
The Knuth-Plass line-breaking algorithm is applied per paragraph; performance is typically not going to be an issue at all.

If you apply it to all paragraphs, yes, you will get pathological performance on some extreme cases—the algorithm is quadratic, if I recall correctly. But there’s nothing preventing you from trying to apply it in general, and giving up if the input is too long. So your five or ten line paragraphs get KP, and longer paragraphs get greedy.

There is absolutely nothing stopping browsers from applying Knuth-Plass. In fact, Firefox has had a bug about implementing it for 14 years <https://bugzilla.mozilla.org/show_bug.cgi?id=630181>, and there’s some useful discussion of things there. And CSS itself is finally actually going ahead with `text-wrap: pretty`, which encourages such things. Long ago, IE apparently even had it via `text-justify: newspaper` <https://news.ycombinator.com/item?id=5189258>.