3

When setting the language for polyglossia to German, one runs into trouble with the quotes library from TikZ: Handing over a label to the angle pic as suggested on page 511 in the pgfmanual fails when the whole tikzpicture is used as newcommand argument.

I give three examples below: The first works as expected (tikzpicture is not used inside a macro), the second throws an error (using it inside a macro), the third tried to circumvent the problem by using the text= option but results in no label for the angle.

\documentclass{article} 
\usepackage{tikz}
\usetikzlibrary{angles, quotes}
\RequirePackage{polyglossia}
    \setdefaultlanguage{german}
\newcommand{\figC}[1]{\begin{center}#1\end{center}}

\begin{document}

This one works due to 'quotes' library:
\begin{center}
\begin{tikzpicture}\shorthandoff{"}
\draw (2,0) coordinate (A) -- (0,0) coordinate (B) -- (1,1) coordinate (C)
    pic ["$\alpha$", draw] {angle};
\end{tikzpicture}
\end{center}

This one throws an error:
\figC{\begin{tikzpicture}\shorthandoff{"}
\draw (2,0) coordinate (A) -- (0,0) coordinate (B) -- (1,1) coordinate (C)
    pic ["$\alpha$", draw] {angle};
\end{tikzpicture}}

This one compiles but does not show the label (using 'text=' as I understood from pgfmanual p. 511):
\begin{center}
\begin{tikzpicture}
\draw (2,0) coordinate (A) -- (0,0) coordinate (B) -- (1,1) coordinate (C)
    pic [text={$\alpha$}, draw] {angle};
\end{tikzpicture}
\end{center}

\end{document}

Compilation result

The questions are:

  • Should I file this somewhere as a bug, or is it my fault?
  • Can I somehow protect the tikzpicture when I want to use it inside a macro?
  • Or are there any other suggestions?
1

In the third example you have to use pic text instead only text. Options for the angle label can be added using pic text options:

\documentclass{article} 
\usepackage{tikz}
\usetikzlibrary{angles, quotes}
\RequirePackage{polyglossia}
    \setdefaultlanguage{german}
\newcommand{\figC}[1]{\begin{center}#1\end{center}}

\begin{document}
\begin{center}
\begin{tikzpicture}
\draw (2,0) coordinate (A) -- (0,0) coordinate (B) -- (1,1) coordinate (C)
    pic [pic text={$\alpha$},draw] {angle};
\end{tikzpicture}
\end{center}
\begin{center}
\begin{tikzpicture}
\draw (2,0) coordinate (A) -- (0,0) coordinate (B) -- (1,1) coordinate (C)
    pic [pic text={$\alpha$},pic text options={red,font=\tiny}, draw] {angle};
\end{tikzpicture}
\end{center}
\end{document}

enter image description here

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.