varkor / quiver

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

quiver cannot import the code it exported, array and aligned #219

Closed ouboub closed 2 weeks ago

ouboub commented 2 months ago

Hi

I already reported some time ago problems with the array and the aligned environment. This issue is however different (with or without the ampersand option.

  1. I insert either a array or a aligned environment into quiver
  2. I export is successfully to latex (latex compiles correctly)
  3. I import the generated tikzcd in the import menu and obtain
The tikz-cd diagram was not imported successfully, as an error was encountered when parsing: Diagrams must end with \end{tikzcd}

Here is a step by step description array

    \left\{
      \begin{array}{l}
        v_{2}^{\prime \prime}(t)=p(t) v_{2}(t)+q(t) v_{2}(t), \quad t \in\left[t_{0}, T\right] \\
        v_{2}\left(t_{0}\right)=0,\\
        v_{2}^{\prime}\left(t_{0}\right)=1
      \end{array}\right.

Exported as

https://q.uiver.app/#q=WzAsMSxbMCwwLCIgICAgXFxsZWZ0XFx7ICAgICAgIFxcYmVnaW57YXJyYXl9e2x9ICAgICAgICAgdl97Mn1ee1xccHJpbWUgXFxwcmltZX0odCk9cCh0KSB2X3syfSh0KStxKHQpIHZfezJ9KHQpLCBcXHF1YWQgdCBcXGluXFxsZWZ0W3RfezB9LCBUXFxyaWdodF0gXFxcXCAgICAgICAgIHZfezJ9XFxsZWZ0KHRfezB9XFxyaWdodCk9MCxcXFxcICAgICAgICAgdl97Mn1ee1xccHJpbWV9XFxsZWZ0KHRfezB9XFxyaWdodCk9MSAgICAgICBcXGVuZHthcnJheX1cXHJpZ2h0LiJdXQ==
\[\begin{tikzcd}
    {    \left\{       \begin{array}{l}         v_{2}^{\prime \prime}(t)=p(t) v_{2}(t)+q(t) v_{2}(t), \quad t \in\left[t_{0}, T\right] \\         v_{2}\left(t_{0}\right)=0,\\         v_{2}^{\prime}\left(t_{0}\right)=1       \end{array}\right.}
\end{tikzcd}\]

now` I want to reimport the construction see the screenshots

quiver-import-bug

Now the aligned

    \left\{
      \begin{aligned}
        v_{2}^{\prime \prime}(t)&=p(t) v_{2}(t)+q(t) v_{2}(t), \quad t \in\left[t_{0}, T\right] \\
        v_{2}\left(t_{0}\right)&=0,\\
        v_{2}^{\prime}\left(t_{0}\right)&=1
      \end{aligned}\right.

exported as

https://q.uiver.app/#q=WzAsMSxbMCwwLCIgICAgXFxsZWZ0XFx7ICAgICAgIFxcYmVnaW57YWxpZ25lZH0gICAgICAgICB2X3syfV57XFxwcmltZSBcXHByaW1lfSh0KSY9cCh0KSB2X3syfSh0KStxKHQpIHZfezJ9KHQpLCBcXHF1YWQgdCBcXGluXFxsZWZ0W3RfezB9LCBUXFxyaWdodF0gXFxcXCAgICAgICAgIHZfezJ9XFxsZWZ0KHRfezB9XFxyaWdodCkmPTAsXFxcXCAgICAgICAgIHZfezJ9XntcXHByaW1lfVxcbGVmdCh0X3swfVxccmlnaHQpJj0xICAgICAgIFxcZW5ke2FsaWduZWR9XFxyaWdodC4iXV0=
\[\begin{tikzcd}
    {    \left\{       \begin{aligned}         v_{2}^{\prime \prime}(t)&=p(t) v_{2}(t)+q(t) v_{2}(t), \quad t \in\left[t_{0}, T\right] \\         v_{2}\left(t_{0}\right)&=0,\\         v_{2}^{\prime}\left(t_{0}\right)&=1       \end{aligned}\right.}
\end{tikzcd}\]

quiver-import-bug1

what is wrong?

Uwe Brauer

and

varkor commented 2 months ago

Thanks for reporting. The issue is that, in general, quiver would need to parse arbitrary LaTeX to figure out what to import. Instead, it makes use of various heuristics that tend to work well in practice. I think the aligned expression is just too complicated for the current heuristics.

ouboub commented 2 months ago

Thanks for reporting. The issue is that, in general, quiver would need to parse arbitrary LaTeX to figure out what to import. Instead, it makes use of various heuristics that tend to work well in practice. I think the aligned expression is just too complicated for the current heuristics.

Thanks that includes also the array environment, I presume?

varkor commented 2 months ago

In the example you posted, the issue is that the quiver link in the code should start with a %. However, the code still does not parse if you add this. I expect aligned and array environments in general are going to cause issues for quiver. It would be better simply to use the generated quiver link in this case, and make the appropriate changes.

varkor commented 2 weeks ago

I'm going to close this, as I don't think it's ever going to be feasible to parse a diagram containing these environments.