summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/rubik/rubikcube.dtx
blob: 053c01df17f9ce38fdb529bce26bf35ec3a7ffa0 (plain)
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
% \iffalse meta-comment
%
%% rubikcube.dtx
%% Copyright 2014  RWD Nickalls (dick@nickalls.org) and A Syropoulos (asyropoulos@yahoo.com)
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work are  RWD Nickalls and A Syropoulos
%
%
% This work consists of the files rubikcube.dtx and rubikcube.ins
% and the derived file rubikcube.sty.
%
%<*readme>
%
% The rubikcube package provides a collection of LaTeX commands and macros 
% for the typesetting of Rubik cube configurations and rotation 
% sequences using the TikZ graphic language.
%
% Please report errors or suggestions for improvement to
%
%         Dick Nickalls or Apostolos Syropoulos
%
% This package requires the basic TikZ package to be loaded already
%</readme>
%
%<*driver>
\listfiles
\documentclass{ltxdoc}
\IfFileExists{rubikcube.sty}{\usepackage{rubikcube}}{%
    \GenericWarning{rubikcube.dtx}{Package file rubikcube.sty not found.
    Documentation will be messed up!^^J
    (Generate rubikcube.sty by (La)TeXing rubikcube.ins, and then^^J
    process rubikcube.dtx again)^^J}\stop
}%
\usepackage{ifpdf}
\usepackage{url}  %% for references
\usepackage{supertabular} %% for Notation table
%%\OnlyDescription
\EnableCrossrefs
\CodelineIndex
\CodelineNumbered
\RecordChanges
\setcounter{StandardModuleDepth}{1}
\begin{document}
  \DocInput{rubikcube.dtx}
  \PrintChanges
  \PrintIndex
