1

I'm trying to use tikz for the first time. I have successfully created the diagram I wanted apart from there being two lines that don't start from their origin. Here is my code:

\begin{tikzpicture}[baseline = (current bounding box.north)]
    \node (v1) at (0,0) {};
    \node (v2) at (2,0) {};
    \node (v3) at (4,0) {};
    \node (at1) at (3.2,0.2) {$\alpha$};
    \draw[dashed]  (v1) edge (v3);
    \draw[->,rotate=20] (v2) -- ++(2,0) node[right] {$\vec{i}$};
    \draw[->,rotate=20] (v2) -- ++(0,2) node[top] {$\vec{j}$};
    \draw[rotate=20] (v2) ++(0.3,0) -- ++(0,0.3);
    \draw[rotate=20] (v2) ++(0,0.3) -- ++(0.3,0);
    \draw ([shift=(0:1)]2,0) arc (0:20:1);
    \end{tikzpicture}

Picture showing that lines are cut off

Also, how do I align the j vector to be above the arrow?

3

Use above instead of top. Furthermore, I would suggest to use \coordinates instead of empty \nodes.

position

\documentclass{article}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}[baseline = (current bounding box.north)]
    \coordinate (v1) at (0,0);
    \coordinate (v2) at (2,0);
    \coordinate (v3) at (4,0);
    \node (at1) at (3.2,0.2) {$\alpha$};
    \draw[dashed]  (v1) edge (v3);
    \draw[->,rotate=20] (v2) -- ++(2,0) node[right] {$\vec{i}$};
    \draw[->,rotate=20] (v2) -- ++(0,2) node[above] {$\vec{j}$};
    \draw[rotate=20] (v2) ++(0.3,0) -- ++(0,0.3);
    \draw[rotate=20] (v2) ++(0,0.3) -- ++(0.3,0);
    \draw ([shift=(0:1)]2,0) arc (0:20:1);
    \end{tikzpicture}
\end{document}
|improve this answer|||||
  • I see, I have it all working now. Thanks. I'll make sure to use coordinates instead of nodes when needed. – whitelined Oct 27 '18 at 15:35

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.