我画了这张图,但我无法将节点 $m$ 放置到线上。有什么建议吗?提前谢谢
\documentclass[a4paper]{article}
\usepackage{pgfplots}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{center}
\begin{tikzpicture}
\coordinate (M) at (0,0) ;
\coordinate (A) at (canvas polar cs:angle=90,radius=3cm);
\coordinate (B) at (canvas polar cs:angle=20,radius=3cm) ;
\draw (M) circle (3cm);
\draw (A) -- (B) ;
\tkzDefMidPoint(A,B) \tkzGetPoint{P}
\draw (A) -- (P) node[midway,sloped] {$// $} ;
\draw (P) -- (B) node[midway,sloped] {$// $} ;
\tkzDrawLine[add = 0.5 and 1.6](P,M) node {m}; %PROBLEM%
\tkzDrawPoints(A,B,M);
\tkzLabelPoints(B,M);
\tkzLabelPoints[above](A);
\end{tikzpicture}
\end{center}
\end{document}
答案1
软件包的宏tkz-*
都是 TikZ 路径的包装器。因此,simplenode {m};
不是任何路径的一部分(就像;
任何宏后面的一样\tkz*
)。
宏\tkzDrawLine
提供按键
start
,end
,start style
和end style
要将节点添加到路径,除了和之外,* style
还可以使用来应用其他pos
选项。at start
at end
在这个例子中,我用来near start
展示影响:
\tkzDrawLine[add = 0.5 and 1.6, start=$m$, start style={near start}](P,M)
代码
\documentclass[tikz,convert=false]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\coordinate (M) at (0,0) ;
\coordinate (A) at (canvas polar cs:angle=90,radius=3cm);
\coordinate (B) at (canvas polar cs:angle=20,radius=3cm) ;
\draw (M) circle (3cm);
\draw (A) -- (B) ;
\tkzDefMidPoint(A,B) \tkzGetPoint{P}
\draw (A) -- (P) node[midway,sloped] {$// $} ;
\draw (P) -- (B) node[midway,sloped] {$// $} ;
\tkzDrawLine[add = 0.5 and 1.6, start=$m$, start style={near start}](P,M)
\tkzDrawPoints(A,B,M);
\tkzLabelPoints(B,M);
\tkzLabelPoints[above](A);
\end{tikzpicture}
\end{document}