varkor / quiver

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

Add line breaks between arrows in the exported tikz-cd code #26

Closed DimaSamoz closed 4 years ago

DimaSamoz commented 4 years ago

Currently line breaks are only added between arrows at different levels (e.g. 1-cells and 2-cells), so all morphisms are exported in one line. It would be good to separate arrows at the same level into their individual lines so the code becomes a bit more readable and editable, if necessary. That is, instead of

\[\begin{tikzcd}
    {S} & {1} \\
    {A} & {\Omega}
    \arrow["{m}"', from=1-1, to=2-1, tail] \arrow["{\mathit{true}}", from=1-2, to=2-2] \arrow["{!_S}"{name=0}, from=1-1, to=1-2] \arrow["{\chi_S}"{name=1, swap}, from=2-1, to=2-2, dashed]
\]

it would be better to export

\[\begin{tikzcd}
    {S} & {1} \\
    {A} & {\Omega}
    \arrow["{m}"', from=1-1, to=2-1, tail]
    \arrow["{\mathit{true}}", from=1-2, to=2-2] 
    \arrow["{!_S}"{name=0}, from=1-1, to=1-2] 
    \arrow["{\chi_S}"{name=1, swap}, from=2-1, to=2-2, dashed]
\]

Should just be a matter of adding some whitespace to https://github.com/varkor/quiver/blob/81f96a711ad6774fcc9bdf2d42fb4cdb9a860843/src/quiver.js#L455 Arrows at different levels can be separated by an empty line, for example.

varkor commented 4 years ago

I'm happy outputting each edge on its own line. This has been changed as of https://github.com/varkor/quiver/commit/831abcf17dabe3c538cb42ba996f2ffb40d7e7c9.