1

When I use tikz with the quotes package in a graph environment to add a label to an edge (as I found out here: Label on edges with tikz-graph) I get problems as soon as I specify an otherlangue with polyglossia.

I've seen other people reporting similar issues with the babel package: problems with tikz and arabi package and Adding a TikZ figure to a document. In both cases the solution was to switch to English but that does not help in this case.

My MWE is:

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{german}
\usepackage{tikz}
\usetikzlibrary{quotes}
\usetikzlibrary{graphs}

\begin{document}
  \begin{english}
    \begin{tikzpicture}
      \graph {
        "A" -- "B" [> "some label"]
      };
    \end{tikzpicture}
  \end{english}
\end{document}

The output is:

! Package pgfkeys Error: I do not know the key '/tikz/"{some label}"' and I am 
going to ignore it. Perhaps you misspelled it.

See the pgfkeys package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.14       }
            ;
? 

The XeLaTeX version is: XeTeX 3.14159265-2.6-0.99999 (TeX Live 2019/dev/Debian)

pgf version is: 3.1.1

1

According to what I find adding \usetikzlibrary{babel} fixes it. I use an updated TeXLive 2019 installation with pgf v3.1.5 and checked both lualatex and xelatex.

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{german}
\usepackage{tikz}
\usetikzlibrary{quotes}
\usetikzlibrary{graphs}
\usetikzlibrary{babel}

\begin{document}
  \begin{english}
    \begin{tikzpicture}
      \graph {
        "A" -- "B" [> "some label"]
      };
    \end{tikzpicture}
  \end{english}
\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.