astoff / tikz-cd

Commutative diagrams with TikZ
46 stars 3 forks source link

incompatibility between polyglossia and tikz-cd #13

Closed mennucc closed 2 years ago

mennucc commented 2 years ago

Dear Augusto Stoffel

there is a weird incompatibility between polyglossia and tikz-cd : the following snippet fails

\documentclass{article}
\usepackage{tikz-cd}
\usepackage{polyglossia}
\setdefaultlanguage{italian}
\begin{document}
  \begin{tikzcd}%
    { A }  \arrow [r,  "{f}"]   \arrow [d,  "{\pi }"] & B \\ 
    { \frac  A \sim } \arrow [ur,   "{\tilde  f}"'] &
  \end{tikzcd}  
\end{document}

but if you set it to \setdefaultlanguage{english} it will work

I tried it with both lualatex and xelatex ; I am using Ubuntu 21.04 , texlive 2020.20210202-3

thanks a.

astoff commented 2 years ago

What happens if you add \usetikzlibrary{babel} to the preamble?

mennucc commented 2 years ago

👍 it fixes the problem. This compiles fine, and the table of contents has the italian title Indice, as expected.

\documentclass [a4paper] {article}
\usepackage{polyglossia}
\setdefaultlanguage{italian}
\setotherlanguages{english}
\usepackage{tikz-cd}
\usetikzlibrary{babel}
\begin{document}
\begin{tikzcd}
A \arrow[rd] \arrow[r, "\phi"] & B \\ & C
\end{tikzcd}
\tableofcontents
\end{document}

Moreover, it works fine regardless of the order of packages in the preamble , so it is robust.

Thanks a lot.

You may want to mention this in the documentation, and/or to activate \usetikzlibrary{babel} automatically inside XeLaTeX or LuaLaTeX

a.

astoff commented 2 years ago

You may want to mention this in the documentation

It is already mentioned :-). But I will add the remark that polyglossia also has this issue.