tkz-euclide でポイントを変数として保存する方法

tkz-euclide でポイントを変数として保存する方法

後で使用するために、tkz-euclide でポイントを定義するにはどうすればよいでしょうか。明らかに、以下のコードは機能しません。\def\x1{1} \def\y1{1} \def\x2{2} \def\y2{0}各 tikzpicture でポイントを定義するなどして xy 座標を保存できることはわかっていますが、ポイント全体を定義してすべての tikzpictues で使用することを好みます。それは可能ですか?

\documentclass{article}
\usepackage{tkz-euclide}
\tkzDefPoint(1,1){A}
\tkzDefPoint(2,0){B}

\begin{document}

\begin{tikzpicture}
\tkzDrawSegment(A,B)
\end{tikzpicture}

\end{document}

答え1

ポイントを保存するために使用できますcoordinate。座標は後でグローバルに使用できます。

\documentclass{article}
\usepackage{tkz-euclide}

\begin{document}

\begin{tikzpicture}
    \coordinate (A) at (1,1);
    \coordinate (B) at (2,0);
    \tkzDrawSegment(A,B)
\end{tikzpicture}

\begin{tikzpicture}
    \tkzDrawSegment(A,B)
\end{tikzpicture}

\end{document}

関連情報