4

Is there an easy latex class to create this figure?

Thanks!

Torbjørn T.
  • 206,688

1 Answers1

10

Here is a TikZ method that uses the angles and quotes libraries to automatically draw the angle based on three coordinates, based off this answer.

enter image description here

\documentclass[tikz,border=3pt]{standalone}
\usetikzlibrary{quotes,angles}
\begin{document}
    \begin{tikzpicture}[line cap=rect]
        \coordinate (Origin) at (0,0);
        \draw [->,blue] (Origin)--++(30:2)  coordinate (VecV) node[midway,auto,swap] {$\vec{v}$};
        \draw [->,red]  (Origin)--++(110:2) coordinate (VecU) node[midway,auto] {$\vec{u}$};
        \draw pic["$\theta$", draw=orange, text=orange, <->, angle eccentricity=1.25, angle radius=1cm]
              {angle=VecV--Origin--VecU};
    \end{tikzpicture}
\end{document}

And an animated version just for fun...

enter image description here

\documentclass[tikz,border=3pt]{standalone}
\usetikzlibrary{quotes,angles}
\begin{document}
\foreach \X in {-180,-170,...,90,80,70,...,-180}{
    \begin{tikzpicture}[line cap=rect]
        \path[use as bounding box] (-2.2,-2.2) rectangle (2.2,2);
        \coordinate (Origin) at (0,0);
        \draw [->,blue] (Origin)--++(\X:2) coordinate (VecV);
        \path (Origin)--++(\X-15:1) coordinate (VecVLabel);
        \node [blue] at (VecVLabel) {$\vec{v}$};
        \draw [->,red]  (Origin)--++(110:2) coordinate (VecU) node[midway,auto] {$\vec{u}$};
        \draw pic["$\theta$", draw=orange, text=orange, <->, angle eccentricity=1.25, angle radius=1cm]           {angle=VecV--Origin--VecU};
    \end{tikzpicture}
    }
\end{document}
Milo
  • 9,440