\end{document}
%</driver>
% \fi
%
%
% 
% \CheckSum{3912}
%
%%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%
%
% \title{The \textsf{rubikcube} package}
%
% \author{
%      RWD Nickalls (dick@nickalls.org) \\
%     A Syropoulos (asyropoulos@yahoo.com)
%       }
%  \date{This file describes version \RCfileversion, last revised \RCfiledate}
%  \maketitle
%
%  \begin{abstract}
%  The \rubikcube\ package provides LaTeX commands and macros 
%  for  typesetting  Rubik cube (3x3x3) notation,  configurations, and 
%  rotation sequences  using the  TikZ graphic language.
%  \end{abstract}
%
% \bigskip
% \hfil
% \begin{minipage}{2cm}
% \centering
% \begin{tikzpicture}[scale=0.4]
% \RubikFaceUpAll{W}
% \RubikFaceFrontAll{O}
% \RubikFaceRightAll{G}
% \DrawRubikCubeRU
% \end{tikzpicture}
% \end{minipage}
% \begin{minipage}{2cm}
% \centering
% \begin{tikzpicture}[scale=0.4]
% \DrawRubikLayerFaceAll{W}
% \DrawRubikLayerSideT {R}{R}{R}
% \DrawRubikLayerSideLR{B}   {G}
%                      {B}   {G}
%                      {B}   {G}
% \DrawRubikLayerSideB {O}{O}{O}
% \draw[thick,->,color=magenta] (1.5,0.5) -- (2.4, 1.4);
% \draw[thick,->] (2.5,1.5) -- (1.6, 2.4);
% \draw[thick,->,color=magenta] (1.3, 2.3) -- (1.3, 0.5);
% \draw[thick,<->,  color=blue] (0.5,2.6) -- (2.5, 2.6);
% \draw[thick,<->,  color=blue] (0.5,0.3) -- (2.5, 0.3);
% \end{tikzpicture}
% \end{minipage}
% \RubikF\RubikR\RubikU\RubikRp\RubikUp\RubikFp\
% \ \ $\longrightarrow$
% \begin{minipage}{2cm}
% \centering
% \begin{tikzpicture}[scale=0.4]
% \DrawRubikLayerFace{W}{W}{B}
%                    {W}{W}{O}
%                    {W}{R}{B}
% \DrawRubikLayerSideT {G}{G}{R}
% \DrawRubikLayerSideLR{R}   {W}
%                      {B}   {W}
%                      {O}   {W}
% \DrawRubikLayerSideB {G}{W}{O}
% \end{tikzpicture}
% \end{minipage}
% \hfil
%
% \bigskip
%
%  \tableofcontents
%
% \pagebreak
%
% \section{Introduction}
%
% The  \rubikcube\  package   provides  a collection of \LaTeX\ commands 
% and macros for  typesetting  Rubik cube  configurations  and layer-rotation 
% instructions using the  PGF/TikZ graphic languages---see examples below.
% We have extended slightly the  layer-rotation  hieroglyphic notation,  originally  
% developed  by Garfath-Cox (1981), and improved by Duvoid (2010, 2011).
%
%  The \textsf{rubikcube} package has been road-tested  on a Microsoft 
%  platform (with MikTeX and Strawberry Perl)
%  and on a Linux platform ({\TeX}Live and Mandriva).
%
% 
%  Useful web sites for solvers are the Speedsolving website, and  those 
% maintained  by Duvoid,  by Fridrich, by Jelinek,  by Reid, and by Vandenburgh (see References).
% For the mathematics and group theory associated with   Rubik's cube  see Chen (2004), 
% Joyner (2008), Hutchings (2011),  Rokicki \textit{et al.}\ (2013). 
% 
%
%  \subsection{Requirements}
%
%     The \rubikcube\ package requires the TikZ package.
%
%
%  \subsection{Supporting tool---the \textsf{rubikrotation} package}
%  \label{sec:addons}
%
%  The \textsf{rubikrotation} package, is a dynamic extension to
% the \rubikcube\ package. It consists of  the  Perl program  
% \texttt{rubikrotation.pl}  and style option \texttt{rubikrotation.sty}. 
%  The \textsf{rubikrotation} package  implements rotation sequences and 
%  random  scrambling of the 3x3x3 Rubik cube on-the-fly using a
%   \cmd{\RubikRotation}\marg{rotation-sequence} command. It returns the 
% new state in a form which is then used by the \rubikcube\ package.
%
%  Since the  \cmd{\RubikRotation} command works by \textsc{call}ing the  
%  \texttt{rubikrotation.pl} program, it follows that the \textsf{rubikrotation}
%   package requires  (a)~Perl to be installed, 
%  and (b)~\LaTeX\ needs to be run using the  \texttt{--shell-escape} commandline option.
%  See the \textsf{rubikrotation}  documentation for details.
%  The \textsf{rubikrotation} package has been road-tested  on a Microsoft 
%  platform (with MikTeX and Strawberry Perl)
%  and on a Linux platform ({\TeX}Live and Mandriva).
%
%
%  \subsection{Copyright}
%  Copyright 2014 RWD Nickalls and A Syropoulos.
%
% \medskip
% {\noindent}This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or any
% later version. The latest version of this licence is in 
%  http://www.latex-project.org/lppl.txt
%
%
% \section{Installation}
%
%
%  \subsection{Generating the files}
%
%  Place the file \texttt{rubikcube.zip} into a temporary directory, and unzip it. 
% This will generate the following files:
% \begin{verbatim}
% rubikcube.ins
% rubikcube.dtx
% rubikcube.sty
% rubikcube.pdf
% example-cube.tex
% example-cube.pdf
% Rubik_doc_figA.pdf
% Rubik_doc_figB.pdf
% Rubik_doc_figC.pdf
% Rubik_doc_figD.pdf
% Rubik_doc_figE.pdf
%\end{verbatim}
%  The  style option \texttt{rubikcube.sty} is generated by  running (pdf)\LaTeX\ on  
% the file \texttt{rubikcube.ins}  as follows:
%\begin{verbatim}
%   pdflatex  rubikcube.ins 
%\end{verbatim}
% The documentation file (\texttt{rubikcube.pdf}) was generated using the following
% steps:
% \begin{verbatim}
%  pdflatex   rubikcube.dtx
%  pdflatex   rubikcube.dtx
%  makeindex -s gind.ist  rubikcube
%  makeindex -s gglo.ist -o rubikcube.gls  rubikcube.glo
%  pdflatex   rubikcube.dtx
%\end{verbatim}
%
%
%  \subsection{Placing the files}
%
% Place the files either in the local working directory, or where your system 
% will find them. For a Linux system with a standard \TeX\ Directory Structure (TDS), then:
%
%\medskip
%{\noindent}*.sty  $\rightarrow$ 
%   \texttt{/usr/local/texlive/texmf-local/tex/latex/local/rubikcube/}
%{\newline}*.pdf  $\rightarrow$  \texttt{/usr/local/texlive/texmf-local/doc/rubikcube/}
%
% \medskip
% {\noindent}Finally, (depending on your system) update the  \TeX\ file database using the 
% \texttt{texhash} command.
%
%
% \subsection{Usage}
%
% Load the package by using the command \cmd{\usepackage\{rubikcube\}}.
% Note that the \rubikcube\ package requires the TikZ package, and so always load TikZ 
% before \rubikcube\  as follows:
% \begin{quote}
%\begin{verbatim}
% \usepackage{tikz}
% \usepackage{rubikcube}
%\end{verbatim}
% \end{quote}
% However, the \rubikcube\ package does check for the presence of TikZ, and will 
% load it  if TikZ is not already loaded.
%
%
%    \section{TikZ picture environment}
%
%  For a basic introduction to the use of TikZ see the following manuals
%  (from CTAN or from \texttt{http://altermundus.com/}).
%  \begin{itemize}
%  \item \texttt{pgfmanual.pdf}, version 2.10 (2012) (900 pages)
%  \item tkz-base-screen.pdf
%  \end{itemize}
% An example of the TikZ picture environment for use with \rubikcube\ is as follows 
%  If no scale is used (default scale = 1), then each of the small cubie sides 
%  will have a length of 1~cm.
% \begin{quote}
%\begin{verbatim}
% \begin{tikzpicture}[scale=0.5]
% ....
% \end{tikzpicture}
%\end{verbatim}
% \end{quote}
% A very useful feature of  TikZ  is that it automatically 
% minimises the surrounding  white-space, and consequently this is 
% mostly quite sufficient.
%
% However,  when making complicated  side-by-side figures it is 
% sometimes helpful to place each sub-figure in a surrounding minipage.
% In this case, a useful approach is to  first adjust 
% the `scale' parameter  to obtain the appropriate size, and 
% then adjust the minipage width as necessary.
% 
% Note that sometimes a temporary \cmd{\fbox\{\}} can be a useful aid  when 
% trying to  visualise the  full extent of the minipage 
% (and its whitespace). In this case remember to include a 
% trailing \% after the first brace \{ of the fbox command in order not to 
% collect any extra `space', as follows:
% \begin{quote}
%\begin{verbatim}
% \fbox{%
%    \begin{minipage}{2cm}
%    \centering
%    \begin{tikzpicture}[scale=0.5]
%    ....
%    \end{tikzpicture}
%    \end{minipage}
% } 
%\end{verbatim}
% \end{quote}
% Unexpected spacing between two adjacent images, or between an 
% image and adjacent text, is usually related to inappropriate 
% (and hidden) white-space associated with the image or its 
% associated \cmd{\minipage}.
%
% 
% \subsection{\rubikcube\ commands}
%
% Although the \rubikcube\ package has been designed with TikZ in mind, 
% it is important to appreciate that of all the  various \rubikcube\  
% commands only the `Draw...' commands actually have to be  used within
% a  TikZ picture environment. 
%
% Indeed, using \rubikcube\ 
% commands outside the TikZ picture environment can make for useful 
% flexibility when a documant is generating  more than one figure
% or image. This is because the scope of a command when used inside
% a TikZ environment is constrained to be `local' to that particular
%  environment, and hence its influence is  not accessable outside 
% the environment.  
%
% For example,  
%
% \subsection{\cmd{\draw} error message}
% \label{drawerrormessage}
%
% If a  \cmd{\Draw...} command is used \textit{outside} a TikZ picture
%  environment, then \LaTeX\  issues a  \cmd{\draw} ``Undefined control
% sequence'' error message, indicating that it is trying to draw 
% something using an undefined TikZ \cmd{\draw} command. 
%
% For example, if we  try to run the \rubikcube\ command 
%  \cmd{\DrawRubikFlat}  without a surrounding TikZ picture environment 
%  you will see something like  the following error message.
%\begin{verbatim} 
%! Undefined control sequence.
%\FlatUp ... }{#1}\pgfmathsetmacro {\uy }{#2}\draw
%                                                  [line join=round,...
%l.56 \DrawRubikFlat
%\end{verbatim}
%
%
%     \section{Command conventions}
%     \label{sec:conventions}
%
%
% \DescribeMacro{\rubikcube}
% This command generates the logo \rubikcube.
%
%
%   \subsection{Capital letters}
%
%  Each `word' in a command (except the word `text')  starts with a capital letter. 
%  For example,  \cmd{\DrawRubikCubeRU}, \cmd{\DrawCubieRU}. 
%  However, in line with \LaTeX,  `text' commands start with a lowercase `t'; 
%  for example \cmd{\textCubieRU}.  Letters  for  colours (R, O, Y, G, B, W, X)  are 
%  always written in uppercase. How the six  face letters  are  written depends 
% on  the command; sometimes in uppercase (eg \cmd{\rrD}, \cmd{\rrDs}, \cmd{\rrDa} ),
%  and  sometimes in lowercase  (eg~\cmd{\rrSu}, \cmd{\rrd}, \cmd{\rrhf}).
%
%     \subsection{XYZ argument ordering}
%
% Many commands have an appended two (XY) or three (XYZ) ordered letter code 
% which is used to for  specifying some feature of the command; perhaps 
%  either  face or cubie colours or a viewpoint direction. 
%
% The convention is that the letter codes are ordered in the XYZ order; 
% ie the first code relates to  an X-related parameter; 
% for example  L (Left) or R (Right); the second relates to  a Y-related 
% parameter;  for example  U (Up) or D (Down); the third (if required) 
% relates to  a Z-related  parameter;  for example  F (Front) or B (Back).
%
% \textsc{example}: |\DrawCubieRU{G}{Y}{O}|  draws a cubie from 
% the RightUp viewpoint. The sequence of  colour codes for the three visible 
% faces are XYZ ordered, and hence result in the cube having a Green Right face, 
% Yellow Up face and Orange Front face.
%
%
%  \subsection{Trailing \% on end of \rubikcube\ commands}
%
% It is important to include a trailing \% on the end of \rubikcube\ 
% commands when used \textit{outside}  a TikZ picture environment.
% This is to prevent  unwanted `space' characters appearing in 
% the graphics. Note that a useful feature  of the TikZ environment
% is that it  automatically minimises any such space.
%
%
%  \section{Rubik rotation commands and notation}
%  \label{sec:RubikCommands} 
%
% We  use the standard Rubik cube notation  of WCA (2012)---see article~12---and
% also the `s' (Slice) and `a' (anti-Slice) notation described in   the 
% `Notation and terminology' section
% in the `Pretty patterns' page on the website of  
% Fridrich (\url{http://www.ws.binghamton.edu/fridrich/ptrns.html}).
% By the term \rubikcube\ we  denote only  the familiar
% 3x3x3 puzzle cube. We  denote similar puzzle cubes  of a different size by 
% the term  NCubes (NxNxN). 
% 
% It is recommended  that  commas  are used to separate sequestial 
% Rubik moves or commands to avoid  ambiguity, especially when using just
%  lettercodes on their own. 
% For example, in the following sequence the commas usefully remove any ambiguity:
%  \rrU,\rrLw2,\rrUsp,\rrDa \ \ (|\rrU,\rrLw2,\rrUsp,\rrDa|).
%
% 
%
% \subsection{Overview}
%
% The \rubikcube\  notation  comprises  a range of 
% commands for moves or rotations (e.g.,~\rrR, \rry, \rrBw) and their equivalent  hieroglyphs 
% (e.g.,~\rrhR, \rrhy, \rrhBw), as well as commands for  drawing 3x3x3 cubes and single cubies.
%
% Note that there are a few rotation commands which  do not have arrow 
% hieroglyphs---their their rotation  is not visible from the \textsc{front} face 
% and hence cannot easily be rendered as  an arrow hieroglyph. Consequently these 
% rotations  have a simple `letter' hieroglyph 
% in the form of the letter-code in a square; for example \rrhBw, \rrhSb. 
%
% \DescribeMacro{\rr..}
%  The letter-code of a rotation is typeset  (as in text) using the rubik-rotation 
%  \cmd{\rr..} stem: ie \rrR\ is typeset using the command \cmd{\rrR}. 
% The hieroglyph of a rotation command is generated  (in text) by
% \DescribeMacro{\rrh..}
% using instead the stem \cmd{\rrh..}. \ Thus the command \cmd{\rrhR} generates 
% \rrhR\  which is the hieroglyph associated with \rrR.  
%
% \DescribeMacro{\Rubik..}
% A vertically combined lettercode  and its hieroglyph  is generated using the command 
% stem \cmd{\Rubik..}. For example, \RubikR\ is generated by the command \cmd{\RubikR}, 
% with  the square hieroglyph sitting on the baseline.
% For some hieroglyphs,  eg~the \rrhx, \rrhy, \rrhz\ denoting 90~degree axis rotations, 
% the only  difference between the \cmd{\rrh..} and \cmd{\Rubik..} forms is that 
% the \cmd{\Rubik..}  form is eleveted  to sit on the baseline just like the other
%  \cmd{\Rubik..} hieroglyphs. 
% For example \cmd{\rrhyp} generates \rrhyp, while
% \cmd{\Rubikyp} generates \Rubikyp.
% 
% \DescribeMacro{\textRubik..}
% A horizontally combined  lettercode and its hieroglyph (in sequence as in text) 
% is generated using  the command stem  \cmd{\textRubik..}. 
% For example,  \textRubikR\ is typeset using the command \cmd{\textRubikR}.
% A list of all commands and their associated  hieroglyphs is given in
%  Section~\ref{sec:listofcommands}. 
%
% 
%
% \subsection{Face rotations}
%
% \DescribeMacro{\rrU}
% \DescribeMacro{\rrD}
% \DescribeMacro{\rrL}
% \DescribeMacro{\rrR}
% \DescribeMacro{\rrF}
% \DescribeMacro{\rrB}
% The six main faces of the cube are denoted as \textsc{front} (towards the observer), 
% \textsc{back},  \textsc{left}, \textsc{right},  \textsc{up}, \textsc{down}.
% The uppercase initial letter  of each face-name (\rrF, \rrB, \rrL, \rrR, \rrU, \rrD) 
% denotes a clockwise 90-degree rotation of the  face as shown in  
% Figure~\ref{fig:notation}. 
% For example, \rrD\ is generated by the `rubik rotation' command \cmd{\rrD}.
%
% \DescribeMacro{\rrUp}
% \DescribeMacro{\rrDp}
% \DescribeMacro{\rrLp}
% \DescribeMacro{\rrRp}
% \DescribeMacro{\rrFp}
% \DescribeMacro{\rrBp}
%  An appended  prime~$^\prime$ indicates an anticlockwise rotation; eg \rrFp. 
%  This is sometimes written as  \rrF$\boldmath{^{-1}}$. The `prime' notation is 
%  achieved by appending a lowercase `p' to the face rotation command. For example, \rrRp\ 
%  is generated by \cmd{\rrRp}. 
%
% \begin{figure}[hbt]
%  \centering
%  \ifpdf
%    \includegraphics[height=6cm]{Rubik_doc_figA.pdf}
%  \fi
% \caption{\label{fig:notation}} 
% \end{figure}
%
%
%  \subsection{Slice rotations}
%
% \DescribeMacro{\rrSu}
% \DescribeMacro{\rrSd}
% \DescribeMacro{\rrSl}
% \DescribeMacro{\rrSr}
% \DescribeMacro{\rrSf}
% \DescribeMacro{\rrSb}
% The Rubik cube (3x3x3) has three orthogonal so-called `inner' slices, whose +ve 
% rotation  direction follows that of a named face. For example the inner slice 
% rotation  between the \textsc{right} and \textsc{left} faces  whose rotation 
% direction follows the rotation \rrR\ (rotation is isomorphic to \rrR) is denoted 
% as \rrSr, which is typeset using the command \cmd{\rrSr}. Note that in these cases
%  the trailing  \texttt{r}  in the command  is lowercase.
%
% \DescribeMacro{\rrSup}
% \DescribeMacro{\rrSdp}
% \DescribeMacro{\rrSlp}
% \DescribeMacro{\rrSrp}
% \DescribeMacro{\rrSfp}
% \DescribeMacro{\rrSbp}
% Each of these slice rotations (S rotations) has a reversed (primed)  p-form,
% the command for which is generated by appending the suffix `p'.
% For example  the inner slice rotations  \rrSlp\ (\cmd{\rrSlp}) and 
% \rrSr\ (\cmd{\rrSr}) are identical.
% The equivalence is more obvious when we see their respective hieroglyphs.
% For example, in this case \linebreak \rrSlp\ (\cmd{\rrSlp}) 
%  $\equiv$ \rrhSlp\ (\cmd{\rrhSlP}), 
%  and  \rrSr\ (\cmd{\rrSr}) $\equiv$ \rrhSr\ (\cmd{\rrhSr}). 
%
% \pagebreak
%
% \subsubsection*{MES slice notation}
%
% \DescribeMacro{\rrM}
% \DescribeMacro{\rrE}
% \DescribeMacro{\rrS}
% \DescribeMacro{\rrMp}
% \DescribeMacro{\rrEp}
% \DescribeMacro{\rrSp}
% An alternative and somewhat confusing (and hence is non-standard) slice notation
%  which is sometimes used  is the following 
% so-called MES notation,  as used in the Waterman algorithm
%  (Treep and Waterman 1987).
% \begin{itemize}
% \item[\rrM] \ (\textsc{middle} slice, between the \textsc{left} 
%      and \textsc{right} faces;  direction  follows  \rrL),
% \item[\rrE] \  (\textsc{equator} slice, between the \textsc{up} and \textsc{down} 
%      faces;  direction follows \rrD),
%  \item[\rrS] \  (\textsc{standing} slice, between the \textsc{front} and 
%      \textsc{back} faces; 
%  direction follows \rrF).
% \end{itemize}
% Each of these also has a reversed (prime) version.
% The equivalent S notations are therefore as follows:  \rrE\ $\equiv$ \rrSd, 
% \rrEp\ $\equiv$ \rrSu, 
% \rrM\ $\equiv$ \rrSl, \rrMp\ $\equiv$ \rrSr, \rrS\ $\equiv$ \rrSf, \rrSp\ $\equiv$ \rrSb. 
%
% 
%
% \subsubsection*{Singmaster slice notation}
%
% \DescribeMacro{\rrUs}
% \DescribeMacro{\rrDs}
% \DescribeMacro{\rrLs}
% \DescribeMacro{\rrRs}
% \DescribeMacro{\rrFs}
% \DescribeMacro{\rrBs}
% These are an alternative (but somewhat less intuitive) form of  
% slice notation  which can be thought of as complementing the 
% inner slice  rotations. These were originally described by 
% Singmaster (Frey and Singmaster, 1982).
% See the link to `notation' on the `Pretty patterns' page of the 
% Fridrich website.
%
% Each of these commands denotes a  rotation of  two opposite faces 
% in the same  direction. For example, \textRubikUs\ $\equiv$ \textRubikU\ + \textRubikDp, 
% which is typeset as: 
% \newline |\textRubikUs\ $\equiv$ \textRubikU\ + \textRubikDp|, 
% i.e., for  \rrUs\ both face-rotations are in the \textit{same} direction 
% as \rrU. 
%
%
% \subsubsection*{Anti-slice notation}
%
% \DescribeMacro{\rrUa}
% \DescribeMacro{\rrDa}
% \DescribeMacro{\rrLa}
% \DescribeMacro{\rrRa}
% \DescribeMacro{\rrFa}
% \DescribeMacro{\rrBa}
% Each of these commands denotes a  rotation of  two opposite faces 
% in \textit{opposite}  directions. 
% For example, \textRubikUa\ $\equiv$ \textRubikU\ + \textRubikD, 
% which is typeset as: 
% \newline |\textRubikUa\ $\equiv$ \textRubikU\ + \textRubikD|.
% See the link to `notation' on the `Pretty patterns' page of the 
% Fridrich website.
%
%
%      \subsection{Wide rotations}
%
% \DescribeMacro{\rrUw}
% \DescribeMacro{\rrDw}
% \DescribeMacro{\rrLw}
% \DescribeMacro{\rrRw}
% \DescribeMacro{\rrFw}
% \DescribeMacro{\rrBw}
% The  clockwise \textit{combined} rotation of  an outer face AND its inner slice 
% (officially known as a `double outer slice' rotation) is denoted by appending a 
% lowercase  \textbf{\textsf{\footnotesize{w}}} (denoting `wide') to a face rotation command.
% For example,  a \textsc{right} double outer slice rotation is  denoted as \rrRw. 
% Similarly, the prime $^\prime$ version \rrLwp\  is generated by \cmd{\rrLwp}.
%
%  The superscript~$^2$, or sometimes just an ordinary 2, indicates that the rotation
%  is applied twice. For example \rrR\textbf{$^2$} or \rrR\textbf{2} 
%  denote  \textit{two} successive 90~degree clockwise rotations of the \textsc{right} face.
%
%
%
%     \subsection{Axis rotations}
%
% \DescribeMacro{\rrx}
% \DescribeMacro{\rry}
% \DescribeMacro{\rrz}
% \DescribeMacro{\rrhx}
% \DescribeMacro{\rrhy}
% \DescribeMacro{\rrhz}
% Whole-cube clockwise rotations  of 90-degrees about about the orthogonal  axes centred 
% on the  \textsc{right}, \textsc{up}, \textsc{front}  faces are denoted 
% as \rrx, \rry, \rrz\ (the \cmd{\rr..} forms) respectively, 
% with their hieroglyphs (the \cmd{\rrh..} forms) being denoted 
% as \rrhx, \rrhy, \rrhz\ in order to distinguish them from  square layer-rotation 
% hieroglyphs.
% Note that \rrx, \rry, \rrz\ rotations are always expressed in lowercase, 
% and hence this practice is extended also to the commands. 
%
% An \rrx\textbf{2} rotation (two \rrx\ rotations one after 
% the other, ie~\rrhx\ \rrhx) denotes rotating 
% the cube 180~degrees about its x axis so as to bring the \textsc{down} face  
% into the \textsc{up} position.
%
%  An appended  prime~$^\prime$ indicates an anticlockwise rotation; 
% for example, \rrxp\ (which is generated by appending a `p' to the end of 
% the command, ie~\cmd{\rrxp}). 
%
% \DescribeMacro{\Rubikx}
% \DescribeMacro{\Rubiky}
% \DescribeMacro{\Rubikz}
% These  \cmd{\Rubik..}  forms (and their prime `p' versions) generate the same
%  hieroglyphs  as their \cmd{\rrh..} versions, except that their spacing is 
%  similar to that associated with the `square box'  \cmd{\Rubik..}  hieroglyphs.  
% Consequently  when typesetting  an axis command in a sequence of  `square-box' 
% \cmd{\Rubik..} commands, it is better to use the \cmd{\Rubik..} form rather than
% the equivalent \cmd{\rrh..} form (see the examples in Section~\ref{sec:examples}).
% There are no \cmd{\textRubik..} forms for the axis commands (since they are 
% not necessary).
%
%
% \subsubsection*{The u, d, l, r, f, b notation} 
%
% \DescribeMacro{\rru}
% \DescribeMacro{\rrd}
% \DescribeMacro{\rrl}
% \DescribeMacro{\rrr}
% \DescribeMacro{\rrf}
% \DescribeMacro{\rrb}
% A commonly used  alternative for the \rrx, \rry, \rrz\ notation 
% (and endorsed  by the WCA)  uses the 
% lowercase face letter to denote a 90~degree whole-cube rotation  in the same 
% sense as that of the   standard face rotations. 
%
% {\noindent}Thus  
% \rru\ $\equiv$ \rry, \    \rrd\ $\equiv$ \rryp, \ 
% \rrl\ $\equiv$ \rrxp, \   \rrr\ $\equiv$ \rrx, \ 
% \rrf\ $\equiv$ \rrz, \    \rrb\ $\equiv$ \rrzp,
%
% {\noindent}For example, \rrd\ is generated by  the command \cmd{\rrd}.
%
% {\noindent}Note that these moves do not have prime $^\prime$ versions  
% since \rru\ is the opposite of \rrd, \rrl\ is the opposite of \rrr, and
% \rrf\ is the opposite of \rrb.
%
% \DescribeMacro{\rrh..}
% \DescribeMacro{\Rubik..}
% As with the \rrhx, \rrhy, \rrhz\ forms (described above) there also 
% equivalent \cmd{\rrh..} and \cmd{\Rubik..} forms. For example, 
% \rrhd\ is generated by the command \cmd{\rrhd}.
%
%
%  \subsection{Examples}
%  \label{sec:examples}
%  \begin{quote}
%    \rrR\  is generated by  the `rubik rotation' command \cmd{\rrR}
%
%    \rrFw\  is generated by  the `rubik rotation' command \cmd{\rrFw}
%
%    \rrL$^2$ is generated by \cmd{\rrL}\verb!$^2$!
%
%    \rrRp\ is generated by \cmd{\rrRp}
%
%    \rrFwp\  is generated by \cmd{\rrFwp}
%
%        \rrx\ and \rrhy\ and \Rubikzp\ are  generated by 
%   \cmd{\rrx}  and \cmd{\rrhy} and \cmd{\Rubikzp}
%
%    \rrf\ and \rrhb\ are  generated by \cmd{\rrf} and \cmd{\rrhb}
%
%  The sequence  \rrU\rrU\rrR\rrR\ is generated by  \cmd{\rrU}\cmd{\rrU}\cmd{\rrR}\cmd{\rrR}
%  \end{quote}
%  
%  \bigskip
%         
%  {\noindent}\RubikF\RubikR\RubikU\Rubiky\RubikRp\RubikLwp\
%  \ \  \verb!\RubikF\RubikR\RubikU\Rubiky\RubikRp\RubikLwp!
%  
%  \bigskip
%  
%  {\noindent}The  equivalent `text' version  of the first three 
%  rotations above (and their commands)  are as follows:
%  
%  \bigskip
%  
%  {\noindent}\textRubikF\ \textRubikR\ \textRubikU\ \ \ \  
%       \verb!\textRubikF\ \textRubikR\ \textRubikU!
%  
%  \bigskip
%  {\noindent}Writing the first sequence using  only  letter-codes or only hieroglyphs, we have:
%  
%  \bigskip
%  
%  {\noindent}\rrF\rrR\rrU\rry\rrRp \ \ \ \
%  \verb!\rrF\rrR\rrU\rry\rrRp!
%  
%  \bigskip
%  
%  {\noindent}\rrhF\rrhR\rrhU\rrhy\rrhRp \ \ \ \
%  \verb!\rrhF\rrhR\rrhU\rrhy\rrhRp\! 
%
%  \bigskip
% 
% The following shows the importance of using commas to avoid ambiguity:
%
% \bigskip
%
% {\noindent}\rrD,\rrU2,\rrF2,\rrDs2,\rrB,  \ \ \ \  \verb!\rrD,\rrU2,\rrF2,\rrDs2,\rrB,!
%
%  \bigskip
%
% {\noindent}\rrhD,\rrhU2,\rrhF2,\rrhDs2,\rrhB, \ \ \ \  \verb!\rrhD,\rrhU2,\rrhF2,\rrhDs2,\rrhB,!
% 
%
%  \subsection{Listing of all rotation commands}
%   \label{sec:listofcommands}
%
% Note that all these commands also have a \cmd{\Rubik..} equivalent form which 
% typesets both the hieroglyph and its lettercode in a vertical format, 
% as shown in the above `Examples' section. These have been ommitted  here
% owing to the difficulty of including this form easily in the following table.
%
% Note also that some \cmd{\rrh..} commands (eg~the \cmd{\rrhB..} commands)  
% show only the lettercode in a square box. This is because these  rotations, which 
%  do not have a `true' visual representation as seen from the \textsc{front} face,
% are somewhat ambiguous unless typeset with the associated lettercode (ie using the 
% \cmd{\Rtbik..}  or \cmd{\textRubik..} commands). 
%
%  \newcommand{\dnstrut}{\rule{0pt}{17pt}}
%  \newcommand{\dns}{\hspace{2mm}}
%  \newcommand{\dnsp}{\hspace{2mm}} 
%
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}}
%  \dnstrut\rrU\dns\cmd{\rrU}
%  & \rrhU\dns\cmd{\rrhU}
%  & \textRubikU\dns\cmd{\textRubikU} \nonumber\\ 
%  \dnstrut\rrUp\dns\cmd{\rrUp}
%  & \rrhUp\dns\cmd{\rrhUp}
%  & \textRubikUp\dns\cmd{\textRubikUp} \nonumber\\ 
%  \dnstrut\rrUw\dns\cmd{\rrUw}
%  & \rrhUw\dns\cmd{\rrhUw}
%  & \textRubikUw\dns\cmd{\textRubikUw} \nonumber\\ 
%  \dnstrut\rrUwp\dns\cmd{\rrUwp}
%  & \rrhUwp\dns\cmd{\rrhUwp}
%  & \textRubikUwp\dns\cmd{\textRubikUwp} \nonumber\\ 
%  \dnstrut\rrUs\dns\cmd{\rrUs}
%  & \rrhUs\dns\cmd{\rrhUs}
%  & \textRubikUs\dns\cmd{\textRubikUs} \nonumber\\ 
%  \dnstrut\rrUsp\dns\cmd{\rrUsp}
%  & \rrhUsp\dns\cmd{\rrhUsp}
%  & \textRubikUsp\dns\cmd{\textRubikUsp} \nonumber\\ 
%  \dnstrut\rrUa\dns\cmd{\rrUa}
%  & \rrhUa\dns\cmd{\rrhUa}
%  & \textRubikUa\dns\cmd{\textRubikUa} \nonumber\\ 
%  \dnstrut\rrUap\dns\cmd{\rrUap}
%  & \rrhUap\dns\cmd{\rrhUap}
%  & \textRubikUap\dns\cmd{\textRubikUap} \nonumber\\
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}}
%  \dnstrut\rrD\dns\cmd{\rrD}
%  & \rrhD\dns\cmd{\rrhD}
%  & \textRubikD\dns\cmd{\textRubikD} \nonumber\\ 
%  \dnstrut\rrDp\dns\cmd{\rrDp}
%  & \rrhDp\dns\cmd{\rrhDp}
%  & \textRubikDp\dns\cmd{\textRubikDp} \nonumber\\ 
%  \dnstrut\rrDw\dns\cmd{\rrDw}
%  & \rrhDw\dns\cmd{\rrhDw}
%  & \textRubikDw\dns\cmd{\textRubikDw} \nonumber\\ 
%  \dnstrut\rrDwp\dns\cmd{\rrDwp}
%  & \rrhDwp\dns\cmd{\rrhDwp}
%  & \textRubikDwp\dns\cmd{\textRubikDwp} \nonumber\\ 
%  \dnstrut\rrDs\dns\cmd{\rrDs}
%  & \rrhDs\dns\cmd{\rrhDs}
%  & \textRubikDs\dns\cmd{\textRubikDs} \nonumber\\ 
%  \dnstrut\rrDsp\dns\cmd{\rrDsp}
%  & \rrhDsp\dns\cmd{\rrhDsp}
%  & \textRubikDsp\dns\cmd{\textRubikDsp} \nonumber\\ 
%  \dnstrut\rrDa\dns\cmd{\rrDa}
%  & \rrhDa\dns\cmd{\rrhDa}
%  & \textRubikDa\dns\cmd{\textRubikDa} \nonumber\\ 
%  \dnstrut\rrDap\dns\cmd{\rrDap}
%  & \rrhDap\dns\cmd{\rrhDap}
%  & \textRubikDap\dns\cmd{\textRubikDap} \nonumber\\
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}}
%  \dnstrut\rrL\dns\cmd{\rrL}
%  & \rrhL\dns\cmd{\rrhL}
%  & \textRubikL\dns\cmd{\textRubikL} \nonumber\\ 
%  \dnstrut\rrLp\dns\cmd{\rrLp}
%  & \rrhLp\dns\cmd{\rrhLp}
%  & \textRubikLp\dns\cmd{\textRubikLp} \nonumber\\ 
%  \dnstrut\rrLw\dns\cmd{\rrLw}
%  & \rrhLw\dns\cmd{\rrhLw}
%  & \textRubikLw\dns\cmd{\textRubikLw} \nonumber\\ 
%  \dnstrut\rrLwp\dns\cmd{\rrLwp}
%  & \rrhLwp\dns\cmd{\rrhLwp}
%  & \textRubikLwp\dns\cmd{\textRubikLwp} \nonumber\\ 
%  \dnstrut\rrLs\dns\cmd{\rrLs}
%  & \rrhLs\dns\cmd{\rrhLs}
%  & \textRubikLs\dns\cmd{\textRubikLs} \nonumber\\ 
%  \dnstrut\rrLsp\dns\cmd{\rrLsp}
%  & \rrhLsp\dns\cmd{\rrhLsp}
%  & \textRubikLsp\dns\cmd{\textRubikLsp} \nonumber\\ 
%  \dnstrut\rrLa\dns\cmd{\rrLa}
%  & \rrhLa\dns\cmd{\rrhLa}
%  & \textRubikLa\dns\cmd{\textRubikLa} \nonumber\\ 
%  \dnstrut\rrLap\dns\cmd{\rrLap}
%  & \rrhLap\dns\cmd{\rrhLap}
%  & \textRubikLap\dns\cmd{\textRubikLap} \nonumber\\
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}}
%  \dnstrut\rrR\dns\cmd{\rrR}
%  & \rrhR\dns\cmd{\rrhR}
%  & \textRubikR\dns\cmd{\textRubikR} \nonumber\\ 
%  \dnstrut\rrRp\dns\cmd{\rrRp}
%  & \rrhRp\dns\cmd{\rrhRp}
%  & \textRubikRp\dns\cmd{\textRubikRp} \nonumber\\ 
%  \dnstrut\rrRw\dns\cmd{\rrRw}
%  & \rrhRw\dns\cmd{\rrhRw}
%  & \textRubikRw\dns\cmd{\textRubikRw} \nonumber\\ 
%  \dnstrut\rrRwp\dns\cmd{\rrRwp}
%  & \rrhRwp\dns\cmd{\rrhRwp}
%  & \textRubikRwp\dns\cmd{\textRubikRwp} \nonumber\\ 
%  \dnstrut\rrRs\dns\cmd{\rrRs}
%  & \rrhRs\dns\cmd{\rrhRs}
%  & \textRubikRs\dns\cmd{\textRubikRs} \nonumber\\ 
%  \dnstrut\rrRsp\dns\cmd{\rrRsp}
%  & \rrhRsp\dns\cmd{\rrhRsp}
%  & \textRubikRsp\dns\cmd{\textRubikRsp} \nonumber\\ 
%  \dnstrut\rrRa\dns\cmd{\rrRa}
%  & \rrhRa\dns\cmd{\rrhRa}
%  & \textRubikRa\dns\cmd{\textRubikRa} \nonumber\\ 
%  \dnstrut\rrRap\dns\cmd{\rrRap}
%  & \rrhRap\dns\cmd{\rrhRap}
%  & \textRubikRap\dns\cmd{\textRubikRap} \nonumber\\
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}}
%  \dnstrut\rrF\dns\cmd{\rrF}
%  & \rrhF\dns\cmd{\rrhF}
%  & \textRubikF\dns\cmd{\textRubikF} \nonumber\\ 
%  \dnstrut\rrFp\dns\cmd{\rrFp}
%  & \rrhFp\dns\cmd{\rrhFp}
%  & \textRubikFp\dns\cmd{\textRubikFp} \nonumber\\ 
%  \dnstrut\rrFw\dns\cmd{\rrFw}
%  & \rrhFw\dns\cmd{\rrhFw}
%  & \textRubikFw\dns\cmd{\textRubikFw} \nonumber\\ 
%  \dnstrut\rrFwp\dns\cmd{\rrFwp}
%  & \rrhFwp\dns\cmd{\rrhFwp}
%  & \textRubikFwp\dns\cmd{\textRubikFwp} \nonumber\\ 
%  \dnstrut\rrFs\dns\cmd{\rrFs}
%  & \rrhFs\dns\cmd{\rrhFs}
%  & \textRubikFs\dns\cmd{\textRubikFs} \nonumber\\ 
%  \dnstrut\rrFsp\dns\cmd{\rrFsp}
%  & \rrhFsp\dns\cmd{\rrhFsp}
%  & \textRubikFsp\dns\cmd{\textRubikFsp} \nonumber\\ 
%  \dnstrut\rrFa\dns\cmd{\rrFa}
%  & \rrhFa\dns\cmd{\rrhFa}
%  & \textRubikFa\dns\cmd{\textRubikFa} \nonumber\\ 
%  \dnstrut\rrFap\dns\cmd{\rrFap}
%  & \rrhFap\dns\cmd{\rrhFap}
%  & \textRubikFap\dns\cmd{\textRubikFap} \nonumber\\
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}}
%  \dnstrut\rrB\dns\cmd{\rrB}
%  & \rrhB\dns\cmd{\rrhB}
%  & \textRubikB\dns\cmd{\textRubikB} \nonumber\\ 
%  \dnstrut\rrBp\dns\cmd{\rrBp}
%  & \rrhBp\dns\cmd{\rrhBp}
%  & \textRubikBp\dns\cmd{\textRubikBp} \nonumber\\ 
%  \dnstrut\rrBw\dns\cmd{\rrBw}
%  & \rrhBw\dns\cmd{\rrhBw}
%  & \textRubikBw\dns\cmd{\textRubikBw} \nonumber\\ 
%  \dnstrut\rrBwp\dns\cmd{\rrBwp}
%  & \rrhBwp\dns\cmd{\rrhBwp}
%  & \textRubikBwp\dns\cmd{\textRubikBwp} \nonumber\\ 
%  \dnstrut\rrBs\dns\cmd{\rrBs}
%  & \rrhBs\dns\cmd{\rrhBs}
%  & \textRubikBs\dns\cmd{\textRubikBs} \nonumber\\ 
%  \dnstrut\rrBsp\dns\cmd{\rrBsp}
%  & \rrhBsp\dns\cmd{\rrhBsp}
%  & \textRubikBsp\dns\cmd{\textRubikBsp} \nonumber\\ 
%  \dnstrut\rrBa\dns\cmd{\rrBa}
%  & \rrhBa\dns\cmd{\rrhBa}
%  & \textRubikBa\dns\cmd{\textRubikBa} \nonumber\\ 
%  \dnstrut\rrBap\dns\cmd{\rrBap}
%  & \rrhBap\dns\cmd{\rrhBap}
%  & \textRubikBap\dns\cmd{\textRubikBap} \nonumber\\
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}}
%  \dnstrut\rrSu\dns\cmd{\rrSu}
%  & \rrhSu\dns\cmd{\rrhSu}
%  & \textRubikSu\dns\cmd{\textRubikSu} \nonumber\\ 
%  \dnstrut\rrSup\dns\cmd{\rrSup}
%  & \rrhSup\dns\cmd{\rrhSup}
%  & \textRubikSup\dns\cmd{\textRubikSup} \nonumber\\ 
%  \dnstrut\rrSd\dns\cmd{\rrSd}
%  & \rrhSd\dns\cmd{\rrhSd}
%  & \textRubikSd\dns\cmd{\textRubikSd} \nonumber\\ 
%  \dnstrut\rrSdp\dns\cmd{\rrSdp}
%  & \rrhSdp\dns\cmd{\rrhSdp}
%  & \textRubikSdp\dns\cmd{\textRubikSdp} \nonumber\\ 
%  \dnstrut\rrSl\dns\cmd{\rrSl}
%  & \rrhSl\dns\cmd{\rrhSl}
%  & \textRubikSl\dns\cmd{\textRubikSl} \nonumber\\ 
%  \dnstrut\rrSlp\dns\cmd{\rrSlp}
%  & \rrhSlp\dns\cmd{\rrhSlp}
%  & \textRubikSlp\dns\cmd{\textRubikSlp} \nonumber\\ 
%  \dnstrut\rrSr\dns\cmd{\rrSr}
%  & \rrhSr\dns\cmd{\rrhSr}
%  & \textRubikSr\dns\cmd{\textRubikSr} \nonumber\\ 
%  \dnstrut\rrSrp\dns\cmd{\rrSrp}
%  & \rrhSrp\dns\cmd{\rrhSrp}
%  & \textRubikSrp\dns\cmd{\textRubikSrp} \nonumber\\ 
%  \dnstrut\rrSf\dns\cmd{\rrSf}
%  & \rrhSf\dns\cmd{\rrhSf}
%  & \textRubikSf\dns\cmd{\textRubikSf} \nonumber\\ 
%  \dnstrut\rrSfp\dns\cmd{\rrSfp}
%  & \rrhSfp\dns\cmd{\rrhSfp}
%  & \textRubikSfp\dns\cmd{\textRubikSfp} \nonumber\\ 
%  \dnstrut\rrSb\dns\cmd{\rrSb}
%  & \rrhSb\dns\cmd{\rrhSb}
%  & \textRubikSb\dns\cmd{\textRubikSb} \nonumber\\ 
%  \dnstrut\rrSbp\dns\cmd{\rrSbp}
%  & \rrhSbp\dns\cmd{\rrhSbp}
%  & \textRubikSbp\dns\cmd{\textRubikSbp} \nonumber\\ 
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}}
%  \dnstrut\rrE\dns\cmd{\rrE}
%  & \rrhE\dns\cmd{\rrhE}
%  & \textRubikE\dns\cmd{\textRubikE} \nonumber\\ 
%  \dnstrut\rrEp\dns\cmd{\rrEp}
%  & \rrhEp\dns\cmd{\rrhEp}
%  & \textRubikEp\dns\cmd{\textRubikEp} \nonumber\\ 
%  \dnstrut\rrM\dns\cmd{\rrM}
%  & \rrhM\dns\cmd{\rrhM}
%  & \textRubikM\dns\cmd{\textRubikM} \nonumber\\ 
%  \dnstrut\rrMp\dns\cmd{\rrMp}
%  & \rrhMp\dns\cmd{\rrhMp}
%  & \textRubikMp\dns\cmd{\textRubikMp} \nonumber\\ 
%  \dnstrut\rrS\dns\cmd{\rrS}
%  & \rrhS\dns\cmd{\rrhS}
%  & \textRubikS\dns\cmd{\textRubikS} \nonumber\\ 
%  \dnstrut\rrSp\dns\cmd{\rrSp}
%  & \rrhSp\dns\cmd{\rrhSp}
%  & \textRubikSp\dns\cmd{\textRubikSp} \nonumber\\ 
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}}
%  \dnstrut\rrx\dns\cmd{\rrx}
%  & \rrhx\dns\cmd{\rrhx}
%  & \Rubikx\dns\cmd{\Rubikx} \nonumber\\ 
%  \dnstrut\rrxp\dns\cmd{\rrxp}
%  & \rrhxp\dns\cmd{\rrhxp}
%  & \Rubikxp\dns\cmd{\Rubikxp} \nonumber\\ 
%  \dnstrut\rry\dns\cmd{\rry}
%  & \rrhy\dns\cmd{\rrhy}
%  & \Rubiky\dns\cmd{\Rubiky} \nonumber\\ 
%  \dnstrut\rryp\dns\cmd{\rryp}
%  & \rrhyp\dns\cmd{\rrhyp}
%  & \Rubikyp\dns\cmd{\Rubikyp} \nonumber\\ 
%  \dnstrut\rrz\dns\cmd{\rrz}
%  & \rrhz\dns\cmd{\rrhz}
%  & \Rubikz\dns\cmd{\Rubikz} \nonumber\\ 
%  \dnstrut\rrzp\dns\cmd{\rrzp}
%  & \rrhzp\dns\cmd{\rrhzp}
%  & \Rubikzp\dns\cmd{\Rubikzp} \nonumber\\ 
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}}
%  \dnstrut\rru\dns\cmd{\rru}
%  & \rrhu\dns\cmd{\rrhu}
%  & \Rubiku\dns\cmd{\Rubiku} \nonumber\\ 
%  \dnstrut\rrd\dns\cmd{\rrd}
%  & \rrhd\dns\cmd{\rrhd}
%  & \Rubikd\dns\cmd{\Rubikd} \nonumber\\ 
%  \dnstrut\rrl\dns\cmd{\rrl}
%  & \rrhl\dns\cmd{\rrhl}
%  & \Rubikl\dns\cmd{\Rubikl} \nonumber\\ 
%  \dnstrut\rrr\dns\cmd{\rrr}
%  & \rrhr\dns\cmd{\rrhr}
%  & \Rubikr\dns\cmd{\Rubikr} \nonumber\\ 
%  \dnstrut\rrf\dns\cmd{\rrf}
%  & \rrhf\dns\cmd{\rrhf}
%  & \Rubikf\dns\cmd{\Rubikf} \nonumber\\ 
%  \dnstrut\rrb\dns\cmd{\rrb}
%  & \rrhb\dns\cmd{\rrhb}
%  & \Rubikb\dns\cmd{\Rubikb} \nonumber\\ 
%  \end{supertabular}
%
%
%
%    \section{Colours}
%
% The \rubikcube\ package defines seven colours which are defined as follows: 
% red~(R), orange~(O), yellow~(Y),  green~(G), blue~(B),  white~(W), 
% and   grey~(X). Now  according to the following webpage\,\footnote{I thank Peter Bartal  
% for pointing this out.}
%
% \medskip
% \noindent\texttt{http://The-Rubiks-Cube.deviantart.com/journal/Using-Official-Rubik}
% \newline\texttt{-s-Cube-Colors-268760351}
%
% \medskip
% {\noindent}the official Rubik cube colours are defined as
% \begin{quote}
%\begin{verbatim}
% .... colours which are red (PMS 200C*), green (PMS 347C*),
% blue (PMS 293C*), orange (PMS 021C*), yellow (PMS 012C*)
% and white.
% .....
% Pantone colors can not be accurately converted to RGB colors, 
% the colors the web runs on. But they can be approximated. 
% Through some research, I have found some estimations which 
% may help you which I have listed below. Remember, these are
% just approximate RGB equivalents to the official Rubik's Cube
%  colors.
% 
% Red: 200C #C41E3A  (www.perbang.dk/rgb/c41e3a/)
% Green: 347C #009E60 (www.perbang.dk/rgb/009e60/)
% Blue: 293C #0051BA (www.perbang.dk/rgb/0051ba/)
% Orange: 021C "Pantone Orange" #FF5800 (www.perbang.dk/rgb/ff5800/)
% Yellow: 012C "Pantone Yellow" #FFD500 (www.perbang.dk/rgb/ffd500/)
% White: N/A #FFFFFF
%
% Red    {HTML}{C41E3A}
% green  {HTML}{009E60}
% Blue   {HTML}{0051BA}
% Yellow {HTML}{FFD500}
% Orange {HTML}{FF5800}
% White  {HTML}{FFFFFF}
%\end{verbatim}
% \end{quote}
%  However, we have optimised these prescribed colours very slightly 
%  for screen \& print use (for example, the yellow  was made very 
%  slightly brighter),  and so the actual colours  as used by 
%  the \rubikcube\ package  are as follows:
%
% \begin{quote}
%\begin{verbatim}
% \definecolor{R}{HTML}{C41E33}
% \definecolor{G}{HTML}{00BE38}
% \definecolor{B}{HTML}{0051BA}
% \definecolor{Y}{HTML}{FFFF00}
% \colorlet{O}{orange}
% \colorlet{W}{white}
% \colorlet{X}{black!30}%
%\end{verbatim}
% \end{quote}
% Different colours  can be allocated   to  the ROYGBWX letters  (using the 
% \cmd{\colorlet} command) as required. For example, the standard `red' 
% colour could  be allocated to the letter R using the command
% \begin{quote}
%    \cmd{\colorlet\{R\}\{red\}}
% \end{quote}
% However, it is important to appreciate that  the letter codes 
% ROYGBWX are `hardwired' into many of the macros in the \rubikcube\ package,
%  so don't change these.
%
%
%  \section{Rubik face coordinates}
%  \label{sec:coordinates}
%
% The coordinate origin  of each view of the Rubik cube  is located  
% at the bottom left corner of the \textsc{front} face, as shown in 
%  Figure~\ref{fig:cubesquaregraph}. Note also that the bottom left 
%  corner of the cube  itself is at $(-1,-1)$, 
%  and hence the default height and width of the cube is 4cm. 
%
% \begin{figure}[hbt]
% \centering
% \ifpdf
%   \includegraphics[height=3cm]{Rubik_doc_figB.pdf}
% \else
% \includegraphics[height=3cm]{Rubik_doc_figB.eps}
% \fi
%
% \parbox{9cm}{\caption{\label{fig:cubesquaregraph}Origin of coordinates 
%  is at the  bottom left corner of the grey \textsc{front} face. 
%  The bottom left corner of the cube  itself is at $(-1,-1)$, 
%  and hence the default height and width of the 3D-cube is 4cm.}}
% \end{figure}
%
% This is an important feature since knowing the location of the 
% origin enables one to easily use any of the  TikZ commands
% (eg~\cmd{\draw} and \cmd{\node} commands) to  superimpose lines, 
% arrows and text etc onto the Rubik cube (see Section~\ref{sec:arrows}).
%
%
%  \subsection{Size of cube \cmd{\minipage}}
%
%  Since the the default height and width of the 3D-cube is 4cm (see above), 
%  it follows that the width of the \cmd{\minipage} required for a cube in a TikZ 
%  picture environment can be easily calculated. For example, if the TikZ 
%  scale used is $0.5$, then the appropriate width of the required minipage 
%  is $0.5 \times 4\mbox{cm} =  2\mbox{cm}$. 
%
% The default width of the semi-flat cube representation is 10cm, and that of the 
% flat cube is 12cm.
%
%  \section{Commands}
%
% All  |rubikcube| commands assume a 3x3x3 cube by default.
% There are three primary command categories:  \cmd{\Draw..} commands 
% (which must be used \textit{inside} a TikZ picture environment), 
% `parameter-allocation' commands (either inside or outside a TikZ environment), 
% and commands which can be used in ordinary text (eg~rotation commands).
%
% A \cmd{\Draw..} command typesets  
% either a Rubik cube, cubie or a layer  using parameters set or defined via 
% previous parameter-allocation commands (eg~face colours, dimensions etc).
%
%
%    \subsection{Draw commands}
%
%   \DescribeMacro{\DrawRubikCubeXY}
%   \DescribeMacro{\DrawCubieXYxyz}
% These  commands  draw Rubik cubes and  single cubies  in one of four 
% orientations as denoted by the terminal XY viewing-direction code RU (RightUp), 
% RD (RightDown), LU (LeftUp),  LD (LeftDown). For example, the command
%  \begin{quote}
%  \cmd{\DrawRubikCubeRU}
%  \end{quote}
% will draw a Rubik cube  as viewed from the RightUp direction, as 
% shown in the following figure.
% 
% \bigskip
%
% \begin{minipage}{2.8cm}
% \begin{tikzpicture}[scale=0.7]
% \DrawRubikCubeRU 
% \end{tikzpicture}
% \end{minipage}
%   \hspace{5mm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
% \begin{tikzpicture}[scale=0.7]
%    \DrawRubikCubeRU 
% \end{tikzpicture}
%\end{verbatim}
% \end{minipage}
%
% \bigskip 
%  
% {\noindent}Note that in the above example all the cubies are displayed 
% in the default grey colour, since no Face colours have been specified. 
% 
% Since \LaTeX\ commands have a maximum limit of only 9 parameters, 
% it is necessary to use separate commands 
% (`Face' and `Slice'  commands---see below) in order to accommodate 
% all 27 visible colours of a 3D~Rubik cube.
%
% Since a single cubie has only three visible faces we can include 
% colour parameters in \cmd{\DrawCubie} commands. Consequently \cmd{\DrawCubie}
%  commands have the format 
% \begin{quote}
%  \cmd{\DrawCubieXY\{x\}\{y\}\{z\}}  
% \end{quote}
% where the  XY pair denote the viewing direction as before, and 
% the xyz  denote the face colours associated with each of the three axes. 
%
% For example, the  command    \cmd{\DrawCubieRU\{O\}\{Y\}\{G\}}   draws a 
%  single cubie as viewed  from the RightUp  direction, 
% with face colours Orange (x-axis), Yellow (y-axis), Green (z-axis), as follows.
% 
% \bigskip
%
% \begin{minipage}{1.35cm}
% \begin{tikzpicture}[scale=1]
% \DrawCubieRU{O}{Y}{G} 
% \end{tikzpicture}
% \end{minipage}
%    \hspace{1cm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
% \begin{tikzpicture}[scale=1]
%    \DrawCubieRU{O}{Y}{G} 
% \end{tikzpicture}
%\end{verbatim}
% \end{minipage}
% 
% \bigskip 
%
%
%
% \begin{figure}[hbt]
%   \centering
% \ifpdf
%    \includegraphics[height=4cm]{Rubik_doc_figC.pdf}
%  \else
% \includegraphics[height=4cm]{Rubik_doc_figC.eps}
% \fi
% \vspace{-5mm}\caption{\label{fig:cubiedydx}Cubie dy dx parameters} 
% \end{figure}
%
%  \DescribeMacro{\Cubiedy}
%  \DescribeMacro{\Cubiedx}
%  Minor  cubie configuration changes  can be effected 
% (within a TikZ picture environment)  by adjusting the dy and dx 
% values ($> 0$; no units)  shown in Figure~\ref{fig:cubiedydx} 
% via the two commands
% \begin{quote}
% \cmd{\Cubiedy\{\}} \\
% \cmd{\Cubiedx\{\}} 
% \end{quote}
% as shown in the folowing example.
%
% \bigskip
%
% \begin{minipage}{1.7cm}
% \begin{tikzpicture}[scale=1]
% \Cubiedy{0.4}
% \Cubiedx{0.8}
% \DrawCubieRU{O}{Y}{G} 
% \end{tikzpicture}
% \end{minipage}
% \hspace{2cm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
% \begin{tikzpicture}[scale=1]
%   \Cubiedy{0.4}
%   \Cubiedx{0.8}
%   \DrawCubieRU{O}{Y}{G} 
% \end{tikzpicture}
%\end{verbatim}
% \end{minipage}
% 
% \bigskip
%
% {\noindent}Note that the  \textsc{front} of the cubie is a unit square, 
% and the graphic origin of the cubie image is at the bottom left corner of the 
% \textsc{front}  (see also the section on Arrows).
% The default  values of dy and dx are 0.4. 
%
% \medskip
%
% \DescribeMacro{\textCubieRU}
% \DescribeMacro{\textCubieRD}
% \DescribeMacro{\textCubieLU}
% \DescribeMacro{\textCubieLD}
% For convenience, there are also four (smaller) `text' versions \textCubieRU{O}{Y}{G}   
%  of the  four \cmd{\DrawCubie} commands for 
% use in ordinary text, as follows:
% \begin{quote}
%  \textCubieRU{O}{Y}{G} \ \ |\textCubieRU{O}{Y}{G}|
%
% \medskip
%
% \textCubieRD{O}{Y}{G} \ \  |\textCubieRD{O}{Y}{G}|     
%
% \medskip
%
% \textCubieLU{O}{Y}{G}  \ \ |\textCubieLU{O}{Y}{G}|
%
% \medskip
%
%  \textCubieLD{O}{Y}{G}  \ \  |\textCubieLD{O}{Y}{G}|  
% \end{quote}
% Note that the \cmd{\textCubieXY} commands are not influenced by the 
% \cmd{\Cubiedy}, \cmd{\Cubiedx} commands as their size is preset for text use. 
%
% Other \cmd{\Draw..} commands which we shall meet later are
%  \texttt{DrawRubikLayerFace..},  \texttt{DrawRubikLayerSide..}, 
% \texttt{DrawNCube..}, \texttt{DrawRubikFlat} and \texttt{DrawRubikCubeFlat}.
%
%
% \subsubsection{\cmd{\draw} error message}
%
% See also section~\ref{drawerrormessage} regarding the error message associated with 
% using a \cmd{\Draw...} command  \textit{outside}  a TikZ picture environment.
%
%
%  \subsection{Face commands}
%
%  \DescribeMacro{\RubikFaceUp}
%  \DescribeMacro{\RubikFaceDown}
%  \DescribeMacro{\RubikFaceLeft}
%  \DescribeMacro{\RubikFaceRight}
%  \DescribeMacro{\RubikFaceFront}
%  \DescribeMacro{\RubikFaceBack}
% These  commands take nine colour arguments and  allocate   colours to the 
% individual cubies  of a  Rubik cube face.
% The ordering is isomorphic to the sequence 1--9, i.e.,~numbering the small 
% squares 1-3~(top row, left to right), 4-6~(middle row, left to right), 
% 7-9~(bottom row, left to right), as follows:
% \begin{quote}
% \fbox{
% \begin{minipage}{1.6cm}
% \#1 \#2 \#3 
%
% \#4 \#5 \#6
%
% \#7 \#8 \#9
% \end{minipage}
% }
% \end{quote}
% Conveniently, \LaTeX\ allows the colour arguments to be separated by spaces 
% (e.g.,~separated in groups of three), or even spread across several 
% lines (e.g.,~in a square block to resemble a 9-face) in order to 
% make the command more visually intuitive, as in the following examples.
% \begin{quote}
%\begin{verbatim}
% \RubikFaceUp{G}{B}{G}   {G}{W}{O}   {G}{O}{G}
%
% \RubikFaceFront{O}{W}{R}
%                {W}{W}{W}
%                {G}{W}{G}
% 
%\end{verbatim}
% \end{quote}
%
%  \DescribeMacro{\RubikFaceUpAll}
%  \DescribeMacro{\RubikFaceDownAll}
%  \DescribeMacro{\RubikFaceLeftAll}
%  \DescribeMacro{\RubikFaceRightAll}
%  \DescribeMacro{\RubikFaceFrontAll}
%  \DescribeMacro{\RubikFaceBackAll}
% For convenience, each of these commands has an associated 
% `\textsc{all}' command which allocates  the same colour to all the cubies 
% on a 9-face, as follows (only a single colour argument is required):
%
% If you want a particular face to be \textsc{all} grey, then one can 
% either omit the particular `Face' command (since the 
% default colour is grey), or  use  a `Face' command specifying the 
% colour-code~X;  for example,  \cmd{\RubikFaceUpAll\{X\}}.
% However, if you do use a Face command, then all of the command's 
% colour arguments must be used, as otherwise you will generate a 
% `missing parameter' error, and no colour will be 
% allocated (i.e.,~you will see  a black-hole).
% Use of these commands is shown in the following figure.
%
% \bigskip
% 
% \begin{minipage}{2.8cm}
% \begin{tikzpicture}[scale=0.7]
% \RubikFaceUpAll{X}
% \RubikFaceRightAll{R}
% \RubikFaceFront{W}{Y}{G}
%                {W}{Y}{G}
%                {W}{Y}{G}
% \DrawRubikCubeRU
% \end{tikzpicture}
% \end{minipage}
%    \hspace{5mm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
% \begin{tikzpicture}[scale=0.7]
%    \RubikFaceUpAll{X}
%    \RubikFaceRightAll{R}
%    \RubikFaceFront{W}{Y}{G}
%                   {W}{Y}{G}
%                   {W}{Y}{G}
%    \DrawRubikCubeRU
% \end{tikzpicture}
%\end{verbatim}
% \end{minipage}
% 
%
% \subsection{RubikCubeSolved command}
%
%  \DescribeMacro{\RubikCubeSolved}
% This command  sets all the face colours to that of a standard `solved' cube
% as shown in the following semi-flat image.
% This command is equivalent to the following set of face commands:
%\begin{verbatim}
%  \RubikFaceUpAll{W}%
%  \RubikFaceDownAll{Y}%
%  \RubikFaceLeftAll{B}%
%  \RubikFaceRightAll{G}%
%  \RubikFaceFrontAll{O}%
%  \RubikFaceBackAll{R}%
%\end{verbatim}
%
% \begin{tikzpicture}[scale=0.6]
% \RubikCubeSolved
% \DrawRubikCubeFlat
% \end{tikzpicture}
%
%  Users can easily set their own alternative `solved'  face/colour configuration by `renewing' 
% this command as follows---remember to include the trailing \%  (note that the colours 
% ROYGBWX are currently hardwired  so don't  use a different set of uppercase letters).
%\begin{verbatim}
% \renewcommand{\RubikCubeSolved}{%
%    \RubikFaceUpAll{..}%
%    \RubikFaceDownAll{..}%
%    \RubikFaceLeftAll{..}%
%    \RubikFaceRightAll{..}%
%    \RubikFaceFrontAll{..}%
%    \RubikFaceBackAll{..}%
% }
%\end{verbatim} 
%
%
%    \subsection{Slice commands}
%
%  \DescribeMacro{\RubikSliceTopX}
%  \DescribeMacro{\RubikSliceEquatorX}
%  \DescribeMacro{\RubikSliceBottomX}
%  These three commands  allocate the six visible cubie colours associated with  a
%   \textit{horizontal}  slice of a Rubik cube. 
% There are three pairs of  Slice commands; one pair 
% (Left view \& Right view) for each of the horizontal  slices Top, Equator, Bottom.
% The six colour arguments  associated with a given slice run in sequence 
% from left to right irrespective of the viewpoint, eg \#1 \#2 \#3   \#4 \#5 \#6.
%
% Since the viewpoint of the Rubik cube (from the Right or from the Left) 
% influences which face the colours are associated with, it is necessary 
% to have the view (R or L) represented in the command name.
%
% The format of the `slice' command is shown in the following example.
% The Rubik  cube is shown from  the LeftDown (LD) view 
% and consequently  each of the `slice' commands in this
% particular example  ends in L, consistent with 
% the final \cmd{\DrawRubikCubeLD} command.
%
% \bigskip
%
% \begin{minipage}{2.8cm}
% \centering
% \begin{tikzpicture}[scale=0.7]
% \RubikFaceDownAll{Y}
% \RubikSliceTopL    {G}{G}{G} {R}{R}{R}
% \RubikSliceEquatorL{R}{R}{R} {B}{B}{B}
% \RubikSliceBottomL {O}{O}{O} {G}{G}{G}
% \DrawRubikCubeLD
% \end{tikzpicture}
% \end{minipage}
%    \hspace{5mm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
% \begin{tikzpicture}[scale=0.7]
%    \RubikFaceDownAll{Y}
%    \RubikSliceTopL     {G}{G}{G} {R}{R}{R}
%    \RubikSliceEquatorL {R}{R}{R} {B}{B}{B}
%    \RubikSliceBottomL  {O}{O}{O} {G}{G}{G}
%    \DrawRubikCubeLD
% \end{tikzpicture}
%\end{verbatim}
% \end{minipage}
%
%
%  \subsection{LayerFace \& LayerSide commands}
%  \label{sec:layerface}
%
%  These commands are mainly  intended  for drawing  final layer 
%  configurations (ie typically using the yellow face in the  \textsc{up} position)
%  with or without the associated side faces of the cubies of the top layer.
%
%  \subsubsection{LayerFace}
%
%  \DescribeMacro{\DrawRubikLayerFace}
%  This LayerFace command  draws a  simple  Rubik cube 3x3 face and allocates colours to the  9 cubies.
%  The command takes nine ordered colour arguments.
%  Their use is illustrated in the following example, which shows  a yellow cross configuration.
%  
%  \bigskip
%
%  \begin{minipage}{2.5cm}
%  \centering
%  \begin{tikzpicture}[scale=0.7]
%  \DrawRubikLayerFace{X}{Y}{X}
%                     {Y}{Y}{Y}
%                     {X}{Y}{X}
%  \end{tikzpicture}
%  \end{minipage}
%  \hspace{1cm}
%  \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
%  \begin{tikzpicture}[scale=0.7]
%     \DrawRubikLayerFace{X}{Y}{X}
%                        {Y}{Y}{Y}
%                        {X}{Y}{X}
%  \end{tikzpicture}
%\end{verbatim}
%  \end{minipage}
%
% \medskip
%
% \subsubsection{\cmd{\draw} error message}
%
% See also section~\ref{drawerrormessage} regarding the error message associated with 
% using a \cmd{\Draw...} command  \textit{outside}  a TikZ picture environment.
%
%  \medskip
%
%  \subsubsection{LayerSide}
% 
%  \DescribeMacro{\DrawLayerSideXYp}
%  LayerSide commands  draw the associated side colours  of  
%  the top layer   as  small rectangular sidebars.
%  The LayerSide commands  adopt a three-letter XYp \textbf{position} notation 
%   where the  XY pair define the location (X:[Left \verb!|! Middle \verb!|! Right]; 
%  Y:[Top \verb!|! Equator \verb!|! Bottom]) of a particular cubie in the layer face.
%
%  \begin{figure}[hbt]
%     \centering
%  \ifpdf
%     \includegraphics[height=3cm]{Rubik_doc_figD.pdf}
%  \else
%  \includegraphics[height=3cm]{Rubik_doc_figD.eps}
%  \fi
%  \vspace{-5mm}\caption{\label{fig:facenotation}LayerSide letter-codes } 
%  \end{figure}
% 
%  Since corner cubies have two side faces, the `p' parameter 
%  (p:[x\verb!|!y])  is required  to denote the directional `position' of 
%  the cubie side-face relative to the cubicle XY position
%  (x indicates adjacent along the x-axis, and  y indicates adjacent along the y-axis).
%  Since edge cubies have only one side face,  the `p' parameter is optional 
%  (for consistency), since it is not strictly  necessary.
%
%  \medskip\noindent\textbf{Commands}: \
%  Various different LayerSide commands are available: those for  
%  drawing a single colour side bar, and   others for facilitating  
%  drawing all 12 side bars.
%     For example, \textit{either} of the following commands 
%
%  \begin{quote}
%\begin{verbatim}
%  \DrawRubikLayerSideLE{G}
%  \DrawRubikLayerSideLEx{G}
%\end{verbatim}
%  \end{quote}
%  draws  a  single small vertical  green rectangle
%  \begin{tikzpicture}[scale=0.5]
%  \DrawRubikLayerSideLEx{G}
%  \end{tikzpicture}
%   just to the left of the Left Equator (LE) square of the 9-face.
%  The following commands draw all three side bars of a given side (Top, Bottom, Left, Right)
%  \begin{quote}
%\begin{verbatim}
%  \DrawRubikLayerSideT{}{}{}
%  \DrawRubikLayerSideB{}{}{}
%  \DrawRubikLayerSideL{}{}{}
%  \DrawRubikLayerSideR{}{}{}
%\end{verbatim}
%  \end{quote}
%  where the T and B forms require the colour parameters to be in left-right 
%  horizontal order (eg, left, middle, right),
%  while the L and R forms require the colour parameters to be in top-down 
%  vertical order (eg, top, equator, bottom).
%  Note that this means that the colour parameters of the  L and R commands 
%  can (if required) then be positioned intuitively (vertically) as follows:
%  \begin{quote}
%\begin{verbatim}
%  \DrawRubikLayerSideL{}
%                      {}
%                      {}
%\end{verbatim}
%  \end{quote}
%  Extending this idea, the L and R forms are combined in the LR command, 
%  which takes six colour arguments ordered in left-right pairs,
%  \begin{quote}
%\begin{verbatim}
%  \DrawRubikLayerSideLR{}{} {}{} {}{}
%\end{verbatim}
%  \end{quote}
%  so that they can also be written vertically as left-right pairs.
%  Use of these commands is shown in the following two examples.
%  
%  \bigskip
% 
%  \begin{minipage}{2.5cm}
%  \centering
%  \begin{tikzpicture}[scale=0.7]
%  
%  
%  \DrawRubikLayerFace{X}{Y}{X}
%                     {Y}{Y}{Y}
%                     {X}{Y}{X}
%  
%  \DrawRubikLayerSideLTy{B}
%  \DrawRubikLayerSideLTx{O}
%  \DrawRubikLayerSideLE{G}
%  \DrawRubikLayerSideR{O}
%                      {B}
%                      {R}
%  \DrawRubikLayerSideB{R}{G}{O}
%  \node (LT) at (0.5, 2.5)  [red]{\small\textsf{LT}};
%  \node (LE) at (0.5, 1.5)  [red]{\small\textsf{LE}};
%  \end{tikzpicture}
%  \end{minipage}
%      \hspace{1cm}
%  \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
%  \begin{tikzpicture}[scale=0.7]
%     \DrawRubikLayerFace{X}{Y}{X}
%                        {Y}{Y}{Y}
%                        {X}{Y}{X}
%     
%     \DrawRubikLayerSideLTy{B}
%     \DrawRubikLayerSideLTx{O}
%     \DrawRubikLayerSideLE{G}
%  
%     \DrawRubikLayerSideR{O}{B}{R}
%     \DrawRubikLayerSideB{R}{G}{O}
%  
%     \node (LT) at (0.5, 2.5) 
%                [red]{\small\textsf{LT}};
%     \node (LE) at (0.5, 1.5)  
%                [red]{\small\textsf{LE}};
%  \end{tikzpicture}
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%  
%  \begin{minipage}{2.5cm}
%  \centering
%  \begin{tikzpicture}[scale=0.7]
%  
%  \DrawRubikLayerFace{G}{Y}{R}
%                     {Y}{Y}{Y}
%                     {B}{Y}{Y}
%  
%  \DrawRubikLayerSideT {Y}{B}{B}
%  \DrawRubikLayerSideLR{R}   {Y}
%                       {R}   {O}
%                       {Y}   {O}
%  \DrawRubikLayerSideB {O}{G}{G}
%  
%  \end{tikzpicture}
%  \end{minipage}
%      \hspace{1cm}
%  \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
%  \begin{tikzpicture}[scale=0.7]
%     \DrawRubikLayerFace{G}{Y}{R}
%                        {Y}{Y}{Y}
%                        {B}{Y}{Y}
%     
%     \DrawRubikLayerSideT {Y}{B}{B}
%     \DrawRubikLayerSideLR{R}   {Y}
%                          {R}   {O}
%                          {Y}   {O}
%     \DrawRubikLayerSideB {O}{G}{G}  
%  \end{tikzpicture}
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%  
%  The default values (size) of the  sidebars are as follows:
%  width (0.3), length(1) and separation  from the square face (0.3). 
%  Note that the default value of the length of a cubie side is 1. 
%  These sidebar values (decimal values $\geq 0$; no units) can be 
%  changed from their default values using the three commands.
%  \begin{quote}
%  \cmd{\RubikSideBarWidth\{\}}\\
%  \cmd{\RubikSideBarLength\{\}}\\
%  \cmd{\RubikSideBarSep\{\}}
%  \end{quote}
%  Values set in the document preamble will apply globally, while values 
%  set within a TikZ picture environment will apply only locally to that 
%  particular environment, as shown in the following example where we have 
%  set both the sidebar width and length to 0.7.
%  
%  \bigskip
%
%  \begin{minipage}{2.5cm}
%  \centering
%  \begin{tikzpicture}[scale=0.7]
%  
%  
%  \DrawRubikLayerFace{X}{Y}{X}
%                     {Y}{Y}{Y}
%                     {X}{Y}{X}
%  
%  \RubikSideBarWidth{0.7}
%  \RubikSideBarLength{0.7}
%  \DrawRubikLayerSideMTy{G}
%  \end{tikzpicture}
%  \end{minipage}
%      \hspace{1cm}
%  \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
%  \begin{tikzpicture}[scale=0.7]
%     \DrawRubikLayerFace{X}{Y}{X}
%                        {Y}{Y}{Y}
%                        {X}{Y}{X}
%     \RubikSideBarWidth{0.7}
%     \RubikSideBarLength{0.7}
%     \DrawRubikLayerSideMTy{G}
%  \end{tikzpicture}
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%  
%  Note also that changing the  sidebar-width or sidebar-separation 
%  values may well also change the surrounding white-space (use \cmd{\fbox} 
%  to visualise this) and may therefore require some fine-tuning of the 
%  minipage width setting in order to optimise  appearance. 
% 
%  Since the \textsc{front} face  drawn using  the \cmd{\DrawRubikCube} command is 
%  identical with that drawn using the \cmd{\DrawLayerFace} command it 
%  follows that LayerSide commands can also be used in conjunction with 
%  the \textsc{front} face drawn using  \cmd{\DrawRubikCube} command, as 
%  shown in the following example.
%  
%  \bigskip
%  
%  \begin{minipage}{2.5cm}
%  \centering
%  \begin{tikzpicture}[scale=0.7]
%  \RubikFaceUp   {X}{W}{X}%
%                 {W}{W}{W}%
%                 {X}{W}{X}%
%  
%  \RubikFaceFront{O}{O}{X}%
%                 {O}{O}{X}%
%                 {X}{X}{W}%
%  
%  \RubikFaceRight{X}{G}{G}%
%                 {X}{G}{G}%
%                 {G}{X}{X}%
%  \DrawRubikCubeRU
%  
%  \DrawRubikLayerSideL{O}{B}{R}
%  \DrawRubikLayerSideB{R}{G}{O}
%  \end{tikzpicture}
%  \end{minipage}
%        \hspace{1cm}
%  \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
%  \begin{tikzpicture}[scale=0.7]
%     \RubikFaceUp   {X}{W}{X}%
%                    {W}{W}{W}%
%                    {X}{W}{X}%
%  
%     \RubikFaceFront{O}{O}{X}%
%                    {O}{O}{X}%
%                    {X}{X}{W}%
%  
%     \RubikFaceRight{X}{G}{G}%
%                    {X}{G}{G}%
%                    {G}{X}{X}%
%     \DrawRubikCubeRU
%  
%     \DrawRubikLayerSideL{O}{B}{R}
%     \DrawRubikLayerSideB{R}{G}{O}
%  \end{tikzpicture}
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%  
%  {\noindent}Note that since using a left or a right \cmd{\DrawRubikLayerSide}  
%  command in conjunction with a \cmd{\DrawRubikCube} command will necessarily 
%  increase the width of the image, one may also have to adjust the width of 
%  the associated minipage. 
%  
% 
%  \subsection{Flat commands}
%  \label{sec:flatcommands}
%  
%  \DescribeMacro{\DrawRubikFlat}
%  \DescribeMacro{\DrawRubikCubeFlat}
%  Flat commands are used to draw `flat' representations of the cube. 
%  The most  standard format, which is generated by the command \cmd{\DrawRubikFlat},
%  is  shown in the following example.
%  
%  \bigskip
%  
%  \begin{minipage}{0.4\textwidth}
%  \centering
%  \begin{tikzpicture}[scale=0.4]
%  \RubikCubeSolved
%
%  \DrawRubikFlat
%  \node (U) at (1.5, 4.5)   [black]{\small\textsf{U}};
%  \node (D) at (1.5, -1.5)  [black]{\small\textsf{D}};
%  \node (L) at (-1.5, 1.5)  [black]{\small\textsf{L}};
%  \node (R) at (4.5, 1.5)   [black]{\small\textsf{R}};
%  \node (F) at (1.5, 1.5)   [black]{\small\textsf{F}};
%  \node (B) at (7.5, 1.5)   [black]{\small\textsf{B}};
%  \end{tikzpicture}
%  \noindent\strut\hspace{5mm}\texttt{$\backslash$DrawRubikFlat}
%  \end{minipage}
%  \begin{minipage}{5cm}
%\begin{verbatim}
%  \begin{tikzpicture}[scale=0.4]
%     \RubikCubeSolved
%     \DrawRubikFlat
%  \end{tikzpicture}
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%  
%  The addition of  text (numbers or letters) in the faces is 
%  straightforward---the origin of the 1-unit grid is located at the 
%  bottom left corner of the front face (green here). 
%  The letters were placed using the following TikZ code:
%  
%\begin{verbatim}
%  \node (U) at (1.5, 4.5)   [black]{\small\textsf{U}};
%  \node (D) at (1.5, -1.5)  [black]{\small\textsf{D}};
%  \node (L) at (-1.5, 1.5)  [black]{\small\textsf{L}};
%  \node (R) at (4.5, 1.5)   [black]{\small\textsf{R}};
%  \node (F) at (1.5, 1.5)   [black]{\small\textsf{F}};
%  \node (B) at (7.5, 1.5)   [black]{\small\textsf{B}};
%\end{verbatim}
%  
%  {\noindent}An interesting `semi-flat' alternative format  uses the standard 
%  view of the cube  and  appends the three hidden sides 
%  (see Rokicki \textit{etal.}, 2013),  which is generated by the 
%  command \cmd{\DrawRubikCubeFlat} as follows.
%  
%  \bigskip
%
%  \begin{minipage}{5cm}
%  \begin{tikzpicture}[scale=0.5]
%  \RubikCubeSolved
%  \DrawRubikCubeFlat
%  \end{tikzpicture}
%  \end{minipage}
%  \begin{minipage}{5cm}
%\begin{verbatim}
%  \begin{tikzpicture}[scale=0.5]
%     \RubikCubeSolved
%     \DrawRubikCubeFlat
%  \end{tikzpicture}
%\end{verbatim}
%  \end{minipage}
%  
% \medskip
%
% \subsubsection{\cmd{\draw} error message}
%
% See also section~\ref{drawerrormessage} regarding the error message associated with 
% using a \cmd{\Draw...} command  \textit{outside}  a TikZ picture environment.
%
%  
%  \section[NCube]{NCube (NxNxN)}
%  \label{sec:NCube}
% 
%  \DescribeMacro{\DrawNCubeAll} 
%  An `NCube' is  a solved NxNxN cube drawn from the RU direction; 
%  (ie.~only shows faces \textsc{up}, \textsc{front}, \textsc{right}). 
%  The cubie colours of each face are All the same.
%  \begin{quote}
%    \cmd{\DrawNCubeAll\{N\}\{Xcolour\}\{Ycolour\}\{Zcolour\}}.
%  \end{quote}
%  This command takes four ordered parameters (N, X, Y, Z)---the number 
%  (integer; $N>0$) of cubies along an edge, followed by three face 
%  colours in XYZ order.
%  Since the viewpoint is only from the RU direction, the  three colour 
%  parameters are: X(Right), Y(Up), Z(Front).
%  
%  \bigskip
%  
%  \begin{minipage}{0.4\textwidth}
%  \begin{tikzpicture}[scale=0.5]
%     \DrawNCubeAll{5}{O}{Y}{G}
%  \end{tikzpicture}
%  \end{minipage}
%  \begin{minipage}{0.5\textwidth}
%\begin{verbatim}
%  \begin{tikzpicture}[scale=0.5]
%     \DrawNCubeAll{5}{O}{Y}{G}
%  \end{tikzpicture}
%\end{verbatim}
%  \end{minipage}
%
% \medskip
%
% \subsubsection{\cmd{\draw} error message}
%
% See also section~\ref{drawerrormessage} regarding the error message associated with 
% using a \cmd{\Draw...} command  \textit{outside}  a TikZ picture environment.
%  
%
%     \section{Arrows}
%     \label{sec:arrows}
%  
%  The \rubikcube\ package does not offer any special commands for drawing 
%  arrows since it is straightforward just to include the appropriate TikZ
%  `draw' commands in the \texttt{tikzpicture} environment. 
%  
%  In order to facilitate using the standard TikZ `draw' commands both 
%  the  RubikCubeFaceFront  and LayerFace commands have the coordinate origin 
%  at the bottom left corner, and draw `faces' consisting of 9~unit-squares 
%  in a  3x3 grid, as shown in  Figure~\ref{fig:facegraph}.
%  Consequently the start and finish coordinates for any arrow or line are 
%  easy to determine.
%  
%  \begin{figure}[hbt]
%     \centering
%  \ifpdf
%     \includegraphics[height=3cm]{Rubik_doc_figE.pdf}
%  \else
%  \includegraphics[height=3cm]{Rubik_doc_figE.eps}
%  \fi
%  \vspace{-5mm}\caption{\label{fig:facegraph}RubikCubeFaceFront and RubikLayerFace coordinates} 
%  \end{figure}
%  
%  Thus, to draw an `ultra thick' green  arrow  from the centre of cubie LB 
%  (say point A) to the centre of cubie ME 
%  (say point B)---see Figure~\ref{fig:facegraph}---we first determine 
%  the coordinates of $A$ \& $B$, namely  $A (0.5, 0.5)$,  $B (1.5, 1.5)$.  
%  Now, to draw the arrow from $A$ to $B$ we  just include  the following TikZ 
%  command in the \texttt{tikzpicture} environment.
%  \begin{quote}
%\begin{verbatim}
%  \draw[->,ultra thick,color=green] (0.5,0.5) -- (1.5, 1.5);
%\end{verbatim}
%  \end{quote}
%  The following example shows the  cubie changes in the \textsc{up} face 
%  generated by the rotation sequence \rrF\rrR\rrU\rrRp\rrUp\rrFp.
%  The magenta arrows indicate movement \textit{with} cubie rotations, 
%  while the black arrow indicates movement \textit{without} rotation.
%  
%  This example also highlights the fact that when there are several arrows, 
%  the start and end positions often need to be offset slightly away from cubie centres.
%  
%  \bigskip
%  \noindent
%  \begin{minipage}{2.5cm}
%  \centering
%  \begin{tikzpicture}[scale=0.7]
%  
%  \DrawRubikLayerFaceAll{W}
%  
%  \draw[->,thick,color=magenta] (1.5,0.5) -- (2.4, 1.4);
%  \draw[->,thick] (2.5,1.5) -- (1.6, 2.4);
%  \draw[->,thick,color=magenta] (1.3, 2.3) -- (1.3, 0.5);
%  \draw[<->,thick,color=magenta] (0.5,2.6) -- (2.5, 2.6);
%  \draw[<->,thick,color=magenta] (0.5,0.3) -- (2.5, 0.3);
%  \end{tikzpicture}
%  \end{minipage}
%  \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
%  \begin{tikzpicture}[scale=0.7]
%  \DrawRubikLayerFaceAll{W}
%  \draw[->,thick,color=magenta] (1.5,0.5) -- (2.4, 1.4);
%  \draw[->,thick] (2.5,1.5) -- (1.6, 2.4);
%  \draw[->,thick,color=magenta] (1.3, 2.3) -- (1.3, 0.5);
%  \draw[<->,thick,color=magenta] (0.5,2.6) -- (2.5, 2.6);
%  \draw[<->,thick,color=magenta] (0.5,0.3) -- (2.5, 0.3);
%  \end{tikzpicture}
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%  Since the coordinates shown in Figure~\ref{fig:facegraph} extend 
%  outwards in all directions, they can also be used as a guide for drawing 
%  arrows (or other structures) outside this 3x3 `face' square. This approach
%  is shown in the following example, where we have changed the TikZ scale 
%  to~0.4 in order to generate a small figure, and also  reduced the minipage
%  width to minimise  surrounding white-space, in order to facilitate placing the 
%  figure and the code side-by-side.
%  
%  \bigskip
%  
%  \noindent
%  \begin{minipage}{1.8cm}
%  \centering
%  \begin{tikzpicture}[scale=0.4]
%  
%  \DrawRubikLayerFace{G}{Y}{R}%
%                     {Y}{Y}{Y}%
%                     {B}{Y}{Y}%
%  
%  \DrawRubikLayerSideT {Y}{B}{B}
%  \DrawRubikLayerSideLR{R}   {Y}
%                       {R}   {O}
%                       {Y}   {O}
%  \DrawRubikLayerSideB {O}{G}{G}
%  
%  \draw[->,ultra thick,color=green] (0.5,5) -- (0.5, 4);
%  \end{tikzpicture}
%  \end{minipage}
%  \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
%  \begin{minipage}{1.8cm}
%  \centering
%  \begin{tikzpicture}[scale=0.4]
%     \DrawRubikLayerFace{G}{Y}{R}
%                        {Y}{Y}{Y}
%                        {B}{Y}{Y}
%     
%     \DrawRubikLayerSideT {Y}{B}{B}
%     \DrawRubikLayerSideLR{R}   {Y}
%                          {R}   {O}
%                          {Y}   {O}
%     \DrawRubikLayerSideB {O}{G}{G}  
%     \draw[->,ultra thick,color=green] (0.5,5) -- (0.5, 4);
%  \end{tikzpicture}
%  \end{minipage}
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%  
%  {\noindent}The following example shows an arrow on the Rubik cube. 
%  The origin of coordinates is at the bottom left corner of the 
%  \textsc{front} face (see Section~\ref{sec:coordinates}).
%  
%  \bigskip
%  \noindent
%  \begin{minipage}{2.8cm}
%  \centering
%  \begin{tikzpicture}[scale=0.7]
%  
%  \RubikFaceFront{O}{O}{O}
%                 {O}{O}{X}
%                 {X}{O}{X}
%  
%  \RubikFaceRight{G}{G}{G}
%                 {X}{G}{G}
%                 {X}{X}{X}
%  
%  \RubikFaceDown {X}{G}{X}
%                 {X}{Y}{X}
%                 {X}{X}{X}
%  
%  \DrawRubikCubeRD
%  \draw[ultra thick,->,color=blue] 
%            (1.5,0.5) -- (2.5, 1.5);
%  \end{tikzpicture}
%  \end{minipage}
%     \hspace{1cm}
%  \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
%    \begin{tikzpicture}[scale=0.7]
%  
%    \RubikFaceFront{O}{O}{O}
%                   {O}{O}{X}
%                   {X}{O}{X}
%  
%    \RubikFaceRight{G}{G}{G}
%                   {X}{G}{G}
%                   {X}{X}{X}
%  
%    \RubikFaceDown {X}{G}{X}
%                   {X}{Y}{X}
%                   {X}{X}{X}
%  
%    \DrawRubikCubeRD
%    \draw[ultra thick,->,color=blue] 
%                (1.5,0.5) -- (2.5, 1.5);  
%  \end{tikzpicture}
%\end{verbatim}
%  \end{minipage}
%  
%
%
% \section{Final example}
%
% We now present, as a final example, the code used to draw the  front page figure:
%
% \bigskip
% \hfil
% \begin{minipage}{2cm}
% \centering
% \begin{tikzpicture}[scale=0.4]
% \RubikCubeSolved
% \DrawRubikCubeRU
% \end{tikzpicture}
% \end{minipage}
% \begin{minipage}{2cm}
% \centering
% \begin{tikzpicture}[scale=0.4]
% \DrawRubikLayerFaceAll{W}
% \DrawRubikLayerSideT {R}{R}{R}
% \DrawRubikLayerSideLR{B}   {G}
%                      {B}   {G}
%                      {B}   {G}
% \DrawRubikLayerSideB {O}{O}{O}
% \draw[thick,->,color=magenta] (1.5,0.5) -- (2.4, 1.4);
% \draw[thick,->] (2.5,1.5) -- (1.6, 2.4);
% \draw[thick,->,color=magenta] (1.3, 2.3) -- (1.3, 0.5);
% \draw[thick,<->,  color=blue] (0.5,2.6) -- (2.5, 2.6);
% \draw[thick,<->,  color=blue] (0.5,0.3) -- (2.5, 0.3);
% \end{tikzpicture}
% \end{minipage}
% \RubikF\RubikR\RubikU\RubikRp\RubikUp\RubikFp\
% \ \ $\longrightarrow$
% \begin{minipage}{2cm}
% \centering
% \begin{tikzpicture}[scale=0.4]
% \DrawRubikLayerFace{W}{W}{B}
%                    {W}{W}{O}
%                    {W}{R}{B}
% \DrawRubikLayerSideT {G}{G}{R}
% \DrawRubikLayerSideLR{R}   {W}
%                      {B}   {W}
%                      {O}   {W}
% \DrawRubikLayerSideB {G}{W}{O}
% \end{tikzpicture}
% \end{minipage}
% \hfil
%
% \bigskip
%
%\begin{verbatim}
% \hfil
% \begin{minipage}{2cm}
%   \centering
%   \begin{tikzpicture}[scale=0.4]
%     \RubikCubeSolved
%     \DrawRubikCubeRU
%   \end{tikzpicture}
% \end{minipage}
% \begin{minipage}{2cm}
%   \centering
%   \begin{tikzpicture}[scale=0.4]
%     \DrawRubikLayerFaceAll{W}
%     \DrawRubikLayerSideT {R}{R}{R}
%     \DrawRubikLayerSideLR{B}   {G}
%                          {B}   {G}
%                          {B}   {G}
%     \DrawRubikLayerSideB {O}{O}{O}
%     \draw[thick,->,color=magenta] (1.5,0.5) -- (2.4, 1.4);
%     \draw[thick,->] (2.5,1.5) -- (1.6, 2.4);
%     \draw[thick,->,color=magenta] (1.3, 2.3) -- (1.3, 0.5);
%     \draw[thick,<->,  color=blue] (0.5,2.6) -- (2.5, 2.6);
%     \draw[thick,<->,  color=blue] (0.5,0.3) -- (2.5, 0.3);
%   \end{tikzpicture}
% \end{minipage}
% \RubikF\RubikR\RubikU\RubikRp\RubikUp\RubikFp\
% \ \ $\longrightarrow$
% \begin{minipage}{2cm}
%   \centering
%   \begin{tikzpicture}[scale=0.4]
%     \DrawRubikLayerFace{W}{W}{B}
%                        {W}{W}{O}
%                        {W}{R}{B}
%     \DrawRubikLayerSideT {G}{G}{R}
%     \DrawRubikLayerSideLR{R}   {W}
%                          {B}   {W}
%                          {O}   {W}
%     \DrawRubikLayerSideB {G}{W}{O}
%   \end{tikzpicture}
% \end{minipage}
% \hfil
%\end{verbatim}
%
%
%  \section{Known issues \& shortcomings}
%
% Please contact the authors regarding any errors, shortcomings and ideas etc. 
%
% \begin{itemize} 
%  
%  \item  The rotation hieroglyphs are optimised for a 10pt font, and  do 
%    not scale  with document  font size. This may be implemented in the future, 
%   and will require careful mapping of the  TikZ scale factor  to font point 
%   size, or just replacing all length parameters by a multiple of \cmd{\em} or \cmd{\en} etc.
%   At the moment it seems to work reasonably well with both 11pt and 12pt fonts.
%
%  \item The sidebars can only be drawn in relation to  either a Front face of a 
%     cube, or a  LayerFace. 
%
%  \item The \textsc{front} face  as drawn using the  \cmd{\DrawNCubeAll} macro  does 
%    not have its origin at the bottom left corner. Not regarded as a significant 
%   problem since this macros is really just a cosmetic fix/tool for drawing a 
%   neat NxNxN cube. 
% 
% \end{itemize}
%
%
%  \section{Acknowledgements}
%  
%  We would like to thank Peter Bartal and  Peter Grill for useful ideas and  
% suggestions.   We have built on some of the initial 
%  ideas of Bartal (2011), and have cited these instances in the code documentation. 
%  
%
%
%   \section{Future supporting packages}
%  
%  Since  Rubik-type cubes currently exist in  a variety of sizes (from 2x2x2 to 11x11x11)
%  it is possible that similar packages dealing with cubes of other sizes may be made in 
%  the future.  Supporting tools  may also be  made
%  using various programming languages, eg Lua etc. Consequently  the naming of such 
%  packages and tools, and even the associated CTAN directories, needs to be given 
%  some thought in order to prevent possible confusion.
%  We suggest, therefore, the following directory structure  for CTAN might be  appropriate.
%  
%  $$
%  \textsc{rubik}  \left\{
%    \begin{array}{l} 
%    \mbox{rubiktools}\\
%    \mbox{rubik2x}\\
%    \mbox{rubik3x}\\
%    \ldots\\
%    \mbox{rubik11x}\\
%    \end{array}
%         \right.\\
%  $$
%
%    \section{References}
%  
%  
%  \begin{itemize}
%  
%  
%  \item  Bartal P (2011)
%  
%  \url{http://tex.stackexchange.com/questions/34482/}
%  
%  \item Chen JJ (2004). Group theory and the Rubik's cube.
%  \url{http://www.math.harvard.edu/~jjchen/docs/Group_Theory_and_the_Rubik's_Cube.pdf}
%  
%  \item Demaine ED, Demaine ML, Eisenstat S, Lubiw A and Winslow A (2011).
%  Algorithms for solving Rubik's cubes.
%  \url{http://www.arxiv.org/abs/1106.5736/}
%  
%  \item Garfath-Cox, A (1981). \textit{The cube},  (Bolden Publishing Co., 
%       East Molesey, Surrey) pp.32.  [copy in British Library]
%  
%  
%  \item Duvoid T (2010).
%  M\'{e}thode simple pour remonter le Rubik's cube. 
%  \newline\url{http://duvoid.fr/rubik/rubik-debutant-couleurs.pdf}
%  \newline\url{http://duvoid.fr/rubik/sources/notation_en.eps}
%  \newline\url{http://duvoid.fr/rubik/sources/rubik-debutant-couleurs.tex}
%  
%  \item Duvoid T (2011).
%  M\'{e}thode avanc\'{e}e  pour remonter le Rubik's cube. 
%  \newline\url{http://duvoid.fr/rubik/rubik-friddrich-couleurs.pdf}
%  \newline\url{http://duvoid.fr/rubik/sources/rubik-friddrich-couleurs.tex}
%  
%  \item Fridrich J. \ \  \url{http://www.ws.binghamton.edu/fridrich/}.  
%  See the useful `notation' section  on the `Pretty patterns' webpage at 
%  \url{http://www.ws.binghamton.edu/fridrich/ptrns.html}.
%
% \item Golomb SW (1982). Rubik's cube and quarks. \textit{American Scientist}; 
%    \underline{70}, pp.~257--259.

%  
%  \item Gymrek M (2009). The mathematics of toys and games.
%  \newline\url{http://wen.mit.edu/sp.268/www/rubik.pdf}
%  
%  \item Hofstadter D (1981). Rubik cube. \textit{Scientific American}; March issue.
%  
%  \item Hutchings M (2011). The mathematics of Rubik's cube (slide presentation). 
%        \url{http://math.berkeley.edu/~hutching/}
%
%
% \item Jelinek website (Jelinek J). Rubik's cube solution method. \url{http://rubikscube.info/}    
%  
%  \item Joyner D (2008). \textit{Adventures in group theory: 
%       Rubik's cube, Merlin's machine and other mathematical toys}.
%  \url{http://mike.verdone.ca/media/rubiks.pdf}
%  
%  
%  \item Kriz J and Siegel P (2008). Rubik's cube-inspired puzzles demonstrate math's simple groups.
%  \textit{Scientific American}; [? July 2008] 
%  
%  
%  \item Learntofish (2010). 
%   \url{http://learntofish.wordpress.com/2010/10/08/20-moves-suffice-to-solve-the-rubiks-cube/}
%
%  \item Randelhofer website (Randelhofer W).  Pretty patterns. 
%  \url{http://www.randelhofer.ch/rubik/patterns/U080.01.html}
%
%   \item Reid M. \ \  \url{http://www.math.ucf.edu/~reid/Rubik/}
%
%  
%  \item Rokicki T, Kociemba H, Davidson M and Dethridge J (2013). The diameter of the 
%       Rubik's cube is twenty.  \textit{SIAM.\ J.\ Discrete Math.}, \underline{27}, 1082--1105.
%  (\url{http://tomas.rokicki.com/rubik20.pdf})
%
%  \item Rubik's cube. See Section on notation. 
%  \newline\url{http://en.wikipedia.org/wiki/Rubik's_Cube}
%  
%  \item Speedsolving website. \url{www.speedsolving.com/}
%  
%  \item Tran R (2005). A mathematical approach to solving Rubik's cube.
%  \url{http://www.math.ubc.ca/~cass/courses/m308/projects/rtran/rtran.pdf}
%  
%
%  \item Treep A and  Waterman M (1987). Marc Waterman's Algorithm, Part 2. 
%    \textit{Cubism For Fun 15}, p.~10 (Nederlandse Kubus Club)
%    [cited from \textit{Wikipedia} (Rubik's cube)]

%  
%  \item Vandenbergh L. \ \ \textsc{cubezone} (\url{http://www.cubezone.be}).
%  
%  \item WCA (2012). World Cube Association Regulations. See Section~12 for notation.
%   \url{http://www.worldcubeassociation.org/regulations.htm}
%  
%  
%  \end{itemize}
%  
%
%
% ^^A ==================================================
% \StopEventually{\PrintIndex}
%
%
%
% \section{The code} 
%  
%  The conventions  we adopt regarding  capital letters and the 
%  XYZ argument ordering are detailed in  Section~\ref{sec:conventions}.
%
%
%   \subsection{    Package heading}
%
%    \begin{macrocode}
%<*rubikcube>
\def\RCfileversion{2.0}%
\def\RCfiledate{2014/01/20}%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rubikcube}[\RCfiledate\space (v\RCfileversion)]
%    \end{macrocode}
%  The package requires TikZ
%    \begin{macrocode}
\@ifpackageloaded{tikz}{}{%
  \typeout{---rubikcube requires the TikZ package.}%
  \RequirePackage{tikz}}%
%    \end{macrocode}
%
%    \begin{macro}{\rubikcube}
%  First we create a suitable logo
%    \begin{macrocode}
\newcommand{\rubikcube}{\textsf{rubikcube}}%
%    \end{macrocode}
%    \end{macro}
%
%
%   \subsection{    Some useful internal commands}
%
%  \begin{macro}{\@rr} 
%  \begin{macro}{\@rrp}
%  \begin{macro}{\@rrw} 
%  \begin{macro}{\@rrwp} 
%  \begin{macro}{\@rrs} 
%  \begin{macro}{\@rrsp}
%  \begin{macro}{\@rra} 
%  \begin{macro}{\@rrap} 
%  \begin{macro}{\@xyzh} 
%  \begin{macro}{\@xyzhp} 
%  \begin{macro}{\@xyzRubik} 
%  \begin{macro}{\@xyzRubikp} 
%  \begin{macro}{\@SquareLetter} 
%  \begin{macro}{\@hRubik} 
% Internal commands. These  are used to generate the
% prime, w, w-prime, s, s-prime, a, a-prime   
% rotation commands. The \cmd{\@xyz..} commands are used to generate the 
% x,y,z,u,d,l,r,f,b, and their prime rotation commands.
% The \cmd{\@SquareLetter} command is used to form the separate square hieroglyph  form
% used for rotations with no \textsc{front} representation 
% (eg B.., Fs, Fsp, Fa, Fap, S, Sp, Sf, Sfp, Sb, Sbp).
% The \cmd{\@hRubik} is the vertical shift  used  to raise the box carying the rotation 
% letter-code in \cmd{\Rubik..} commands not visible from the front.
%
%  The idea is that by using these internal
% tools we will be able to more easily standardise the  size and position 
% of all the various glyphs. However, these internal tools are currently 
% only partially implemented (= work in progress).
% \begin{macrocode}
\newcommand{\@rr}[1]{\textbf{\textsf{#1}}}
\newcommand{\@rrp}[1]{\textbf{\textsf{#1}$^\prime$}}
\newcommand{\@rrw}[1]{\textbf{\textsf{#1\footnotesize{w}}}}
\newcommand{\@rrwp}[1]{\textbf{\textsf{#1\footnotesize{w}}$^\prime$}}
\newcommand{\@rrs}[1]{\textbf{\textsf{#1\footnotesize{s}}}}
\newcommand{\@rrsp}[1]{\textbf{\textsf{#1\footnotesize{s}}$^\prime$}}
\newcommand{\@rra}[1]{\textbf{\textsf{#1\footnotesize{a}}}}
\newcommand{\@rrap}[1]{\textbf{\textsf{#1\footnotesize{a}}$^\prime$}}
\newcommand{\@xyzh}[1]{\textbf{[\textsf{#1}]}\,}
\newcommand{\@xyzhp}[1]{\textbf{[\textsf{#1}$^\prime$]}\,}
\newcommand{\@xyzRubik}[1]{\raisebox{3.45pt}{\textbf{[\textsf{#1}]}}}
\newcommand{\@xyzRubikp}[1]{\raisebox{3.45pt}{\textbf{[\textsf{#1}$^\prime$]}}}
\newcommand{\@SquareLetter}[1]{\setlength\fboxsep{2.5pt}\fboxrule=0.8pt%
   \fbox{\rule[-1pt]{0pt}{8.5pt}\raisebox{-0.5pt}{#1}}}
\newlength\@hRubik%
\setlength{\@hRubik}{0.185cm}%
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%
%   \subsection{    Colours}
%
%  These colour allocations were initially defined by Peter Bartal (2011).
%  Now modified so that grey is defined as {black!30}.
%
%    \begin{macrocode}
\definecolor{R}{HTML}{C41E33}%
\definecolor{G}{HTML}{00BE38}%
\definecolor{B}{HTML}{0051BA}%
\definecolor{Y}{HTML}{FFFF00}%
\colorlet{X}{black!30}% grey
\colorlet{O}{orange}%
\colorlet{W}{white}%
%    \end{macrocode}
%
%  \subsection{    Face commands}
%
% Cubeface notation = U,D,L,R,F,B (Singmaster)
% {\newline}Cubiesquare notation = t,b,l,r = top,bottom,left,right.
% Need to use t,b for cubiesquares to avoid confusion with cubeFace notation.
% Number the cubiesquares on a face 1-9, starting topleft, ending bottom right, as follows: 
% {\newline}\strut\hspace{1cm}Up row \ \ \ \ \ (1,2,3) = tl, tm, tr
% {\newline}\strut\hspace{1cm}middle row (4,5,6) = ml, mm, mr
% {\newline}\strut\hspace{1cm}bottom row (7,8,9) = bl, bm, br
%
%  \begin{macro}{\RubikFaceUp} 
%  \begin{macro}{\RubikFaceDown} 
%  \begin{macro}{\RubikFaceLeft} 
%  \begin{macro}{\RubikFaceRight} 
%  \begin{macro}{\RubikFaceFront}  
%  \begin{macro}{\RubikFaceBack}  
% These 5 commands allocate a colour to each of the 9 cubiesquares in the 
% specified face (Up, Down, Left, Right, Front, Back).  Each command takes 9 arguments 
% (colour codes) in the order 1--9 as specified above. 
%
% {\noindent}For example, \cmd{\RubikFaceUp\{R\}\{O\}\{Y\} \{G\}\{B\}\{W\} \{X\}\{R\}\{G\}}
%
%
% {\noindent}Each of the 9 \cmd{\def\{\}} commands below allocates one colour 
% to a specific cubiesquare, using a simple three-letter encoding. 
% Each letter is an initial letter of the words Up, Down, Left, Right, Front, Back, 
% left, middle, right, top, middle, bottom. 
% For example in the command \cmd{\Urt\{\#1\}} 
% the U stands for the Up face of the cube, while the \texttt{rt} stands 
% for the ``right-top'' cubiesquare on this face. Note that the order 
% of the two lowercase letters (in this case \texttt{rt}) are written 
% in the $x,y$ order; ie the first of the two lowercase letters relates to the $x$ 
% direction (either left, middle, or right), while the second  lowercase letter 
% relates to the $y$  direction (either top, middle, or bottom)
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro} 
%  \end{macro}
%  \end{macro}
%    \begin{macrocode}
\newcommand{\RubikFaceUp}[9]{%
\def\Ult{#1}\def\Umt{#2}\def\Urt{#3}% 
\def\Ulm{#4}\def\Umm{#5}\def\Urm{#6}%
\def\Ulb{#7}\def\Umb{#8}\def\Urb{#9}%
}   
\newcommand{\RubikFaceFront}[9]{%
\def\Flt{#1}\def\Fmt{#2}\def\Frt{#3}% 
\def\Flm{#4}\def\Fmm{#5}\def\Frm{#6}%
\def\Flb{#7}\def\Fmb{#8}\def\Frb{#9}%
}
\newcommand{\RubikFaceRight}[9]{%
\def\Rlt{#1}\def\Rmt{#2}\def\Rrt{#3}% 
\def\Rlm{#4}\def\Rmm{#5}\def\Rrm{#6}%
\def\Rlb{#7}\def\Rmb{#8}\def\Rrb{#9}%
}
\newcommand{\RubikFaceDown}[9]{%
\def\Dlt{#1}\def\Dmt{#2}\def\Drt{#3}% 
\def\Dlm{#4}\def\Dmm{#5}\def\Drm{#6}%
\def\Dlb{#7}\def\Dmb{#8}\def\Drb{#9}%
}
\newcommand{\RubikFaceLeft}[9]{%
\def\Llt{#1}\def\Lmt{#2}\def\Lrt{#3}% 
\def\Llm{#4}\def\Lmm{#5}\def\Lrm{#6}%
\def\Llb{#7}\def\Lmb{#8}\def\Lrb{#9}%
}
\newcommand{\RubikFaceBack}[9]{%
\def\Blt{#1}\def\Bmt{#2}\def\Brt{#3}% 
\def\Blm{#4}\def\Bmm{#5}\def\Brm{#6}%
\def\Blb{#7}\def\Bmb{#8}\def\Brb{#9}%
}
%    \end{macrocode}
%
%  \begin{macro}{\RubikFaceUpAll} 
%  \begin{macro}{\RubikFaceDownAll} 
%  \begin{macro}{\RubikFaceLeftAll} 
%  \begin{macro}{\RubikFaceRightAll} 
%  \begin{macro}{\RubikFaceFrontAll}  
%  \begin{macro}{\RubikFaceBackAll}  
% These 5 commands allocate the same colour to all 9 cubiesquares in the specified face (Up, Down, Left, Right, Front).  Each command therefore  takes only  1 argument (one of the colour codes).
%
% {\noindent}For example, \cmd{\RubikFaceUpAll\{R\}}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro} 
%  \end{macro}
%  \end{macro}
%    \begin{macrocode}
\newcommand{\RubikFaceUpAll}[1]{%
\def\Ult{#1}\def\Umt{#1}\def\Urt{#1}% 
\def\Ulm{#1}\def\Umm{#1}\def\Urm{#1}%
\def\Ulb{#1}\def\Umb{#1}\def\Urb{#1}%
}
\newcommand{\RubikFaceFrontAll}[1]{%
\def\Flt{#1}\def\Fmt{#1}\def\Frt{#1}% 
\def\Flm{#1}\def\Fmm{#1}\def\Frm{#1}%
\def\Flb{#1}\def\Fmb{#1}\def\Frb{#1}%
}
\newcommand{\RubikFaceRightAll}[1]{%
\def\Rlt{#1}\def\Rmt{#1}\def\Rrt{#1}% 
\def\Rlm{#1}\def\Rmm{#1}\def\Rrm{#1}%
\def\Rlb{#1}\def\Rmb{#1}\def\Rrb{#1}%
}
\newcommand{\RubikFaceLeftAll}[1]{%
\def\Llt{#1}\def\Lmt{#1}\def\Lrt{#1}% 
\def\Llm{#1}\def\Lmm{#1}\def\Lrm{#1}%
\def\Llb{#1}\def\Lmb{#1}\def\Lrb{#1}%
}
\newcommand{\RubikFaceDownAll}[1]{%
\def\Dlt{#1}\def\Dmt{#1}\def\Drt{#1}% 
\def\Dlm{#1}\def\Dmm{#1}\def\Drm{#1}%
\def\Dlb{#1}\def\Dmb{#1}\def\Drb{#1}%
}
\newcommand{\RubikFaceBackAll}[1]{%
\def\Blt{#1}\def\Bmt{#1}\def\Brt{#1}% 
\def\Blm{#1}\def\Bmm{#1}\def\Brm{#1}%
\def\Blb{#1}\def\Bmb{#1}\def\Brb{#1}%
}
%    \end{macrocode}
%
% {\noindent}We now use these commands to initialise all visible faces to  default colour grey (X)
%
% \begin{macrocode}
\RubikFaceUpAll{X}%
\RubikFaceDownAll{X}%
\RubikFaceLeftAll{X}%
\RubikFaceRightAll{X}%
\RubikFaceFrontAll{X}%
\RubikFaceBackAll{X}%
%    \end{macrocode}
%
%
%   \subsection{  RubikCubeSolved command}
%
%    \begin{macro}{\RubikCubeSolved}
% This command sets the face/colour configuration (state) of a  typical 
% solved Rubik cube. 
%    \begin{macrocode}
\newcommand{\RubikCubeSolved}{%
  \RubikFaceUpAll{W}%
  \RubikFaceDownAll{Y}%
  \RubikFaceLeftAll{B}%
  \RubikFaceRightAll{G}%
  \RubikFaceFrontAll{O}%
  \RubikFaceBackAll{R}%
}
%    \end{macrocode}
%    \end{macro}
%
%
% \subsection{    Slice macros}
%
% \begin{macro}{\RubikSliceTopR} 
% \begin{macro}{\RubikSliceTopL} 
% \begin{macro}{\RubikSliceEquatorR} 
% \begin{macro}{\RubikSliceEquatorL} 
% \begin{macro}{\RubikSliceBottomR} 
% \begin{macro}{\RubikSliceBottomL} 
% These 6 commands allocate colours for the 6 visible ordered 
% cubiesquares along the side  of  a horizontal slice  
% ordered 1--6 from left to right. We require  both  L view  
% and R view versions.
%    \begin{macrocode}
\newcommand{\RubikSliceTopR}[6]{% 
\def\Flt{#1}\def\Fmt{#2}\def\Frt{#3}% 
\def\Rlt{#4}\def\Rmt{#5}\def\Rrt{#6}%
} 
\newcommand{\RubikSliceTopL}[6]{% 
\def\Llt{#1}\def\Lmt{#2}\def\Lrt{#3}% 
\def\Flt{#4}\def\Fmt{#5}\def\Frt{#6}%
} 
\newcommand{\RubikSliceEquatorR}[6]{% 
\def\Flm{#1}\def\Fmm{#2}\def\Frm{#3}%
\def\Rlm{#4}\def\Rmm{#5}\def\Rrm{#6}%
} 
\newcommand{\RubikSliceEquatorL}[6]{% 
\def\Llm{#1}\def\Lmm{#2}\def\Lrm{#3}%
\def\Flm{#4}\def\Fmm{#5}\def\Frm{#6}%
} 
\newcommand{\RubikSliceBottomR}[6]{% 
\def\Flb{#1}\def\Fmb{#2}\def\Frb{#3}%
\def\Rlb{#4}\def\Rmb{#5}\def\Rrb{#6}%
} 
\newcommand{\RubikSliceBottomL}[6]{% 
\def\Llb{#1}\def\Lmb{#2}\def\Lrb{#3}%
\def\Flb{#4}\def\Fmb{#5}\def\Frb{#6}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
%      \subsection{    Cube drawing macros}
%
% Since the three visible sides of a Rubik cube have up to  27  non-grey colours, 
% and \TeX\ has only 9 macro  parameters available, we are forced to draw 
% Rubik cubes  by first specifying the colours on each of the three faces, 
% and then  using a `DrawRubikCubeXY' command, where the trailing XY code
%  defines the  view direction (X = either R, L; Y = either U, D). 
% The order of the XY code is important: X first, Y second.
%
% On each face the cubies are drawn in the following order: Top row 
% (left to right), Middle row (left to right), Bottom row (left to right).
%
% The TikZ  draw cycle for each cubie square on a Rubik cube face cycles 
% through the  four corners of the cubie in the following order: 
% lb $\rightarrow$ lt $\rightarrow$ rt $\rightarrow$ rb;  the code being lb (LeftBottom), 
% lt (LeftTop), rt (RightTop), rb (RightBottom)
% (only need four coords) origin at bottom left of front face.
%
%  \begin{macro}{\DrawRubikCubeFrontFace}
% This `FrontFace' command  is an `internal' command  which draws and paints 
% all the cubiesquares on the front face of a cube.  It is used by all 
% of the  cube drawing macros which display the front face. 
% The 9 colours are allocated by an earlier \cmd{\RubikFaceFront} command.
% These Face macros are based, in part, on those of Peter Bartal (2011).
%    \begin{macrocode}
\newcommand{\DrawRubikCubeFrontFace}{%
%  ---top row left to right
\draw[line join=round,line cap=round,ultra thick,fill=\Flt]%
(0,2) -- (0, 3) -- (1,3) -- (1,2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Fmt]%
(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Frt]%
(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle;
% -----middle row left to right
\draw[line join=round,line cap=round,ultra thick,fill=\Flm]%
(0,1) -- (0, 2) -- (1,2) -- (1,1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Fmm]%
(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Frm]%
(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle;
% ----bottom row left to right
\draw[line join=round,line cap=round,ultra thick,fill=\Flb]%
(0,0) -- (0, 1) -- (1,1) -- (1,0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Fmb]%
(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Frb]%
(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle;
}
%    \end{macrocode}
% \end{macro}
%
%      \subsubsection{    Viewing direction}
%
%  The command  `DrawRubikCubeXY' command uses a trailing XY code
%  to specify  the  view direction (X = either R, L; Y = either U, D). 
%  The order of the XY code is important: X first, Y second (so its easy
%  to remember).
%
%  \begin{macro}{\DrawRubikCubeRU}
% This command draws and paints a Rubik cube  as viewed from 
% the Right Upper (RU) viewpoint. It starts by using the internal 
% command \cmd{\DrawRubikCubeFrontFace} to draw the Front face, 
% and then draws the Up face  followed by the Right face.
% The colours are allocated by  the last \cmd{\RubikFaceUp}
% and \cmd{\RubikFaceRight}  commands. 
%    \end{macro}
%    \begin{macrocode}
\newcommand{\DrawRubikCubeRU}{%
\DrawRubikCubeFrontFace %% frontface
%%-----------Up face----------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Ult]%
(0.66,3.66) -- (1,4) -- (2,4) -- (1.66,3.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umt]%
(1.66,3.66) -- (2,4) -- (3,4) -- (2.66,3.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urt]%
(2.66,3.66) -- (3,4) -- (4,4) -- (3.66,3.66)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Ulm]%
(0.33,3.33) -- (0.66,3.66) -- (1.66,3.66) -- (1.33,3.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umm]%
(1.33,3.33) -- (1.66,3.66) -- (2.66,3.66) -- (2.33,3.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urm]%
(2.33,3.33) -- (2.66,3.66) -- (3.66,3.66) -- (3.33,3.33)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]%
(0,3) -- (0.33,3.33) -- (1.33,3.33) -- (1,3)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umb]%
(1,3) -- (1.33,3.33) -- (2.33,3.33) -- (2,3)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urb]%
(2,3) -- (2.33,3.33) -- (3.33,3.33) -- (3,3)  -- cycle;
%%-----------Right face----------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]%
(3,2) -- (3, 3) -- (3.33,3.33) -- (3.33,2.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmt]%
(3.33,2.33) -- (3.33, 3.33) -- (3.66,3.66) -- (3.66,2.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]%
(3.66,2.66) -- (3.66, 3.66) -- (4,4) -- (4,3)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlm]%
(3,1) -- (3, 2) -- (3.33,2.33) -- (3.33,1.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmm]%
(3.33,1.33) -- (3.33, 2.33) -- (3.66,2.66) -- (3.66,1.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrm]%
(3.66,1.66) -- (3.66, 2.66) -- (4,3) -- (4,2)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]%
(3,0) -- (3, 1) -- (3.33,1.33) -- (3.33,0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmb]%
(3.33,0.33) -- (3.33, 1.33) -- (3.66,1.66) -- (3.66,0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]%
(3.66,0.66) -- (3.66, 1.66) -- (4,2) -- (4,1)  -- cycle;
}
%    \end{macrocode}
%
% \begin{macro}{\DrawRubikCube}
% This command  is equivalent to the previous \cmd{\DrawRubikCubeRU}
% and hence is the default form (ie if one omits the trailing XY 
% viewpoint code).
% \end{macro}
%    \begin{macrocode}
\newcommand{\DrawRubikCube}{\DrawRubikCubeRU}
%    \end{macrocode}
%
%
% \begin{macro}{\DrawRubikCubeRD}
% This command draws and paints a Rubik cube  as viewed from 
% the Right Down (RD) viewpoint.
% \end{macro}
%    \begin{macrocode}
\newcommand{\DrawRubikCubeRD}{%
\DrawRubikCubeFrontFace %% frontface
%%----------Right face--------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]%
(3,2) -- (3, 3) -- (3.33,2.66) -- (3.33,1.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmt]%
(3.33,1.66) -- (3.33, 2.66) -- (3.66,2.33) -- (3.66,1.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]%
(3.66,1.33) -- (3.66, 2.33) -- (4,2) -- (4,1)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlm]%
(3,1) -- (3, 2) -- (3.33,1.66) -- (3.33,0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmm]%
(3.33,0.66) -- (3.33, 1.66) -- (3.66,1.33) -- (3.66,0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrm]%
(3.66,0.33) -- (3.66, 1.33) -- (4,1) -- (4,0)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]%
(3,0) -- (3, 1) -- (3.33,0.66) -- (3.33,-0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmb]%
(3.33,-0.33) -- (3.33, 0.66) -- (3.66,0.33) -- (3.66,-0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]%
(3.66,-0.66) -- (3.66, 0.33) -- (4,0) -- (4,-1)  -- cycle;
%%-----------Down face---------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]%
(0.33,-0.33) -- (0, 0) -- (1,0) -- (1.33,-0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmt]%
(1.33,-0.33) -- (1, 0) -- (2,0) -- (2.33,-0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drt]%
(2.33,-0.33) -- (2, 0) -- (3,0) -- (3.33,-0.33)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlm]%
(0.66,-0.66) -- (0.33, -0.33) -- (1.33,-0.33) -- (1.66,-0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmm]%
(1.66,-0.66) -- (1.33, -0.33) -- (2.33,-0.33) -- (2.66,-0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drm]%
(2.66,-0.66) -- (2.33, -0.33) -- (3.33,-0.33) -- (3.66,-0.66)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]%
(1,-1) -- (0.66, -0.66) -- (1.66,-0.66) -- (2,-1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmb]%
(2,-1) -- (1.66, -0.66) -- (2.66,-0.66) -- (3,-1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drb]%
(3,-1) -- (2.66, -0.66) -- (3.66,-0.66) -- (4,-1)  -- cycle;
}
%    \end{macrocode}
%
% \begin{macro}{\DrawRubikCubeLD}
% This command draws and paints a Rubik cube  as viewed from 
% the Left Down (LD) viewpoint.
% \end{macro}
%    \begin{macrocode}
\newcommand{\DrawRubikCubeLD}{%
\DrawRubikCubeFrontFace %% frontface
%%------------Left face--------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Llt]%
(-1,1) -- (-1, 2) -- (-0.66,2.33) -- (-0.66,1.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmt]%
(-0.66,1.33) -- (-0.66, 2.33) -- (-0.33,2.66) -- (-0.33,1.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]%
(-0.33,1.66) -- (-0.33, 2.66) -- (0,3) -- (0,2)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Llm]%
(-1,0) -- (-1, 1) -- (-0.66,1.33) -- (-0.66,0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmm]%
(-0.66,0.33) -- (-0.66, 1.33) -- (-0.33,1.66) -- (-0.33,0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrm]%
(-0.33,0.66) -- (-0.33, 1.66) -- (0,2) -- (0,1)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Llb]%
(-1,-1) -- (-1, 0) -- (-0.66,0.33) -- (-0.66,-0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmb]%
(-0.66,-0.66) -- (-0.66, 0.33) -- (-0.33,0.66) -- (-0.33,-0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]%
(-0.33,-0.33) -- (-0.33, 0.66) -- (0,1) -- (0,0)  -- cycle;
%%------------Down face----------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]%
(-0.33,-0.33) -- (0, 0) -- (1,0) -- (0.66,-0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmt]%
(0.66,-0.33) -- (1, 0) -- (2,0) -- (1.66,-0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drt]%
(1.66,-0.33) -- (2, 0) -- (3,0) -- (2.66,-0.33)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlm]%
(-0.66,-0.66) -- (-0.33, -0.33) -- (0.66,-0.33) -- (0.33,-0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmm]%
(0.33,-0.66) -- (0.66, -0.33) -- (1.66,-0.33) -- (1.33,-0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drm]%
(1.33,-0.66) -- (1.66, -0.33) -- (2.66,-0.33) -- (2.33,-0.66)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]%
(-1,-1) -- (-0.66, -0.66) -- (0.33,-0.66) -- (0,-1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmb]%
(0,-1) -- (0.33, -0.66) -- (1.33,-0.66) -- (1,-1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drb]%
(1,-1) -- (1.33, -0.66) -- (2.33,-0.66) -- (2,-1)  -- cycle;
}
%    \end{macrocode}
%
%
% \begin{macro}{\DrawRubikCubeLU}
% This command draws and paints a Rubik cube  as viewed from 
% the Left Up (LU) viewpoint.
% \end{macro}
%    \begin{macrocode}
\newcommand{\DrawRubikCubeLU}{%
\DrawRubikCubeFrontFace %% frontface
%%-----------Left face-----------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Llt]%
(-1,3) -- (-1, 4) -- (-0.66,3.66) -- (-0.66,2.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmt]%
(-0.66,2.66) -- (-0.66, 3.66) -- (-0.33,3.33) -- (-0.33,2.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]%
(-0.33,2.33) -- (-0.33, 3.33) -- (0,3) -- (0,2)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Llm]%
(-1,2) -- (-1, 3) -- (-0.66,2.66) -- (-0.66,1.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmm]%
(-0.66,1.66) -- (-0.66, 2.66) -- (-0.33,2.33) -- (-0.33,1.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrm]%
(-0.33,1.33) -- (-0.33, 2.33) -- (0,2) -- (0,1)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Llb]%
(-1,1) -- (-1, 2) -- (-0.66,1.66) -- (-0.66,0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmb]%
(-0.66,0.66) -- (-0.66, 1.66) -- (-0.33,1.33) -- (-0.33,0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]%
(-0.33,0.33) -- (-0.33, 1.33) -- (0,1) -- (0,0)  -- cycle;
%%-----------Up face---------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Ult]%
(-0.66,3.66) -- (-1, 4) -- (0,4) -- (0.33,3.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umt]%
(0.33,3.66) -- (0, 4) -- (1,4) -- (1.33,3.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urt]%
(1.33,3.66) -- (1, 4) -- (2,4) -- (2.33,3.66)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Ulm]%
(-0.33,3.33) -- (-0.66, 3.66) -- (0.33,3.66) -- (0.66,3.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umm]%
(0.66,3.33) -- (0.33, 3.66) -- (1.33,3.66) -- (1.66,3.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urm]%
(1.66,3.33) -- (1.33, 3.66) -- (2.33,3.66) -- (2.66,3.33)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]%
(0,3) -- (-0.33, 3.33) -- (0.66,3.33) -- (1,3)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umb]%
(1,3) -- (0.66, 3.33) -- (1.66,3.33) -- (2,3)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urb]%
(2,3) -- (1.66, 3.33) -- (2.66,3.33) -- (3,3)  -- cycle;%
\ %%trailing space 
}
%    \end{macrocode}
%
%
%   \subsection{    LayerFace commands}
%
%  \begin{macro}{\DrawRubikLayerFace}
%  \begin{macro}{\DrawRubikLayerFaceAll}
%  [Nov 2, 2013] These two LayerFace commands draw and paint a single  
%  9-cubie face. The first command takes 9 ordered colour parameters,
%  (ordered in layers from top left to bottom right, so \texttt{\#1} 
%  is the placeholder for the colour of the TopLeft cubie etc.)
%  The second takes only one colour parameter (since all the 
%  colours are the same).
%  The drawing origin (0,0) = bottom left corner. Cubies are drawn
%  from left to right.
%  NOTE: this macro is SAME as the  internal command 
%  \cmd{\DrawRubikCubeFrontFace}
%    which is used for drawing the front face of a  cube.
% \end{macro}
% \end{macro}
%    \begin{macrocode}
\newcommand{\DrawRubikLayerFace}[9]{%
%%-----------FRONT face---------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
(0,2) -- (0, 3) -- (1,3) -- (1,2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=#2]%
(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=#3]%
(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=#4]%
(0,1) -- (0, 2) -- (1,2) -- (1,1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=#5]%
(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=#6]%
(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=#7]%
(0,0) -- (0, 1) -- (1,1) -- (1,0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=#8]%
(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=#9]%
(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle;
}
\newcommand{\DrawRubikLayerFaceAll}[1]{%
%%----------FRONT face-----------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
(0,2) -- (0, 3) -- (1,3) -- (1,2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
(0,1) -- (0, 2) -- (1,2) -- (1,1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
(0,0) -- (0, 1) -- (1,1) -- (1,0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle;
}
%    \end{macrocode}
%
%
%   \subsection{    Flat commands}
%
%  \begin{macro}{\FlatUp}
%  \begin{macro}{\FlatDown}
%  \begin{macro}{\FlatLeft}
%  \begin{macro}{\FlatRight}
%  \begin{macro}{\FlatFront}
%  \begin{macro}{\FlatBack}
%  Each of these six internal `Flat'  commands draws a separate face.
%  Each command (except \cmd{\FlatFront}) takes two arguments, 
%  namely an  X-coordinate  and Y-coordinate of the bottom left 
%  corner of the  face.  This (X,Y) pair allows the user to position
%  the face. Note that the \cmd{\FlatFront} command takes no arguments,
%  since by definition the bottom left corner of this face is (0,0).
%
%  \textsc{example}: The following command positions the Up face so 
%  that its bottom left corner is located at (0,3): 
%  \begin{quote}
%    \cmd{\FlatUp\{0\}\{3\}}
%  \end{quote}
%  These internal commands are used  by the commands \cmd{\DrawRubikFlat}  
%  and \cmd{\DrawRubikCubeFlat} to draw various flat representations 
%  of a Rubik's cube.
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%    \begin{macrocode}
\newcommand{\FlatUp}[2]{%
\pgfmathsetmacro{\ux}{#1}%
\pgfmathsetmacro{\uy}{#2}%
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Ult]%
(\ux + 0,\uy + 2) -- (\ux + 0,\uy + 3) -- (\ux + 1,\uy + 3)%
 -- (\ux + 1,\uy + 2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umt]%
(\ux + 1,\uy + 2) -- (\ux + 1,\uy + 3) -- (\ux + 2,\uy + 3)%
 -- (\ux + 2,\uy + 2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urt]%
(\ux + 2,\uy + 2) -- (\ux + 2,\uy + 3) -- (\ux + 3,\uy + 3)%
 -- (\ux + 3,\uy + 2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Ulm]%
(\ux + 0,\uy + 1) -- (\ux + 0,\uy + 2) -- (\ux + 1,\uy + 2)%
 -- (\ux + 1,\uy + 1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umm]%
(\ux + 1,\uy + 1) -- (\ux + 1,\uy + 2) -- (\ux + 2,\uy + 2)%
 -- (\ux + 2,\uy + 1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urm]%
(\ux + 2,\uy + 1) -- (\ux + 2,\uy + 2) -- (\ux + 3,\uy + 2)%
 -- (\ux + 3,\uy + 1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]%
(\ux + 0,\uy + 0) -- (\ux + 0,\uy + 1) -- (\ux + 1,\uy + 1)%
 -- (\ux + 1,\uy + 0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umb]%
(\ux + 1,\uy + 0) -- (\ux + 1,\uy + 1) -- (\ux + 2,\uy + 1)%
 -- (\ux + 2,\uy + 0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urb]%
(\ux + 2,\uy + 0) -- (\ux + 2,\uy + 1) -- (\ux + 3,\uy + 1)%
 -- (\ux + 3,\uy + 0) -- cycle;
}
%%-------------------------
\newcommand{\FlatDown}[2]{%
\pgfmathsetmacro{\ddx}{#1}%
\pgfmathsetmacro{\ddy}{#2}%
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]%
(\ddx + 0,\ddy + 2) -- (\ddx + 0,\ddy + 3) -- (\ddx + 1,\ddy + 3)%
 -- (\ddx + 1,\ddy + 2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmt]%
(\ddx + 1,\ddy + 2) -- (\ddx + 1,\ddy + 3) -- (\ddx + 2,\ddy + 3)%
 -- (\ddx + 2,\ddy + 2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drt]%
(\ddx + 2,\ddy + 2) -- (\ddx + 2,\ddy + 3) -- (\ddx + 3,\ddy + 3)%
 -- (\ddx + 3,\ddy + 2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlm]%
(\ddx + 0,\ddy + 1) -- (\ddx + 0,\ddy + 2) -- (\ddx + 1,\ddy + 2)%
 -- (\ddx + 1,\ddy + 1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmm]%
(\ddx + 1,\ddy + 1) -- (\ddx + 1,\ddy + 2) -- (\ddx + 2,\ddy + 2)%
 -- (\ddx + 2,\ddy + 1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drm]%
(\ddx + 2,\ddy + 1) -- (\ddx + 2,\ddy + 2) -- (\ddx + 3,\ddy + 2)%
 -- (\ddx + 3,\ddy + 1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]%
(\ddx + 0,\ddy + 0) -- (\ddx + 0,\ddy + 1) -- (\ddx + 1,\ddy + 1)%
 -- (\ddx + 1,\ddy + 0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmb]%
(\ddx + 1,\ddy + 0) -- (\ddx + 1,\ddy + 1) -- (\ddx + 2,\ddy + 1)%
 -- (\ddx + 2,\ddy + 0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drb]%
(\ddx + 2,\ddy + 0) -- (\ddx + 2,\ddy + 1) -- (\ddx + 3,\ddy + 1)%
 -- (\ddx + 3,\ddy + 0) -- cycle;
}
%%-----------------------
\newcommand{\FlatFront}{%
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Flt]%
(0,2) -- (0, 3) -- (1,3) -- (1,2)  -- cycle;
%%
\draw[line join=round,line cap=round,ultra thick,fill=\Fmt]%
(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle;
%%
\draw[line join=round,line cap=round,ultra thick,fill=\Frt]%
(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Flm]%
(0,1) -- (0, 2) -- (1,2) -- (1,1)  -- cycle;
%%
\draw[line join=round,line cap=round,ultra thick,fill=\Fmm]%
(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle;
%%
\draw[line join=round,line cap=round,ultra thick,fill=\Frm]%
(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Flb]%
(0,0) -- (0, 1) -- (1,1) -- (1,0)  -- cycle;
%%
\draw[line join=round,line cap=round,ultra thick,fill=\Fmb]%
(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle;
%%
\draw[line join=round,line cap=round,ultra thick,fill=\Frb]%
(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle;
}
%%-------------------------
\newcommand{\FlatBack}[2]{%
\pgfmathsetmacro{\bx}{#1}%
\pgfmathsetmacro{\by}{#2}%
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Blt]%
(\bx + 0,\by + 2) -- (\bx + 0,\by + 3) -- (\bx + 1,\by + 3)%
 -- (\bx + 1,\by + 2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Bmt]%
(\bx + 1,\by + 2) -- (\bx + 1,\by + 3) -- (\bx + 2,\by + 3)%
 -- (\bx + 2,\by + 2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Brt]%
(\bx + 2,\by + 2) -- (\bx + 2,\by + 3) -- (\bx + 3,\by + 3)%
 -- (\bx + 3,\by + 2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Blm]%
(\bx + 0,\by + 1) -- (\bx + 0,\by + 2) -- (\bx + 1,\by + 2)%
 -- (\bx + 1,\by + 1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Bmm]%
(\bx + 1,\by + 1) -- (\bx + 1,\by + 2) -- (\bx + 2,\by + 2)%
 -- (\bx + 2,\by + 1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Brm]%
(\bx + 2,\by + 1) -- (\bx + 2,\by + 2) -- (\bx + 3,\by + 2)%
 -- (\bx + 3,\by + 1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Blb]%
(\bx + 0,\by + 0) -- (\bx + 0,\by + 1) -- (\bx + 1,\by + 1)%
 -- (\bx + 1,\by + 0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Bmb]%
(\bx + 1,\by + 0) -- (\bx + 1,\by + 1) -- (\bx + 2,\by + 1)%
 -- (\bx + 2,\by + 0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Brb]%
(\bx + 2,\by + 0) -- (\bx + 2,\by + 1) -- (\bx + 3,\by + 1)%
 -- (\bx + 3,\by + 0) -- cycle;
}
%%-------------------------
\newcommand{\FlatLeft}[2]{%
\pgfmathsetmacro{\lx}{#1}%
\pgfmathsetmacro{\ly}{#2}%
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Llt]%
(\lx + 0,2) -- (\lx + 0, 3) -- (\lx + 1,3) -- (\lx + 1,2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmt]%
(\lx + 1,2) -- (\lx + 1, 3) -- (\lx + 2,3) -- (\lx + 2,2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]%
(\lx + 2,2) -- (\lx + 2, 3) -- (\lx + 3,3) -- (\lx + 3,2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Llm]%
(\lx + 0,1) -- (\lx + 0, 2) -- (\lx + 1,2) -- (\lx + 1,1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmm]%
(\lx + 1,1) -- (\lx + 1, 2) -- (\lx + 2,2) -- (\lx + 2,1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrm]%
(\lx + 2,1) -- (\lx + 2, 2) -- (\lx + 3,2) -- (\lx + 3,1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Llb]%
(\lx + 0,0) -- (\lx + 0, 1) -- (\lx + 1,1) -- (\lx + 1,0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmb]%
(\lx + 1,0) -- (\lx + 1, 1) -- (\lx + 2,1) -- (\lx + 2,0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]%
(\lx + 2,0) -- (\lx + 2, 1) -- (\lx + 3,1) -- (\lx + 3,0) -- cycle;
}
%%--------------------------
\newcommand{\FlatRight}[2]{%
\pgfmathsetmacro{\rx}{#1}% %3
\pgfmathsetmacro{\ry}{#2}% %0
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]%
(\rx + 0,2) -- (\rx + 0, 3) -- (\rx + 1,3) -- (\rx + 1,2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmt]%
(\rx + 1,2) -- (\rx + 1, 3) -- (\rx + 2,3) -- (\rx + 2,2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]%
(\rx + 2,2) -- (\rx + 2, 3) -- (\rx + 3,3) -- (\rx + 3,2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlm]%
(\rx + 0,1) -- (\rx + 0, 2) -- (\rx + 1,2) -- (\rx + 1,1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmm]%
(\rx + 1,1) -- (\rx + 1, 2) -- (\rx + 2,2) -- (\rx + 2,1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrm]%
(\rx + 2,1) -- (\rx + 2, 2) -- (\rx + 3,2) -- (\rx + 3,1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]%
(\rx + 0,0) -- (\rx + 0, 1) -- (\rx + 1,1) -- (\rx + 1,0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmb]%
(\rx + 1,0) -- (\rx + 1, 1) -- (\rx + 2,1) -- (\rx + 2,0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]%
(\rx + 2,0) -- (\rx + 2, 1) -- (\rx + 3,1) -- (\rx + 3,0) -- cycle;
}
%    \end{macrocode}
%
%  \begin{macro}{\DrawRubikFlat}
%  Draws a standard flat representation of the Rubik's 
%  cube (colours only)
%    \begin{macrocode}
\newcommand{\DrawRubikFlat}{%
  \FlatUp{0}{3}%
  \FlatDown{0}{-3}%
  \FlatLeft{-3}{0}%
  \FlatFront%
  \FlatRight{3}{0}%
  \FlatBack{6}{0}%
}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\DrawRubikCubeFlat}
%  Draws a Rubik's  cube together with the three hidden faces
%   (colours only)
%    \begin{macrocode}
\newcommand{\DrawRubikCubeFlat}{%
  \DrawRubikCube%
  \FlatDown{0}{-3}%
  \FlatLeft{-3}{0}%
  \FlatBack{4}{1}%
}
%    \end{macrocode}
%  \end{macro}
%
%
%   \subsection{    SideBar commands}
%
%  SideBar commands draw narrow bars of colour indicating  the 
%  side colours of each of the cubies forming the side of
%  a given layer (face).
%
%  \begin{macro}{\RubikSideBarWidth}
%  \begin{macro}{\RubikSideBarLength} 
%  \begin{macro}{\RubikSideBarSep}
% These three commands allow the user to set the Width, Length 
% and Separation parameters for the sidebar (in decimal values, 
% where 1 is equivalent to the length of the side of a cubie).
%  \end{macro}
%  \end{macro}
%  \end{macro}
%    \begin{macrocode}
\newcommand{\RubikSideBarWidth}[1]{\pgfmathsetmacro{\bw}{#1}}
\newcommand{\RubikSideBarLength}[1]{\pgfmathsetmacro{\bl}{#1}}
\newcommand{\RubikSideBarSep}[1]{\pgfmathsetmacro{\bs}{#1}}
%    \end{macrocode}
% We first set some default values
%    \begin{macrocode}
\RubikSideBarWidth{0.3}%
\RubikSideBarLength{1}%
\RubikSideBarSep{0.3}%
%    \end{macrocode}
%
%
% \subsubsection{    Allocating  a colour to a single cubie sidebar}
% 
% \begin{macro}{\side@barT}
% \begin{macro}{\side@barB}
% \begin{macro}{\side@barL}
% \begin{macro}{\side@barR}
% Internal commands.
% Full length face SideBars are really multiple instances of 
% single cubie bars, 
% each of which is drawn  using one of four internal SideBar 
% commands---one for each of the sides which we shall 
% call Top, Bottom,  Left, Right.
% Each SideBar command  takes two arguments: one for cubie position 
% \marg{$ 1 \mid 2 \mid 3$} and  one for 
% the colour-code \marg{$ R \mid O \mid Y \mid G \mid B \mid W \mid X $}.
%
% \textsc{example}: the following command allocates a colour to a single 
% cubie sidebar on the Left of a Rubik face: 
%  \begin{quote}
%     \cmd{\side@barL}\marg{cubie-position}\marg{colour-code}
%  \end{quote}
% There are three cubie positions on  each of the four sides 
% of a face, and these 
% are numbered 1 to 3 starting from the bottom left corner (1,1). 
% The SideBar command  also implements the set (or default) 
% Length (\cmd{\bl}), Width (\cmd{\bw}) and Separation (\cmd{\bs}) 
% values mentioned above. \cmd{\blh} = Half \cmd{\bl} = \cmd{\bl}/2.
% Note that the TikZ \cmd{\pgfmathsetmacro} commands (which do the maths)
%  must be inside  the TeX sidebar command in order to work.
% The start point of Draw command for  each bar rectangle 
%    is botton Left corner of the bar =(\cmd{\dx},\cmd{\dy})
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
\newcommand{\side@barL}[2]{%
%% #1 = cubie possn no, #2 = colour
\pgfmathsetmacro{\blh}{\bl*(0.5)}%
\pgfmathsetmacro{\dx}{0 - \bs - \bw}%
\pgfmathsetmacro{\dy}{#1-1+0.5-\blh}%
\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) 
  -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle;
}
\newcommand{\side@barR}[2]{%
%% #1 = cubie possn no, #2 = colour
\pgfmathsetmacro{\blh}{\bl*(0.5)}%
\pgfmathsetmacro{\dx}{3 + \bs}%
\pgfmathsetmacro{\dy}{#1 -1+0.5-\blh}%
\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl)
  -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle;
}
\newcommand{\side@barT}[2]{%
%% #1 = cubie possn no, #2 = colour
\pgfmathsetmacro{\blh}{\bl*(0.5)}%
\pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}%
\pgfmathsetmacro{\dy}{3 +\bs}%
\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw)
  -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle;
}
\newcommand{\side@barB}[2]{%
%% #1 = cubie possn no, #2 = colour
\pgfmathsetmacro{\blh}{\bl*(0.5)}%
\pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}%
\pgfmathsetmacro{\dy}{0 -\bs-\bw}%
\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw)
  -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle;
}
%    \end{macrocode}
%
%
% \subsubsection{    Drawing a single cubie sidebar}
% 
%  \begin{macro}{\DrawRubikLayerSideX$_1$X$_2$X$_3$}
% This command draws the sidebars using the above \cmd{\sidebar} command.
% The X$_1$X$_2$X$_2$ parameters refer to the  options Left, Middle, 
% Right, Top, Equator, Bottom, x, y, as follows:
% \begin{quote}
%  X$_1$  is an $x$ parameter: either $\langle L\mid M \mid  R\rangle$
%  {\newline}X$_2$  is an $y$ parameter: either $\langle T\mid E \mid  B\rangle$
%  {\newline}X$_3$  is an extra parameter: either $\langle x\mid y \rangle$,
%  required by corner sidebars to indicate whether the sidebar was either 
%  above or below $\langle y \rangle$, or to the left or 
%  right $\langle x \rangle$ of the associated  cubie.
% An $X_3$ parameter is not required for the sidebar of an edge cubie, since 
% only one location is posible in these cases.
% \end{quote}
% For example, the following command
% \begin{quote}
%   \cmd{\DrawRubikLayerSideLTy\{G\}}
% \end{quote}
% draws a Green sidebar above the Top Left cubie. 
% \end{macro}
% 
% \begin{macrocode}
%%---Left side
\newcommand{\DrawRubikLayerSideLTx}[1]{\side@barL{3}{#1}}
\newcommand{\DrawRubikLayerSideLEx}[1]{\side@barL{2}{#1}}
\newcommand{\DrawRubikLayerSideLE}[1]{\side@barL{2}{#1}}
\newcommand{\DrawRubikLayerSideLBx}[1]{\side@barL{1}{#1}}
%---Right side
\newcommand{\DrawRubikLayerSideRTx}[1]{\side@barR{3}{#1}}
\newcommand{\DrawRubikLayerSideREx}[1]{\side@barR{2}{#1}}
\newcommand{\DrawRubikLayerSideRE}[1]{\side@barR{2}{#1}}
\newcommand{\DrawRubikLayerSideRBx}[1]{\side@barR{1}{#1}}
%---Top side
\newcommand{\DrawRubikLayerSideLTy}[1]{\side@barT{1}{#1}}
\newcommand{\DrawRubikLayerSideMTy}[1]{\side@barT{2}{#1}}
\newcommand{\DrawRubikLayerSideMT}[1]{\side@barT{2}{#1}}
\newcommand{\DrawRubikLayerSideRTy}[1]{\side@barT{3}{#1}}
%---Bottom side
\newcommand{\DrawRubikLayerSideLBy}[1]{\side@barB{1}{#1}}
\newcommand{\DrawRubikLayerSideMBy}[1]{\side@barB{2}{#1}}
\newcommand{\DrawRubikLayerSideMB}[1]{\side@barB{2}{#1}}
\newcommand{\DrawRubikLayerSideRBy}[1]{\side@barB{3}{#1}}
%    \end{macrocode}
%
%
%  \subsubsection{    Drawing multiple cubie  sidebars}
%
%    \begin{macro}{\DrawRubikLayerSideT}
%    \begin{macro}{\DrawRubikLayerSideB}
%    \begin{macro}{\DrawRubikLayerSideL}
%    \begin{macro}{\DrawRubikLayerSideR}
%  These commands allow the drawing of  3 small sidebars along 
%  one particular side (Top, Bottom, Left, Right), as indicated 
%  by the appended T, B, L, R letter code.
%  Each command takes three ordered colour arguments, which are ordered 
%  either from left to right (the T and B forms), or from top to bottom
%  (the L and R forms)
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%   \begin{macrocode}
%%--Top side---
\newcommand{\DrawRubikLayerSideT}[3]{%
  \DrawRubikLayerSideLTy{#1}%
  \DrawRubikLayerSideMTy{#2}%
  \DrawRubikLayerSideRTy{#3}%
}
%%--Bottom side---
\newcommand{\DrawRubikLayerSideB}[3]{%
  \DrawRubikLayerSideLBy{#1}%
  \DrawRubikLayerSideMBy{#2}%
  \DrawRubikLayerSideRBy{#3}%
}
%%--Left side--------
%% colours run vertically DOWN
\newcommand{\DrawRubikLayerSideL}[3]{%
  \DrawRubikLayerSideLTx{#1}%
  \DrawRubikLayerSideLEx{#2}%
  \DrawRubikLayerSideLBx{#3}%
}
%%--Right side--------
%% colours run vertically DOWN
\newcommand{\DrawRubikLayerSideR}[3]{%
  \DrawRubikLayerSideRTx{#1}%
  \DrawRubikLayerSideREx{#2}%
  \DrawRubikLayerSideRBx{#3}%
}
%    \end{macrocode}
%
%  \begin{macro}{\DrawRubikLayerSideLR}
% This command draws six cubie sidebars, three on each side, drawn in (L, R)
%  pairs. The command takes six colour arguments, ordered in pairs, 
%  as shown in the following example.
% \begin{quote}
%\begin{verbatim}
%  \DrawRubikLayerSideLR{G}   {G}
%                       {R}   {B}
%                       {Y}   {B}
%\end{verbatim}
%  \end{quote}
%  \begin{macrocode}
\newcommand{\DrawRubikLayerSideLR}[6]{%
  \DrawRubikLayerSideLTx{#1}%
  \DrawRubikLayerSideRTx{#2}%
  \DrawRubikLayerSideLEx{#3}%
  \DrawRubikLayerSideREx{#4}%
  \DrawRubikLayerSideLBx{#5}%
  \DrawRubikLayerSideRBx{#6}%
}
%    \end{macrocode}
%  \end{macro}
%
%
%    \subsection{    NCube command}
%
%  \textsc{history}: The essence of this command was originally developed by Peter Bartal 
%  as his command \cmd{\rubikcube} (see Bartal,
%  2011). We have modified it, as follows (June 2012):
%  \newline\strut\hspace{\parindent}(1) adjusted  to use the TikZ \cmd{\pgfmathsetmacro\{\}\{\}} command,
%  \newline\strut\hspace{\parindent}(2)  renamed to \cmd{\DrawNCubeAll}.
%
%    \begin{macro}{\DrawNCubeAll}
% {\noindent}This command draws a solved NxNxN Rubik's cube from the RightUp viewpoint.
% All cubies on a given face have the same colour. 
% The command takes four ordered  arguments, as follows:
% \newline\strut\hspace{\parindent}\#1 = number of cubies ($n>0$) along each side,
% \newline\strut\hspace{\parindent}\#2, \#3, \#4 = colors of the visible faces (in X,Y,Z order);
%  X=Right face  colour, Y=Up face colour, Z=Front face colour.
%
% \begin{macrocode}
\newcommand{\DrawNCubeAll}[4]{%
   \pgfmathsetmacro{\ncubes}{#1-1}%
%% need to subtract 1 from the given number of cubies per side 
%% to avoid the origin of the initial cube to be displaced
    \foreach \x in {0,...,\ncubes}{%
      \foreach \y in {0,...,\ncubes}{%
        \foreach \z in {0,...,\ncubes}{%
          \cube@dxdydz{1}{#2}{#3}{#4}{\x}{\y}{\z}% 
  }}}}
%    \end{macrocode}
%    \end{macro}
%
%   \begin{macro}{\cube@dxdydz}
% This internal command is  used only by the \cmd{\DrawNCubeAll} command.
% The original version of this command was developed  by Peter Bartal (see Bartal, 2011).
% It was modified (2012) by RWD Nickalls (to implement  a more 
% intuitive X, Y, Z ordering of parameters), and also by Peter Grill (see below).
%
%  The cube need not be in the origin, the distances of 
% the Down-behind [L] corner from 
% the origin are taken as parameters.
% The command takes 7 ordered arguments:
% \newline\strut\hspace{\parindent}1 - length of an edge 
% \newline\strut\hspace{\parindent}2 - color of the X face (Right) (RWDN)
% \newline\strut\hspace{\parindent}3 - color of the Y face (Up)    (RWDN)
% \newline\strut\hspace{\parindent}4 - color of the Z face (Front) (RWDN)
% \newline\strut\hspace{\parindent}5 - x-position in space
% \newline\strut\hspace{\parindent}6 - y-position in space
% \newline\strut\hspace{\parindent}7 - z-position in space
%
% \textsc{usage}:  |\cube@dxdydz{1}{cX}{cY}{cZ}{x}{y}{z}|
%
% {\noindent}The original code
%   |\pgfmathparse{#1+#5}\let\dy\pgfmathresult| 
% {\newline} was changed  to the more intuitive  |\pgfmathsetmacro{\dx}{#1+#5}|
% (suggested by Peter Grill 2011).
%
% \textsc{changes}: RWD Nickalls (2012): 
% (1) added the [line join=round,line cap=round] 
% options to  each of the TikZ  `draw' commands, in order to improve 
% the line joining (first two options); (2) adjusted  the \cmd{\cube@dxdydz} macro 
% to adopt the ordered  XYZ face colour notation
% (by reassigning \#2, \#3, \#4).
%    \begin{macrocode}
\newcommand{\cube@dxdydz}[7]{%
   \pgfmathsetmacro{\dx}{#1+#5}% 
%% calculates the 'displacement' (distance from the origin) of the 
%% far corners of the cube along the x axis from the arguments
   \pgfmathsetmacro{\dy}{#1+#6}%
%% calculates the 'displacement' (distance from the origin) of the 
%% far corners of the cube along the y axis from the arguments
   \pgfmathsetmacro{\dz}{#1+#7}%
%% calculates the 'displacement' (distance from the origin) of the 
%% far corners of the cube along the z axis from the arguments
%% Draw FRONT face   (using the X colour = #4)
    \draw[line join=round,line cap=round,ultra thick,fill=#4]%
 (#5,#6,\dz) -- (\dx,#6,\dz) -- (\dx,\dy,\dz) -- (#5,\dy,\dz) -- cycle;
%% The 'rectangle' command does not work with 3D coordinates, 
%% so this is the way to draw the squres with space coordinates
%% Draw UP face (using the Y colour = #3)
   \draw[line join=round,line cap=round,ultra thick,fill=#3]%
 (#5,\dy,\dz) -- (\dx,\dy,\dz) -- (\dx,\dy,#7) -- (#5,\dy,#7) -- cycle;
%% Draw RIGHT face   (using the X colour = #2)
 \draw[line join=round,line cap=round,ultra thick,fill=#2]%
 (\dx,#6,\dz) -- (\dx,#6,#7) -- (\dx,\dy,#7) -- (\dx,\dy,\dz) -- cycle;
    }
%    \end{macrocode}
%    \end{macro}
%
%
%  \subsection{    Drawing single cubies}
%
%  \begin{macro}{\Cubiedx}
%  \begin{macro}{\Cubiedy}
%  These two commands set the value of the two length parameters
%  \texttt{cx} and \texttt{cy}, and allow the user to vary the size 
%  (adjust \texttt{cy}) and horizontal viewpoint  (adjust \texttt{cx})
%  of a single cubie (described in more detail in the \rubikcube\ 
%   package  documentation).
%  Note that we cannot use the names \texttt{dx}, \texttt{dy} since these have been 
% used before (see above). However we use \texttt{dx}, \texttt{dy} in the  command names
% since these will be more  readily understood by the user.
%    \begin{macrocode}
\newcommand{\Cubiedx}[1]{\pgfmathsetmacro{\cx}{#1}}
\newcommand{\Cubiedy}[1]{\pgfmathsetmacro{\cy}{#1}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
% We now set the default values (cx=cy=0.4)
%    \begin{macrocode}
\Cubiedx{0.4}
\Cubiedy{0.4}
%    \end{macrocode}
%
%
%  \begin{macro}{\DrawCubieRU}
%  \begin{macro}{\DrawCubieRD}
%  \begin{macro}{\DrawCubieLU}
%  \begin{macro}{\DrawCubieLD}
% These four commands draw a single cubie from the RightUp, RightDown, 
% LeftUp, LeftDown viewpoint. The viewpoint is specified using an appended 
% two-letter XY ordered viewpoint code: either RU, RD, LU, LD.
% These commands take three arguments, namely three different XYZ 
% ordered colour codes (R,O,Y,G,B,W,X).
% \newline\textsc{format}: \cmd{\DrawCubieRU}\marg{colourX}\marg{colourY}\marg{colourZ}
% \newline\textsc{usage}: |\DrawCubieRU{G}{B}{W}|
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \begin{macrocode}
\newcommand{\DrawCubieRU}[3]{%
%% Front face (z)
\draw[line join=round,line cap=round,ultra thick,fill=#3]%
 (0,0) -- (0, 1) -- (1, 1) -- (1,0) -- cycle;
%% Up face(y)
\draw[line join=round,line cap=round,ultra thick,fill=#2]%
 (0,1) -- (\cx, 1+\cy) -- (1+\cx,1+\cy) -- (1,1) -- cycle;
%% Right face(x)
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
 (1,0) -- (1,1) -- (1+\cx,1+\cy) -- (1+\cx, \cy) -- cycle;
}
\newcommand{\DrawCubieRD}[3]{%
%% Front face (z)
\draw[line join=round,line cap=round,ultra thick,fill=#3]%
 (0,0) -- (0, 1) -- (1, 1) -- (1,0) -- cycle;
%% Down face (y)
\draw[line join=round,line cap=round,ultra thick,fill=#2]%
 (\cx,-\cy) -- (0, 0) -- (1,0) -- (1+\cx,-\cy) -- cycle;
%% Right face (x)
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
 (1,0) -- (1,1) -- (1+\cx,-\cy+1) -- (1+\cx, -\cy) -- cycle;
}
\newcommand{\DrawCubieLD}[3]{%
%% Front face (z)
\draw[line join=round,line cap=round,ultra thick,fill=#3]%
 (0,0) -- (0, 1) -- (1, 1) -- (1,0) -- cycle;
%% Down face (y)
\draw[line join=round,line cap=round,ultra thick,fill=#2]%
 (-\cx,-\cy) -- (0, 0) -- (1,0) -- (1-\cx,-\cy) -- cycle;
%% Left face (x)
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
 (-\cx,-\cy) -- (-\cx,-\cy+1) -- (0,1) -- (0,0) -- cycle;
}
\newcommand{\DrawCubieLU}[3]{%
%% Front face (z)
\draw[line join=round,line cap=round,ultra thick,fill=#3]%
 (0,0) -- (0, 1) -- (1, 1) -- (1,0) -- cycle;
%% Up face (y)
\draw[line join=round,line cap=round,ultra thick,fill=#2]%
 (-\cx,1+\cy) -- (1-\cx, 1+\cy) -- (1,1) -- (0,1) -- cycle;
%% Left face (x)
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
 (-\cx, \cy) -- (-\cx,\cy+1) -- (0,1) -- (0,0) -- cycle;
}
%    \end{macrocode}
%
%
%  \subsection{    Text cubies}
% 
%  \begin{macro}{\textCubieRU}
%  \begin{macro}{\textCubieRD}
%  \begin{macro}{\textCubieLU}
%  \begin{macro}{\textCubieLD}
%  These four commands draw a single `text' cubie from the RightUp, RightDown, 
%  LeftUp, LeftDown viewpoint. 
%  They are `text' forms of the DrawCubie' versions described above.
%  Their size is scaled to be suitable for use with  10--12 point fonts.  
%
%  As before, the viewpoint is specified using an appended 
% two-letter XY ordered viewpoint code: either RU, RD, LU, LD.
% These commands take three arguments, namely three different XYZ 
% ordered colour codes (R,O,Y,G,B,W,X).
% \newline\textsc{format}: \cmd{\textCubieRU}\marg{colourX}\marg{colourY}\marg{colourZ}
% \newline\textsc{usage}: |\textCubieRU{G}{B}{W}|
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \begin{macrocode}
\newcommand{\textCubieRU}[3]{%
\begin{minipage}{0.66cm}
\centering
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieRU{#1}{#2}{#3}
\end{tikzpicture}
\end{minipage}
}
\newcommand{\textCubieRD}[3]{%
\begin{minipage}{0.66cm}
\centering
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieRD{#1}{#2}{#3}
\end{tikzpicture}
\end{minipage}
}
\newcommand{\textCubieLD}[3]{%
\begin{minipage}{0.66cm}
\centering
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieLD{#1}{#2}{#3}
\end{tikzpicture}
\end{minipage}
}
\newcommand{\textCubieLU}[3]{%
\begin{minipage}{0.66cm}
\centering
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieLU{#1}{#2}{#3}
\end{tikzpicture}
\end{minipage}
}
%    \end{macrocode}
%
%
%  \subsection{    Rotation commands --- face and slice}
%
% \textsc{notation}: We require a special notation to denote the 
% various Rubik rotations (denoted 
% by the stem rr). These rotations can be denoted either  using a letter code
% say, \cmd{\rrR} for a Right  face rotation, or by the equivalent hieroglyph
% denoted as \cmd{\rrhR}  (Rubik rotation hieroglyph Right) etc.
% Commands such as \cmd{\RubikXXXX} typeset a pair of rr and rrh vertically.
% Commands such as \cmd{\textRubikXXXX} typeset  the pair rr and rrh horizontally 
% (ie  a sort of `text' mode).
%
% The square hieroglyphs are built up in stages. We first create an internal 
% command  for drawing the square (\cmd{\DrawNotationBox}), and then draw the 
% contents (lines, arrows, arcs of circles, and sometimes just text).
% (for the TikZ  ARC command see  TikZ pgfmanual2012  page p146 (\S 14.8)).
%
%  The presence of small overfilled hboxes associated with these squares
% were originally checked using the ltugboat.cls, and all fixed mainly
% by setting the associated  minipages $\rightarrow$ width = 0.6cm, 
%  and using TKZ scale=0.5.
% NOTE: do not use a trailing |%|  after each |\end{tikzpicture}| 
% as we actually need a small space to appear when used in text.
%
%
%   \begin{macro}{\DrawNotationBox}
% This command draws the surrounding square box of  all the hieroglyphs.
% Note that we start at (0,0) and draw to the final point 
% in order to make a nice corner join.
%
%   \begin{macrocode}
\newcommand{\DrawNotationBox}{%
  \draw [thick] (0,0) -- (0,1) -- (1,1) -- (1,0) -- (0,0) -- (0,1)%
}
%    \end{macrocode}
%    \end{macro}
%
% We now define  a number of points and line-segments inside the square 
% (eg.; \cmd{\sd}, \cmd{\sh} \ldots\ etc.) which will be required
% for use in drawing the various lines and arrows.
% Some hieroglyphs contain either one circular arc, or two concentric arcs, 
% and these arcs require both a center and a start point.
% 
%\begin{macrocode}
\pgfmathsetmacro{\sd}{0.25} % horiz space 
\pgfmathsetmacro{\sdd}{2*\sd} 
\pgfmathsetmacro{\sddd}{3*\sd}
\pgfmathsetmacro{\sh}{0.6} % height
\pgfmathsetmacro{\sb}{0.2} % base
\pgfmathsetmacro{\sbh}{\sb + \sh} % UP
\pgfmathsetmacro{\scx}{\sdd+0.2} % Start of CircleX
\pgfmathsetmacro{\scy}{\sd*2/3}  % Start of CircleY
\pgfmathsetmacro{\sqcx}{\scx-0.13} %% SQuare CenterX
\pgfmathsetmacro{\sqcy}{\scy+0.25} %% SQuare CenterY
%    \end{macrocode}
%
%
%  \subsubsection{     Rotation B}
%
%  \begin{macro}{\rrB}
%  \begin{macro}{\SquareB}
%  \begin{macro}{\rrhB}
%  \begin{macro}{\RubikB}
%  \begin{macro}{\textRubikB}
%  These commands  all draw forms which denote the B rotation.
%  Not visible from the front.
% \begin{macrocode}
\newcommand{\rrB}{\@rr{B}}
\newcommand{\SquareB}{\@SquareLetter{\rrB}}
\newcommand{\rrhB}{\raisebox{-0.25mm}{\SquareB}\,}
\newcommand{\RubikB}{\raisebox{\@hRubik}{\SquareB}\,}
\newcommand{\textRubikB}{\rrhB\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Bp}
%
%  \begin{macro}{\rrBp}
%  \begin{macro}{\SquareBp}
%  \begin{macro}{\rrhBp}
%  \begin{macro}{\RubikBp}
%  \begin{macro}{\textRubikBp}
%  These commands  all draw forms which denote the Bp rotation.
%  Not visible from the front.
% \begin{macrocode}
\newcommand{\rrBp}{\@rrp{B}}
\newcommand{\SquareBp}{\@SquareLetter{\rrBp}}
\newcommand{\rrhBp}{\raisebox{-0.25mm}{\SquareBp}\,}
\newcommand{\RubikBp}{\raisebox{\@hRubik}{\SquareBp}\,}
\newcommand{\textRubikBp}{\rrhBp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Bw}
%
%  \begin{macro}{\rrBw}
%  \begin{macro}{\SquareBw}
%  \begin{macro}{\rrhBw}
%  \begin{macro}{\RubikBw}
%  \begin{macro}{\textRubikBw}
%  These commands  all draw forms which denote the Bw rotation.
%  Not visible from the front.
% \begin{macrocode}
%\newcommand{\rrBw}{\textbf{\textsf{Bw}}}
\newcommand{\rrBw}{\@rrw{B}}
\newcommand{\SquareBw}{\@SquareLetter{\rrBw}}
\newcommand{\rrhBw}{\raisebox{-0.25mm}{\SquareBw}\,}
\newcommand{\RubikBw}{\raisebox{\@hRubik}{\SquareBw}\,}
\newcommand{\textRubikBw}{\rrhBw\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Bwp}
%
%  \begin{macro}{\rrBwp}
%  \begin{macro}{\SquareBwp}
%  \begin{macro}{\rrhBwp}
%  \begin{macro}{\RubikBwp}
%  \begin{macro}{\textRubikBwp}
%  These commands  all draw forms which denote the Bwp rotation.
% Not visible from the front.
% \begin{macrocode}
%\newcommand{\rrBwp}{\textbf{\textsf{Bwp}}}
\newcommand{\rrBwp}{\@rrwp{B}}
\newcommand{\SquareBwp}{\@SquareLetter{\rrBwp}}
\newcommand{\rrhBwp}{\raisebox{-0.25mm}{\SquareBwp}\,}
\newcommand{\RubikBwp}{\raisebox{\@hRubik}{\SquareBwp}\,}
\newcommand{\textRubikBwp}{\rrhBwp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Bs}
%
%  \begin{macro}{\rrBs}
%  \begin{macro}{\SquareBs}
%  \begin{macro}{\rrhBs}
%  \begin{macro}{\RubikBs}
%  \begin{macro}{\textRubikBs}
%  These commands  all draw forms which denote the Bs rotation.
%  Not visible from the front.
% \begin{macrocode}
%\newcommand{\rrBs}{\textbf{\textsf{Bs}}}
\newcommand{\rrBs}{\@rrs{B}}
\newcommand{\SquareBs}{\@SquareLetter{\rrBs}}
\newcommand{\rrhBs}{\raisebox{-0.25mm}{\SquareBs}\,}
\newcommand{\RubikBs}{\raisebox{\@hRubik}{\SquareBs}\,}
\newcommand{\textRubikBs}{\rrhBs\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Bsp}
%
%  \begin{macro}{\rrBsp}
%  \begin{macro}{\SquareBsp}
%  \begin{macro}{\rrhBsp}
%  \begin{macro}{\RubikBsp}
%  \begin{macro}{\textRubikBsp}
%  These commands  all draw forms which denote the Bsp rotation.
%  Not visible from the front.
% \begin{macrocode}
%\newcommand{\rrBsp}{\textbf{\textsf{Bsp}}}
\newcommand{\rrBsp}{\@rrsp{B}}
\newcommand{\SquareBsp}{\@SquareLetter{\rrBsp}}
\newcommand{\rrhBsp}{\raisebox{-0.25mm}{\SquareBsp}\,}
\newcommand{\RubikBsp}{\raisebox{\@hRubik}{\SquareBsp}\,}
\newcommand{\textRubikBsp}{\rrhBsp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Ba}
%
%  \begin{macro}{\rrBa}
%  \begin{macro}{\SquareBa}
%  \begin{macro}{\rrhBa}
%  \begin{macro}{\RubikBa}
%  \begin{macro}{\textRubikBa}
%  These commands  all draw forms which denote the Ba rotation.
% Not visible from the front.
% \begin{macrocode}
%\newcommand{\rrBa}{\textbf{\textsf{Ba}}}
\newcommand{\rrBa}{\@rra{B}}
\newcommand{\SquareBa}{\@SquareLetter{\rrBa}}
\newcommand{\rrhBa}{\raisebox{-0.25mm}{\SquareBa}\,}
\newcommand{\RubikBa}{\raisebox{\@hRubik}{\SquareBa}\,}
\newcommand{\textRubikBa}{\rrhBa\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Bap}
%
%  \begin{macro}{\rrBap}
%  \begin{macro}{\SquareBap}
%  \begin{macro}{\rrhBap}
%  \begin{macro}{\RubikBap}
%  \begin{macro}{\textRubikBap}
%  These commands  all draw forms which denote the Bap rotation.
% Not visible from the front.
% \begin{macrocode}
%\newcommand{\rrBap}{\textbf{\textsf{Bap}}}
\newcommand{\rrBap}{\@rrap{B}}
\newcommand{\SquareBap}{\@SquareLetter{\rrBap}}
\newcommand{\rrhBap}{\raisebox{-0.25mm}{\SquareBap}\,}
\newcommand{\RubikBap}{\raisebox{\@hRubik}{\SquareBap}\,}
\newcommand{\textRubikBap}{\rrhBap\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation D}
%
%  \begin{macro}{\rrD}
%  \begin{macro}{\SquareD}
%  \begin{macro}{\rrhD}
%  \begin{macro}{\RubikD}
%  \begin{macro}{\textRubikD}
%  These commands  all draw forms which denote the D rotation.
% \begin{macrocode}
\newcommand{\rrD}{\textbf{\textsf{D}}}
%%
\newcommand{\SquareD}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick, ->]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%%
}
\newcommand{\rrhD}{\raisebox{-0.333\height}{\SquareD}\,}
%%
\newcommand{\RubikD}{%
\begin{minipage}{0.6cm}
\centering
\SquareD\\
\rrD
\end{minipage}%
}
\newcommand{\textRubikD}{\rrD\,\rrhD}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Dp}
%
%  \begin{macro}{\rrDp}
%  \begin{macro}{\SquareDp}
%  \begin{macro}{\rrhDp}
%  \begin{macro}{\RubikDp}
%  \begin{macro}{\textRubikDp}
%  These commands  all draw forms which denote the Dp rotation.
% \begin{macrocode}
\newcommand{\rrDp}{\textbf{\textsf{D}$^\prime$}}
%%
\newcommand{\SquareDp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick]     (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick]     (\sb,\sdd)  -- (\sbh, \sdd);
\draw [thick, <-] (\sb,\sd)   -- (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhDp}{\raisebox{-0.333\height}{\SquareDp}\,}
%%
\newcommand{\RubikDp}{%
\begin{minipage}{0.6cm}
\centering
\SquareDp\\
\rrDp
\end{minipage}%
}
\newcommand{\textRubikDp}{\rrDp\,\rrhDp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Dw}
%
%  \begin{macro}{\rrDw}
%  \begin{macro}{\SquareDw}
%  \begin{macro}{\rrhDw}
%  \begin{macro}{\RubikDw}
%  \begin{macro}{\textRubikDw}
%  These commands  all draw forms which denote the Dw rotation.
% \begin{macrocode}
\newcommand{\rrDw}{\textbf{\textsf{D\footnotesize{w}}}}
%%
\newcommand{\SquareDw}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick]     (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick, ->] (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick, ->] (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhDw}{\raisebox{-0.333\height}{\SquareDw}\,}
%%
\newcommand{\RubikDw}{%
\begin{minipage}{0.6cm}
\centering
\SquareDw\\
\rrDw
\end{minipage}%
}
\newcommand{\textRubikDw}{\rrDw\,\rrhDw}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Dwp}
%
%  \begin{macro}{\rrDwp}
%  \begin{macro}{\SquareDwp}
%  \begin{macro}{\rrhDwp}
%  \begin{macro}{\RubikDwp}
%  \begin{macro}{\textRubikDwp}
%  These commands  all draw forms which denote the Dwp rotation.
% \begin{macrocode}
\newcommand{\rrDwp}{\textbf{\textsf{D\footnotesize{w}}$^\prime$}}
%%
\newcommand{\SquareDwp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick]     (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick, <-] (\sb,\sdd)  -- (\sbh, \sdd);
\draw [thick, <-] (\sb,\sd)   -- (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhDwp}{\raisebox{-0.333\height}{\SquareDwp}\,}
%%
\newcommand{\RubikDwp}{%
\begin{minipage}{0.6cm}
\centering
\SquareDwp\\
\rrDwp
\end{minipage}%
}
\newcommand{\textRubikDwp}{\rrDwp\,\rrhDwp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Ds}
%
%  \begin{macro}{\rrDs}
%  \begin{macro}{\SquareDs}
%  \begin{macro}{\rrhDs}
%  \begin{macro}{\RubikDs}
%  \begin{macro}{\textRubikDs}
%  These commands  all draw forms which denote the Ds rotation.
% \begin{macrocode}
\newcommand{\rrDs}{\@rrs{D}}
%%
\newcommand{\SquareDs}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick, ->]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhDs}{\raisebox{-0.333\height}{\SquareDs}\,}
%%
\newcommand{\RubikDs}{%
\begin{minipage}{0.6cm}
\centering
\SquareDs\\
\rrDs
\end{minipage}%
}
\newcommand{\textRubikDs}{\rrDs\,\rrhDs}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Dsp}
%
%  \begin{macro}{\rrDsp}
%  \begin{macro}{\SquareDsp}
%  \begin{macro}{\rrhDsp}
%  \begin{macro}{\RubikDsp}
%  \begin{macro}{\textRubikDsp}
%  These commands  all draw forms which denote the Dsp rotation.
% \begin{macrocode}
\newcommand{\rrDsp}{\@rrsp{D}}
%%
\newcommand{\SquareDsp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick, <-]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhDsp}{\raisebox{-0.333\height}{\SquareDsp}\,}
%%
\newcommand{\RubikDsp}{%
\begin{minipage}{0.6cm}
\centering
\SquareDsp\\
\rrDsp
\end{minipage}%
}
\newcommand{\textRubikDsp}{\rrDsp\,\rrhDsp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Da} 
%
%  \begin{macro}{\rrDa}
%  \begin{macro}{\SquareDa}
%  \begin{macro}{\rrhDa}
%  \begin{macro}{\RubikDa}
%  \begin{macro}{\textRubikDa}
%  These commands  all draw forms which denote the Da rotation.
% \begin{macrocode}
\newcommand{\rrDa}{\@rra{D}}
%%
\newcommand{\SquareDa}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick, ->]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhDa}{\raisebox{-0.333\height}{\SquareDa}\,}
%%
\newcommand{\RubikDa}{%
\begin{minipage}{0.6cm}
\centering
\SquareDa\\
\rrDa
\end{minipage}%
}
\newcommand{\textRubikDa}{\rrDa\,\rrhDa}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Dap} 
%
%  \begin{macro}{\rrDap}
%  \begin{macro}{\SquareDap}
%  \begin{macro}{\rrhDap}
%  \begin{macro}{\RubikDap}
%  \begin{macro}{\textRubikDap}
%  These commands  all draw forms which denote the Dap rotation.
% \begin{macrocode}
\newcommand{\rrDap}{\@rrap{D}}
%%
\newcommand{\SquareDap}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick, <-]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhDap}{\raisebox{-0.333\height}{\SquareDap}\,}
%%
\newcommand{\RubikDap}{%
\begin{minipage}{0.6cm}
\centering
\SquareDap\\
\rrDap
\end{minipage}%
}
\newcommand{\textRubikDap}{\rrDap\,\rrhDap}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation E}
%
%  \begin{macro}{\rrE}
%  \begin{macro}{\SquareE}
%  \begin{macro}{\rrhE}
%  \begin{macro}{\RubikE}
%  \begin{macro}{\textRubikE}
%  These commands  all draw forms which denote the E rotation.
% \begin{macrocode}
\newcommand{\rrE}{\textbf{\textsf{E}}}
%%
\newcommand{\SquareE}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick, ->]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhE}{\raisebox{-0.333\height}{\SquareE}\,}
%%
\newcommand{\RubikE}{%
\begin{minipage}{0.6cm}
\centering
\SquareE\\
\rrE
\end{minipage}%
}
\newcommand{\textRubikE}{\rrE\,\rrhE}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Ep}
%
%  \begin{macro}{\rrEp}
%  \begin{macro}{\SquareEp}
%  \begin{macro}{\rrhEp}
%  \begin{macro}{\RubikEp}
%  \begin{macro}{\textRubikEp}
%  These commands  all draw forms which denote the Ep rotation.
% \begin{macrocode}
\newcommand{\rrEp}{\textbf{\textsf{E}$^\prime$}}
%%
\newcommand{\SquareEp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick, <-]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhEp}{\raisebox{-0.333\height}{\SquareEp}\,}
%%
\newcommand{\RubikEp}{%
\begin{minipage}{0.6cm}
\centering
\SquareEp\\
\rrEp
\end{minipage}%
}
\newcommand{\textRubikEp}{\rrEp\,\rrhEp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation F}
%
%  \begin{macro}{\rrF}
%  \begin{macro}{\SquareF}
%  \begin{macro}{\rrhF}
%  \begin{macro}{\RubikF}
%  \begin{macro}{\textRubikF}
%  These commands  all draw forms which denote the F rotation.
%  \begin{macrocode}
\newcommand{\rrF}{\textbf{\textsf{F}}}
%%
\newcommand{\SquareF}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\scx, \scy) arc[radius=0.35, start angle=-60, delta angle=290];
\end{tikzpicture}%
}
\newcommand{\rrhF}{\raisebox{-0.333\height}{\SquareF}\,}
%%
\newcommand{\RubikF}{%
\begin{minipage}{0.6cm}
\centering
\SquareF\\
\rrF
\end{minipage}%
}
\newcommand{\textRubikF}{\rrF\,\rrhF}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Fp}
%
%  \begin{macro}{\rrFp}
%  \begin{macro}{\SquareFp}
%  \begin{macro}{\rrhFp}
%  \begin{macro}{\RubikFp}
%  \begin{macro}{\textRubikFp}
%  These commands  all draw forms which denote the Fp rotation.
% \begin{macrocode}
\newcommand{\rrFp}{\textbf{\textsf{F}$^\prime$}}
%%
\newcommand{\SquareFp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\scx, \scy) arc[radius=0.35, start angle=-60, delta angle=290];
\end{tikzpicture}%
}
\newcommand{\rrhFp}{\raisebox{-0.333\height}{\SquareFp}\,}
%%
\newcommand{\RubikFp}{%
\begin{minipage}{0.6cm}
\centering
\SquareFp\\
\rrFp
\end{minipage}%
}
\newcommand{\textRubikFp}{\rrFp\,\rrhFp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Fw}
%
%  \begin{macro}{\rrFw}
%  \begin{macro}{\SquareFw}
%  \begin{macro}{\rrhFw}
%  \begin{macro}{\RubikFw}
%  \begin{macro}{\textRubikFw}
%  These commands  all draw forms which denote the Fw rotation.
% \begin{macrocode}
\newcommand{\rrFw}{\textbf{\textsf{F\footnotesize{w}}}}
%%
\newcommand{\SquareFw}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\scx, \scy) arc[radius=0.35, start angle=-60, delta angle=290];
\draw [thick] (\sqcx,\sqcy) arc[radius=0.1, start angle=-60, delta angle=360];
%\node (squareLab) at (0.5,0.5)  {$o$};
\end{tikzpicture}%
}
\newcommand{\rrhFw}{\raisebox{-0.333\height}{\SquareFw}\,}
%%
\newcommand{\RubikFw}{%
\begin{minipage}{0.6cm}
\centering
\SquareFw\\
\rrFw
\end{minipage}%
}
\newcommand{\textRubikFw}{\rrFw\,\rrhFw}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Fwp}
%
%  \begin{macro}{\rrFwp}
%  \begin{macro}{\SquareFwp}
%  \begin{macro}{\rrhFwp}
%  \begin{macro}{\RubikFwp}
%  \begin{macro}{\textRubikFwp}
%  These commands  all draw forms which denote the Fwp rotation.
% \begin{macrocode}
\newcommand{\rrFwp}{\textbf{\textsf{F\footnotesize{w}}$^\prime$}}
%%
\newcommand{\SquareFwp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\scx, \scy) arc[radius=0.35, start angle=-60, delta angle=290];
\draw [thick] (\sqcx,\sqcy) arc[radius=0.1, start angle=-60, delta angle=360];
\end{tikzpicture}%
}
\newcommand{\rrhFwp}{\raisebox{-0.333\height}{\SquareFwp}\,}
%%
\newcommand{\RubikFwp}{%
\begin{minipage}{0.6cm}
\centering
\SquareFwp\\
\rrFwp
\end{minipage}%
}
\newcommand{\textRubikFwp}{\rrFwp\,\rrhFwp}
%%
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Fs}
%
%  \begin{macro}{\rrFs}
%  \begin{macro}{\rrhFs}
%  \begin{macro}{\RubikFs}
%  \begin{macro}{\textRubikFs}
%  These commands  draw forms of the Singmaster Fs slice rotation.
%  We need to just make square with Fs in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
%  Not visible from the front.
% \begin{macrocode}
\newcommand{\rrFs}{\@rrs{F}}
\newcommand{\SquareFs}{\@SquareLetter{\rrFs}} 
\newcommand{\rrhFs}{\raisebox{-0.25mm}{\SquareFs}\,}
\newcommand{\RubikFs}{\raisebox{\@hRubik}{\SquareFs}\,}
\newcommand{\textRubikFs}{\rrhFs\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Fsp}
%
%  \begin{macro}{\rrFsp}
%  \begin{macro}{\rrhFsp}
%  \begin{macro}{\RubikFsp}
%  \begin{macro}{\textRubikFsp}
%  These commands  draw forms of the Singmaster Fsp slice rotation.
%  We need to just make square with Fsp in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
%  Not visible from the front.
% \begin{macrocode}
\newcommand{\rrFsp}{\@rrsp{F}}
\newcommand{\SquareFsp}{\@SquareLetter{\rrFsp}}
\newcommand{\rrhFsp}{\raisebox{-0.25mm}{\SquareFsp}\,}
\newcommand{\RubikFsp}{\raisebox{\@hRubik}{\SquareFsp}\,}
\newcommand{\textRubikFsp}{\rrhFsp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Fa}
%
%  \begin{macro}{\rrFa}
%  \begin{macro}{\rrhFa}
%  \begin{macro}{\RubikFa}
%  \begin{macro}{\textRubikFa}
%  These commands  draw forms of the Singmaster Fa slice rotation.
%  We need to just make square with Fa in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
%  Not visible from the front.
% \begin{macrocode}
\newcommand{\rrFa}{\@rra{F}}
\newcommand{\SquareFa}{\@SquareLetter{\rrFa}}
\newcommand{\rrhFa}{\raisebox{-0.25mm}{\SquareFa}\,}
\newcommand{\RubikFa}{\raisebox{\@hRubik}{\SquareFa}\,}
\newcommand{\textRubikFa}{\rrhFa\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Fap}
%
%  \begin{macro}{\rrFap}
%  \begin{macro}{\rrhFap}
%  \begin{macro}{\RubikFap}
%  \begin{macro}{\textRubikFap}
%  These commands  draw forms of the Singmaster Fap slice rotation.
%  We need to just make square with Fap in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
%  Not visible from the front.
% \begin{macrocode}
\newcommand{\rrFap}{\@rrap{F}}
\newcommand{\SquareFap}{\@SquareLetter{\rrFap}}
\newcommand{\rrhFap}{\raisebox{-0.25mm}{\SquareFap}\,}
\newcommand{\RubikFap}{\raisebox{\@hRubik}{\SquareFap}\,}
\newcommand{\textRubikFap}{\rrhFap\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation L}
%
%  \begin{macro}{\rrL}
%  \begin{macro}{\SquareL}
%  \begin{macro}{\rrhL}
%  \begin{macro}{\RubikL}
%  \begin{macro}{\textRubikL}
%  These commands  all draw forms which denote the L rotation.
% \begin{macrocode}
\newcommand{\rrL}{\textbf{\textsf{L}}}
%%
\newcommand{\SquareL}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\sd, \sb) -- (\sd, \sbh);
\draw [thick] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhL}{\raisebox{-0.333\height}{\SquareL}\,}
%%
\newcommand{\RubikL}{%
\begin{minipage}{0.6cm}
\centering
\SquareL\\
\rrL
\end{minipage}%
}
\newcommand{\textRubikL}{\rrL\,\rrhL}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Lp}
%
%  \begin{macro}{\rrLp}
%  \begin{macro}{\SquareLp}
%  \begin{macro}{\rrhLp}
%  \begin{macro}{\RubikLp}
%  \begin{macro}{\textRubikLp}
%  These commands  all draw forms which denote the Lp rotation.
% \begin{macrocode}
\newcommand{\rrLp}{\textbf{\textsf{L}$^\prime$}}
%%
\newcommand{\SquareLp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick,->] (\sd, \sb) -- (\sd, \sbh);
\draw [thick] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLp}{\raisebox{-0.333\height}{\SquareLp}\,}
%%
\newcommand{\RubikLp}{%
\begin{minipage}{0.6cm}
\centering
\SquareLp\\
\rrLp
\end{minipage}%
}
\newcommand{\textRubikLp}{\rrLp\,\rrhLp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Lw}
%
%  \begin{macro}{\rrLw}
%  \begin{macro}{\SquareLw}
%  \begin{macro}{\rrhLw}
%  \begin{macro}{\RubikLw}
%  \begin{macro}{\textRubikLw}
%  These commands  all draw forms which denote the Lw rotation.
% \begin{macrocode}
\newcommand{\rrLw}{\textbf{\textsf{L\footnotesize{w}}}}
%%
\newcommand{\SquareLw}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\sd, \sb) -- (\sd, \sbh);
\draw [thick, <-] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLw}{\raisebox{-0.333\height}{\SquareLw}\,}
%%
\newcommand{\RubikLw}{%
\begin{minipage}{0.6cm}
\centering
\SquareLw\\
\rrLw
\end{minipage}%
}
\newcommand{\textRubikLw}{\rrLw\,\rrhLw}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Lwp}
%
%  \begin{macro}{\rrLwp}
%  \begin{macro}{\SquareLwp}
%  \begin{macro}{\rrhLwp}
%  \begin{macro}{\RubikLwp}
%  \begin{macro}{\textRubikLwp}
%  These commands  all draw forms which denote the Lwp rotation.
% \begin{macrocode}
\newcommand{\rrLwp}{\textbf{\textsf{L\footnotesize{w}}$^\prime$}}
%%
\newcommand{\SquareLwp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick,->] (\sd, \sb) -- (\sd, \sbh);
\draw [thick,->] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLwp}{\raisebox{-0.333\height}{\SquareLwp}\,}
%%
\newcommand{\RubikLwp}{%
\begin{minipage}{0.6cm}
\centering
\SquareLwp\\
\rrLwp
\end{minipage}%
}
\newcommand{\textRubikLwp}{\rrLwp\,\rrhLwp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{    Rotation Ls}
%
%  \begin{macro}{\rrLs}
%  \begin{macro}{\SquareLs}
%  \begin{macro}{\rrhLs}
%  \begin{macro}{\RubikLs}
%  \begin{macro}{\textRubikLs}
%  These commands  all draw forms which denote the Ls rotation.
% \begin{macrocode}
\newcommand{\rrLs}{\@rrs{L}}
%%
\newcommand{\SquareLs}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\sd, \sb) -- (\sd, \sbh);
\draw [thick] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick, <-] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLs}{\raisebox{-0.333\height}{\SquareLs}\,}
%%
\newcommand{\RubikLs}{%
\begin{minipage}{0.6cm}
\centering
\SquareLs\\
\rrLs
\end{minipage}%
}
\newcommand{\textRubikLs}{\rrLs\,\rrhLs}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{    Rotation Lsp}
%
%  \begin{macro}{\rrLsp}
%  \begin{macro}{\SquareLsp}
%  \begin{macro}{\rrhLsp}
%  \begin{macro}{\RubikLsp}
%  \begin{macro}{\textRubikLsp}
%  These commands  all draw forms which denote the Lsp rotation.
% \begin{macrocode}
\newcommand{\rrLsp}{\@rrsp{L}}
%%
\newcommand{\SquareLsp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\sd, \sb) -- (\sd, \sbh);
\draw [thick] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick, ->] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLsp}{\raisebox{-0.333\height}{\SquareLsp}\,}
%%
\newcommand{\RubikLsp}{%
\begin{minipage}{0.6cm}
\centering
\SquareLsp\\
\rrLsp
\end{minipage}%
}
\newcommand{\textRubikLsp}{\rrLsp\,\rrhLsp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{    Rotation La}
%
%  \begin{macro}{\rrLa}
%  \begin{macro}{\SquareLa}
%  \begin{macro}{\rrhLa}
%  \begin{macro}{\RubikLa}
%  \begin{macro}{\textRubikLa}
%  These commands  all draw forms which denote the La rotation.
% \begin{macrocode}
\newcommand{\rrLa}{\@rra{L}}
%%
\newcommand{\SquareLa}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\sd, \sb) -- (\sd, \sbh);
\draw [thick] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick, ->] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLa}{\raisebox{-0.333\height}{\SquareLa}\,}
%%
\newcommand{\RubikLa}{%
\begin{minipage}{0.6cm}
\centering
\SquareLa\\
\rrLa
\end{minipage}%
}
\newcommand{\textRubikLa}{\rrLa\,\rrhLa}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Lap}
%
%  \begin{macro}{\rrLap}
%  \begin{macro}{\SquareLap}
%  \begin{macro}{\rrhLap}
%  \begin{macro}{\RubikLap}
%  \begin{macro}{\textRubikLap}
%  These commands  all draw forms which denote the Lap rotation.
% \begin{macrocode}
\newcommand{\rrLap}{\@rrap{L}}
%%
\newcommand{\SquareLap}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\sd, \sb) -- (\sd, \sbh);
\draw [thick] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick, <-] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLap}{\raisebox{-0.333\height}{\SquareLap}\,}
%%
\newcommand{\RubikLap}{%
\begin{minipage}{0.6cm}
\centering
\SquareLap\\
\rrLap
\end{minipage}%
}
\newcommand{\textRubikLap}{\rrLap\,\rrhLap}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{    Rotation M}
%
%  \begin{macro}{\rrM}
%  \begin{macro}{\SquareM}
%  \begin{macro}{\rrhM}
%  \begin{macro}{\RubikM}
%  \begin{macro}{\textRubikM}
%  These commands  all draw forms which denote the M rotation.
% \begin{macrocode}
\newcommand{\rrM}{\textbf{\textsf{M}}}
%%
\newcommand{\SquareM}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\sd, \sb) -- (\sd, \sbh);
\draw [thick, <-] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhM}{\raisebox{-0.333\height}{\SquareM}\,}
%%
\newcommand{\RubikM}{%
\begin{minipage}{0.6cm}
\centering
\SquareM\\
\rrM
\end{minipage}%
}
\newcommand{\textRubikM}{\rrM\,\rrhM}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Mp}
%
%  \begin{macro}{\rrMp}
%  \begin{macro}{\SquareMp}
%  \begin{macro}{\rrhMp}
%  \begin{macro}{\RubikMp}
%  \begin{macro}{\textRubikMp}
%  These commands  all draw forms which denote the Mp rotation.
% \begin{macrocode}
\newcommand{\rrMp}{\textbf{\textsf{M}$^\prime$}}
%%
\newcommand{\SquareMp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\sd, \sb) -- (\sd, \sbh);
\draw [thick,->] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhMp}{\raisebox{-0.333\height}{\SquareMp}\,}
%%
\newcommand{\RubikMp}{%
\begin{minipage}{0.6cm}
\centering
\SquareMp\\
\rrMp
\end{minipage}%
}
\newcommand{\textRubikMp}{\rrMp\,\rrhMp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{    Rotation R}
%
%  \begin{macro}{\rrR}
%  \begin{macro}{\SquareR}
%  \begin{macro}{\rrhR}
%  \begin{macro}{\RubikR}
%  \begin{macro}{\textRubikR}
%  These commands  all draw forms which denote the R rotation.
% \begin{macrocode}
\newcommand{\rrR}{\textbf{\textsf{R}}}
%%
\newcommand{\SquareR}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
%% draw three lines in the square, one with an arrow
\draw [thick] (\sd, \sb) -- (\sd, \sbh);
\draw [thick] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick, ->] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhR}{\raisebox{-0.333\height}{\SquareR}\,}
%%
\newcommand{\RubikR}{%
\begin{minipage}{0.6cm}
\centering
\SquareR\\
\rrR
\end{minipage}%
}
\newcommand{\textRubikR}{\rrR\,\rrhR}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{    Rotation Rp}
%
%  \begin{macro}{\rrRp}
%  \begin{macro}{\SquareRp}
%  \begin{macro}{\rrhRp}
%  \begin{macro}{\RubikRp}
%  \begin{macro}{\textRubikRp}
%  These commands  all draw forms which denote the Rp rotation.
% \begin{macrocode}
\newcommand{\rrRp}{\textbf{\textsf{R}$^\prime$}}
%%
\newcommand{\SquareRp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\sd, \sb) -- (\sd, \sbh);
\draw [thick] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick, <-] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRp}{\raisebox{-0.333\height}{\SquareRp}\,}
%%
\newcommand{\RubikRp}{%
\begin{minipage}{0.6cm}
\centering
\SquareRp\\
\rrRp
\end{minipage}%
}
\newcommand{\textRubikRp}{\rrRp\,\rrhRp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{    Rotation Rw}
%
%  \begin{macro}{\rrRw}
%  \begin{macro}{\SquareRw}
%  \begin{macro}{\rrhRw}
%  \begin{macro}{\RubikRw}
%  \begin{macro}{\textRubikRw}
%  These commands  all draw forms which denote the Rw rotation.
% \begin{macrocode}
\newcommand{\rrRw}{\textbf{\textsf{R\footnotesize{w}}}}
%%
\newcommand{\SquareRw}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\sd, \sb) -- (\sd, \sbh);
\draw [thick, ->] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick, ->] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRw}{\raisebox{-0.333\height}{\SquareRw}\,}
%%
\newcommand{\RubikRw}{%
\begin{minipage}{0.6cm}
\centering
\SquareRw\\
\rrRw
\end{minipage}%
}
\newcommand{\textRubikRw}{\rrRw\,\rrhRw}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{    Rotation Rwp}
%
%  \begin{macro}{\rrRwp}
%  \begin{macro}{\SquareRwp}
%  \begin{macro}{\rrhRwp}
%  \begin{macro}{\RubikRwp}
%  \begin{macro}{\textRubikRwp}
%  These commands  all draw forms which denote the Rwp rotation.
% \begin{macrocode}
\newcommand{\rrRwp}{\textbf{\textsf{R\footnotesize{w}}$^\prime$}}
%%
\newcommand{\SquareRwp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\sd, \sb) -- (\sd, \sbh);
\draw [thick, <-] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick, <-] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRwp}{\raisebox{-0.333\height}{\SquareRwp}\,}
%%
\newcommand{\RubikRwp}{%
\begin{minipage}{0.6cm}
\centering
\SquareRwp\\
\rrRwp
\end{minipage}%
}
\newcommand{\textRubikRwp}{\rrRwp\,\rrhRwp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Rs}
%
%  \begin{macro}{\rrRs}
%  \begin{macro}{\SquareRs}
%  \begin{macro}{\rrhRs}
%  \begin{macro}{\RubikRs}
%  \begin{macro}{\textRubikRs}
%  These commands  all draw forms which denote the Rs rotation.
% \begin{macrocode}
\newcommand{\rrRs}{\@rrs{R}}
%%
\newcommand{\SquareRs}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick,->] (\sd, \sb) -- (\sd, \sbh);
\draw [thick] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick,->] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRs}{\raisebox{-0.333\height}{\SquareRs}\,}
%%
\newcommand{\RubikRs}{%
\begin{minipage}{0.6cm}
\centering
\SquareRs\\
\rrRs
\end{minipage}%
}
\newcommand{\textRubikRs}{\rrRs\,\rrhRs}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Rsp}
%
%  \begin{macro}{\rrRsp}
%  \begin{macro}{\SquareRsp}
%  \begin{macro}{\rrhRsp}
%  \begin{macro}{\RubikRsp}
%  \begin{macro}{\textRubikRsp}
%  These commands  all draw forms which denote the Rsp rotation.
% \begin{macrocode}
\newcommand{\rrRsp}{\@rrsp{R}}
%%
\newcommand{\SquareRsp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick,<-] (\sd, \sb) -- (\sd, \sbh);
\draw [thick] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick,<-] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRsp}{\raisebox{-0.333\height}{\SquareRsp}\,}
%%
\newcommand{\RubikRsp}{%
\begin{minipage}{0.6cm}
\centering
\SquareRsp\\
\rrRsp
\end{minipage}%
}
\newcommand{\textRubikRsp}{\rrRsp\,\rrhRsp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Ra}
%
%  \begin{macro}{\rrRa}
%  \begin{macro}{\SquareRa}
%  \begin{macro}{\rrhRa}
%  \begin{macro}{\RubikRa}
%  \begin{macro}{\textRubikRa}
%  These commands  all draw forms which denote the Ra rotation.
% \begin{macrocode}
\newcommand{\rrRa}{\@rra{R}}
%%
\newcommand{\SquareRa}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick,<-] (\sd, \sb) -- (\sd, \sbh);
\draw [thick] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick,->] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRa}{\raisebox{-0.333\height}{\SquareRa}\,}
%%
\newcommand{\RubikRa}{%
\begin{minipage}{0.6cm}
\centering
\SquareRa\\
\rrRa
\end{minipage}%
}
\newcommand{\textRubikRa}{\rrRa\,\rrhRa}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Rap}
%
%  \begin{macro}{\rrRap}
%  \begin{macro}{\SquareRap}
%  \begin{macro}{\rrhRap}
%  \begin{macro}{\RubikRap}
%  \begin{macro}{\textRubikRap}
%  These commands  all draw forms which denote the Rap rotation.
% \begin{macrocode}
\newcommand{\rrRap}{\@rrap{R}}
%%
\newcommand{\SquareRap}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick,->] (\sd, \sb) -- (\sd, \sbh);
\draw [thick] (\sdd,\sb) -- (\sdd, \sbh);
\draw [thick,<-] (\sddd, \sb) -- (\sddd, \sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRap}{\raisebox{-0.333\height}{\SquareRap}\,}
%%
\newcommand{\RubikRap}{%
\begin{minipage}{0.6cm}
\centering
\SquareRap\\
\rrRap
\end{minipage}%
}
\newcommand{\textRubikRap}{\rrRap\,\rrhRap}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation S}
%
%  \begin{macro}{\rrS}
%  \begin{macro}{\SquareS}
%  \begin{macro}{\rrhS}
%  \begin{macro}{\RubikS}
%  \begin{macro}{\textRubikS}
%  These commands  all draw forms which denote the S rotation.
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrS}{\@rr{S}}
\newcommand{\SquareS}{\@SquareLetter{\rrS}}
\newcommand{\rrhS}{\raisebox{-0.25mm}{\SquareS}\,}
\newcommand{\RubikS}{\raisebox{\@hRubik}{\SquareS}\,}
\newcommand{\textRubikS}{\rrhS\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Sp}
%
%  \begin{macro}{\rrSp}
%  \begin{macro}{\SquareSp}
%  \begin{macro}{\rrhSp}
%  \begin{macro}{\RubikSp}
%  \begin{macro}{\textRubikSp}
%  These commands  all draw forms which denote the Sp rotation.
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrSp}{\@rrp{S}}
\newcommand{\SquareSp}{\@SquareLetter{\rrSp}}
\newcommand{\rrhSp}{\raisebox{-0.25mm}{\SquareSp}\,}
\newcommand{\RubikSp}{\raisebox{\@hRubik}{\SquareSp}\,}
\newcommand{\textRubikSp}{\rrhSp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Su}
%
%  \begin{macro}{\rrSu}
%  \begin{macro}{\rrhSu}
%  \begin{macro}{\RubikSu}
%  \begin{macro}{\textRubikSu}
%  These commands  draw forms of the Singmaster Su slice rotation.
%  We also need to finetune the spacing 
%  between these `slice' hieroglyphs (especially Fs  and Bs).
% \begin{macrocode}
\newcommand{\rrSu}{\textbf{\textsf{S\footnotesize{u}}}}
\newcommand{\rrhSu}{\rrhEp}%
\newcommand{\RubikSu}{%
\begin{minipage}{0.6cm}
\centering
\SquareEp\\
\rrSu
\end{minipage}%
}
\newcommand{\textRubikSu}{\rrSu\,\rrhEp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Sup}
%
%  \begin{macro}{\rrSup}
%  \begin{macro}{\rrhSup}
%  \begin{macro}{\RubikSup}
%  \begin{macro}{\textRubikSup}
%  These commands  draw forms of the Singmaster Sup slice rotation.
%  We also need to finetune the spacing 
%  between these `slice' hieroglyphs (especially Fs  and Bs).
% \begin{macrocode}
\newcommand{\rrSup}{\textbf{\textsf{S\footnotesize{u}}$^\prime$}}
\newcommand{\rrhSup}{\rrhE}%
\newcommand{\RubikSup}{%
\begin{minipage}{0.6cm}
\centering
\SquareE\\
\rrSup
\end{minipage}%
}
\newcommand{\textRubikSup}{\rrSup\,\rrhE}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Sd}
%
%  \begin{macro}{\rrSd}
%  \begin{macro}{\rrhSd}
%  \begin{macro}{\RubikSd}
%  \begin{macro}{\textRubikSd}
%  These commands  draw forms of the Singmaster Sd slice rotation.
% \begin{macrocode}
\newcommand{\rrSd}{\textbf{\textsf{S\footnotesize{d}}}}
\newcommand{\rrhSd}{\rrhE}%
\newcommand{\RubikSd}{%
\begin{minipage}{0.6cm}
\centering
\SquareE\\
\rrSd
\end{minipage}%
}
\newcommand{\textRubikSd}{\rrSd\,\rrhE}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Sdp}
%
%  \begin{macro}{\rrSdp}
%  \begin{macro}{\rrhSdp}
%  \begin{macro}{\RubikSdp}
%  \begin{macro}{\textRubikSdp}
%  These commands  draw forms of the Singmaster Sdp slice rotation.
% \begin{macrocode}
\newcommand{\rrSdp}{\textbf{\textsf{S\footnotesize{d}}$^\prime$}}
\newcommand{\rrhSdp}{\rrhEp}%
\newcommand{\RubikSdp}{%
\begin{minipage}{0.6cm}
\centering
\SquareEp\\
\rrSdp
\end{minipage}%
}
\newcommand{\textRubikSdp}{\rrSdp\,\rrhEp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Sl}
%
%  \begin{macro}{\rrSl}
%  \begin{macro}{\rrhSl}
%  \begin{macro}{\RubikSl}
%  \begin{macro}{\textRubikSl}
%  These commands  draw forms of the Singmaster Sl slice rotation.
% \begin{macrocode}
\newcommand{\rrSl}{\textbf{\textsf{S\footnotesize{l}}}}
\newcommand{\rrhSl}{\rrhM}%
\newcommand{\RubikSl}{%
\begin{minipage}{0.6cm}
\centering
\SquareM\\
\rrSl
\end{minipage}%
}
\newcommand{\textRubikSl}{\rrSl\,\rrhM}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Slp}
%
%  \begin{macro}{\rrSlp}
%  \begin{macro}{\rrhSlp}
%  \begin{macro}{\RubikSlp}
%  \begin{macro}{\textRubikSlp}
%  These commands  draw forms of the Singmaster Slp slice rotation.
% \begin{macrocode}
\newcommand{\rrSlp}{\textbf{\textsf{S\footnotesize{l}}$^\prime$}}
\newcommand{\rrhSlp}{\rrhMp}%
\newcommand{\RubikSlp}{%
\begin{minipage}{0.6cm}
\centering
\SquareMp\\
\rrSlp
\end{minipage}%
}
\newcommand{\textRubikSlp}{\rrSlp\,\rrhMp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Sr}
%
%  \begin{macro}{\rrSr}
%  \begin{macro}{\rrhSr}
%  \begin{macro}{\RubikSr}
%  \begin{macro}{\textRubikSr}
%  These commands  draw forms of the Singmaster Sr slice rotation.
% \begin{macrocode}
\newcommand{\rrSr}{\textbf{\textsf{S\footnotesize{r}}}}
\newcommand{\rrhSr}{\rrhMp}%
\newcommand{\RubikSr}{%
\begin{minipage}{0.6cm}
\centering
\SquareMp\\
\rrSr
\end{minipage}%
}
\newcommand{\textRubikSr}{\rrSr\,\rrhMp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Srp}
%
%  \begin{macro}{\rrSrp}
%  \begin{macro}{\rrhSrp}
%  \begin{macro}{\RubikSrp}
%  \begin{macro}{\textRubikSrp}
%  These commands  draw forms of the Singmaster Srp slice rotation.
% \begin{macrocode}
\newcommand{\rrSrp}{\textbf{\textsf{S\footnotesize{r}}$^\prime$}}
\newcommand{\rrhSrp}{\rrhM}%
\newcommand{\RubikSrp}{%
\begin{minipage}{0.6cm}
\centering
\SquareM\\
\rrSrp
\end{minipage}%
}
\newcommand{\textRubikSrp}{\rrSrp\,\rrhM}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Sf}
%
%  \begin{macro}{\rrSf}
%  \begin{macro}{\rrhSf}
%  \begin{macro}{\RubikSf}
%  \begin{macro}{\textRubikSf}
%  These commands  draw forms of the Singmaster Sf slice rotation.
%  We need to just make square with Sf in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrSf}{\textbf{\textsf{S\footnotesize{f}}}}
\newcommand{\SquareSf}{\@SquareLetter{\rrSf}}
\newcommand{\rrhSf}{\raisebox{-0.25mm}{\SquareSf}\,}
\newcommand{\RubikSf}{\raisebox{\@hRubik}{\SquareSf}\,}
\newcommand{\textRubikSf}{\rrhSf\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Sfp}
%
%  \begin{macro}{\rrSfp}
%  \begin{macro}{\rrhSfp}
%  \begin{macro}{\RubikSfp}
%  \begin{macro}{\textRubikSfp}
%  These commands  draw forms of the Singmaster Sfp slice rotation.
%  We need to just make square with Sfp in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrSfp}{\textbf{\textsf{S\footnotesize{f}}$^\prime$}}
\newcommand{\SquareSfp}{\@SquareLetter{\rrSfp}}
\newcommand{\rrhSfp}{\raisebox{-0.25mm}{\SquareSfp}\,}
\newcommand{\RubikSfp}{\raisebox{\@hRubik}{\SquareSfp}\,}
\newcommand{\textRubikSfp}{\rrhSfp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Sb}
%
%  \begin{macro}{\rrSb}
%  \begin{macro}{\rrhSb}
%  \begin{macro}{\RubikSb}
%  \begin{macro}{\textRubikSb}
%  These commands  draw forms of the Singmaster Sb slice rotation.
%  We need to just make square with Sb in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrSb}{\textbf{\textsf{S\footnotesize{b}}}}
\newcommand{\SquareSb}{\@SquareLetter{\rrSb}}
\newcommand{\rrhSb}{\raisebox{-0.25mm}{\SquareSb}\,}
\newcommand{\RubikSb}{\raisebox{\@hRubik}{\SquareSb}\,}
\newcommand{\textRubikSb}{\rrhSb\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Sbp}
%
%  \begin{macro}{\rrSbp}
%  \begin{macro}{\rrhSbp}
%  \begin{macro}{\RubikSbp}
%  \begin{macro}{\textRubikSbp}
%  These commands  draw forms of the Singmaster Sbp slice rotation.
%  We need to just make square with Sbp in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
% Not visible from th front.
% \begin{macrocode}
\newcommand{\rrSbp}{\textbf{\textsf{S\footnotesize{b}}$^\prime$}}
\newcommand{\SquareSbp}{\@SquareLetter{\rrSbp}}
\newcommand{\rrhSbp}{\raisebox{-0.25mm}{\SquareSbp}\,}
\newcommand{\RubikSbp}{\raisebox{\@hRubik}{\SquareSbp}\,}
\newcommand{\textRubikSbp}{\rrhSbp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation U}
%
%  \begin{macro}{\rrU}
%  \begin{macro}{\SquareU}
%  \begin{macro}{\rrhU}
%  \begin{macro}{\RubikU}
%  \begin{macro}{\textRubikU}
%  These commands  all draw forms which denote the U rotation.
% \begin{macrocode}
\newcommand{\rrU}{\textbf{\textsf{U}}}
%%
\newcommand{\SquareU}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhU}{\raisebox{-0.333\height}{\SquareU}\,}
%%
\newcommand{\RubikU}{%
\begin{minipage}{0.6cm}
\centering
\SquareU\\
\rrU
\end{minipage}%%
}
\newcommand{\textRubikU}{\rrU\,\rrhU}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Uw}
%
%  \begin{macro}{\rrUw}
%  \begin{macro}{\SquareUw}
%  \begin{macro}{\rrhUw}
%  \begin{macro}{\RubikUw}
%  \begin{macro}{\textRubikUw}
%  These commands  all draw forms which denote the Uw rotation.
% \begin{macrocode}
\newcommand{\rrUw}{\textbf{\textsf{U\footnotesize{w}}}}
%%
\newcommand{\SquareUw}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick, <-] (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
%
\newcommand{\rrhUw}{\raisebox{-0.333\height}{\SquareUw}\,}
%%
\newcommand{\RubikUw}{%
\begin{minipage}{0.6cm}
\centering
\SquareUw\\
\rrUw
\end{minipage}%%
}
%%
\newcommand{\textRubikUw}{\rrUw\,\rrhUw}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Up}
%
%  \begin{macro}{\rrUp}
%  \begin{macro}{\SquareUp}
%  \begin{macro}{\rrhUp}
%  \begin{macro}{\RubikUp}
%  \begin{macro}{\textRubikUp}
%  These commands  all draw forms which denote the Up rotation.
% \begin{macrocode}
\newcommand{\rrUp}{\textbf{\textsf{U}$^\prime$}}
%%
\newcommand{\SquareUp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhUp}{\raisebox{-0.333\height}{\SquareUp}\,}
%%
\newcommand{\RubikUp}{%
\begin{minipage}{0.6cm}
\centering
\SquareUp\\
\rrUp
\end{minipage}%%
}
\newcommand{\textRubikUp}{\rrUp\,\rrhUp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Uwp}
%
%  \begin{macro}{\rrUwp}
%  \begin{macro}{\SquareUwp}
%  \begin{macro}{\rrhUwp}
%  \begin{macro}{\RubikUwp}
%  \begin{macro}{\textRubikUwp}
%  These commands  all draw forms which denote the Uwp rotation.
% \begin{macrocode}
\newcommand{\rrUwp}{\textbf{\textsf{U\footnotesize{w}}$^\prime$}}
%%
\newcommand{\SquareUwp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick, ->] (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhUwp}{\raisebox{-0.333\height}{\SquareUwp}\,}
%%
\newcommand{\RubikUwp}{%
\begin{minipage}{0.6cm}
\centering
\SquareUwp\\
\rrUwp
\end{minipage}%%
}
\newcommand{\textRubikUwp}{\rrUwp\,\rrhUwp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Us} 
%
%  \begin{macro}{\rrUs}
%  \begin{macro}{\SquareUs}
%  \begin{macro}{\rrhUs}
%  \begin{macro}{\RubikUs}
%  \begin{macro}{\textRubikUs}
%  These commands  all draw forms which denote the Us rotation.
% \begin{macrocode}
\newcommand{\rrUs}{\@rrs{U}}
%%
\newcommand{\SquareUs}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick, <-]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhUs}{\raisebox{-0.333\height}{\SquareUs}\,}
%%
\newcommand{\RubikUs}{%
\begin{minipage}{0.6cm}
\centering
\SquareUs\\
\rrUs
\end{minipage}%
}
\newcommand{\textRubikUs}{\rrUs\,\rrhUs}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Usp} 
%
%  \begin{macro}{\rrUsp}
%  \begin{macro}{\SquareUsp}
%  \begin{macro}{\rrhUs}
%  \begin{macro}{\RubikUs}
%  \begin{macro}{\textRubikUsp}
%  These commands  all draw forms which denote the Usp rotation.
% \begin{macrocode}
\newcommand{\rrUsp}{\@rrsp{U}}
%%
\newcommand{\SquareUsp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick, ->]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhUsp}{\raisebox{-0.333\height}{\SquareUsp}\,}
%%
\newcommand{\RubikUsp}{%
\begin{minipage}{0.6cm}
\centering
\SquareUsp\\
\rrUsp
\end{minipage}%
}
\newcommand{\textRubikUsp}{\rrUsp\,\rrhUsp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Ua} 
%
%  \begin{macro}{\rrUa}
%  \begin{macro}{\SquareUa}
%  \begin{macro}{\rrhUa}
%  \begin{macro}{\RubikUa}
%  \begin{macro}{\textRubikUa}
%  These commands  all draw forms which denote the Ua rotation.
% \begin{macrocode}
\newcommand{\rrUa}{\@rra{U}}
%%
\newcommand{\SquareUa}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick, ->]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhUa}{\raisebox{-0.333\height}{\SquareUa}\,}
%%
\newcommand{\RubikUa}{%
\begin{minipage}{0.6cm}
\centering
\SquareUa\\
\rrUa
\end{minipage}%
}
\newcommand{\textRubikUa}{\rrUa\,\rrhUa}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotation Uap} 
%
%  \begin{macro}{\rrUap}
%  \begin{macro}{\SquareUap}
%  \begin{macro}{\rrhUap}
%  \begin{macro}{\RubikUap}
%  \begin{macro}{\textRubikUap}
%  These commands  all draw forms which denote the Uap rotation.
% \begin{macrocode}
\newcommand{\rrUap}{\@rrap{U}}
%%
\newcommand{\SquareUap}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\sb,\sddd) -- (\sbh, \sddd);
\draw [thick]     (\sb,\sdd) --  (\sbh, \sdd);
\draw [thick, <-]     (\sb,\sd) --   (\sbh, \sd);
\end{tikzpicture}%
}
\newcommand{\rrhUap}{\raisebox{-0.333\height}{\SquareUap}\,}
%%
\newcommand{\RubikUap}{%
\begin{minipage}{0.6cm}
\centering
\SquareUap\\
\rrUap
\end{minipage}%
}
\newcommand{\textRubikUap}{\rrUap\,\rrhUap}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsection{    Rotation commands --- axis rotations}
%
%  \subsubsection{    Rotations x and xp}
%
%  \begin{macro}{\rrx}
%  \begin{macro}{\rrhx}
%  \begin{macro}{\Rubikx}
%  These commands  all draw forms which denote the x rotation.
% \begin{macrocode}
\newcommand{\rrx}{\textbf{\textsf{x}}}
\newcommand{\Rubikx}{\@xyzRubik{x}}
\newcommand{\rrhx}{\@xyzh{x}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%  \begin{macro}{\rrxp}
%  \begin{macro}{\rrhxp}
%  \begin{macro}{\Rubikxp}
%  These commands  all draw forms which denote the xp rotation.
% \begin{macrocode}
\newcommand{\rrxp}{\textbf{\textsf{x}$^\prime$}}
\newcommand{\Rubikxp}{\@xyzRubikp{x}}
\newcommand{\rrhxp}{\@xyzhp{x}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotations y and yp}
%
%  \begin{macro}{\rry}
%  \begin{macro}{\rrhy}
%  \begin{macro}{\Rubiky}
%  These commands  all draw forms which denote the y rotation.
% \begin{macrocode}
\newcommand{\rry}{\textbf{\textsf{y}}}
\newcommand{\Rubiky}{\@xyzRubik{y}}
\newcommand{\rrhy}{\@xyzh{y}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%  \begin{macro}{\rryp}
%  \begin{macro}{\rrhyp}
%  \begin{macro}{\Rubikyp}
%  These commands  all draw forms which denote the yp rotation.
% \begin{macrocode}
\newcommand{\rryp}{\textbf{\textsf{y}$^\prime$}}
\newcommand{\Rubikyp}{\@xyzRubikp{y}}
\newcommand{\rrhyp}{\@xyzhp{y}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotations z and zp}
%
%  \begin{macro}{\rrz}
%  \begin{macro}{\rrhz}
%  \begin{macro}{\Rubikz}
%  These commands  all draw forms which denote the z rotation.
% \begin{macrocode}
\newcommand{\rrz}{\textbf{\textsf{z}}}
\newcommand{\Rubikz}{\@xyzRubik{z}}
\newcommand{\rrhz}{\@xyzh{z}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%  \begin{macro}{\rrzp}
%  \begin{macro}{\rrhzp}
%  \begin{macro}{\Rubikzp}
%  These commands  all draw forms which denote the zp rotation.
% \begin{macrocode}
\newcommand{\rrzp}{\textbf{\textsf{z}$^\prime$}}
\newcommand{\Rubikzp}{\@xyzRubikp{z}}
\newcommand{\rrhzp}{\@xyzhp{z}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotations u and d}
%
%  \begin{macro}{\rru}
%  \begin{macro}{\rrhu}
%  \begin{macro}{\Rubiku}
%  These commands  all draw forms which denote the u rotation.
% \begin{macrocode}
\newcommand{\rru}{\textbf{\textsf{u}}}
\newcommand{\Rubiku}{\@xyzRubik{u}}
\newcommand{\rrhu}{\@xyzh{u}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%  \begin{macro}{\rrd}
%  \begin{macro}{\rrhd}
%  \begin{macro}{\Rubikd}
%  These commands  all draw forms which denote the d rotation.
% \begin{macrocode}
\newcommand{\rrd}{\textbf{\textsf{d}}}
\newcommand{\Rubikd}{\@xyzRubik{d}}
\newcommand{\rrhd}{\@xyzh{d}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotations l and r}
%
%  \begin{macro}{\rrl}
%  \begin{macro}{\rrhl}
%  \begin{macro}{\Rubikl}
%  These commands  all draw forms which denote the l rotation.
% \begin{macrocode}
\newcommand{\rrl}{\textbf{\textsf{l}}}
\newcommand{\Rubikl}{\@xyzRubik{l}}
\newcommand{\rrhl}{\@xyzh{l}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%  \begin{macro}{\rrr}
%  \begin{macro}{\rrhr}
%  \begin{macro}{\Rubikr}
%  These commands  all draw forms which denote the r rotation.
% \begin{macrocode}
\newcommand{\rrr}{\textbf{\textsf{r}}}
\newcommand{\Rubikr}{\@xyzRubik{r}}
\newcommand{\rrhr}{\@xyzh{r}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{     Rotations f and b}
%
%  \begin{macro}{\rrf}
%  \begin{macro}{\rrhf}
%  \begin{macro}{\Rubikf}
%  These commands  all draw forms which denote the f rotation.
% \begin{macrocode}
\newcommand{\rrf}{\textbf{\textsf{f}}}
\newcommand{\Rubikf}{\@xyzRubik{f}}
\newcommand{\rrhf}{\@xyzh{f}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%  \begin{macro}{\rrb}
%  \begin{macro}{\rrhb}
%  \begin{macro}{\Rubikb}
%  These commands  all draw forms which denote the b rotation.
% \begin{macrocode}
\newcommand{\rrb}{\textbf{\textsf{b}}}
\newcommand{\Rubikb}{\@xyzRubik{b}}
\newcommand{\rrhb}{\@xyzh{b}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
% --------------------------
%    End of this package
% --------------------------
%    \begin{macrocode}
%</rubikcube>
%    \end{macrocode}
%
%
%
%
% \Finale
%
\endinput