Category Theory
Zulip Server
Archive

You're reading the public-facing archive of the Category Theory Zulip server.
To join the server you need an invite. Anybody can get an invite by contacting Matteo Capucci at name dot surname at gmail dot com.
For all things related to this archive refer to the same person.


Stream: deprecated: mathematics

Topic: How to draw a diagram in LaTeX


view this post on Zulip Frank Tsai (Aug 23 2023 at 21:42):

I'm curious about how mathematicians draw commutative diagram, topology diagrams, etc in their papers.
I'm aware of tikz and tikz-cd, but for complicated diagrams it's time-consuming to draw them in tikz.
Is there an alternative to tikz that people use? I heard inkscape is a reasonable alternative.

view this post on Zulip Jean-Baptiste Vienney (Aug 23 2023 at 21:44):

There is Quiver.

view this post on Zulip Jean-Baptiste Vienney (Aug 23 2023 at 21:46):

It's based on tikz though apparently

view this post on Zulip Frank Tsai (Aug 23 2023 at 21:47):

I'm aware of quiver. My question was more general but I guess I just worded it poorly.

Say, I want to draw a complicated topological figure, is there an alternative to tikz?

view this post on Zulip Mike Shulman (Aug 23 2023 at 23:32):

I've used Inkscape once upon a time; it's not bad. But in my experience stuff drawn that way tends to look "approximate" whereas stuff drawn with tikz looks "exact" because you say say numerically exactly where you want things. Then again I mostly draw commutative diagrams, where inexact placement of objects is very noticeable; for more flabby topological pictures maybe it matters less.

view this post on Zulip Mike Shulman (Aug 23 2023 at 23:32):

For large commutative diagrams, tikzcd-editor can save a lot of time.

view this post on Zulip Wojciech Nawrocki (Aug 23 2023 at 23:37):

I have recently taken to using Penrose, see e.g. this example. It outputs an SVG which you can include in a LaTeX file.

view this post on Zulip Niles Johnson (Aug 23 2023 at 23:44):

In case anyone wants a pure text option, I've been using a few custom tikz styles that use the style of tikzcd, but without being constrained to a rectangular grid. Here's one illustrative example:
8e0bd0ce-d684-4f82-81c8-cf1448d31968.jpg

view this post on Zulip Niles Johnson (Aug 23 2023 at 23:46):

this is from the "advanced" part of a latex starter repository I made for some students a few years ago:

https://gitlab.com/nilesjohnson/latex_starter/-/tree/master/advanced

I've tweaked things a bit more since then, but I haven't bothered to update the repository. If anyone is interested, any of my recent arxiv posts would have the source, and I'm happy to discuss further.

view this post on Zulip Nathanael Arkor (Aug 24 2023 at 00:18):

Mike Shulman said:

For large commutative diagrams, tikzcd-editor can save a lot of time.

Out of curiosity, do you suggest tikzcd-editor because you find it does a better job than quiver? (I ask because, if there are shortcomings with quiver that are stopping people using it, I'd like to address them.)

view this post on Zulip Naso (Aug 24 2023 at 01:06):

Nathanael Arkor said:

Mike Shulman said:

For large commutative diagrams, tikzcd-editor can save a lot of time.

Out of curiosity, do you suggest tikzcd-editor because you find it does a better job than quiver? (I ask because, if there are shortcomings with quiver that are stopping people using it, I'd like to address them.)

One shortcoming I noticed is there doesn't appear to be a way to get a reflexive arrow (where source = target)?

view this post on Zulip Mike Shulman (Aug 24 2023 at 01:19):

Hmm, I think I just never got around to trying quiver and updating my bookmarks. On a quick glance, the only feature that's obviously (apparently) missing is loops, as Naso mentioned. Apparently you have to use a dedicated LaTeX style file too? That's a trifle annoying but I suppose not too big a deal; it looks like it just defines some tikz styles.

view this post on Zulip David Michael Roberts (Aug 24 2023 at 01:19):

I've always used xypic to draw commutative diagrams. For small and simple diagrams it's very reasonable to use. For large complex diagrams ... just a bit more patience is needed.

view this post on Zulip Nathanael Arkor (Aug 24 2023 at 09:17):

Naso said:

One shortcoming I noticed is there doesn't appear to be a way to get a reflexive arrow (where source = target)?

This is the main feature that tikzcd-editor has that quiver doesn't, yes. I'd be interested to know if that's what would hold people back from using it.

view this post on Zulip Nathanael Arkor (Aug 24 2023 at 09:23):

Mike Shulman said:

Apparently you have to use a dedicated LaTeX style file too? That's a trifle annoying but I suppose not too big a deal; it looks like it just defines some tikz styles.

On this point, the package (which defines some useful TikZ styles) was recently added to CTAN, so it should be possible simply to \usepackage{quiver} as soon as the package is added to TeXLive :)

view this post on Zulip Nathanael Arkor (Aug 24 2023 at 09:43):

Actually, I just saw that it's already available with TeXLive, so this is possible now.

view this post on Zulip Mike Shulman (Aug 24 2023 at 14:53):

(If you happen to be living on the bleeding edge of TeXLive.)

view this post on Zulip Jonas Frey (Aug 24 2023 at 21:46):

One thing that annoys me about tikz-cd are the long compilation times, and that it's not compatible with tikz's externallibrary, which allows for tikz-images to be cached so that they don't have to be recompiled on each run. I really hope they'll fix that in future versions of tikz-cd.

view this post on Zulip Nathanael Arkor (Aug 24 2023 at 22:14):

If it's something that can be fixed in tikz-cd rather than external, you could submit a feature request on the repository.

view this post on Zulip Jonas Frey (Aug 24 2023 at 22:39):

Nathanael Arkor said:

If it's something that can be fixed in tikz-cd rather than external, you could submit a feature request on the repository.

Good idea, done!

view this post on Zulip Matteo Capucci (he/him) (Aug 25 2023 at 10:00):

Nathanael Arkor said:

Mike Shulman said:

For large commutative diagrams, tikzcd-editor can save a lot of time.

Out of curiosity, do you suggest tikzcd-editor because you find it does a better job than quiver? (I ask because, if there are shortcomings with quiver that are stopping people using it, I'd like to address them.)

I never head about tikcd-editor, and checking it out I'm saying the best feature it has over quiver is being able to parse LaTeX back to a diagram! Reflexive arrows are also nice to have but so far I never missed this feature from quiver. Also let me say IMO quiver has a better UX (feels faster to use), but that might just be because I'm quite used to it by now.

view this post on Zulip Nathanael Arkor (Aug 25 2023 at 10:04):

I'm saying the best feature it has over quiver is being able to parse LaTeX back to a diagram!

This may not be the case for much longer :)

view this post on Zulip Eduardo Ochs (Aug 25 2023 at 13:49):

I use this,

http://anggtwu.net/dednat6/tug-slides.pdf

that is a front-end for diagxy, that in its turn is a front-end for xypic. It is very extensible and I use it to generate all the diagrams in my notes and papers - see:

http://anggtwu.net/math-b.html

Many of those diagrams use extensions of Dednat6 that use Pict2e as their back-ends (partly because Pict2e is very fast). But I only know one person besides me who uses Dednat6...

view this post on Zulip Tomáš Jakl (Aug 26 2023 at 10:25):

Nathanael Arkor said:

On this point, the package (which defines some useful TikZ styles) was recently added to CTAN, so it should be possible simply to \usepackage{quiver} as soon as the package is added to TeXLive :smile:

Any chance quiver can have the option in the menu to generate an output that does not depend on custom TikZ styles?

view this post on Zulip Nathanael Arkor (Aug 26 2023 at 10:37):

The package is very simple, and most of the styles won't be used in a typical diagram. So you could always manually add to your preamble the styles that happen to be used in your diagrams (e.g. it's likely you'll need the curve style, but potentially not any of the others).

view this post on Zulip Mike Shulman (Aug 26 2023 at 20:53):

It seems like it should be easy for quiver to put the property definitions directly in the code it generates rather than referring to styles. Styles, like macros, are just abbreviations, so it should be able to expand the abbreviations.

view this post on Zulip Nathanael Arkor (Aug 26 2023 at 22:25):

It would be simple. However, it would result in (in some cases significantly) larger exported TikZ code. If this is a trade off people find preferable to including a package, or a style in the preamble, then it's something that could be considered.

view this post on Zulip Matteo Capucci (he/him) (Aug 29 2023 at 08:13):

Indeed, I like to repeat as little code as possible