使用 Tikz 绘制角度符号和各种箭头

使用 Tikz 绘制角度符号和各种箭头

我想使用以下方法重现下图Tikz

在此处输入图片描述

到目前为止,我已经完成了以下操作:

在此处输入图片描述

使用以下 MWE:

\documentclass[a4paper,12pt]{report}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{calc,intersections}


\begin{document}
\begin{center}
\begin{tikzpicture}[font=\sffamily\small]

    \draw[->,thick] (-0.1,0) -- (6.5,0) node[anchor=west]{y};
    \draw[->,thick] (0,-3.1) -- (0,3.5) node[anchor=south]{z};

    \foreach \y in {-3,-2,-1,0,1,2,3} \draw [thick](-2pt,\y) -- (2pt,\y);
    \begin{scope}[color=black]
    \filldraw (0,-2) circle (0.08cm) node (A) {} node[anchor=north] {};
    \filldraw (0,0) circle (0.08cm) node (B) {} node[anchor=west,xshift=5pt] {};
    \filldraw (0,2) circle (0.08cm) node (C) {} node[anchor=south,yshift=0.1cm] {};
        \filldraw (4,3) circle (0.08cm) node (D) {} node[anchor=south,yshift=0.1cm] {};
    \end{scope}
\draw[->] (A) -- (D);
\draw[->] (B) -- (D);
\draw[->] (C) -- (D);

\end{tikzpicture}
\end{center}
\end{document}

有人能帮我复制出准确的原始图形吗?

答案1

angles这可以通过库(和)来实现quotes。要使箭头沿着线移动,decorations.markings很有用。

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings, arrows.meta, angles, quotes}

\tikzset{myarrow/.style={decoration={markings,mark=at position .9 with {\arrow{Latex}}},postaction={decorate}}}
\tikzset{dot/.style=fill, circle, inner sep=1.5pt}

\begin{document}
\begin{tikzpicture}
    \draw[-Latex,thick] (0,0) -- (6.5,0) node[right]{$y$};
    \draw[-Latex,thick] (0,-2.5) -- (0,3.5) node[above]{$z$};
    %\foreach \y in {-3,-2,-1,0,1,2,3} \draw [thick](-2pt,\y) -- (2pt,\y);
    \coordinate (Z) at (0,3);
    \node[dot] at (0,-2) (A) {};
    \node[dot] at (0,0) (B) {};
    \node[dot] at (0,2) (C) {};
    \node[dot] at (4,3) (D) {};
    \draw[myarrow] (A) to node[near end, below right]{\scriptsize $\mathrm r_2$} (D) 
        pic (a1) [draw, latex-, angle radius=1cm, angle eccentricity=.85, "\scriptsize $\theta_1$"] 
            {angle = D--C--Z};
    \draw[myarrow] (B) to node[near end, above]{\scriptsize $\mathrm r$} (D)
        pic (a0) [draw, latex-, angle radius=1cm, angle eccentricity=.85, "\scriptsize $\theta$"] 
            {angle = D--B--Z};
    \draw[myarrow] (C) to node[near end, above]{\scriptsize $\mathrm r_1$} (D) 
        pic (a2) [draw, latex-, angle radius=1cm, angle eccentricity=.85, "\scriptsize $\theta_2$"] 
            {angle = D--A--Z};
    \draw[line width=2pt,-latex](-.2,-2)--(.5,-2);
    \draw[line width=2pt,-latex](-.2,2)--(.5,2);
    \foreach \y in {2,0,-2} \draw(-.9,\y)--(-.5,\y);
    \draw[latex-latex] (-.7,-2) to node[fill=white, rectangle, inner sep=2pt]{\scriptsize $d/2$} (-.7,0);
    \draw[latex-latex] (-.7,2) to node[fill=white, rectangle, inner sep=2pt]{\scriptsize $d/2$} (-.7,0);
\end{tikzpicture}
\end{document}

相关内容