Live data from Hacker News

Towards LaTeX in the Browser

hackernoon.com

61–68 of 68 posts

Re: Towards LaTeX in the Browser

#61
I wonder whether this is the right approach. TeX itself is one of the most heavily documented programs in existence. Not only are its workings documented in detail in The TeXbook (and a host of other books by other authors, such as Eijkhout's TeX by Topic) but even the program itself has been written in a “literate programming” style, with pretty formatted source code (with profuse comments) available in print (Vol B of Computers and Typesetting) and as a PDF (http://texdoc.net/texmf-dist/doc/generic/knuth/tex/tex.pdf), there's a detailed history/retrospective and log of every change that went into the program (see Chapters 10 and 11 of the book Literate Programming, though the log without explanation is also available online http://texdoc.net/texmf-dist/doc/generic/knuth/errata/errorl...), and there are even 12 hours of video of Knuth talking about the internals of the program (https://www.youtube.com/watch?v=bbqY1mTwrj8&index=12&list=PL...).

So when the article says:

> To reproduce all of LaTeX in the browser is too much to ask

I wonder why? The file tex.web is less than 25000 lines long, much of it comments, so I'd estimate that TeX itself is only about 20000 sloc (in fact tangle on tex.web generates a Pascal file tex.p which is only 6115 lines long). This is not a lot IMO, and it would be a lot better to actually re-implement this, with additional support for things like getting the parse tree etc.

Re: Towards LaTeX in the Browser

#62

Earlier quoted context omitted.

I've been using org-mode and exporting it to HTML. Then making an @media(print) style sheet and exporting the HTML/printCSS to PDF through princeXML. It's been amazing. Latex equations are exported as pngs (for PDF export because I don't think prince does Mathjax, but org mode can export to mathjax). I have my bibliography with bibtex2html. And templating my pdfs becomes so much easier than with latex. It's just HTML…

Any particular reason why you don't use org-mode's latex export (org-latex-export-to-pdf / C-c C-e l p) directly? It will render math nicely, not as embedded images, etc.

It's really because of theming. I was trying to theme my latex document, but it don't know tex well. I do know CSS well though. So theming my header, my margins, my bloquotes, my images etc is very easy in CSS. I have no idea how to achieve this easily with tex.

Re: Towards LaTeX in the Browser

#64

Earlier quoted context omitted.

It's an interesting idea. At what point, though, do we draw the line between what a character set (like Unicode) should handle, and what should be handled by a higher-level layer? I'm thinking that things like boldness, italicisation, and super script aren't really the job for a character set.

I'd say if the formatting changes the meaning of the language, Unicode should support it. So if you are searching through text, any change to your query string that you would like to constrain the text that matches should be supported by Unicode. Unicode should at least support anything that affects the semantic equality of strings.

I'm thinking of Unicode as a character set, and that text exists on an abstraction level above characters.

Re: Towards LaTeX in the Browser

#65

Earlier quoted context omitted.

I'd say if the formatting changes the meaning of the language, Unicode should support it. So if you are searching through text, any change to your query string that you would like to constrain the text that matches should be supported by Unicode. Unicode should at least support anything that affects the semantic equality of strings.

I'm thinking of Unicode as a character set, and that text exists on an abstraction level above characters.

I was thinking that it's analogous to ก็็็็็็็็็็็็็็็็็็็็ where the character dictates how the surrounding characters are rendered.

Re: Towards LaTeX in the Browser

#66
post #39

Earlier quoted context omitted.

It's an interesting idea. At what point, though, do we draw the line between what a character set (like Unicode) should handle, and what should be handled by a higher-level layer? I'm thinking that things like boldness, italicisation, and super script aren't really the job for a character set.

Unicode already has 𝐛𝐨𝐥𝐝, 𝘪𝘵𝘢𝘭𝘪𝘤 and ˢᵘᵖᵉʳˢᶜʳⁱᵖᵗ variants of the Latin alphabet.

The bold and italic characters actually belong to the Mathematical Alphanumeric Symbols [0] block, so they're strictly meant for math notation rather than general formatting. The superscripts are part of the Spacing Modifier Letters [1] block, which is used for IPA. You'll also sometimes find other formatting quirks that are deprecated in Unicode and meant for compatibility purposes.

[0]: https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symb...

[1]: https://en.wikipedia.org/wiki/Spacing_Modifier_Letters

Re: Towards LaTeX in the Browser

#67
I actually did 'LaTeX in the browser' as a master thesis in 2014, but never went to continue developing it afterwards, be it as open-source project or with a commercial intent in mind. Although I though, at that time, I was at least up to the few solutions that were out there and solved the task of instant updates and real-time collaborative work on a document pretty gracefully.

Some neat improvements would have been version and so on, but you know, never made it that far after picking up a job. Kind of a shame...

https://github.com/djuerges/cotex

Re: Towards LaTeX in the Browser

#68
There is not really a need to modify LaTeX at all to make it run in the browser. It already exists. Without modifying a single line of code, we have implemented a full browser-based port of LaTeX as part of our Browsix project, which makes it possible to run full, unmodified Unix applications inside the browser. See http://browsertex.org and http://browsix.org (and http://bpowers.net and https://jvilk.com/ and http://plasma.cs.umass.edu).
Post reply on HN