1

I'm trying to draw a simple coordinate system using TikZ. I've also got an angle which I want to label as phi (\varphi). The following code without the label works:

\documentclass{standalone}

\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{positioning,calc,patterns,angles,quotes}

\definecolor{grid-light-grey}{gray}{.95}

\begin{document}

\frame{
    \begin{tikzpicture}[axis/.style={very thick, ->, >=stealth'}]
    \tkzInit[xmax=5, ymax=3, xmin=-2, ymin=-2]
    \tkzGrid[sub, color=grid-light-grey, subxstep=1, subystep=1]

    %% CUSTOM AXIS
    \draw[axis] (-2.5, 0) -- (5.5, 0) node(re)[below left] {$Re$};
    \draw[axis] (0, -2.5) -- (0, 3.5) node(im)[below left] {$Im$};
    \coordinate (origin) at (0,0);

    \draw[draw=green, thick] (origin) -- (3, 2)  node [anchor=south west] {$ z  = a + bi$} 
    node[] (num) {\fontfamily{qag}\selectfont x};

    \draw[dashed] (3,  2) -- (0,  2) node[anchor=east] {$b$};

    \draw[dashed] (3,  2) -- (3,  0) node[anchor=south west] {$a$};

    \node[color=green] at (1, 1) {$r$};

    \pic[draw] {angle = re--origin--num};
    \end{tikzpicture}
}

\end{document}

Unfortunately, when I try to label the angle by passing an option to the \pic command:

\pic[draw, "$\varphi$"] {angle = re--origin--num};

Suddenly it leads to an error. This is especially peculiar since the same setup seems to work in this answer to a similar question:

https://tex.stackexchange.com/a/219039/172626

Does anybody see what the problem is, and why the syntax works in the answer to that question, but not in my case?

  • 1
    What error you got? I get no error here. – Sigur Oct 21 '18 at 12:24
  • I'm sorry, I should have checked the minimal example before posting. Apparently, it's an error that only occurs within my bigger document. To avoid it, I'll just compile the image in a different text document and include the pdf. – R. Hahnemann Oct 21 '18 at 12:28
  • 1
    Does adding \usetikzlibrary{babel} to the preamble of the big document help? – user121799 Oct 21 '18 at 16:21
0

I've encountered the problem again, and I've tried out @marmot's advice on including the tikzlibrary babel. The problem is indeed solved.

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.