
두 벡터 사이에 각도를 그리고 싶습니다.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{angles,quotes,babel,plotmarks}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[decoration=brace]
% orthogonal ground line
\draw[thick] (-3,0) -- (3,0);
% Origin
\draw[fill=black] (0,0) node(O)[anchor=north] {$O$};
% vector a
\draw[thick,->] (0,0) -- (-2,2) node(a)[anchor=north east] {$a$};
% vector b
\draw[thick,->] (0,0) -- (2.5,1.5) node(b)[anchor=west] {$b$};
\pic [draw, -, angle eccentricity=1.2, angle radius=1cm,, "$\gamma$"] {angle=b--O--a};
\end{tikzpicture}
\end{document}
어떤 이유로 각도가 예상보다 크게 그려지나요?
이 작업을 올바르게 수행하는 방법에 대한 조언이 있습니까?
답변1
그 이유는 각도의 좌표를 잘못 정의했기 때문입니다. 을 쓰는 경우 레이블의 노드에 대한 참조로 \draw (0,0) -- (-2,2) node (a) [anchor=north east] {$a$};
정의합니다 . 정의한 대로 중심은 좌표에 대한 것입니다 . 하지만 실제로 각도에 필요한 좌표입니다 .(a)
$a$
north east
(-2,2)
(-2,2)
따라서 다음을 수행해야 합니다.
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{angles,quotes}
\begin{document}
\begin{tikzpicture}
% orthogonal ground line
\draw[thick] (-3,0) -- (3,0);
% Origin
\draw[fill=black] (0,0) coordinate (O) node [anchor=north] {$O$};
% vector a
\draw[thick,->] (0,0) -- (-2,2) coordinate (a) node[anchor=north east] {$a$};
% vector b
\draw[thick,->] (0,0) -- (2.5,1.5) coordinate (b) node[anchor=west] {$b$};
\pic[draw, angle eccentricity=1.2, angle radius=1cm,, "$\gamma$"] {angle=b--O--a};
\end{tikzpicture}
\end{document}
대안으로 다음을 사용할 수 있습니다 labels
.
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{angles,quotes}
\begin{document}
\begin{tikzpicture}
% orthogonal ground line
\draw[thick] (-3,0) -- (3,0);
% Origin
\draw[fill=black] (0,0) coordinate[label={below:$0$}] (O);
% vector a
\draw[thick,->] (0,0) -- (-2,2) coordinate[label={below left:$a$}] (a);
% vector b
\draw[thick,->] (0,0) -- (2.5,1.5) coordinate[label={right:$b$}] (b);
\pic [draw, angle eccentricity=1.2, angle radius=1cm,, "$\gamma$"] {angle=b--O--a};
\end{tikzpicture}
\end{document}
답변2
이는 매우 쉽게 수행할 수 있습니다 pstricks
. 특히 다음을 사용하면 됩니다 pst-eucl
.
\documentclass[pstricks, border=6pt]{standalone}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}(-3,-1)(3,3)
\psset{arrowinset=0.12,labelsep=3pt}
\pstGeonode[PointSymbol=none, PosAngle={-90,135, 45}](0,0){O}(-2,2){a}(2.5,1.5){b}
% orthogonal ground line
\psline (-3,0)(3,0)
\ncline{->}{O}{a}\ncline{->}{O}{b}
\pstMarkAngle[linewidth=0.3pt, LabelSep=0.6]{b}{O}{a}{$\gamma$}%
\end{pspicture}
\end{document}
답변3
노드는 끝점에 없지만 그 옆에 좌표를 지정해야 합니다.
\begin{tikzpicture}[decoration=brace]
% orthogonal ground line
\draw[thick] (-3,0) -- (3,0);
% Origin
\coordinate (O) at (0,0);
\draw[fill=black] (O) node[anchor=north] {$O$};
% vector a
\coordinate (a) at (-2,2);
\draw[thick,->] (O) -- (a) node[anchor=south east] {$a$};
% vector b
\coordinate (b) at (2.5,1.5);
\draw[thick,->] (O) -- (b) node[anchor=south west] {$b$};
\pic [draw, -, angle eccentricity=1.2, angle radius=1cm,, "$\gamma$"] {angle=b--O--a};
\end{tikzpicture}