Yesterday, I saw a discussion on the Mathematical Research Forum regarding 3D order-3 magic cubes. The experts on the forum had already discussed it quite thoroughly, so I didn’t have much to add. Then, a sudden idea struck me: could I draw such a 3D magic cube using pure LaTeX?
Yesterday afternoon, I tinkered with it for a while and only produced a semi-finished product. After further refinement by the forum expert mathe, it was finally successfully drawn:
\begin{array}{ccccccccccccccc} & & & & 4 & - & - & - & - & 25 & - & - & - & - & 11 \\ \\ & & & \rotatebox[origin=c]{45}{$|$} & {\color{red!50}\vdots} & & & & \rotatebox[origin=c]{45}{$|$} & {\color{red!50}\vdots} & & & & \rotatebox[origin=c]{45}{$|$} & | \\ \\ & & 14 & - & - & - & - & 22 & - & - & - & - & 7 & & | \\ \\ & \rotatebox[origin=c]{45}{$|$} & {\color{red!50}\vdots} & & {\color{red!50}\vdots} & & \rotatebox[origin=c]{45}{$|$} & {\color{red!50}\vdots} & & {\color{red!50}\vdots} & & \rotatebox[origin=c]{45}{$|$} & | & & | \\ 24 & - & - & - & - & 1 & - & - & - & - & 18 & & | & & | \\ | & & {\color{red!50}\vdots} & & \color{red}{13} & | & {\color{red!50}\cdots} & {\color{red!50}\vdots} & {\color{red!50}\cdots} & \color{red}{27} & | & {\color{red!50}\cdots} & | & {\color{red!50}\cdots} & 5 \\ | & & {\color{red!50}\vdots} & \rotatebox[origin=c]{45}{\color{red!50}$\vdots$} & {\color{red!50}\vdots} & | & & {\color{red!50}\vdots} & \rotatebox[origin=c]{45}{\color{red!50}$\vdots$} & {\color{red!50}\vdots} & | & & | & \rotatebox[origin=c]{45}{$|$} & | \\ | & & \color{red}{8} & {\color{red!50}\cdots} & {\color{red!50}\cdots} & | & {\color{red!50}\cdots} & \color{red}{12} & {\color{red!50}\cdots} & {\color{red!50}\cdots} & | & {\color{red!50}\cdots} & 22 & & | \\ | & \rotatebox[origin=c]{45}{\color{red!50}$\vdots$} & {\color{red!50}\vdots} & & {\color{red!50}\vdots} & | & \rotatebox[origin=c]{45}{\color{red!50}$\vdots$} & {\color{red!50}\vdots} & & {\color{red!50}\vdots} & | & \rotatebox[origin=c]{45}{$|$} & | & & | \\ 15 & - & - & - & - & 3 & - & - & - & - & 21 & & | & & | \\ | & & {\color{red!50}\vdots} & & \color{red}{9} & | & {\color{red!50}\cdots} & {\color{red!50}\vdots} & {\color{red!50}\cdots} & \color{red}{26} & | & {\color{red!50}\cdots} & | & {\color{red!50}\cdots} & 6 \\ | & & {\color{red!50}\vdots} & \rotatebox[origin=c]{45}{\color{red!50}$\vdots$} & & | & & {\color{red!50}\vdots} & \rotatebox[origin=c]{45}{\color{red!50}$\vdots$} & & | & & | & \rotatebox[origin=c]{45}{$|$} \\ | & & \color{red}{16} & {\color{red!50}\cdots} & {\color{red!50}\cdots} & | & {\color{red!50}\cdots} & \color{red}{8} & {\color{red!50}\cdots} & {\color{red!50}\cdots} & | & {\color{red!50}\cdots} & 17 \\ | & \rotatebox[origin=c]{45}{\color{red!50}$\vdots$} & & & & | & \rotatebox[origin=c]{45}{\color{red!50}$\vdots$} & & & & | & \rotatebox[origin=c]{45}{$|$} \\ 23 & - & - & - & - & 2 & - & - & - & - & 19 \\ \end{array}
In fact, the code contains some embedded HTML code (in the original MathJax version), so it is not strictly pure LaTeX code; rather, it is a combination of LaTeX and MathJax.
Original address: https://kexue.fm/archives/6534
For more details on reposting, please refer to: Scientific Space FAQ