如何使用 TikZ 用数字或字母标记立方体的面、顶点和边?例如,我想用 1 到 6 来编号立方体的面。
答案1
像这样吗?
\documentclass[border=5mm,tikz]{standalone}
\usepackage{mwe}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[thick](2,2,0)--(0,2,0)--(0,2,2)--(2,2,2)--(2,2,0)--(2,0,0)--(2,0,2)--(0,0,2)--(0,2,2);
\draw[thick](2,2,2)--(2,0,2);
\draw[gray](2,0,0)--(0,0,0)--(0,2,0);
\draw[gray](0,0,0)--(0,0,2);
\draw(1,1,2) node{1};
\draw(1,2,1) node{2};
\draw(2,1,1) node{3};
\draw[gray!20](1,0,1) node{4};
\draw[gray!20](0,1,1) node{5};
\draw[gray!20](1,1,0) node{6};
\end{tikzpicture}
\end{document}
答案2
PSTricks 解决方案:
\documentclass{article}
\usepackage{pstricks}
\begin{document}
\psset{dimen = m, linejoin = 2}
\begin{pspicture}(3,3)
\psframe(0,0)(2,2)
\psline(2,2)(3,3)(3,1)(2,0)
\psline(0,2)(1,3)(3,3)
{\psset{linestyle = dashed}
\psline(1,1)(0,0)
\psline(1,1)(1,3)
\psline(1,1)(3,1)}
{\small
\rput(0.5,1.5){$1$}
\rput(0.5,0.2){$2$}
\rput(2.5,1.5){$3$}
\rput(2.5,2.8){$4$}
\rput(1.5,2.5){$5$}
\rput(1.5,0.5){$6$}}
\end{pspicture}
\end{document}