Hacker News new | past | comments | ask | show | jobs | submit login
TeXmacs and the Art of Mathematical Writing (texmacs.github.io)
69 points by amichail 12 days ago | hide | past | favorite | 44 comments

The main issue I have with TeXmacs (and similar software like LyX) is that it's hard to collaborate with others who don't use it. TeXmacs and LyX both support exporting to LaTeX, but YMMV with the readability of the LaTeX source produced, which makes it near impossible to share it with your coauthors. Also, it's hard to use them to typeset articles for journals that often require the authors use a specific style file. None of this is criticism of TeXmacs per se, and I have nothing but respect for the developers, but I believe these are the main reasons why TeXmacs isn't popular among people who write math.

I generally use TeXmacs for notes and derivations for myself. For journal articles that obviously will be collaborations I use just plain latex of course. I think the most I did was in grad school is that I wrote my candidacy report in TeXmacs, but that was obviously just something I wrote myself and it didn't require a specific style.

I think a happy medium would be if you could export snippets of latex from a larger texmacs doc but I haven't actually tried it.

I generally use TeXmacs for notes, derivations, lectures, articles, all, of course. Most of my papers in the last 7 years, around 15 and all my lectures in the same period, circa 2 courses a year.

More in detail, all these papers are been written completely in TeXmacs and then converted to LaTeX to be put in arXiv: https://arxiv.org/abs/2004.09637 https://arxiv.org/abs/2004.01513 https://arxiv.org/abs/2004.00872 https://arxiv.org/abs/2003.14264 https://arxiv.org/abs/1912.06881 https://arxiv.org/abs/1912.04830 https://arxiv.org/abs/1906.11187 https://arxiv.org/abs/1812.04422 https://arxiv.org/abs/1810.12014 https://arxiv.org/abs/1805.10814 https://arxiv.org/abs/1708.03118 https://arxiv.org/abs/1702.03195 https://arxiv.org/abs/1701.07373 https://arxiv.org/abs/1610.07886 https://arxiv.org/abs/1508.03877 https://arxiv.org/abs/1502.00157

Similarly all the lecture notes in this page: https://www.iam.uni-bonn.de/abteilung-gubinelli/teaching

I think most of the discussion in this thread does not report any real current experience using it.

Interesting. How do you collaborate with others who just use latex?

Just as a note, I do use it today, just not to publish anything as I mostly have to adhere to journal article styles (can't just get by on preprints in my field) and I collaborate with others.

I convince them to use TeXmacs :). At least I do not want to use LaTeX anymore (note that I've been hardcore LaTeX users for long time and also developed software to support LaTeX, e.g. TeXniscope, a previewer for DVI/PDF files in the early times of MacOS). Conversion to LaTeX format happens in the last stage of the submission (to arXiv or to a journal). It takes usually from 1 to maybe 10 min to have the file ready, maybe small tweaks for some bugs which I report and then get corrected. Three of my students wrote their PhD thesis with TeXmacs, and at least two/three other people I know. If I need to collaborate on a file which is being written in LaTeX I write my parts in TeXmacs and then I paste them in the file.

Most of my presentations are also written in TeXmacs and in these days I use it to teach via Zoom, or to discuss with colleagues/students, make computations, etc... Not really using paper anymore. If you need to do algebraic manipulations, then it is more convenient to copy/paste on the screen that to rewrite the same equation several times with small variations on the paper.

Using the submission requirements as an argument seems so wrong to me, it is like saying: since the final format is PDF we need to write our ideas directly in PDF... if one day editors will decide to use XML as submission format, then what? I do not want to think about mathematics with a screen divided in two parts, and the quality of the process is also very important to me. I spend maybe months to work on a paper in TeXmacs and at most only 1h in LaTeX when I really need to because editors are become used to require from the authors the work a professional typesetter would have done in the past.

Just wanted to say I loved your course on martingales approx 7 years ago at Dauphine, maybe it was already in TeXmacs :)

Thanks. Glad you liked it enough to remember :) Indeed, I've just checked and I still have the TeXmacs files for the "polycopié du cours de Processus Discrets". The main developer was in Orsay at the same time I was there 2006, for mixed circumstances I've started to interest me to that software at the same time. I should say at the beginning I was attracted to TeXmacs not as a user but because it is a very complex piece of software which is very fun to hack on (choose your language: Scheme or C++).

> I think a happy medium would be if you could export snippets of latex from a larger texmacs doc but I haven't actually tried it.

In the TeXmacs editor Edit->Copy to->LaTeX (one might have to add some macro definitions in the preamble of the LaTeX document)

