Tikz 线路与原点断开

Tikz 线路与原点断开

我第一次尝试使用 tikz。除了有两条线没有从原点开始外,我已经成功创建了我想要的图表。这是我的代码:

\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}

图片显示线条被切断

另外,我如何将 j 向量对齐到箭头上方?

答案1

使用above而不是top。此外,我建议使用\coordinates 而不是空的\nodes。

位置

\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}

相关内容