问题:我想在点 E 和 F 之间画一条虚线
梅威瑟:
\documentclass[12pt]{article}
\usepackage{pgf,tikz,pgfplots}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
\draw [line width=0.5pt] (-2,4)-- (2,4);
\draw [line width=0.5pt] (-2,4)-- (-3,0);
\draw [line width=0.5pt] (-3,0)-- (3,0);
\draw [line width=0.5pt] (2,4)-- (3,0);
\draw [line width=0.5pt] (-2,4)-- (3,0);
\draw [line width=0.5pt] (-3,0)-- (2,4);
\draw [line width=0.5pt] (-2.4,2.40)-- (2.40,2.40);
\draw[color=black] (-2.00,4.4) node {$A$};
\draw[color=black] (2.0,4.4) node {$B$};
\draw[color=black] (-3.25,0.00) node {$C$};
\draw[color=black] (3.25,0.00) node {$D$};
\draw[color=black] (-2.65,2.45) node {$E$};
\draw[color=black] (2.65,2.40) node {$F$};
\end{tikzpicture}
\end{document}
答案1
只需在相应的命令中添加dotted
选项:draw
\documentclass[12pt]{article}
\usepackage{pgf,tikz,pgfplots}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
\draw [line width=0.5pt] (-2,4)-- (2,4);
\draw [line width=0.5pt] (-2,4)-- (-3,0);
\draw [line width=0.5pt] (-3,0)-- (3,0);
\draw [line width=0.5pt] (2,4)-- (3,0);
\draw [line width=0.5pt] (-2,4)-- (3,0);
\draw [line width=0.5pt] (-3,0)-- (2,4);
\draw [line width=0.5pt, dotted] (-2.4,2.40)-- (2.40,2.40); %<-----
\draw[color=black] (-2.00,4.4) node {$A$};
\draw[color=black] (2.0,4.4) node {$B$};
\draw[color=black] (-3.25,0.00) node {$C$};
\draw[color=black] (3.25,0.00) node {$D$};
\draw[color=black] (-2.65,2.45) node {$E$};
\draw[color=black] (2.65,2.40) node {$F$};
\end{tikzpicture}
\end{document}