Perhaps a support software to guide the writing of both the TeXmacs and the LaTeX versions of a document so that conversion is straightforward, and therefore easier to make it readable for the converter, might be useful (see discussion at http://forum.texmacs.cn/t/an-idea-for-collaborative-work-wit...). For what regards the journal style files, as far as I know they are being refined in TeXmacs---my feeling is that a comprehensive set will be reached only through user contributions.

(La)TeX is being hobbled anyway by having so many non-UTF-8-first legacy tools and not being able to directly export to a document format appropriate for electronic documents.

What about the readability of HTML exported by TeXmacs ? Can you reverse import that HTML without losses ? Can the HTML be exported as a single file ? (MTHML ? (Firefox Y U no support ?? :'( ))

I'm not sure I understand a use case for lossless reverse HTML import. TeXmacs can import HTML (e.g. Wikipedia pages) including proper recovery of mathematical formulas from MathJaX or MathML. TeXmacs can export HTML with math in MathML (since 2005), MathJaX or images according to user preferences. The exported HTML human-readable (although with some CSS here and there) like the LaTeX export (who say the contrary has visibly never used TeXmacs, at least recently). You can check the quality of the HTML export by looking at TeXmacs website (https://www.texmacs.org/tmweb/home/welcome.en.html) and at the blog (https://texmacs.github.io/notes/docs/main.html) or also at this other blog (https://plopezadeva.com) or at the webpage of Joris van der Hoeven, the main developer (http://www.texmacs.org/joris/main/joris.html). Comments and suggestions for improvements are welcome. TeXmacs do not use UTF-8 (or any other Unicode encoding) internally but support an arbitrary, extensible encoding (much like Unicode) which can be converted to Unicode without problems. The reason is simple: TeXmacs was initiated before Unicode was widely supported (~1998). Even in current times we see few reason to move to Unicode, all the TeXmacs internals are independent from external libraries or tools. It was properly working in ~1999, it works now and it will work as long as a minimal C++ compiler works.

Thanks for the details !

The use case would be collaboration with people that might not be using TeXmacs themselves,(M)HTML being the document format.

That is always tricky. HTML is a presentation language in many ways since the use of tricks or inline CSS is not forbidden. So the problem of interaction with it is similar with the problem of interaction with LaTeX (which however adds on top the macro problem). We are doing research on conservative conversion from LaTeX and probably similar techniques could be used for HTML. However I think would be more meaningful to aim to Markdown or some restricted versions of HTML as common format, since this will is easier to map reasonably well to the TeXmacs document format. I wonder if tools like PanDoc have these bidirectional conversion capabilities themselves. We are planning to have a conservative conversion for Markdown documents (meaning that local edits in TeXmacs only change locally the original Markdown document)

For the readability of HTML exported by TeXmacs, please take a look yourself at the html files in https://github.com/texmacs/notes/tree/main/docs I think that the developers would be happy to hear any comment on that topic. I am not able to answer your other questions, I hope someone else will answer them.

TeXmacs is awesome, I used it in grad school to take notes during QFT lectures and I could follow along because the shortcuts are just so intuitive if you already know latex: for example in math mode, ^ enters superscript, _ enters subscript, you can access greek letters by tab completion from the roman alphabet characters like \alpha is a+tab, \delta is d+tab, \Delta is D+tab (capital D tab). It's awesome, although a little buggy in the less used bits like the graphics maker.

Still, it has a load of potential, it just needs a little more love (developers and money I suppose).

EDIT: little tidbit, much like the online org-mode manual, judging by the typeface and the color of the hyperlinks, I bet this article itself was written in texmacs and exported to html.

> I bet this article itself was written in texmacs and exported to html.

you won. Actually as I wrote in another comment all the TeXmacs website, the blog in which the article appears, the web page of the main developer and some other websites are completely generated within TeXmacs with no assistance whatsoever from external static site generators. The content can be edited directly in TeXmacs and the hyperlinks works connecting the TeXmacs documents, so you can navigate and edit the website from within the program. This workflow has some advantages and some users adopted it for their own blogs (https://plopezadeva.com). If you strive for minimialism (with a touch of style) I can see hardly how you can more minimal. If you do not like the colors you can always change them. The typeface and the colors are defined in CSS, so you can provide those of your likings. For more fancy workflows a user developed a Markdown converted so that he can write his articles in TeXmacs and then use them with Hugo (here the result https://paperwhy.8027.org)

The graphics editor was buggy, but I find quite stable now. Lately it never blow in my face and if a speaker is writing on a blackboard I can essentially copy his drawings. If I'm lecturing on Zoom I usually use the graphics editor to illustrate some ideas ( see some examples here https://www.iam.uni-bonn.de/fileadmin/user_upload/gubinelli/... , note that this is the actual script of the lecture, written online and not postprocessed )

> EDIT: little tidbit, much like the online org-mode manual, judging by the typeface and the color of the hyperlinks, I bet this article itself was written in texmacs and exported to html.

Even more than the typeface and the hyperlink color, I found this to be a give away :P

"Figure 1. This article has been written in TeXmacs. The image shows the article being drafted and the management of the figures within the program."

I'm sorry you do not like it. Actually is borderline for me too. But I didn't resisted...

Did you reply to the wrong comment?

I do not think so. I understood you didn't liked the Figure comment (and maybe the figure itself)?

Ah! No, no, that's not what I meant at all. User noobermin guessed that the web page was written in TeXmacs and exported to HTML by analyzing subtle hints such as the typeface and the color of the links. I pointed out that of you actually read the article there is no need to interpret these clues, since the article plainly and explicitly states it was written in TeXmacs and exported to HTML!

Does that clear things up?

Yes it does. I didn't got the phrasing right. Sorry! Anyway my comment is valid, I was not really sure if I should keep the recursive picture or not. But I didn't resisted...

I used it in 2006-7 while at grad school. The tab-completion was indeed awesome, it's just so intuitive. Find the key that's close to what you want, then hit tab until it gets what you want. I ended up using LyX because it was a bit faster and better supported, but I wish they would learn from this interface.

It should be noted that TeXmacs isn't just for authoring documents in the traditional sense. It also allows running shell-like programming sessions, for example a computer algebra system, right inside the document itself. The idea is similar to Mathematica and Jupyter but rather using cells for specific purpose (text, code, ...), in TeXmacs everything is part of the same document.

[Plug] If you're an emacs user, here's a project which renders all math in LaTeX documents to SVG preview images automatically as you type:


I've used it a lot and I believe the experience is better than preview-latex in auctex (that's the only thing from auctex that it replaces). The main drawback at the moment is that you can't use the full range of math delimiters, but it does support the standard/recommended AMSMath ones.

How is that different from the preview mode of AucTeX?

I just ignore the entire TeX-Editor landscape and use VSCode with LaTeX Workshop. The latter falls apart for what I use it for often (*.cls files etc.), but VSCode is simply so much more powerful than any niche, language-specific editor can ever hope to be.

LaTeX-specific support like tab completion mentioned in this thread ("hit a+tab for alpha") also doesn't work in my use cases. I use `glossaries-extra` for everything it's suitable for, so all symbols are glossary macros and not literal letters (`\alpha`...). It makes the source beautifully readable and is more in LaTeX's spirit: what you mean is what you get (`\section` vs. `\large\bfseries\sffamily`...). So instead of `\alpha` it might say `\sym{absorbtion_coefficient}`. If you ignore the necessary `\sym` macro bit, equations in source code will read like you'd say them out loud. There's no ambiguity left, what the author meant is right there, no guessing needed.

Want to change the symbol? There's only one place you'll have to change it at. Often, you cannot change e.g. `\alpha` globally (sed and friends) because such a popular symbol is probably used in multiple contexts.

Generate a nomenclature? It's one command once everything is set up, no manual `nomencl` (which is an awful, hacky, old thing) sorcery anymore. You can even print a list of all the pages a symbol, acronym, ... has been used.

And that's just `glossaries-extra`. There's `unicode-math`/`fontspec`, `tcolorbox`, `polyglossia`, `csquotes` (latex editors might helpfully auto-complete quotes (``''), but that is entirely misguided in the first place; use `csquotes`), `cleveref`, `biblatex`, `floatrow`, `caption`, ... modern LaTeX is pretty wonderful and has a lot to offer, but I found LaTeX-specific editors lag behind and their LaTeX-specific support is not useful in a lot of those cases. Plus, LaTeX Workshop is very good in its own right.

> I just ignore the entire TeX-Editor landscape

TeXmacs is not a TeX-editor, it is an independent program. The word "TeX" is in the name because one of the ambitions of the program is to inherit the typographic excellence of TeX (see the "parent article"). On this topic, the author of TeXmacs claims he has surpassed it.

It is rather amusing how this product is neither TeX, nor emacs. Pretty sure the vast majority of folks assume it is related to at least one, if not both.

According to Joris van der Hoeven "... it has become clear over time that this choice of name was one of the biggest mistakes of the project. Indeed, the name incorrectly suggests that TeXmacs is some kind of interface to (La)TeX."

Besides that TeXmacs isn't a TeX editor, how exactly is VS Code more powerful than TeXmaker for example for the purpose of authoring TeX documents?

I'm learning for the first time that TeXmacs can interface with R for reproducible research and computational notebook type writing. I might give this a shot! I like writing Rmarkdown, but I sure hate writing prose in fixed width fonts, and I miss a lot of WYSIWYG features when I'm in Rstudio/Emacs.

I have tried it now on Xubuntu 20.10 and there is a bug. I have asked here if anyone knows how to fix it: http://forum.texmacs.cn/t/does-the-r-plugin-work/434

Please see http://forum.texmacs.cn/t/does-the-r-plugin-work/434/2 (you maybe have figured it out on your own). I tried the solution with R_LIBS_USER=~/.local/lib/R, and despite still an error being present it is possible to enter commands and see the output. Plots are displayed in own windows, but it may be that with simple programming they may be embedded in the document too.

Edit: in the same thread one can read how to embed plots generated with R in the TeXmacs document. So my impression is that there is sufficient functionality for working.

TeXmacs has interfaces for many systems (https://twitter.com/gnu_texmacs/status/1382216780702175232) including R. Seems that currently R does not run, however I think a medium R user can understand and fix the problem. The interface code for R is written in R.

Please give org-mode and org-babel a try also. There is much more utility with org and a much larger user-base. Org is more of a standard than TeXmacs, which I haven’t heard of until today. You can do all of what TeXmacs is doing without using their interface, which looks difficult to modify.

TeXmacs is as extensible as Emacs, being based on the same principles: having a full-fledged scheme interpreter to modify the behaviour of the UI and to programmatically edit the documents. You can even have Emacs-like keybindings :). What Emacs lacks and TeXmacs has is a sophisticate typesetting engine (i.e. something like TeX) to render complex documents. What Emacs has and TeXmacs lacks is a large user base and dedicated people which develop extensions, but it has a small number of core developers which maintain and use it everyday. It has ~20 years of development history.

The latest Rstudio has visual mode, which lets you write prose in a normal font and code in fixed-width. It's an early iteration, but fairly usable.

Both texmacs and lyx are excellent products, especially in the seamless integration of images and diagrams. More traditionally, Vim and Emacs can be used with snippets and vimtex/auctex quite efficiently, both for interactive note-taking and to prepare large documents. Gilles Castel has an excellent guide on the Vim side [0], and I cannot help mentioning my system [1] which I think produces pretty clear latex code.

[0] https://castel.dev/post/lecture-notes-1/

[1] https://www.reddit.com/r/unixporn/comments/jtjol5/cinnamon_l...

I found both links you suggest very interesting and impressive. But again part of my objection is that I do not want my screen divided in two, there is no need in 2020 to stick to this old tradition. I like more to be able to do this:


I've used Emacs+AucTeX for long time and I agree with you that it is an excellent toolset. It is simply that with certain tools you will never ever even think to do something because it is just these 5 sec (too much) away. Like using colors in a table, or making algebraic manipulations directly on the documents on complex formulas.

The tools we use shape what we do, subtly. If it takes you more than 5 min to make a drawing, maybe you take the decision not to do one. If takes more thant 30 sec to make a table, then same: maybe you get along without. In any case the burden of the technology will impose on you to get out of your writing focus to care about technical matters (open another applications, look into stackexchange...). I wrote that blog article to make a point for all those users who care about the quality of the interaction with the writing tool. I understand very well other tools allow more flexibility in some respects or wider compatibility, but in my personal experience none of the above mentioned tools can replace TeXmacs for creative technical writing or even for fast note taking.

If you compare TeXmacs and LyX then you miss the point of my blog article. I've tried to carefully explain the particular nature of TeXmacs including some careful UI design choices which allows the UI to be out of your way and out of your screen. Ideally, there should be no button on the screen (look at Emacs, no toolbar), the free space on the screen has to be allocated for the document, with the right information popping up when needed. Moreover I do not want to see an approximation of the final result, that is not good enough (and we are in 2020) It is not a problem with LyX itself: if you stick to 100% compatibility with LaTeX then there is no much more you can do.

Not to be confused with writing (La)TeX in Emacs, which is also fun.

Pandoc lets you write in Markdown but also include mathematics in LaTeX. For me this is a nice combination.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact