(I'm a co-founder at Overleaf.com, which does collaborative 'LaTeX in the browser' in a different sense.)<p>I like the idea of a 'sane' subset of LaTeX that is easy to publish to the web. There are tools like LaTeXML and TeX4ht that try to convert general LaTeX documents to (X)HTML, but it's a very hard problem.<p>Some difficulties arise from the fact that TeX is just very hard to parse in general. Even the first stage of parsing TeX is Turing complete [1]. This makes it hard to write tooling e.g. for linting (though tools exist, e.g. chktex) or creating a WYSIWYG editor backed by LaTeX [2]. (edit: or creating a good LaTeX auto-complete [4])<p>Others arise from TeX's extensibility --- there are many thousands of packages that define their own commands and environments for different types of documents and different disciplines. This extensibility is on the one hand one of the main reasons that TeX and LaTeX are still actively used some 40 years after TeX's initial release, but on the other hand a major challenge for conversion to HTML. The LaTeXML project has many custom bindings [3] for these packages, but it's far from complete.<p>I guess the main question is whether we can find the right subset, and this project looks like a great start.<p>[1] <a href="https://tex.stackexchange.com/questions/4201/is-there-a-bnf-grammar-of-the-tex-language" rel="nofollow">https://tex.stackexchange.com/questions/4201/is-there-a-bnf-...</a><p>[2] <a href="https://www.overleaf.com/blog/81" rel="nofollow">https://www.overleaf.com/blog/81</a> --- my first attempt at rich text on Overleaf, many years ago<p>[3] <a href="http://dlmf.nist.gov/LaTeXML/manual/customization/customization.latexml.html" rel="nofollow">http://dlmf.nist.gov/LaTeXML/manual/customization/customizat...</a><p>[4] <a href="https://www.overleaf.com/blog/523-a-data-driven-approach-to-latex-autocomplete" rel="nofollow">https://www.overleaf.com/blog/523-a-data-driven-approach-to-...</a>
Just a bit of historical correction. The article/post says:<p>"Ten years later, in 1978, his work bore fruit"<p>This gets things pretty wrong. He got the idea in 1977, and his estimate of "this will take 6 months" was pretty close, in that the initial version was finished sometime in 1978. It then took about another ten years to be "actually done". (Rewrite, add features, fix bugs, create Metafont, create WEB, etc...)
I wonder if somebody has taken TeX and compiled to the browser in wasm using emscripten. That would be easier to port but heavy on load times.<p>Edit: it exists! <a href="https://github.com/manuels/texlive.js/" rel="nofollow">https://github.com/manuels/texlive.js/</a> is a limited port of LaTeX to JS, rendered to PDF
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 <i>The TeXbook</i> (and a host of other books by other authors, such as Eijkhout's <i>TeX by Topic</i>) 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 <i>Computers and Typesetting</i>) and as a PDF (<a href="http://texdoc.net/texmf-dist/doc/generic/knuth/tex/tex.pdf" rel="nofollow">http://texdoc.net/texmf-dist/doc/generic/knuth/tex/tex.pdf</a>), there's a detailed history/retrospective and log of every change that went into the program (see Chapters 10 and 11 of the book <i>Literate Programming</i>, though the log without explanation is also available online <a href="http://texdoc.net/texmf-dist/doc/generic/knuth/errata/errorlog.pdf" rel="nofollow">http://texdoc.net/texmf-dist/doc/generic/knuth/errata/errorl...</a>), and there are even 12 hours of video of Knuth talking about the internals of the program (<a href="https://www.youtube.com/watch?v=bbqY1mTwrj8&index=12&list=PL94E35692EB9D36F3" rel="nofollow">https://www.youtube.com/watch?v=bbqY1mTwrj8&index=12&list=PL...</a>).<p>So when the article says:<p>> To reproduce all of LaTeX in the browser is too much to ask<p>I wonder why? The file <i>tex.web</i> is less than 25000 lines long, much of it comments, so I'd estimate that TeX itself is only about 20000 sloc (in fact <i>tangle</i> on <i>tex.web</i> generates a Pascal file <i>tex.p</i> 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.
I was wondering recently if/how it would be possible to piggybag latex’ georgous typesetting (place the letters) to bring justified-text to websites.
I want to do a PoC for absolut positioning all letters of a basic document placed by tex for my screensize.<p>Did anyone ever see such an approach?
Are there any other solutions to document typesetting with latex-like features? TeX is very obtuse for someone who hasn't been using it for a long time.
What do you think of this project {lambda way} as an alternative to LaTeX in a browser: <a href="http://lambdaway.free.fr" rel="nofollow">http://lambdaway.free.fr</a><p>For instance, from this wiki page <a href="http://lambdaway.free.fr/workshop/?view=oxford" rel="nofollow">http://lambdaway.free.fr/workshop/?view=oxford</a> I could directly generate a PDF paper, <a href="http://lambdaway.free.fr/workshop/data/lambdatalk_20170728.pdf" rel="nofollow">http://lambdaway.free.fr/workshop/data/lambdatalk_20170728.p...</a>, and slides, <a href="http://lambdaway.free.fr/workshop/?view=oxford_slides" rel="nofollow">http://lambdaway.free.fr/workshop/?view=oxford_slides</a><p>Some other pages in this workshop:
<a href="http://lambdaway.free.fr/workshop/?view=factory" rel="nofollow">http://lambdaway.free.fr/workshop/?view=factory</a>
<a href="http://lambdaway.free.fr/workshop/?view=NIL" rel="nofollow">http://lambdaway.free.fr/workshop/?view=NIL</a>
<a href="http://lambdaway.free.fr/workshop/?view=teaching" rel="nofollow">http://lambdaway.free.fr/workshop/?view=teaching</a>
<a href="http://lambdaway.free.fr/workshop/?view=lambdacode" rel="nofollow">http://lambdaway.free.fr/workshop/?view=lambdacode</a><p>Your comments are welcome.<p>Alain Marty
I used <a href="https://github.com/phfaist/pylatexenc" rel="nofollow">https://github.com/phfaist/pylatexenc</a> to convert LaTeX to unicode text, with math symbols and superscripts etc.<p>It's of course never going to be as good looking as MathJax or something like that -- but it may be more appropriate to be able to treat it as plain Unicode text in some cases.<p>For instance, it works in title fields across the web and search engines will understand it better than anything else.
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 <a href="http://browsertex.org" rel="nofollow">http://browsertex.org</a> and <a href="http://browsix.org" rel="nofollow">http://browsix.org</a> (and <a href="http://bpowers.net" rel="nofollow">http://bpowers.net</a> and <a href="https://jvilk.com/" rel="nofollow">https://jvilk.com/</a> and <a href="http://plasma.cs.umass.edu" rel="nofollow">http://plasma.cs.umass.edu</a>).
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.<p>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...<p><a href="https://github.com/djuerges/cotex" rel="nofollow">https://github.com/djuerges/cotex</a>
I read the post but I still don't understand: is it possible to define new commands using \def or \newcommand? At first I thought these are what the other meant by "macro", but later he says<p>> We are exploring ways for users to define non-default environment behaviors in the browser. The same goes for macros used outside the dollar and double-dollar fences.<p>But I can't use \def or \newcommend to define things that appear <i>inside</i> dollar signs either.
Just for fun here is a little web game I made to look like a maths paper using MathJax.<p><a href="https://angarg12.github.io/TrueExponential/" rel="nofollow">https://angarg12.github.io/TrueExponential/</a>
PreTeXt from <a href="http://mathbook.pugetsound.edu/" rel="nofollow">http://mathbook.pugetsound.edu/</a> has gotten some mindshare.
I love the output of LaTeX but the language itself (and it’s dependencies and packages) are an absolute horror show.<p>I’ve never understood how people can learn be it so, writing it is painful, it’s tooling is <i>abysmal</i>, and it rarely seems to work except on the person who wrote its machine.<p>We’ve got to be able to do better.