News for hackers. Stuff that matters.
Re:LaTeX.css – Make your website look like a LaTeX document by xigoi on Monday December 02, 2024 @07:45AM (#42295654)
Try to make a LaTeX document that automatically reflows based on screen size and you’ll see why it’s difficult.
Re:LaTeX.css – Make your website look like a LaTeX document by fooker on Monday December 02, 2024 @07:52AM (#42295691)
That is not what a latex document is for.

It's like talking about reflowing a physical page.

Instead, you change the document page size and render multiple versions and switch it out based on zoom level.

Re:LaTeX.css – Make your website look like a LaTeX document by xigoi on Monday December 02, 2024 @07:55AM (#42295704)
That’s the point. HTML has to support arbitrary screen sizes whereas LaTeX doesn’t, so the layout algorithms have to be more accomodating.
Re:LaTeX.css – Make your website look like a LaTeX document by eddd-ddde on Monday December 02, 2024 @07:57AM (#42295724)
But the width of a PDF is still arbitrary isn't it? Can you just, recalculate for bigger widths?
Re:LaTeX.css – Make your website look like a LaTeX document by MrVandemar on Monday December 02, 2024 @08:04AM (#42295774)
Not really. It's fixed at "compile time". Eg "A4" or "Letter". I guess it "changes" according to zoom level, but that's just enlarging or shrinking - no reflow required.
Re:LaTeX.css – Make your website look like a LaTeX document by Bootvis on Monday December 02, 2024 @08:13AM (#42295852)
You could apply the LaTeX algorithm to each rendering. The rendering might jump and it would be a change from before but it can be done.
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>.

Re:LaTeX.css – Make your website look like a LaTeX document by xigoi on Monday December 02, 2024 @03:22PM (#42300023)
You can’t ask the user of a website to fix overfull hboxes for you after they resize their browser window.
Re:LaTeX.css – Make your website look like a LaTeX document by WillAdams on Monday December 02, 2024 @08:28AM (#42295980)
A good example of this is Bertrand Russell's _Introduction to Mathematical Philosophy_:

https://courses.umass.edu/klement/imp/

which is available in a number of sizes _and_ has the LaTeX source available showing how the various sizes are arrived at.

Re:LaTeX.css – Make your website look like a LaTeX document by xigoi on Monday December 02, 2024 @03:24PM (#42300036)
It’s still just a few different sizes. A HTML website has to support every possible width.
Re:LaTeX.css – Make your website look like a LaTeX document by WillAdams on Tuesday December 03, 2024 @01:00PM (#42309062)
The LaTeX source may be easily edited to impart any size/proportion desired --- not quite as straight-forward as re-sizing a browser window, but the same ultimate effect.
Re:LaTeX.css – Make your website look like a LaTeX document by jxy on Wednesday December 04, 2024 @12:36PM (#42319808)
The HTML version is quite nice. Do you know how they did the LaTeX to html conversion?
Re:LaTeX.css – Make your website look like a LaTeX document by WillAdams on Wednesday December 04, 2024 @03:08PM (#42321500)
No idea. Ask the folks who manage that page?