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.
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])
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.
I guess the main question is whether we can find the right subset, and this project looks like a great start.
[1] https://tex.stackexchange.com/questions/4201/is-there-a-bnf-...
[2] https://www.overleaf.com/blog/81 --- my first attempt at rich text on Overleaf, many years ago
[3] http://dlmf.nist.gov/LaTeXML/manual/customization/customizat...
[4] https://www.overleaf.com/blog/523-a-data-driven-approach-to-...
That's probably the only approach that really makes sense:
During the past decade I was surprised to learn that the writing of programs for TeX and Metafont proved to be much more difficult than all the other things I had done (like proving theorems or writing books). The creation of good software demand a significiantly higher standard of accuracy than those other things do, and it requires a longer attention span than other intellectual tasks.
It also causes much less page-reflowing than MathJax, and is much more lightweight.
"Ten years later, in 1978, his work bore fruit"
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...)
Edit: it exists! https://github.com/manuels/texlive.js/ is a limited port of LaTeX to JS, rendered to PDF
Unless you want to write in English, which i am going to bet it still has a somewhat large audience :-P
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.
Did anyone ever see such an approach?
[1]: https://pandoc.org/index.html [2]: http://rmarkdown.rstudio.com/
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 CSS !! My figures are numbered and captioned and referenced throughout the text, same for tables. And my table of content is generated. And code is highlighted. And I have access to ditaa for ascii flow charts and a bunch of other stuff (for making uml in ascii with png export for the PDF for example). It also handles excel like tables with formulae (possible to have lisp formulae !! So cool !!) in text mode !!. And of course, you can plot your table through gnuplot inside your org file. You tell it which columns and rows, the type of graph etc :)
It's also easy to include other org files, or to go down to raw HTML for the export (rather than org mode->HTML) if need be (for a picture than spans over 2 pages for instance).
Give it a try, you might like it ;) In the end it's just an org mode export to HTML to PDF with the print CSS media query. But it works remarkably well and you have all the org mode features.
Prince does MathML, at least, if you want to avoid images.
And, if you feel like spending an obscene amount of money, on the order of $10k, there's Arbortext APP[2]. (I don't know why this even exists?)
[0]: https://ulyssesapp.com/ [1]: https://www.scribus.net/ [2]: https://en.wikipedia.org/wiki/Arbortext_Advanced_Print_Publi...
Can’t CSS make up for that to some extent?
Look into groff and possibly heirloom doctools. It's fairly difficult to learn and the default macro packages on most installations may be somewhat difficult to come to terms with/adjust for your own needs. You're definitely expected to learn basic troff macros to hack up a macro package if needed. See also: http://www.schaffter.ca/mom/ and https://utroff.org/
For instance, from this wiki page http://lambdaway.free.fr/workshop/?view=oxford I could directly generate a PDF paper, http://lambdaway.free.fr/workshop/data/lambdatalk_20170728.p..., and slides, http://lambdaway.free.fr/workshop/?view=oxford_slides
Some other pages in this workshop: http://lambdaway.free.fr/workshop/?view=factory http://lambdaway.free.fr/workshop/?view=NIL http://lambdaway.free.fr/workshop/?view=teaching http://lambdaway.free.fr/workshop/?view=lambdacode
Your comments are welcome.
Alain Marty
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.
For instance, it works in title fields across the web and search engines will understand it better than anything else.
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...
> 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.
But I can't use \def or \newcommend to define things that appear inside dollar signs either.
$$ \newcommand{\bra}{\left<} \newcommand{\ket}{\right>} $$
$$ \bra a | b \ket $$
If you go to https://jxxcarlson.github.io/app/minilatex/src/index.html, press the "Clear" button, then paste the above text, then press "Render", you should see the macros \bra and \ket properly rendered.
Also, you should definitely use \lange and \rangle in place of < and > for bra-ket notation :)
I’ve never understood how people can learn be it so, writing it is painful, it’s tooling is abysmal, and it rarely seems to work except on the person who wrote its machine.
We’ve got to be able to do better.
It seems like you haven't tried many editors. Have you tried TeXStudio (https://www.texstudio.org/)?
> it rarely seems to work except on the person who wrote its machine.
I and many others edit the same documents at the university where I work, without significant issues. Distributions like TeXLive (https://www.tug.org/texlive/) provide a consistent all-inclusive cross-platform solution.
Yes, many people produce good work in it - it’s output is fantastic after all - but an editor that would have been a substandard user experience in the 90s is the best LaTeX has in tooling.
That’s exactly what I mean!
Also, it should be considered that it's impossible to make breaking changes in the LaTeX language otherwise you lost the ability to compile a paper from 30 years ago.
But if you're trying to do something simple, I would say go for pandoc and use whatever format you're comfortable, then convert it to TeX: https://pandoc.org/