varkor / quiver

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

tikzcd returns an error on a simple diagram #100

Closed suhr closed 3 years ago

suhr commented 3 years ago

For https://q.uiver.app/?q=WzAsMyxbMCwxLCJBIl0sWzIsMSwiQiJdLFsyLDAsIkIiXSxbMCwxLCJmIiwyXSxbMCwyLCJmIl0sWzIsMSwiXFxtYXRocm17aWR9X0IiXV0=, Quiver generates the following code:

% https://q.uiver.app/?q=WzAsMyxbMCwxLCJBIl0sWzIsMSwiQiJdLFsyLDAsIkIiXSxbMCwxLCJmIiwyXSxbMCwyLCJmIl0sWzIsMSwiXFxtYXRocm17aWR9X0IiXV0=
\[\begin{tikzcd}
    && B \\
    A && B
    \arrow["f"', from=2-1, to=2-3]
    \arrow["f", from=2-1, to=1-3]
    \arrow["{\mathrm{id}_B}", from=1-3, to=2-3]
\end{tikzcd}\]

But trying to use it with XeLaTeX gives the following error:

! Package pgfkeys Error: I do not know the key '/tikz/"f"'' and I am going to i
gnore it. Perhaps you misspelled it.

See the pgfkeys package documentation for explanation.
Type  H <return>  for immediate help
...
l.113 I think the culprit is a tikzcd arrow in cell 2-3.
\errmessage ...currentrow -\tikzcd@currentcolumn }

l.116 \end{tikzcd}
                  \]
varkor commented 3 years ago

Are you including quiver.sty? This example doesn't result in any error for me.

suhr commented 3 years ago

Yes, I do. This is the file: https://gist.github.com/suhr/843e1a02155fb089b7520e100cedd610

TeXlive is installed with texlive.combine { inherit (texlive) scheme-medium collection-langcyrillic marginnote eulervm tikz-cd; } in NixOS. Maybe I need an another obscure TeX package to make it work?

suhr commented 3 years ago

Additional info: removing labels makes it compile. But unfortunately, labels matter.

varkor commented 3 years ago

Does the following example compile for you?

\documentclass{article}

\usepackage{quiver}

\begin{document}

% https://q.uiver.app/?q=WzAsMyxbMCwxLCJBIl0sWzIsMSwiQiJdLFsyLDAsIkIiXSxbMCwxLCJmIiwyXSxbMCwyLCJmIl0sWzIsMSwiXFxtYXRocm17aWR9X0IiXV0=
\[\begin{tikzcd}
    && B \\
    A && B
    \arrow["f"', from=2-1, to=2-3]
    \arrow["f", from=2-1, to=1-3]
    \arrow["{\mathrm{id}_B}", from=1-3, to=2-3]
\end{tikzcd}\]

\end{document}

This is a minimal example that compiles for me.

suhr commented 3 years ago

It finds out, importing quotes after quiver fixed the issue.

varkor commented 3 years ago

Great, I'm glad you found a solution! This is a useful fact to know (LaTeX can be such a pain with package ordering problems).

suhr commented 3 years ago

It is not really about package order, but the fact I needed to import quotes at all. It might make sense to add \RequirePackage{quotes} to quiver.sty if it does not break anything.

varkor commented 3 years ago

Oh, I misunderstood. But quotes is a package that converts double quotes to LaTeX quotation marks. That shouldn't be necessary here, because the " characters in TikZ are not supposed to be LaTeX quotation marks. So I'm not sure what's going on. I feel it's quite likely another package you're using is conflicting with TikZ.