quiver
quiver copied to clipboard
`//` for line breaks works in quiver but not in tikzcd
This diagram contains a //
in two nodes. In quiver the line break is rendered, but the LaTeX output
\[\begin{tikzcd}
multi\\line && other\\node
\end{tikzcd}\]
renders as
Ideally quiver should convert this to a syntax that works with tikzcd.
This should be fairly easy to fix, so long as there's a convenient way to render newlines in tikz-cd. If anyone knows how to do this, please let me know :)
Wrapping it in an array should work
\begin{array}{c}
multi \\ line
\end{array}
but I have not tested it extensively.
I am using \parbox{3cm}{\centering Something That Is Longer Than Expected}
to get multiline working, however, it doesn't render with the mathematical font. I get an error with a normal \\
, I'm not quite sure why. \newline
and \linebreak
are ignored as inputs.
On reflection, this is more difficult than I first thought, since one has to determine which occurrences of \\
are actually newlines, which I believe requires parsing the LaTeX. KaTeX is doing this already, but I'm not sure whether it's possible to extract this information somehow.
However, one can add newlines to diagrams manually using \shortstack
.
I think the correct solution here would be to disable new lines in quiver. I'm not sure this is possible yet with KaTeX, so I've opened https://github.com/KaTeX/KaTeX/issues/3773.
Fixed in https://github.com/varkor/quiver/commit/a239252650751968577a981af20ebbea490fe07c (by disabling newlines).
Unfortunately, I had to revert the fix due to the issue reported here: https://github.com/varkor/quiver/issues/163#issuecomment-1546983693.
There's a discussion of this issue at diagrams - tikz-cd quiver code not working - TeX - LaTeX Stack Exchange . I think the third answer there has an automatic solution that can be implemented in quiver.
@user202729: thanks for the suggestion. I'll look into this issue and #225 this evening.
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.