Skip to content

Instantly share code, notes, and snippets.

@UweZiegenhagen
Created November 27, 2024 17:31
Show Gist options
  • Select an option

  • Save UweZiegenhagen/0adc54a217d016cc5ac3d0bde9a66026 to your computer and use it in GitHub Desktop.

Select an option

Save UweZiegenhagen/0adc54a217d016cc5ac3d0bde9a66026 to your computer and use it in GitHub Desktop.
TikZ Cube with coordinates
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{csquotes}
\usepackage{xcolor}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\coordinate (b11) at (1,0);
\coordinate (b12) at (2,0);
\coordinate (b13) at (3,0);
\coordinate (b21) at (1,-1);
\coordinate (b22) at (2,-1);
\coordinate (b23) at (3,-1);
\coordinate (b31) at (1,-2);
\coordinate (b32) at (2,-2);
\coordinate (b33) at (3,-2);
\draw (b11) -- (b13);
\draw (b13) -- (b33);
\draw[dashed] (b11) -- (b31);
\draw[dashed] (b31) -- (b33);
\draw[dashed] (b21) -- (b23);
\draw[dashed] (b32) -- (b12);
\coordinate (m11) at (0,-1);
\coordinate (m12) at (1,-1);
\coordinate (m13) at (2,-1);
\coordinate (m21) at (0,-2);
\coordinate (m22) at (1,-2);
\coordinate (m23) at (2,-2);
\coordinate (m31) at (0,-3);
\coordinate (m32) at (1,-3);
\coordinate (m33) at (2,-3);
\coordinate (f11) at (-1,-2);
\coordinate (f12) at (0,-2);
\coordinate (f13) at (1,-2);
\coordinate (f21) at (-1,-3);
\coordinate (f22) at (0,-3);
\coordinate (f23) at (1,-3);
\coordinate (f31) at (-1,-4);
\coordinate (f32) at (0,-4);
\coordinate (f33) at (1,-4);
\draw (f11) -- (f13);
\draw (f13) -- (f33);
\draw (f11) -- (f31);
\draw (f31) -- (f33);
\draw (f12) -- (f32);
\draw (f21) -- (f23);
\draw (f23) -- (b23);
\draw (f23) -- (b23);
\draw (b11) -- (f11);
\draw (b13) -- (f13);
\draw (b33) -- (f33);
\draw [dashed] (f31) -- (b31);
\draw [dashed] (f21) -- (b21);
\draw [dashed] (f32) -- (b32);
\draw (m11) -- (m13);
\draw (m33) -- (m13);
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment