![如何使用 TikZ 将角度标记的装饰增加一倍或三倍?](https://linux22.com/image/368917/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20TikZ%20%E5%B0%86%E8%A7%92%E5%BA%A6%E6%A0%87%E8%AE%B0%E7%9A%84%E8%A3%85%E9%A5%B0%E5%A2%9E%E5%8A%A0%E4%B8%80%E5%80%8D%E6%88%96%E4%B8%89%E5%80%8D%EF%BC%9F.png)
我想以类似于这张照片的方式装饰一个角度的标记(取自这个问题):
从这个答案我可以构建这个:
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows,angles,decorations.markings,arrows.meta}
\tikzset{mydeco/.style={pic actions/.append code=\tikzset{postaction=decorate}}}
\begin{document}
\begin{tikzpicture}[>=latex, decoration={ markings, mark= at position 0.5 with {\arrow{|}} } ]
% Declare Points
\coordinate (A) at (0,0);
\coordinate (X) at (6,1);
\coordinate (Y) at (3,5);
\draw[thick] (X) -- (A) -- (Y)
pic [mydeco, draw, thick, angle radius = 0.5 cm] {angle = X--A--Y};
% Label Points
\draw (A) node[below left] {$A$};
\draw (X) node[below right] {$x$};
\draw (Y) node[above left] {$y$};
\end{tikzpicture}
\end{document}
这看起来是一个好的开始,但是:
我不知道如何将装饰标记增加一倍或三倍。
例如,如果我仅将“位置”数字从 0.5 更改为 0.6,那么,尽管我期望装饰的位置会发生变化,但我得到的却是双倍的装饰,但我不知道为什么(而且它不再居中,所以显然不可能控制加倍):
注意:我arrows.meta
也装了东西以便用这些箭头尝试一些东西,但没有得到任何令人满意的东西。
答案1
我认为你不需要任何箭。
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{angles,decorations.markings}
\tikzset{mydecotwo/.style={decoration={ markings, %
mark= at position 0.5 with
with{
\draw (-1pt,-2pt) -- (-1pt,2pt);
\draw (1pt,-2pt) -- (1pt,2pt);
} },
pic actions/.append code=\tikzset{postaction=decorate}}}
\tikzset{mydecothree/.style={decoration={ markings, %
mark= at position 0.5 with
with{
\draw (-2pt,-2pt) -- (-2pt,2pt);
\draw (0pt,-2pt) -- (0pt,2pt);
\draw (2pt,-2pt) -- (2pt,2pt);
} },
pic actions/.append code=\tikzset{postaction=decorate}}}
\begin{document}
\begin{tikzpicture}[>=latex]
% Declare Points
\coordinate (A) at (0,0);
\coordinate (X) at (6,1);
\coordinate (Y) at (3,5);
\draw[thick] (X) -- (A) -- (Y)
pic [mydecotwo, draw, thick, angle radius = 0.5 cm] {angle = X--A--Y};
% Label Points
\draw (A) node[below left] {$A$};
\draw (X) node[below right] {$x$};
\draw (Y) node[above left] {$y$};
\coordinate (B) at (7,0);
\coordinate (U) at (9,-1);
\coordinate (V) at (10,5);
\draw[thick] (U) -- (B) -- (V)
pic [mydecothree, draw, thick, angle radius = 0.5 cm] {angle = U--B--V};
\end{tikzpicture}
\end{document}
编辑:添加了三条线。