yishn / tikzcd-editor

A simple visual editor for creating commutative diagrams.

Home Page:https://tikzcd.yichuanshen.de/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tikzcd and babel

zx9w opened this issue · comments

commented

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:

  1. 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).
  2. You could explain what I'm doing wrong here so that others can find this issue and apply the same fix.
  3. 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.

I can use your given code just fine in Overleaf:

tikz

Maybe there's some configuration error on your side? Maybe someone can help if you post your entire LaTeX code here, which compiler you're using, and the errors that it produces.

commented

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.

commented

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.

commented

Much appreciated, works like a charm.