在 tkz-euclide 中,点用灰色填充,轮廓为黑色。我可以使用以下方法将点设置为完全黑色
\tkzSetUpPoint[fill=black]
现在我想要一个新的关键字,rot
这样当我输入
\tkzDrawPoint[red](P)
这相当于输入
\tkzDrawPoint[color=red,fill=red](P)
我在这里看到的问题是,红色的定义和作用例如
\tkzDrawSegment[red](P_1,P_2)
\tkzLabelSegment[red](P_1,P_2){$s$}
梅威瑟:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){P_1} \tkzDefPoint(1,0){P_2}
\tkzDrawPoint(P_1)
\tkzDrawPoint[red](P_2)
\tkzLabelSegment[red](P_1,P_2){$s$}
\end{tikzpicture}
\end{document}
答案1
改变点颜色的正确语法例如\tkzDrawPoint[color=red](P_2)
(对于红点边框)或\tkzDrawPoints[fill=blue!30](P_2, P_3)
改变填充(观察如何定义颜色)。所以尝试:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){P_1} \tkzDefPoint(1,0){P_2} \tkzDefPoint(2,0){P_3}
\tkzDrawPoint(P_1)
\tkzDrawPoints[color=red](P_2) % <---
\tkzDrawPoints[color=red,fill=red](P_3) % <---
\end{tikzpicture}
\end{document}
答案2
这是我对此的临时解决方案。
\makeatletter
\pgfkeys{drawpoint/.cd,
red/.style={color=red,fill=red}
}
\pgfkeys{/tikz/.cd,
red/.style={color=red},
Red/.style={color=red,fill=red!30,opacity=0.3},
}
\makeatother
现在,不仅可以为命令使用那些定义的颜色,\tkzDrawSegment
还可以为\tkzDrawPoint
和\tkzDrawCircle
例子:
\documentclass{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\makeatletter
\pgfkeys{drawpoint/.cd,
red/.style={color=red,fill=red}
}
\pgfkeys{/tikz/.cd,
red/.style={color=red},
Red/.style={color=red,fill=red!30,opacity=0.3},
}
\makeatother
\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0.5/0.5/A,1.5/0.5/B,1.5/1.5/C,0.5/1.5/D,1/1/M}
\tkzDrawPoint[red](M)
\tkzDrawPolygon(A,B,C,D)
\tkzMarkAngle[Red,size=0.3cm](D,C,B)
\tkzDrawCircle[Red](A,M)
\end{tikzpicture}
\end{document}