quiver icon indicating copy to clipboard operation
quiver copied to clipboard

`//` for line breaks works in quiver but not in tikzcd

Open AlexanderZeilmann opened this issue 3 years ago • 7 comments

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 Bildschirmfoto 2022-01-25 um 12 09 19

Ideally quiver should convert this to a syntax that works with tikzcd.

AlexanderZeilmann avatar Jan 25 '22 11:01 AlexanderZeilmann

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 :)

varkor avatar Jan 25 '22 11:01 varkor

Wrapping it in an array should work

\begin{array}{c}
multi \\ line
\end{array}

but I have not tested it extensively.

AlexanderZeilmann avatar Jan 25 '22 12:01 AlexanderZeilmann

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.

balacij avatar Mar 16 '22 16:03 balacij

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.

varkor avatar Jan 09 '23 18:01 varkor

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.

varkor avatar Jan 09 '23 20:01 varkor

Fixed in https://github.com/varkor/quiver/commit/a239252650751968577a981af20ebbea490fe07c (by disabling newlines).

varkor avatar Apr 13 '23 18:04 varkor

Unfortunately, I had to revert the fix due to the issue reported here: https://github.com/varkor/quiver/issues/163#issuecomment-1546983693.

varkor avatar May 18 '23 20:05 varkor

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 avatar May 01 '24 08:05 user202729

@user202729: thanks for the suggestion. I'll look into this issue and #225 this evening.

varkor avatar May 01 '24 12:05 varkor

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.

varkor avatar May 01 '24 14:05 varkor