画图基本格式
\usepackage{tikz}\begin{document}
...
\end{document}
一、基本图形的绘制
1点的绘制
\draw[option](x,y);
1、用斜二测画法画多面体
\documentclass[tikz]{standalone}
\tikzset{xyz/.style={x={(-135:0.5)},y={(1cm,0)},z={(0,1cm)}}}
\tikzstyle{every node}=[font=\small]
\begin{document}\begin{tikzpicture}[xyz,line width=0.7pt,line join =round,scale=2]\coordinate(A)at(0,0,0);\coordinate(B)at(0,1,0);\coordinate(C)at(-1,1,0);\coordinate(D)at(-1,0,0);\coordinate(P)at(0,0,1);\draw(P)--(A)--(B)--(C)--(P)--(B);\draw[dashed,line width=0.4pt](P)--(D)--(A) (D)--(C);\node[shift={(90:5pt)}] at (P){$P$};\node[shift={(-135:5pt)}] at (A){$A$};\node[shift={(-45:5pt)}] at (B){$B$};\node[shift={(0:5pt)}] at (C){$C$};\node[shift={(180:6pt)}] at (D){$D$};\end{tikzpicture}\end{document}
效果图:
2、直接描点法画立方体的截面图
\documentclass{ctexart}
\RequirePackage{tkz-euclide}
\begin{document}\begin{tikzpicture}[pol/.style={fill=brown!30,opacity=0.5},seg/.style={tkzdotted,color=gray},hidden pt/.style={fill=gray!40},scale=2]\tkzSetUpPoint[size=2]%%%%%%%定义点\tkzDefPoints{0/0/A, 2.5/0/B,1.33/0.75/D,0/2.5/E,2.5/2.5/F}%坐标和名字用/分隔,用大括号括起来%%%%%%%连线\tkzDrawPolygon(A,B,F,E)\tkzDrawSegments[seg](A,D)\tkzDefLine[parallel=through D](A,B)\tkzGetPoint{I1}\tkzDefLine[parallel=through B](A,D)\tkzGetPoint{I2}\tkzInterLL(D,I1)(B,I2)\tkzGetPoint{C}\tkzDrawSegments(B,C)\tkzDrawSegments[seg](D,C)\tkzDefLine[parallel=through E](A,D)\tkzGetPoint{I3}\tkzDefLine[parallel=through D](A,E)\tkzGetPoint{I4}\tkzInterLL(D,I3)(E,I4)\tkzGetPoint{H}\tkzDefLine[parallel=through F](B,C)\tkzGetPoint{I5}\tkzDefLine[parallel=through C](B,F)\tkzGetPoint{I6}\tkzInterLL(F,I5)(C,I6)\tkzGetPoint{G}\tkzDrawSegments(C,G G,F G,H H,E)\tkzDrawSegments[seg](H,D)\tkzDefMidPoint(H,G)\tkzGetPoint{P}\tkzDefMidPoint(G,C)\tkzGetPoint{Q}\tkzDefMidPoint(C,B)\tkzGetPoint{R}\tkzDefMidPoint(B,A)\tkzGetPoint{S}\tkzDefMidPoint(A,E)\tkzGetPoint{T}\tkzDefMidPoint(E,H)\tkzGetPoint{U}\tkzDrawSegments[seg](P,Q R,S T,U)\tkzDrawSegments(Q,R S,T U,P)\tkzFillPolygon[pol](P,Q,R,S,T,U)\tkzDrawSegments[seg](H,A A,C C,H)\tkzLabelPoints[below](A,S,B)\tkzLabelPoints[right](C,Q)\tkzLabelPoints[above](G,P,H)\tkzLabelPoints[left](E,T)\tkzLabelPoints[above=2pt,left](U,D)\tkzLabelPoints[below=4pt,right](R,F)\tkzDrawPoints(A,B,C,E,F,G,H,P,Q,R,S,T,U)\tkzDrawPoints[hidden pt](D)\end{tikzpicture}\end{document}
效果图