tikzcd and babel
zx9w opened this issue · comments
When I compile the latex produced by this tool locally or in overleaf I always get a ton of issues relating to the labels and then the produced diagram won't have any labels.
Now I know that the syntax you use (which is \arrow[r, "label"]
) is supposed to work because the manual introduces it literally on page 2. However when I compile a document with this code:
\begin{tikzcd}
A \arrow[r, "\phi"] & B
\end{tikzcd}
which is practically straight from the documentation (but generated by the editor), then whether it's in overleaf or on a fresh latex install in a container on my machine the compiler won't recognize the label as such.
Because of this I always need to refactor the code generated by the tool to the form \arrow{r}{label}
.
My suggestion is therefore to do one of three things:
- There could be a toggle setting to allow the user to control which format the code should be exported to (which would be an enhancement).
- You could explain what I'm doing wrong here so that others can find this issue and apply the same fix.
- I'm not crazy and we should change the default to the "wrong" syntax.
Thanks for a wonderful tool, it has made drawing huge diagrams much less painful.
Hey, you're right it totally works, there must be some conflict with other packages I'm using, I should have tried a smaller example. Let me check if I can figure out what the conflict is and I'll get back to you. Sorry for slow reply.
Okay the problem that would be specific to me was exceedingly obvious as soon as I thought about it, the thing that causes the conflict is the following (you can try it if you like):
\usepackage[icelandic]{babel}
\usepackage{t1enc}
\selectlanguage{icelandic}
Maybe other languages will experience a similar problem, I dunno. Either way, the issue should probably be filed with the language package?
Ah, I remember vaguely that there's a problem with the babel package and tikz... I think you need to use the following code to avoid that:
\usepackage{tikz}
\usetikzlibrary{cd, babel}
I think I found this code snippet on StackExchange somewhere and worked for my master thesis. Let me know if it helps.
Much appreciated, works like a charm.