%% %% example-cube.tex %% package example using the rubikcube package %% Requires the tikz package %% January 20, 2014 %%--------NOTE------------------------------------------- %% USAGE: (pdf)latex example-cube.tex %%------------------------------------------------------- \documentclass[a4paper]{article} \usepackage{tikz} %% load tikz before rubikcube \usepackage{rubikcube} \usepackage{url} \pagestyle{myheadings} \markright{\textsc{rubikcube} package; \hspace{2cm}file = example-cube.tex} %% increase textwidth to make room \addtolength{\oddsidemargin}{-1.5cm} \addtolength{\textwidth}{3cm} %% brace and bracket \newcommand{\Rubikbracket}[1]{$\left(\mbox{#1}\right)$} \newcommand{\Rubikbrace}[1]{$\left\{\mbox{#1}\right\}$} %% \begin{document} %%------------------------- \subsection*{Example---the `superflip' configuration} Once you have mastered Rubik's cube, then an interesting exercise is to generate the so-called `superflip' configuration, in which all the corners are correctly solved, while all the edges are flipped. For the impatient, the superflip sequence of 24 quarter-turn rotations (listed on Randelshofer's website) is as follows. This converts the solved cube on the left into the configuration shown on the right. \bigskip \begin{center} \RubikU\RubikR\RubikR\RubikFp\RubikR\RubikDp\RubikL\RubikBp\RubikR% \RubikUp\RubikR\RubikUp\RubikD\RubikFp\RubikU\RubikFp\RubikUp\RubikDp% \RubikB\RubikLp\RubikFp\RubikBp\RubikDp\RubikLp \end{center} \medskip {\noindent}Surprisingly, this sequence is actually equivalent to \Rubikbrace{\Rubikbracket{\RubikM\RubikUp}4, \Rubiky, \Rubikxp}3 \bigskip \begin{figure}[hbt] \centering \RubikCubeSolved% \begin{minipage}{2cm} \begin{tikzpicture}[scale=0.5] \DrawRubikCubeRU \end{tikzpicture} \end{minipage} \hspace{5mm}$\Longrightarrow$\hspace{5mm}% \RubikFaceUp {W}{R}{W} {B}{W}{G} {W}{O}{W}% \RubikFaceDown {Y}{O}{Y} {B}{Y}{G} {Y}{R}{Y}% \RubikFaceLeft {B}{W}{B} {R}{B}{O} {B}{Y}{B}% \RubikFaceRight{G}{W}{G} {O}{G}{R} {G}{Y}{G}% \RubikFaceFront{O}{W}{O} {B}{O}{G} {O}{Y}{O}% \RubikFaceBack{R}{W}{R} {G}{R}{B} {R}{Y}{R}% \begin{minipage}{2cm} \begin{tikzpicture}[scale=0.5] \DrawRubikCubeRU \end{tikzpicture} \end{minipage} \hspace{1cm}% \begin{minipage}{5cm} \begin{tikzpicture}[scale=0.5] \DrawRubikCubeFlat \end{tikzpicture} \end{minipage} \caption{Two images of the superflip configuration.} \end{figure} The code for all this is given below---note that the facelet colours can be written in various ways. Note also the trailing \% at the end of each line which is not inside a TikZ picture environment, and the value of placing each TikZ picture environment inside a minipage. Since the default width of a Rubik cube is 4cm (see \S\,7 Fig~2 in \texttt{rubikcube.pdf}), then since the TikZ scale here is 0.5 then the required width of its minipage is equal to $0.5 \times 4\mbox{cm} = 2\mbox{cm}$. %%---------- \begin{verbatim} ------------------- \newcommand{\Rubikbracket}[1]{$\left(\mbox{#1}\right)$} \newcommand{\Rubikbrace}[1]{$\left\{\mbox{#1}\right\}$} \begin{center} \RubikU\RubikR\RubikR\RubikFp\RubikR\RubikDp\RubikL\RubikBp\RubikR% \RubikUp\RubikR\RubikUp\RubikD\RubikFp\RubikU\RubikFp\RubikUp\RubikDp% \RubikB\RubikLp\RubikFp\RubikBp\RubikDp\RubikLp \end{center} \medskip {\noindent}Surprisingly, this sequence is actually equivalent to \Rubikbrace{\Rubikbracket{\RubikM\RubikUp}4, \Rubiky, \Rubikxp}3 \bigskip \begin{figure}[hbt] \centering \RubikCubeSolved \begin{minipage}{2cm} \begin{tikzpicture}[scale=0.5] \DrawRubikCubeRU \end{tikzpicture} \end{minipage} \hspace{5mm}$\Longrightarrow$\hspace{5mm}% \RubikFaceUp {Y}{B}{Y} {R}{Y}{O} {Y}{G}{Y}% \RubikFaceDown {W}{G}{W} {R}{W}{O} {W}{B}{W}% \RubikFaceLeft {R}{Y}{R} {B}{R}{G} {R}{W}{R}% \RubikFaceRight{O}{Y}{O} {G}{O}{B} {O}{W}{O}% \RubikFaceFront{G}{Y}{G} {R}{G}{O} {G}{W}{G}% \RubikFaceBack {B}{Y}{B}% {O}{B}{R}% {B}{W}{B}% \begin{minipage}{2cm} \begin{tikzpicture}[scale=0.5] \DrawRubikCubeRU \end{tikzpicture} \end{minipage} \hspace{1cm}% \begin{minipage}{5cm} \begin{tikzpicture}[scale=0.5] \DrawRubikCubeFlat \end{tikzpicture} \end{minipage} \caption{Two images of the superflip configuration.} \end{figure} ------------------- \end{verbatim} \subsection*{Using the rubikrotation package} This is just a note to show that if this file were run in conjunction with the \texttt{rubikrotation} package, using the \LaTeX\ commandline switch \texttt{--shell-escape}, then the above figure could be generated more simply by replacing \begin{verbatim} \RubikFaceUp {Y}{B}{Y} {R}{Y}{O} {Y}{G}{Y}% \RubikFaceDown {W}{G}{W} {R}{W}{O} {W}{B}{W}% \RubikFaceLeft {R}{Y}{R} {B}{R}{G} {R}{W}{R}% \RubikFaceRight{O}{Y}{O} {G}{O}{B} {O}{W}{O}% \RubikFaceFront{G}{Y}{G} {R}{G}{O} {G}{W}{G}% \RubikFaceBack {B}{Y}{B}% {O}{B}{R}% {B}{W}{B}% \end{verbatim} with the command \begin{verbatim} \RubikRotation{\superflip}% \end{verbatim} ie,~using instead the following code: \begin{verbatim} ----------------- \newcommand{\superflip}{U,R2,Fp,R,Dp,L,Bp,R,Up,R,Up,D,% Fp,U,Fp,Up,Dp,B,Lp,Fp,Bp,Dp,Lp} \begin{figure}[hbt] \centering \RubikCubeSolved% \begin{minipage}{2cm} \begin{tikzpicture}[scale=0.5] \DrawRubikCubeRU \end{tikzpicture} \end{minipage} \hspace{5mm}$\Longrightarrow$\hspace{5mm}% \RubikRotation{\superflip}% \begin{minipage}{2cm} \begin{tikzpicture}[scale=0.5] \DrawRubikCubeRU \end{tikzpicture} \end{minipage} \hspace{1cm}% \begin{minipage}{5cm} \begin{tikzpicture}[scale=0.5] \DrawRubikCubeFlat \end{tikzpicture} \end{minipage} \caption{Two images of the superflip configuration.} \end{figure} ----------------- \end{verbatim} \begin{center} ------ END ------ \end{center} \end{document}