6 ms·
This is amazing. • This seems to be their main page: https://www.swiftlatex.com/ https://www.swiftlatex.com/ • Not all the source code is on GitHub; crucially
by svat 7y ago
This is amazing.
• This seems to be their main page: https://www.swiftlatex.com/ https://www.swiftlatex.com/
• Not all the source code is on GitHub; crucially their modification of the TeX engine seems to be distributed only as the two `.wasm` binary files). Not sure if they plan to share more or not.
• As mentioned in the FAQ/docs page, this is the work of just two people from New Zealand (Gerald Weber and Elliott Wen), and they have a paper about it from 2018 (“SwiftLaTeX: Exploring Web-based True WYSIWYG Editing for Digital Publishing”, DOI: 10.1145/3209280.3209522). Based on a quick skim so far, the paper looks fantastic, looking forward to reading it in more detail.
• In the paper, Figure 5 and the surrounding text describe how TeX was modified (the part of most interest to me); it's really clever! To avoid modifying the data structures and introducing new bugs, they hook only into TeX's internal allocation functions for tokens. (TeX as originally written by Knuth does not use malloc() or equivalent; it does all its own allocation out of giant arrays called "mem" and "str".) They can then look up this bookkeeping when the token lists are being shipped out to PDF format.
• Looks like it has some limitations as far as PS/PDF specials goes (aka “drivers” in the TeX world), so TikZ or tcolorbox don't work too well for example. However my guess is that this is just an issue with their PDF rendering (per the paper they use something like Pdf2htmlEX rather than pdf.js, for speed), and not a fundamental issue.
• But otherwise most of the standard LaTeX features and packages seem to work (labels and cross-references, etc); you can \usepackage anything and it will download the corresponding files but no data leaves your system; everything happens in the browser. Heck I even pasted in xii.tex (without the final "jbye") and it works (can click on “partridge” in the PDF and go to the corresponding part of the source).
• This sort of WYSIWYG editing for LaTeX has been done in a couple of proprietary systems before (BaKoMa TeX / Texpad), and some ancient systems as well (VorTeX), but they've been buggy in my limited experience. There was also a very impressive demo at this year's TUG meeting, by David Fuchs (who Knuth described as his “right-hand man” on the TeX project). All these projects have had to grapple with the same issues (achieving quiescence etc). This one seems to have its share of minor bugs (some artefacts seem to be visible in their published paper too!), so e.g. a feature to fully update the PDF after a (very) long typing pause (or manual user request) seems desirable. Nevertheless it's very impressive as it is.
• I think some sort of engagement with the TeX community (the mailing lists at http://tug.org/texlive/lists.html http://tug.org/texlive/lists.html etc) may help: it appears their code is currently based on pdfTeX; they should probably consider XeTeX / LuaTeX as well (given that the doc page at https://swiftlatex.readthedocs.io/en/latest/ https://swiftlatex.readthedocs.io/en/latest/ mentions “Lack of Unicode Support”). There are experts there with some idea of corner cases, the weird things that users want, etc. Hope this becomes part of the TeX mainstream (what little there is of it) to benefit all users (good typesetting for everyone!) and not some sort of edge case that dies when/if the authors lose interest.
Overall, am really awestruck by all this. Congratulations and good luck to the authors!
- ChuckNorris89 7y agoThis is indeed amazing. I'm interested if it can be self hosted for using in a commercial environment. This would be a killer feature for increasing Latex adoption at corporations stuck with MS Word.
- tingletech 7y agothe open source license is AGPL-3. Interestingly, their CLA specifies UK law, but they are based in New Zealand.
- chongli 7y agoEven with AGPL-3 a corporation could still use it internally (which I think was the GP’s point). It can’t be used to start an Overleaf competitor though, since you’d have to release all of your changes.
- enriquto 7y ago> It can’t be used to start an Overleaf competitor though, since you’d have to release all of your changes. Can you explain the logic of this argument? I don't understand it. That's the whole point of the AGPL, that you release your changes.
- celticninja 7y agoI think GP is saying that you could not use it as a basis for proprietary software but you could build on it it and sell it to people as long as you published your modifications.
- bigjake 7y agoIirc AGPL states that basically you must make the source to your entire application available to users, both the client and server side. I believe many misinterpret this to mean your entire application must be open sourced publicly, but this is not entirely true. If a corporation develops something using AGPL code and none of their users are external to the company, then they are under no obligation to distribute their source (or they must distribute it to themselves, which is effectively the same thing). IANAL, however.