mathstodon.xyz is one of the many independent Mastodon servers you can use to participate in the fediverse.
A Mastodon instance for maths people. We have LaTeX rendering in the web interface!

Server stats:

2.8K
active users

Terence Tao

Every five to ten years, I make the effort to switch my editor to a more modern one. This process has now iterated several times back from when I was a graduate student in the mid-1990s using vi from a UNIX shell to write in plain TeX. On the suggestion of a reader here, I installed + + + as an upgrade from my current setup of +
which I had been using for almost a decade, and am recording my first impressions here (which will most likely be quite naive for existing VSCode users).

The installation had no problems (other than the four hours needed to download TeX live on a slow internet connection). I began experimenting with various features. So far I have mostly played with the user-defined code snippets feature, which can allow me for instance to create an entire corollary environment by typing in a trigger word (I chose "cor") and pressing tab (see enclosed screenshots). Strangely enough I had a version of this functionality 20 years ago during a brief period when I experimented with using Microsoft Word as a LaTeX editor purely for the ability to use Visual Basic macros (though I abandoned this shortly after due to the lack of other LaTeX-friendly features). I could certainly see myself using this feature frequently as a time-saver.

So far the AI-powered Copilot suggestions have been mainly useful for filling out the snippet functionality: after giving a few examples of the snippets I wanted, it was able to suggest more that I could accept, again with the single click of the tab key.

(Incidentally, the screenshots are displaying a paper which I will be putting on the arXiv shortly. Stay tuned...)

I found useful for creating more complicated snippets involving regex expressions. Specifically, I wanted a snippet that could take a LaTeX expression such as (x+y=z) and add \left and \right modifiers to the delimiter to create \left(x+y=z \right). It took two tries on GPT's part, but the second solution worked to give exactly what I wanted (and even helpfully formatted it in the VScode JSON format that I needed, even though I didn't ask for this). chat.openai.com/share/35a5eee7

A brief update: it turns out that the GPT-provided regex didn't quite handle nested delimiters in the way I intended, but it was close enough that I was able to read the regex documentation manually and tweak it to what I wanted. So some prior skill in regex was needed to accomplish the task, but less than what would have been required without the assistance of GPT.

More generally, it seems that GPT allows one to "level up" one's skill in a text-based task, but with diminishing returns the more expert one already is. Someone completely unfamiliar with the task may become the equivalent of an advanced beginner with GPT; a beginner may achieve the equivalent of an intermediate level of skill; and someone already at intermediate level may effectively become an expert, at least in some aspects. But for someone already expert, the further gains from GPT assistance are relatively modest (at least, in the way I have been using the tool).

@tao This looks very slick. I use Sublime Text which has similar functionality in some ways, but the layout presented here (and the use of Copilot to create new snippets) seems very useful.

@tao I'm currently experimenting with vscode too, coming from a rather bare bones vim (almost vi actually) setup due to the need to be compatible/portable across not only Linux and Windows but als different UNIXes. Since this requirement will soon mostly be gone and vscode is neatly scriptable, it does look like a neat alternative.

I'm also using development container functionality for reproducible and consistent builds across different machines independent of the LaTeX setup. This also allows me to use a more sandboxed setup; not in a security way, mind you, but a more atomic setup that's easy to maintain.

@tao For me, emacs with the package auctex remains my favourite way of editing LaTeX files, since the last millennium.

Often I am forced to use something else, such as Overleaf when collaborating, and although it is fine, it doesn't even come close to emacs with auctex. (Overleaf actually has an emacs mode, so it comes close.)

@tao Just in case you missed this one, LatexWorkshop also gives you a citation browser (Cmd+Shift+P and type latexworkshop… to see options) that has come in handy a lot of times :)

@tao@mathstodon.xyz

For completion¹ I’d add that the combination of
NeoVim + VimTeX + UltiSnips works wonderfully for me. See this for an example of how this setup can be used for taking notes in mathematics in real time.

¹ I.e. not for my-editor-is-better-than-yours toxic reasons.

NeovimNeovimHyperextensible Vim-based text editor

@tao fwiw, I use texmacs which is a wysiwyg editor. But it doesn't save files as tex, but can export to tex and supports AMS math formats. The best editor I have used.

texmacs.org/tmweb/home/welcome

www.texmacs.orgWelcome to GNU TeXmacs (FSF GNU project)

@tao I've found / + very good and even better than + after proper configuration (which, vim being vim, can take some time). One of the nicest parts of it is its use of vim's conceal feature, where it displays some commands like \int in math mode as an actual integral sign. Maybe next time you can try going back to your vi roots with this.
Although VimTeX doesn't come with snippets by default, there are plenty of ways to set that up in vim if you so desire. I think that there's also a copilot extension available for nvim.

@tao very well said Tao. That is exactly my conclusion a while ago on my podcast datascienceathome.com

@tao Could you please share the revised regex string?

@saf This is the current version. I suspect it may need some further tweaking in the event of mixed delimiters (e.g., \{ (a+b)/(c+d): a,b,c,d \in A \}), but so far it has performed correctly in the use cases I have applied it to. (Since I can manually correct the snippet afterwards, I would be satisfied with say a 95% success rate here, rather than 100%, which is one reason why I am willing to experiment with AI-generated code.)

@tao Nested delimiters imply a non-regular language, so a regular expression is usually not what you want (/real/ regular expressions /can't/, but nowadays, they are often extended for some use cases, but it's still an ill fit).

If you use a parser library that can e. g. apply BNF grammars, it's usually much easier and straightforward to express what you actually want.

(For example in Common Lisp, I'd use esrap; in Clojure instaparse.)