For writing LaTeX documents, I use VS Code together with the latex-workshop extension.

One thing I particularly like about VS Code is its built-in support for snippets and how easy it is to implement your own.

As there aren’t any extensions in the marketplace providing snippets for commutative diagrams, I implemented some using tikz-cd on my own:

Demonstration

This is what using the snippets looks like:

snippet

Result:

result

I cycle through the preselected X, Y, S, T by pressing tab, which makes it very convenient to change the objects’ names appearing in the diagram.

snippets-tikzcd

In case you want to try it for yourself, I packaged the whole thing and published it as the snippets-tikzcd extension.

To install the extension, simply go to File ⟶ Preferences ⟶ Extensions, search for snippets-tikzcd and install. If you for some reason dislike using the marketplace, you can also find the plugin in the versions folder of this GitHub repository.

supported diagrams

Here’s the kinds of diagrams the extension currently supports:

  • (pushout/pullback) squares
  • triangles
  • cubes
  • (short/split/long) exact sequences and the ‘snake’
  • equalizers and reflexive parallel pairs
  • (augmented) (co-)simplicial objects
  • adjunctions and natural transformations

Read the above as trigger triggers the drop-down menu to select all the varieties of diagrams of shape trigger (as in the demo).

Note that, in the future, the above list might not be comprehensive anymore if I end up adding some other diagrams. I’ll try to always keep the information on the overview page of the extension up-to-date.

contributing

If you’d like to have other types of diagrams supported or have anything else to report, either contact me or submit a pull request at the GitHub repo.

Enjoy!