1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
%%
%% 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}
|