3

I want to draw an angle between two points, but for some reason TexStudio can't find tikz's \pic function (though I imported the 'angles' library).

Here is my code:

\documentclass[12pt, a4paper]{standalone}

\usepackage{tikz}

\usetikzlibrary{angles}

\begin{document}
\begin{tikzpicture}
    \pic [draw, angle eccentricity=1.5] {angle = (0,1) -- (0,0) -- (1,0)};
\end{tikzpicture}
\end{document}

Could someone please tell me where my mistake is?

Thanks!

5

You need to use named coordinates I think:

\documentclass[12pt, a4paper]{standalone}

\usepackage{tikz}

\usetikzlibrary{angles}

\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\coordinate (A) at (0,1);
\coordinate (B) at (1,0);

    \pic [draw, angle eccentricity=1.5] {angle=A--O--B};
\end{tikzpicture}
\end{document}
  • 1
    Indeed - in the TikZ/PGF manual, in the section about the Angles library, it says "The three points (A), (B), and (C) must be the names of nodes or coordinates; you cannot use direct coordinates like (1,1) here." – Jānis Lazovskis Feb 27 '17 at 15:56

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.