1

Why my angle does not get a line?

I just copied from Label angle with tikz , but something got wrong.

enter image description here

\documentclass{article}
\usepackage{tkz-euclide}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usetkzobj{all}
\usepackage{subcaption}

\usetkzobj{all}
\usetikzlibrary{calc,patterns,angles,quotes}

\begin{document}

\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=1]
 \begin{scope}[thick,font=\scriptsize]
    \draw [->] (-.5,0) -- (5.5,0) node [above left]  {$\operatorname{Re} z$};
    \draw [->] (0,-.5) -- (0,4) node [below right] {$\operatorname{Im} z$};
  \end{scope}
  \coordinate (o) at (0,0);
  \coordinate (z) at (4,3);
  \coordinate (zx) at (4,0);
  \coordinate (zy) at (0,3);
  \draw  (0,0) -- node[above] {$r$} (z) node [right] {$z$};
  \draw [dotted] (z) -- (zx) node [below] {$x$};
  \draw [dotted] (z) -- (zy) node [left] {$y$};
  \draw pic["$\theta$", ->, angle eccentricity=1.2,angle radius = 1cm] {angle = zx--o--z}; 
\end{tikzpicture}
\caption{$z$ in the complex plane.}
\label{fig:complex-plane-1}
\end{figure}
\end{document}
PeptideChain
  • 1,335

1 Answers1

5

Your syntax when using pic was wrong. You obtain

enter image description here

when using

\documentclass{article}
\usepackage{tkz-euclide}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usetkzobj{all}
\usepackage{subcaption}

\usetkzobj{all}
\usetikzlibrary{calc,patterns,angles,quotes}

\begin{document}

\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=1]
 \begin{scope}[thick,font=\scriptsize]
    \draw [->] (-.5,0) -- (5.5,0) node [above left]  {$\operatorname{Re} z$};
    \draw [->] (0,-.5) -- (0,4) node [below right] {$\operatorname{Im} z$};
  \end{scope}
  \coordinate (o) at (0,0);
  \coordinate (z) at (4,3);
  \coordinate (zx) at (4,0);
  \coordinate (zy) at (0,3);
  \draw  (0,0) -- node[above] {$r$} (z) node [right] {$z$};
  \draw [dotted] (z) -- (zx) node [below] {$x$};
  \draw [dotted] (z) -- (zy) node [left] {$y$};
  \pic[draw, "$\theta$", ->, angle eccentricity=0.8,angle radius = 1.5cm] {angle = zx--o--z}; 
\end{tikzpicture}
\caption{$z$ in the complex plane.}
\label{fig:complex-plane-1}
\end{figure}
\end{document}
Jan
  • 619
  • 1
    Small precision: with @PeptideChain's code, just adding a draw option for the pic as in \draw pic[draw, "$\theta$", ... solves the problem too (as well as \path pic[draw, "$\theta$", ..., of course). IOW, the pic path wasn't being drawn, only “accessory stuff” such as node texts. – frougon Aug 03 '19 at 07:42
  • @frougon thank you, this also probably the cause of my error: I merged two correct examples in a wrong one – PeptideChain Aug 03 '19 at 07:54