3

How can I label the faces, vertices and edges of a cube with numbers or letters using TikZ? For instance I want to numerate the faces of a cube from 1 to 6.

2 Answers2

6

Something like this?

\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}

enter image description here

2

A PSTricks solution:

\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}

output