3

I have the following code for a cube:

 \usepackage{tikz}
 \usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=1.7,> = latex]
\pgfmathsetmacro{\cubex}{2}
\pgfmathsetmacro{\cubey}{1}
\pgfmathsetmacro{\cubez}{1}
\draw[black,fill=yellow] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
\draw[black,fill=yellow] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
\draw[black,fill=yellow] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;
\draw[|<->|,yshift=-.5em] (-\cubex,-\cubey,0)--node[below]{$b_0 \cdots b_m$}++(\cubex,0,0);
\draw[|<->|,xshift=-.5em] (-\cubex,-\cubey,0)--node[above,sloped]{$a_0\cdots a_l$}++(0,\cubey,0);
\draw[|<->|,shift={(.5em,-.5em)}] (0,-\cubey,0)--node[below,sloped]{$c_0 \cdots c_n$}++(0,0,-\cubez);
\end{tikzpicture}
\end{document}

enter image description here I want to make an 3 dimensional array that is simmilar to the form of the cube, something like that, which has the same alignment and labels like my cube.

enter image description here

Cherry
  • 195

1 Answers1

1

If you are only interested in 3D arrays, then there is a simple way to get these with PSTricks:

 \documentclass{standalone}
 \usepackage{pst-all}
 \usepackage[vcentermath,enableskew]{youngtab}
 \begin{document}
 \begin{pspicture}(-1,-2)(5,1.5)
 \psset{viewpoint=1 0.7 0.5}
 \ThreeDput[normal=0 1 0](0,0,0){\young(0000,1111,0100,0111)}
 \ThreeDput[normal=0 1 0](0,2,0){\young(0000,1111,0100,0111)}
 \ThreeDput[normal=0 1 0](0,4,0){\young(0000,1111,0100,0111)}
 \end{pspicture}
 \end{document}

enter image description here

This method has the advantage that the numbers are also tilted, i.e. the block array really looks 3-dimensional, and it is easy to add lines etc.