varkor / quiver

A modern commutative diagram editor for the web.
https://q.uiver.app
MIT License
2.37k stars 78 forks source link

Add support for newlines on edge #225

Closed user202729 closed 2 months ago

user202729 commented 2 months ago

See https://tex.stackexchange.com/questions/716842/i-created-a-quiver-image-but-when-i-compile-it-clashes .

Also discussed in tikz pgf - Linebreak inside label - tikzcd package - TeX - LaTeX Stack Exchange and tikz cd - How to break the text appearing next to arrows in two lines? - TeX - LaTeX Stack Exchange

Side note, this is not a duplicate of https://github.com/varkor/quiver/issues/136 as this concerns \\ in an edge label, and the fix is relatively simple (I think). Even if it isn't easy to deterministically detect \\, I think it's always possible to do a safeguarding and add align=center whenever a \\ is suspected.

varkor commented 2 months ago

Even if it isn't easy to deterministically detect \\, I think it's always possible to do a safeguarding and add align=center whenever a \\ is suspected.

Yes, I suspect this could work. I'll try it out, thanks.

varkor commented 2 months ago

An issue with align=center is that it also forces the label into text mode, which doesn't match KaTeX's behaviour. I would really like a way to permit the newlines automatically whilst keeping the label in math mode.

Edit: I have a different idea to make things work.

varkor commented 2 months ago

This is fixed by https://github.com/varkor/quiver/commit/46269555e260cd3da1deb90ebf1a5cd1893fd81c. You can test it out using https://q.uiver.app/dev/.

Let me know if you encounter any issues with it. I will push a new version of quiver when I am happy it is working as intended.

user202729 commented 2 months ago

There's substack too which seems to remain in math mode. (https://tex.stackexchange.com/questions/462374/linebreak-inside-label-tikzcd-package?noredirect=1&lq=1 . Information on TeX.SE is really scattered everywhere. Better than none though.)

You may want to post a response on the linked question regarding quiver issue too (technically I also can but I'm not the one who fix the feature anyway, so I just leave a comment).

varkor commented 2 months ago

At one point I tried using \substack and decided it wouldn't work, but now I don't remember why... In any case, \array seems to work, so I think I'll leave it like this unless anyone raises any issues with it.

You may want to post a response on the linked question regarding quiver issue too (technically I also can but I'm not the one who fix the feature anyway, so I just leave a comment).

Yes, that's a good idea. I'll do so once I push a new version of quiver.