除了手动在多边形的相等边上放置一条短线外,什么最佳做法可以表明边长相等?
梅威瑟:
\documentclass[12pt,table]{beamer}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{frame}
\begin{figure}[!htbp]
\centering
\begin{tikzpicture}[scale=0.7]
\draw[] (0,0) -- (-4,-3) ;
\draw[] (0,0) -- (4,-3) ;
\draw[] (-4,-3) -- (4,-3);
\draw[thick,rotate around={34:(0,0)}] (-1.5,0.25) -- (-1.5,-0.25) ;
\draw[thick,rotate around={-34:(0,0)}] (1.5,0.25) -- (1.5,-0.25) ;
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
答案1
您可以用节点的内容绘制这条线:
\documentclass[12pt,table]{beamer}
\usepackage{pgfplots}
\usetikzlibrary{quotes}
\begin{document}
\begin{frame}
\begin{figure}
\centering
\begin{tikzpicture}[scale=0.7]
\draw (0,0) -- node[sloped] {$|$} (-4,-3)
(0,0) -- node[sloped] {$|$} ( 4,-3)
(-4,-3) -- (4,-3);
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
答案2
根据@Bernard的评论,人们可以用tkz-euclide 包(见第 77 页)。
以下是两种(略有)不同的方法来表示等腰三角形,并提供坐标和所需标记:
\documentclass[12pt,table]{beamer}
\usepackage{tikz,pgfplots}
\usepackage{tkz-euclide}
\begin{document}
\begin{frame}
\begin{figure}[!htbp]
\centering
\begin{tikzpicture}[scale=0.7]
\node (A) at (0,0){};
\node (B) at (-4,-3){};
\node (C) at (4,-3){};
\draw (0,0) -- (-4,-3);
\draw (0,0) -- (4,-3);
\draw (-4,-3) -- (4,-3);
\tkzDrawSegments(A,B C,B A,C)
\tkzMarkSegments[mark=|,color=red,size=6pt](C,A A,B)
\end{tikzpicture}
\bigskip
\begin{tikzpicture}[scale=0.7]
\tkzDefPoint(0,0){A}
\tkzDefPoint(4,3){B}
\tkzDefPoint(8,0){C}
\tkzDrawSegments(A,B C,B A,C)
\tkzMarkSegments[mark=|,color=red,size=6pt](C,B A,B)
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
根据您的需要,您可以|
通过||
或甚至来更改字符|||
,还可以自定义标记的颜色,如上图所示。
答案3
您也可以使用以下代码(我从维基百科中获取)这里,然后对其进行了修改)
\usepackage[pdftex,active,tightpage]{preview}
\usepackage{tikz}
\usetikzlibrary{positioning, calc}
% Begin tikz
\begin{tikzpicture}[scale=0.8]
\coordinate[label=left:$A$] (A) at (-1,0);
\coordinate[label=right:$B$] (B) at (5,0);
\coordinate[label=above:$C$] (C) at (2,3.464);
% angle CAB
\begin{scope}[shift={(-1cm,0cm)}]
\draw[fill=green!30] (0,0) -- (0:0.6cm) arc (0:50:0.6cm);
\end{scope}
% angle CBA
\begin{scope}[shift={(5cm,0cm)}]
\draw[fill=green!30] (0,0) -- (-180:0.6cm) arc (180:130:0.6cm);
\end{scope}
% drawing triangle
\draw [line width=1.5pt] (A) -- (B)
(A) -- node[sloped] {$|$} (C)
(B) -- node[sloped] {$|$} (C);
\end{tikzpicture}
你应该得到以下图片: