summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-09-25 23:12:16 +0000
committerKarl Berry <karl@freefriends.org>2015-09-25 23:12:16 +0000
commit97e34175d0f5e100422fbd133cadfcf6f5e944e6 (patch)
tree11f29e6d9beb227b762da99c70f81b369733d71a
parentead3792e2d57305d0777008c5073968c36ec7ba3 (diff)
rubik (25sep15)
git-svn-id: svn://tug.org/texlive/trunk@38457 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl255
-rw-r--r--Master/texmf-dist/doc/latex/rubik/README70
-rw-r--r--Master/texmf-dist/doc/latex/rubik/README.txt98
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubik-doc-figA.pdf (renamed from Master/texmf-dist/doc/latex/rubik/Rubik_doc_figA.pdf)bin3929 -> 3929 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubik-doc-figB.pdf (renamed from Master/texmf-dist/doc/latex/rubik/Rubik_doc_figB.pdf)bin4076 -> 4076 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubik-doc-figC.pdf (renamed from Master/texmf-dist/doc/latex/rubik/Rubik_doc_figC.pdf)bin2799 -> 2799 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubik-doc-figD.pdfbin0 -> 2908 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubik-doc-figE.pdf (renamed from Master/texmf-dist/doc/latex/rubik/Rubik_doc_figE.pdf)bin4064 -> 4064 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubik-doc-figF.pdfbin0 -> 7033 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubik_doc_figD.pdfbin2968 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figA.pdf (renamed from Master/texmf-dist/doc/latex/rubik/Rubikrot_doc_figA.pdf)bin1538 -> 1538 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figB.pdf (renamed from Master/texmf-dist/doc/latex/rubik/Rubikrot_doc_figB.pdf)bin1856 -> 1856 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figC.pdfbin0 -> 3864 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figD.pdfbin0 -> 9342 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/example-cube.pdfbin128323 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/example-cube.tex188
-rw-r--r--Master/texmf-dist/doc/latex/rubik/example-rot1.pdfbin104322 -> 0 bytes
-rwxr-xr-xMaster/texmf-dist/doc/latex/rubik/example-rot1.sh3
-rw-r--r--Master/texmf-dist/doc/latex/rubik/example-rot1.tex307
-rw-r--r--Master/texmf-dist/doc/latex/rubik/example-rot2.pdfbin40513 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/example-rot2.sh1
-rw-r--r--Master/texmf-dist/doc/latex/rubik/example-rot2.tex42
-rw-r--r--Master/texmf-dist/doc/latex/rubik/examples.pdfbin0 -> 204366 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/examples.sh5
-rw-r--r--Master/texmf-dist/doc/latex/rubik/examples.tex467
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikcube.pdfbin463727 -> 724329 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikrotation.148
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikrotation.pdfbin294467 -> 372478 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikrotationPL.pdfbin0 -> 163436 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikrotationPL.tex1333
-rwxr-xr-xMaster/texmf-dist/scripts/rubik/rubikrotation.pl255
-rwxr-xr-xMaster/texmf-dist/source/latex/rubik/example-rot1.bat2
-rwxr-xr-xMaster/texmf-dist/source/latex/rubik/example-rot2.bat1
-rwxr-xr-xMaster/texmf-dist/source/latex/rubik/examples.bat4
-rw-r--r--Master/texmf-dist/source/latex/rubik/rubikcube.dtx3675
-rw-r--r--Master/texmf-dist/source/latex/rubik/rubikcube.ins39
-rw-r--r--Master/texmf-dist/source/latex/rubik/rubikrotation.dtx1177
-rw-r--r--Master/texmf-dist/source/latex/rubik/rubikrotation.ins12
-rw-r--r--Master/texmf-dist/tex/latex/rubik/rubikcube.sty504
-rw-r--r--Master/texmf-dist/tex/latex/rubik/rubikrotation.sty116
40 files changed, 5691 insertions, 2911 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl b/Build/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl
index c09baffa5cc..77c3dadbab3 100755
--- a/Build/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl
+++ b/Build/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl
@@ -1,22 +1,48 @@
-#!/usr/bin/perl -W
-## rubikrotation.pl (version2.0)
-##=============================
-# Copyright 20 January 2014 RWD Nickalls and A Syropoulos
+#!/usr/bin/env perl
+##
+use Carp;
+use Fatal;
+use warnings;
+##
+our $version = "3.0 (25 Sept 2015)";
+##---------------------------
+##
+## rubikrotation.pl
+## VERSION 3.0
+## Copyright 25 September, 2015,
+## RWD Nickalls (dick@nickalls.org)
+## A Syropoulos (asyropoulos@yahoo.com)
+##
+##--------------------------------
+## changes in v3.0:
+## 1) accepts command-line arguments for input (mandatory) and output (optional) filenames
+## default output filename is: rubikOUT.txt
+## 2) included the symbols [ and ] to denote a rotation-name label (ie as well as *)
+## 3) fixed some of the variable definitions (as highlighted by <use strict> pragma)
+##--------------------------------
+## changes in v2.3:
+## 1) accepts a single commandline argument (datafilename)
+## 2) uses the standard modules Carp and Fatal (give extra line info on error)
+##--------------------------------
+## changes in v2.2:
+## 1) changed licence --> LatexPP
+## 2) included random n errors in ERROR messages (lines 492--495)
+## 3) included version number in error message
+##------------------------------
#
# This file is part of the LaTeX rubikrotation package, and
# requires rubikcube.sty and rubikrotation.sty
#
# rubikrotation.pl is a Perl-5 program and free software:
-# you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# any later version.
+# This program can be redistributed and/or modified under the terms
+# of the LaTeX Project Public License Distributed from CTAN
+# archives in directory macros/latex/base/lppl.txt; either
+# version 1 of the License, or any later version.
#
# rubikrotation.pl is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-##=============================
##---------------------------------------------------------------------
## OVERVIEW
@@ -26,8 +52,8 @@
## and writes the new state to the file rubikstateNEW.dat, which is then input
## by the TeX file. Further documentation accompanies the rubikrotation package.
-## Note that all posible state changing rotations of a 3x3x3 cube are
-## either conbinations of, or the inverse of, just 9 different rotations,
+## Note that all possible state changing rotations of a 3x3x3 cube are
+## either combinations of, or the inverse of, just 9 different rotations,
## three associated with each XYZ axis.
##--------------------------------------------------
@@ -42,23 +68,97 @@
## The first argument in each line of the file rubikstate.dat is the rubikkeyword.
## Program is documented in the rubikrotation.pdf (see section ``Overview'')
-### start by opening the three working files (last one ``for append'')
+our $source_file="";
+our $out_file="rubikOUT.txt"; #default
+our $argc=@ARGV;
+our $commandLineArgs = join(" ", @ARGV);
+our $showargs="\tcommandline args = $commandLineArgs\n";
+our $usage="\tUsage: rubikrotation [-h|--help|-v|--version] -i <input file> [-o <out file>]\n";
+our $rubikversion="\tVersion: this is rubikrotation version $version\n";
+#
+## check for correct number of commandline arguments and allocate filenames
+#
+if ($argc == 0||$argc > 4 ){ # croak if 0 or more than 4 arguments
+ croak $rubikversion,$showargs,
+ "\tWrong no of arguments\n",
+ $usage;
+ }
+ else {
+ SWITCHES:
+ while($_ = $ARGV[0]) {
+ shift;
+ if (/^-h$/ || /^--help$/ ) {
+ die $rubikversion,$usage,
+ "\twhere,\n" .
+ "\t[-h|--help]\tgives this help listing\n" .
+ "\t[-v|--version]\tgives version\n" .
+ "\t[-i] \tcreates specified input file\n",
+ "\t[-o] \tcreates specified output file\n",
+ "\tFor documentation see: rubikrotation.pdf,\n",
+ "\trubikrotationPL.pdf and rubikcube.pdf.\n\n";
+ }
+ elsif (/^-v$/ || /^--version$/ ) {die $rubikversion;}
+ elsif (/^-i$/) {
+ if (!@ARGV){
+ croak $showargs,
+ "\tNo input file specified!\n",
+ $usage;
+ }
+ else {
+ $source_file = $ARGV[0],
+ shift;
+ }
+ }
+ elsif (/^-o$/) {
+ if (!@ARGV) {
+ croak $showargs,
+ "\tNo output file specified!\n",
+ $usage;
+ }
+ else {
+ $out_file = $ARGV[0],
+ shift;
+ }
+ }
+ elsif (/^-\w+/) {
+ croak $showargs,
+ "\t$_: Illegal command line switch!\n",
+ $usage;
+ }
+ else {
+ croak $showargs,
+ "\tmissing filenames or ? missing -i or -o switch!\n",
+ $usage;
+ }
+ } # end of while
+}; # end of else
+
+print "This is rubikrotation version $version\n";
+#================================
+ open(IN_FILE, "<$source_file") ||croak "\tCan't open source file: $source_file\n";
+ open(TeX_OUT_FILE, ">$out_file")||croak "\tCan't open output file: $out_file\n";
+
+ ## create error file (for append)
+ open (ERROR_OUT_FILE, ">>rubikstateERRORS.dat")||croak "ERROR: can't open file rubikstateERRORS.dat\n";
- open (IN_FILE, "<rubikstate.dat")||die "ERROR: can't open file rubikstate.dat\n";
- open (TeX_OUT_FILE, ">rubikstateNEW.dat")||die "ERROR: can't open file rubikstateNEW.dat\n";
- open (ERROR_OUT_FILE, ">>rubikstateERRORS.dat")||die "ERROR: can't open file rubikstateERRORS,dat\n";
## use dots for Perl messages (I have used dashes for LaTeX messages in the .sty)
## gprint sub prints its argument (message) to both the screen and to the TeX_OUT_FILE
- gprint ("...PERL process...................................");
+ gprint ("...PERL process..................................");
+ gprint ("...program = rubikrotation.pl v$version");
## setup global error parameters, so we can write all the errors to a file as an array
-%error = (); # setup an array for error messages (was %)
-$erroralert = ""; # error flag
-$errornumber = 0; #set number of errors to zero
+my %error = (); # setup an array for error messages (was %)
+my $erroralert = ""; # error flag
+my $errornumber = 0; #set number of errors to zero
+
+ gprint ("...reading the current rubik state (from File: $source_file)");
- gprint ("...reading the current rubik state (rubikstate.dat)");
+my $dataline = "";
+my $rubikkeyword = "";
+my $rotationcommand = "";
+my @data;
LINE: while (<IN_FILE>){
next LINE if /^#/; #skip comments
@@ -69,7 +169,7 @@ $errornumber = 0; #set number of errors to zero
#$n++; # count the number of lines
@data=split (/,/, $dataline); # create an array called data
## we have 10 fields (0--9)
- ## check for rubikkeyword= up,down,left,right,front,back,rotation, checkstate:
+ ## check for rubikkeyword= up,down,left,right,front,back,checkstate,rotation:
gprint ("...$dataline");
$rubikkeyword=$data[0];
@@ -127,11 +227,12 @@ $errornumber = 0; #set number of errors to zero
gprint ("...command=$rotationcommand");
+ ##-----random-----------------
## if second argument = random,
- ## then we also need to check if third argument is an integer;
+ ## THEN we also need to check if third argument is an integer;
## if so -->random sub.
## if the 3rd argument is NOT an integer then reject line & get next input line
- if ($data[1] eq 'random')
+ if ($data[1] eq 'random')
{
if ($data[2] =~/\D/) {
errormessage("[$data[2]] not an integer");
@@ -148,14 +249,20 @@ $errornumber = 0; #set number of errors to zero
# to the rotation sub, BUT, need to first remove the
# rubikkeyword `rotation' from the begining of line (array)
# as we need to send ONLY the sequence string to the rotation sub.
- shift (@data);
+
+ ## remove keyword rotation
+ shift (@data);
+
+ ## process @data string by the rotation sub
rotation(@data);
}
- }
-
- };
+ }
+##-------------------------------
+## place additional keywords here
+##-------------------------------
+ }; ## end of while
- ## we have finished reading in all the lines from the rubikstate.dat file,
+ ## we have finished reading in all the lines from the source file,
## and doing all the rotations etc, so we now just write the new cube state
## to the output file = TeX_OUT_FILE (so LaTeX can read it)
writestate();
@@ -174,7 +281,7 @@ sub errormessage{
};
##======================================
-## prints argument (comments) to screen and also to TeX_OUT_FILE (= rubikstateNEW.dat).
+## prints argument (comments) to screen and also to TeX_OUT_FILE.
## The typeout commands will find its way into the log file when read by latex
## Important to include trailing % for messages written to the TeX_OUT_FILE
## to stop extra <spaces> being seen by TeX.
@@ -201,6 +308,8 @@ sub checkstate{
my $R=0,my $O=0,my $Y=0,my $G=0,my $B=0,my $W=0,my $X=0;
+my $cubiecolour = "";
+
foreach $cubiecolour (@cubies)
{
if ($cubiecolour eq R) {$R = $R+1}
@@ -230,7 +339,7 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
# no of arguments passed to the sub = $#_ (black book p 156)
sub rotation {
-## here we process an array (from main) consisting of all
+## here we process the array @data (from main) consisting of all
## the rotation commands associated with
## a single RubikRotation command.
@@ -239,6 +348,8 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
my $originalchar="";
my $j;
my $numberofchars; ## length of a string
+ my $nfrontchars;
+ my $char = "";
gprint ("...arguments passed to `rotation' sub = @_ (n= $n)");
foreach $char (@_) {
@@ -246,8 +357,9 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
## grab a copy of the original char for use if m Mod4=0
$originalchar=$char;
- ## if argument has a leading * then it is a label (not a rotation) so jump to next one
- if (substr ($char,0,1) eq "*"){
+ ## if argument has a leading * or [ or ] then it is a label (not a rotation)
+ ## so jump to next one
+ if (substr ($char,0,1) =~ /[ * \[ \] ]/ ){
gprint ("...$char is a label OK");
next;
};
@@ -258,7 +370,7 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
## split char string into front chars (= $char) + trailing digit (= $m)
$m = 1; # initialise m
- ## if terminal char is a digit (d) then d --> m and let frontstring --> char
+ ## if terminal char is a digit (d) then let d --> m and let frontstring --> char
## (Black book p 130 & 136)
## if the frontstring contains any digits then it will be rejected in the filter below anyway.
@@ -275,8 +387,8 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
## (if MOD 4 = 0 then nothing will happen as j starts at 1)
## but should generate an errormessage
if ( $m == 0 ){
- gprint ("...rotation $originalchar equiv 0 MOD 4 (NOT IMPLEMENTED)");
- errormessage ("[$originalchar] in RubikRotation (= 0 MOD 4)");
+ gprint ("...rotation $originalchar equiv 0;(MOD 4) (NOT IMPLEMENTED)");
+ errormessage ("[$originalchar] in RubikRotation (4 MOD 4 = 0)");
next;
};
};
@@ -293,7 +405,7 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
elsif ($char eq "Rsp") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Rsp OK (= rrRp + rrL)"); &rrRsp}}
elsif ($char eq "Ra") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Ra OK (= rrR + rrL)"); &rrRa}}
elsif ($char eq "Rap") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Rap OK (= rrRp + rrLp)"); &rrRap}}
- ####
+ ####
elsif ($char eq "L") {for($j=1;$j<=$m;$j++) {gprint ("...rotation L OK (= rrLp3)"); &rrL}}
elsif ($char eq "Lp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lp OK"); &rrLp}}
elsif ($char eq "Lw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lw OK (= rrLp3 + rrSrp)"); &rrLw}}
@@ -351,8 +463,8 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
elsif ($char eq "Sfp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sfp OK (= rrSf3)"); &rrSfp}}
elsif ($char eq "Sb") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sb OK (= rrSfp)"); &rrSb}}
elsif ($char eq "Sbp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sbp OK (= rrSf)"); &rrSbp}}
- ## XYZ stuff
- ## need to include lowercase x,y,x, and also u,d,l,r,f,b equivalents
+ ## XYZ stuff
+ ## need to include lowercase x,y,x, and also u,d,l,r,f,b equivalents
elsif ($char eq "X" or $char eq "x" or $char eq "r")
{for($j=1;$j<=$m;$j++) {gprint ("...rotation $char OK (= rrR + rrSr + rrLp)"); &rrR;&rrSr;&rrLp}}
elsif ($char eq "Xp" or $char eq "xp" or $char eq "l")
@@ -373,14 +485,21 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
elsif ($char eq "S") {for($j=1;$j<=$m;$j++) {gprint ("...rotation S OK (= Sf) "); &rrSf}}
elsif ($char eq "Sp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sp OK (= Sb) "); &rrSb}}
####
+ ## check for missing rotation
+ elsif ($char eq "") {for($j=1;$j<=$m;$j++)
+ {gprint ("...rotation ,$char, ERROR ? typo or missing rotation"),
+ errormessage("[,$char,] in RubikRotation: ? typo or missing rotation")}}
+ ####
+ ## rotation must be undefined
else {
- gprint ("...rotation $originalchar NOT KNOWN");
- errormessage("[$originalchar] in RubikRotation");
- };
- }
- };
-
-## aNOTE we only defined and determined 9 primary rotation transforms,
+ gprint ("...rotation $originalchar NOT KNOWN");
+ errormessage("[$originalchar] in RubikRotation\{\}");
+ };
+ }; # end of foreach
+ }; # end of sub
+
+##---------------------------------------------
+## aNOTE we have defined (as rotation SUBs at the end) just 9 primary rotation transforms,
## rrR, rrSr, rrLp
## rrU, rrSu, rrDp
## rrF, rrSf, rrBp
@@ -465,12 +584,14 @@ sub random{
## (perl 5 book page 68)
## ? maybe we should only use the 18 rotations mentioned in Rokicki 2013 paper?
## but here I have included all the S ones too.
-@rrlist= ("U", "Up", "Su", "Sup",
- "D", "Dp", "Sd", "Sdp",
- "L", "Lp", "Sl", "Slp",
- "R", "Rp", "Sr", "Srp",
- "F", "Fp", "Sf", "Sfp",
- "B", "Bp", "Sb", "Sbp");
+
+
+my @rrlist= ("U", "Up", "Su", "Sup",
+ "D", "Dp", "Sd", "Sdp",
+ "L", "Lp", "Sl", "Slp",
+ "R", "Rp", "Sr", "Srp",
+ "F", "Fp", "Sf", "Sfp",
+ "B", "Bp", "Sb", "Sbp");
my $rrlistnumber=$#rrlist;
print " rrlistnumber = $rrlistnumber\n";
@@ -480,12 +601,13 @@ print " rrlistnumber = $rrlistnumber\n";
my $defaultn = 50;
my $maxn = 200;
## grab the integer passed from the random() command in main
-$s = $_[0];
+my $s = $_[0];
if ($s >= $maxn) {$s = $maxn;
- gprint ("...WARNING: maximum n = 200")}
+ gprint ("...WARNING: maximum n = 200");
+ errormessage ("random: max n =200 (n=200 was used)")}
elsif ($s == 0) {$s = $defaultn;
- gprint ("...WARNING: integer = 0 or not given: using default value 50")};
-
+ gprint ("...WARNING: integer = 0 or not given: using default value 50");
+ errormessage ("random: n invalid (n=50 was used)")};
my @rr; ## array to hold all the random rotations
print " randomising the available rotations\n";
@@ -500,9 +622,11 @@ srand;
## = (lastindexnumber -1). Therefore we need to use the range 0--(lastindexnumber+1)
## in order to randomise all posibilities on our list.
+my $j;
+
for ($j = 1; $j <=$s; $j=$j+1)
{
- $p= int(rand ($rrlistnumber +1));
+ my $p= int(rand ($rrlistnumber +1));
print "Rotation = $p, $rrlist[$p] \n";
## push rotation code $rrlist[$p] on to END of array @rr
push (@rr, $rrlist[$p]);
@@ -517,24 +641,25 @@ for ($j = 1; $j <=$s; $j=$j+1)
##===================subs==================================
sub writestate{
-## this just writes the final state to the TeX_OUT_FILE (= rubikstateNEW) will be read by latex.
+## this just writes the final state to the TeX_OUT_FILE (= rubikstateNEW.dat) will be read by latex.
-print (TeX_OUT_FILE "\%\% file=rubikstateNEW.dat (Perl)\n");
+print (TeX_OUT_FILE "\%\% output datafile=$out_file\n");
+print (TeX_OUT_FILE "\%\% PERL prog=rubikrotation version $version\n");
+print (TeX_OUT_FILE "\\typeout{...writing new Rubik state to file $out_file}\%\n");
print (TeX_OUT_FILE "\\RubikFaceUp\{$Ult[0]\}\{$Umt[0]\}\{$Urt[0]\}\{$Ulm[0]\}\{$Umm[0]\}\{$Urm[0]\}\{$Ulb[0]\}\{$Umb[0]\}\{$Urb[0]\}\%\n");
print (TeX_OUT_FILE "\\RubikFaceDown\{$Dlt[0]\}\{$Dmt[0]\}\{$Drt[0]\}\{$Dlm[0]\}\{$Dmm[0]\}\{$Drm[0]\}\{$Dlb[0]\}\{$Dmb[0]\}\{$Drb[0]\}\%\n");
print (TeX_OUT_FILE "\\RubikFaceLeft\{$Llt[0]\}\{$Lmt[0]\}\{$Lrt[0]\}\{$Llm[0]\}\{$Lmm[0]\}\{$Lrm[0]\}\{$Llb[0]\}\{$Lmb[0]\}\{$Lrb[0]\}\%\n");
print (TeX_OUT_FILE "\\RubikFaceRight\{$Rlt[0]\}\{$Rmt[0]\}\{$Rrt[0]\}\{$Rlm[0]\}\{$Rmm[0]\}\{$Rrm[0]\}\{$Rlb[0]\}\{$Rmb[0]\}\{$Rrb[0]\}\%\n");
print (TeX_OUT_FILE "\\RubikFaceFront\{$Flt[0]\}\{$Fmt[0]\}\{$Frt[0]\}\{$Flm[0]\}\{$Fmm[0]\}\{$Frm[0]\}\{$Flb[0]\}\{$Fmb[0]\}\{$Frb[0]\}\%\n");
print (TeX_OUT_FILE "\\RubikFaceBack\{$Blt[0]\}\{$Bmt[0]\}\{$Brt[0]\}\{$Blm[0]\}\{$Bmm[0]\}\{$Brm[0]\}\{$Blb[0]\}\{$Bmb[0]\}\{$Brb[0]\}\%\n");
-print (TeX_OUT_FILE "\\typeout{...writing new Rubik state to file rubikstateNEW.dat}\%\n");
## now include any error messages generated
## (these are all in an array waiting to be printed out)
if ($erroralert eq "YES")
{
- ## open a separate file just for errors (we append the errrors to end of file)
- ## this file (rubikstate.cfg) was opened by the TeX file
+ ## write errors to a separate file (just for errors---we append the errrors to end of file)
+ ## the error file (rubikstateERRORS.dat) was created by the TeX file
my $ne; #number of errors
$ne=$#error; ## number of errors= largest index num since we started at zero
### do not attach error to a <checkstate> command
@@ -582,7 +707,7 @@ print " Perl output file written OK\n";
## R = RIGHT, s = side; 0=colour, 1= number
## make the clockwise rotation permutation
## In this permutation the Front-right-bottom (Frb) (side)facelet rotates to
-## the new position of Up-right-bottom (Urb) (side)facelet.
+## the new position of Up-right-bottom (Urb) (side)facelet.
##-----------SIDE-------
## 12 side cubie facelets in arrays @Rs0 (colours) and @Rs1 (numbers)
## these are the initial positions
@@ -597,11 +722,11 @@ print " Perl output file written OK\n";
$Drb[1],$Drm[1],$Drt[1]);
## now we reallocate the initial array elements to the new
-## post (90 degree clockwise) rotation position.
+## post (90 degree clockwise) rotation position.
## Cube is viewed from FRONT.
-## positions of side facelets of Right slice are numbered 0-11 in clockwise direction,
+## Positions of side facelets of Right slice are numbered 0-11 in clockwise direction,
## (as seen from Right face) starting with Up-right-bottom facelet.
-## first line example:
+## First line example:
## variable $Urb[0] (Upface-right-bottom colour) <-- colour of first element in @Rs0 (=Frb[0])
## variable $Urb[1] (Upface-right-bottom number) <-- number of first element in @Rs1 (=Frb[1])
$Urb[0]=$Rs0[0]; $Urb[1]=$Rs1[0];
diff --git a/Master/texmf-dist/doc/latex/rubik/README b/Master/texmf-dist/doc/latex/rubik/README
deleted file mode 100644
index 29121a01cec..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/README
+++ /dev/null
@@ -1,70 +0,0 @@
-
-February 3, 2014
---------------------------------------------------------------------------
-the RUBIK bundle 2014/02/03
- - rubikcube package v2.0 -> macros and commands for typesetting
- - rubikrotation package v2.0 -> macros and Perl program for rotations
---------------------------------------------------------------------------
-
-The RUBIK bundle provides two complementary packages for documenting the
-Rubik cube (3x3x3) notation, configurations and rotation sequences.
-The two packages are (a) rubikcube package, and (b) rubikrotation package.
-
-(a) Rubikcube package
-
- The rubikcube package provides a collection of LaTeX commands
- and macros for typesetting Rubik cube configurations and rotation
- instructions using the PGF/TikZ graphic languages.
- This is a stand-alone LaTeX package. However, it's scope is greatly enhanced
- by the rubikrotation package.
-
-(b) Rubikrotation package
-
- The rubikrotation package, is a dynamic extension to
- the rubikcube package. It consists of the Perl program
- rubikrotation.pl and style option rubikrotation.sty.
- The rubikrotation package implements rotation sequences and
- random scrambling of the Rubik cube on-the-fly using a
- \RubikRotation command. It returns the new state in a form
- which is then used for typesetting by the rubikcube package.
-
- Since the \RubikRotation command works by CALLing the
- Perl program rubikrotation.pl, it follows that the rubikrotation
- package requires (a)~Perl to be installed, and (b) LaTeX needs to
- be run using the --shell-escape commandline option.
-
---------------------------------------------------------------------------
-RWD Nickalls email: dick@nickalls.org
-A Syropoulos email: asyropoulos@yahoo.com
---------------------------------------------------------------------------
-Copyright 2014 RWD Nickalls & A Syropoulos
-
-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.
-
---------------------------------------------------------------------------
-The RUBIK bundle consists of the following files
-package files:
- - rubikcube.ins
- - rubikcube.dtx
- - rubikrotation.ins,
- - rubikrotation.dtx,
- - rubikrotation.pl (Perl program)
-image files:
- - pdf -files for the documentation (6 pictures)
-documentation, examples and README:
- - rubikcube.pdf
- - rubikrotation.pdf,
- - example-cube.pdf, example-cube.tex
- - example-rot1.pdf, example-rot1.tex
- - example-rot2.pdf, example-rot2.pdf
- - README (this file)
---------------------------------------------------------------------------
-If you have any ideas, questions, suggestions or bugs to report, please
-feel free to contact us.
---------------------------------------------------------------------------
diff --git a/Master/texmf-dist/doc/latex/rubik/README.txt b/Master/texmf-dist/doc/latex/rubik/README.txt
new file mode 100644
index 00000000000..73e4741a858
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/README.txt
@@ -0,0 +1,98 @@
+
+September 25, 2015
+--------------------------------------------------------------------------
+the RUBIK bundle 2015/09/25
+ - rubikcube package v3.0 -> macros and commands for typesetting
+ - rubikrotation package v3.0 -> macros and Perl program for rotations
+--------------------------------------------------------------------------
+
+The RUBIK bundle provides two complementary packages for documenting the
+Rubik cube (3x3x3) notation, configurations and rotation sequences.
+The two packages are (a) rubikcube package, and (b) rubikrotation package.
+
+ (1) Rubikcube package
+
+ The rubikcube package provides a collection of LaTeX commands
+ and macros for typesetting Rubik cube configurations and rotation
+ instructions using the PGF/TikZ graphic languages.
+ This is a stand-alone LaTeX package. However, it is expected to be used in
+ conjunction with its complementary rubikrotation package.
+
+ (2) Rubikrotation package
+
+ The rubikrotation package, is a dynamic extension to
+ the rubikcube package. It consists of the Perl script
+ rubikrotation.pl and style option rubikrotation.sty.
+ The rubikrotation package implements rotation sequences and
+ random scrambling of the Rubik cube on-the-fly using a
+ RubikRotation command. It returns the new state in a form
+ which is then used for typesetting by the rubikcube package.
+
+ Since the RubikRotation command works by CALLing the
+ Perl script rubikrotation.pl, it follows that the rubikrotation
+ package requires (a) Perl to be installed, and (b) (Pdf)LaTeX needs
+ to be run using the --shell-escape command-line switch.
+
+ (3) New features
+
+ (a) All rotation commands can now use the rotation-code as an argument;
+ for example, the rotation \rr{D} can now be typeset using the
+ command \cmd{\rr\{D\}} etc. The new rotation commands are:
+ \rr{<rotation-code>}
+ \rrh{<rotation-code>}
+ \Rubik{<rotation-code>}
+ \textRubik{<rotation-code>}
+ The original rotation command formats (e.g.,\rrD) are still supported
+ for backwards compatibility.
+
+ (b) \ShowCube and \ShowCubeF are new commands for displaying
+ a cube inside a minipage.
+
+ (c) \RubikCubeGrey is a new command for setting up a `starter cube'
+ for which the only allocated colours are those for the centre cubies
+ The colour configuration matches that of the \RubikCubeSolved command.
+
+--------------------------------------------------------------------------
+RWD Nickalls email: dick@nickalls.org
+A Syropoulos email: asyropoulos@yahoo.com
+--------------------------------------------------------------------------
+Copyright 2014 RWD Nickalls & A Syropoulos
+
+Licence
+
+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.
+--------------------------------------------------------------------------
+The RUBIK bundle consists of the following files
+
+package files:
+ - rubikcube.ins,
+ - rubikcube.dtx,
+ - rubikcube.sty,
+ - rubikrotation.ins,
+ - rubikrotation.dtx,
+ - rubikrotation.sty,
+ - rubikrotation.pl (Perl script)
+documentation and README:
+ - rubikcube.pdf
+ - rubikrotation.pdf,
+ - rubikrotationPL.pdf, Prel program documentation
+ - rubikrotationPL.tex
+ - rubikrotation.1, MAN file for perl script
+ - README.txt (this file)
+image files:
+ - pdf -files for the rubikcube documentation (6 pictures)
+ - pdf -files for the rubikrotation documentation (4 pictures)
+examples:
+ - example-rot.pdf,
+ - example-rot.tex
+bash and bat files (for running rotation examples)
+--------------------------------------------------------------------------
+If you have any ideas, questions, suggestions or bugs to report, please
+feel free to contact us.
+--------------------------------------------------------------------------
diff --git a/Master/texmf-dist/doc/latex/rubik/Rubik_doc_figA.pdf b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figA.pdf
index 63be7621483..63be7621483 100644
--- a/Master/texmf-dist/doc/latex/rubik/Rubik_doc_figA.pdf
+++ b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figA.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/Rubik_doc_figB.pdf b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figB.pdf
index 5bdd92967c5..5bdd92967c5 100644
--- a/Master/texmf-dist/doc/latex/rubik/Rubik_doc_figB.pdf
+++ b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figB.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/Rubik_doc_figC.pdf b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figC.pdf
index 53dc10e8395..53dc10e8395 100644
--- a/Master/texmf-dist/doc/latex/rubik/Rubik_doc_figC.pdf
+++ b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figC.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figD.pdf b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figD.pdf
new file mode 100644
index 00000000000..26fb68fe62c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figD.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/Rubik_doc_figE.pdf b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figE.pdf
index 5d013ff25a6..5d013ff25a6 100644
--- a/Master/texmf-dist/doc/latex/rubik/Rubik_doc_figE.pdf
+++ b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figE.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figF.pdf b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figF.pdf
new file mode 100644
index 00000000000..cc59d3f62b0
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figF.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/Rubik_doc_figD.pdf b/Master/texmf-dist/doc/latex/rubik/Rubik_doc_figD.pdf
deleted file mode 100644
index 1304c069452..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/Rubik_doc_figD.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/Rubikrot_doc_figA.pdf b/Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figA.pdf
index 9154ba3075c..b3992299158 100644
--- a/Master/texmf-dist/doc/latex/rubik/Rubikrot_doc_figA.pdf
+++ b/Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figA.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/Rubikrot_doc_figB.pdf b/Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figB.pdf
index 7478436a27f..7478436a27f 100644
--- a/Master/texmf-dist/doc/latex/rubik/Rubikrot_doc_figB.pdf
+++ b/Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figB.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figC.pdf b/Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figC.pdf
new file mode 100644
index 00000000000..7ca1fe2db2d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figC.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figD.pdf b/Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figD.pdf
new file mode 100644
index 00000000000..a5df718d3bc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figD.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/example-cube.pdf b/Master/texmf-dist/doc/latex/rubik/example-cube.pdf
deleted file mode 100644
index 39d91a7b135..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/example-cube.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/example-cube.tex b/Master/texmf-dist/doc/latex/rubik/example-cube.tex
deleted file mode 100644
index e923c805c9a..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/example-cube.tex
+++ /dev/null
@@ -1,188 +0,0 @@
-%%
-%% example-cube.tex
-%% package example using the rubikcube package
-%% Requires the tikz package
-%% January 20, 2014
-%%--------NOTE-------------------------------------------
-%% USAGE: (pdf)latex example-cube.tex
-%%-------------------------------------------------------
-\documentclass[a4paper]{article}
-\usepackage{tikz} %% load tikz before rubikcube
-\usepackage{rubikcube}
-\usepackage{url}
-\pagestyle{myheadings}
-\markright{\textsc{rubikcube} package; \hspace{2cm}file = example-cube.tex}
-%% increase textwidth to make room
-\addtolength{\oddsidemargin}{-1.5cm}
-\addtolength{\textwidth}{3cm}
-%% brace and bracket
-\newcommand{\Rubikbracket}[1]{$\left(\mbox{#1}\right)$}
-\newcommand{\Rubikbrace}[1]{$\left\{\mbox{#1}\right\}$}
-%%
-\begin{document}
-%%-------------------------
-\subsection*{Example---the `superflip' configuration}
-
-Once you have mastered Rubik's cube, then an interesting exercise is to generate
-the so-called `superflip' configuration, in which all the corners are correctly
-solved, while all the edges are flipped.
-
-For the impatient, the superflip sequence of 24 quarter-turn rotations (listed on Randelshofer's website) is as follows. This converts the solved cube on the left into the configuration shown on the right.
-
-\bigskip
-
-\begin{center}
-\RubikU\RubikR\RubikR\RubikFp\RubikR\RubikDp\RubikL\RubikBp\RubikR%
-\RubikUp\RubikR\RubikUp\RubikD\RubikFp\RubikU\RubikFp\RubikUp\RubikDp%
-\RubikB\RubikLp\RubikFp\RubikBp\RubikDp\RubikLp
-\end{center}
-
-\medskip
-
-{\noindent}Surprisingly, this sequence is actually equivalent to
-\Rubikbrace{\Rubikbracket{\RubikM\RubikUp}4, \Rubiky, \Rubikxp}3
-
-
-\bigskip
-\begin{figure}[hbt]
-\centering
-\RubikCubeSolved%
-\begin{minipage}{2cm}
- \begin{tikzpicture}[scale=0.5]
- \DrawRubikCubeRU
- \end{tikzpicture}
-\end{minipage}
-\hspace{5mm}$\Longrightarrow$\hspace{5mm}%
-\RubikFaceUp {W}{R}{W} {B}{W}{G} {W}{O}{W}%
-\RubikFaceDown {Y}{O}{Y} {B}{Y}{G} {Y}{R}{Y}%
-\RubikFaceLeft {B}{W}{B} {R}{B}{O} {B}{Y}{B}%
-\RubikFaceRight{G}{W}{G} {O}{G}{R} {G}{Y}{G}%
-\RubikFaceFront{O}{W}{O} {B}{O}{G} {O}{Y}{O}%
-\RubikFaceBack{R}{W}{R}
- {G}{R}{B}
- {R}{Y}{R}%
-\begin{minipage}{2cm}
- \begin{tikzpicture}[scale=0.5]
- \DrawRubikCubeRU
- \end{tikzpicture}
-\end{minipage}
-\hspace{1cm}%
-\begin{minipage}{5cm}
- \begin{tikzpicture}[scale=0.5]
- \DrawRubikCubeFlat
- \end{tikzpicture}
-\end{minipage}
-\caption{Two images of the superflip configuration.}
-\end{figure}
-
-The code for all this is given below---note that the facelet colours can be
-written in various ways. Note also the trailing \% at the end of each line which is not inside a TikZ picture environment, and the value of placing each TikZ picture environment inside a minipage.
-Since the default width of a Rubik cube is 4cm (see \S\,7 Fig~2 in \texttt{rubikcube.pdf}), then since the TikZ scale here is 0.5 then the required width of its minipage is equal to $0.5 \times 4\mbox{cm} = 2\mbox{cm}$.
-%%----------
-\begin{verbatim}
--------------------
-\newcommand{\Rubikbracket}[1]{$\left(\mbox{#1}\right)$}
-\newcommand{\Rubikbrace}[1]{$\left\{\mbox{#1}\right\}$}
-
-\begin{center}
-\RubikU\RubikR\RubikR\RubikFp\RubikR\RubikDp\RubikL\RubikBp\RubikR%
-\RubikUp\RubikR\RubikUp\RubikD\RubikFp\RubikU\RubikFp\RubikUp\RubikDp%
-\RubikB\RubikLp\RubikFp\RubikBp\RubikDp\RubikLp
-\end{center}
-
-\medskip
-
-{\noindent}Surprisingly, this sequence is actually equivalent to
-\Rubikbrace{\Rubikbracket{\RubikM\RubikUp}4, \Rubiky, \Rubikxp}3
-
-\bigskip
-
-\begin{figure}[hbt]
-\centering
-\RubikCubeSolved
-\begin{minipage}{2cm}
- \begin{tikzpicture}[scale=0.5]
- \DrawRubikCubeRU
- \end{tikzpicture}
-\end{minipage}
-\hspace{5mm}$\Longrightarrow$\hspace{5mm}%
-\RubikFaceUp {Y}{B}{Y} {R}{Y}{O} {Y}{G}{Y}%
-\RubikFaceDown {W}{G}{W} {R}{W}{O} {W}{B}{W}%
-\RubikFaceLeft {R}{Y}{R} {B}{R}{G} {R}{W}{R}%
-\RubikFaceRight{O}{Y}{O} {G}{O}{B} {O}{W}{O}%
-\RubikFaceFront{G}{Y}{G} {R}{G}{O} {G}{W}{G}%
-\RubikFaceBack {B}{Y}{B}%
- {O}{B}{R}%
- {B}{W}{B}%
-\begin{minipage}{2cm}
- \begin{tikzpicture}[scale=0.5]
- \DrawRubikCubeRU
- \end{tikzpicture}
-\end{minipage}
-\hspace{1cm}%
-\begin{minipage}{5cm}
- \begin{tikzpicture}[scale=0.5]
- \DrawRubikCubeFlat
- \end{tikzpicture}
-\end{minipage}
-\caption{Two images of the superflip configuration.}
-\end{figure}
--------------------
-\end{verbatim}
-
-
-\subsection*{Using the rubikrotation package}
-
-This is just a note to show that if this file were run in conjunction with the \texttt{rubikrotation} package, using the \LaTeX\ commandline switch \texttt{--shell-escape}, then the above figure could be generated more simply by replacing
-\begin{verbatim}
-\RubikFaceUp {Y}{B}{Y} {R}{Y}{O} {Y}{G}{Y}%
-\RubikFaceDown {W}{G}{W} {R}{W}{O} {W}{B}{W}%
-\RubikFaceLeft {R}{Y}{R} {B}{R}{G} {R}{W}{R}%
-\RubikFaceRight{O}{Y}{O} {G}{O}{B} {O}{W}{O}%
-\RubikFaceFront{G}{Y}{G} {R}{G}{O} {G}{W}{G}%
-\RubikFaceBack {B}{Y}{B}%
- {O}{B}{R}%
- {B}{W}{B}%
-\end{verbatim}
-with the command
-\begin{verbatim}
-\RubikRotation{\superflip}%
-\end{verbatim}
-ie,~using instead the following code:
-\begin{verbatim}
------------------
-\newcommand{\superflip}{U,R2,Fp,R,Dp,L,Bp,R,Up,R,Up,D,%
-Fp,U,Fp,Up,Dp,B,Lp,Fp,Bp,Dp,Lp}
-
-\begin{figure}[hbt]
-\centering
-\RubikCubeSolved%
-\begin{minipage}{2cm}
- \begin{tikzpicture}[scale=0.5]
- \DrawRubikCubeRU
- \end{tikzpicture}
-\end{minipage}
-\hspace{5mm}$\Longrightarrow$\hspace{5mm}%
-\RubikRotation{\superflip}%
-\begin{minipage}{2cm}
- \begin{tikzpicture}[scale=0.5]
- \DrawRubikCubeRU
- \end{tikzpicture}
-\end{minipage}
-\hspace{1cm}%
-\begin{minipage}{5cm}
- \begin{tikzpicture}[scale=0.5]
- \DrawRubikCubeFlat
- \end{tikzpicture}
-\end{minipage}
-\caption{Two images of the superflip configuration.}
-\end{figure}
------------------
-\end{verbatim}
-
-
-\begin{center}
------- END ------
-\end{center}
-
-\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/rubik/example-rot1.pdf b/Master/texmf-dist/doc/latex/rubik/example-rot1.pdf
deleted file mode 100644
index d18a90284e8..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/example-rot1.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/example-rot1.sh b/Master/texmf-dist/doc/latex/rubik/example-rot1.sh
deleted file mode 100755
index b45c859559e..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/example-rot1.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/bash
-pdflatex --shell-escape example-rot1.tex
-pdflatex --shell-escape example-rot1.tex
diff --git a/Master/texmf-dist/doc/latex/rubik/example-rot1.tex b/Master/texmf-dist/doc/latex/rubik/example-rot1.tex
deleted file mode 100644
index 5f424bc6132..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/example-rot1.tex
+++ /dev/null
@@ -1,307 +0,0 @@
-%%
-%% example-rot1.tex
-%% package examples using the rubikrotation package
-%% Requires tikz and rubikcube packages
-%% January 20, 2014
-%%--------NOTE-------------------------------------------
-%% USAGE: (pdf)latex --shell-escape example-rot1.tex
-%% run three times to get all labels and fig nos correct
-%%-------------------------------------------------------
-\documentclass[a4paper]{article}
-\usepackage{tikz} %% load tikz before rubikcube
-\usepackage{rubikcube,rubikrotation}
-\usepackage{url}
-\pagestyle{myheadings}
-\markright{\textsc{rubikrotation} package; \hspace{2cm}file = example-rot1.tex}
-%-----------
-%% some well known sequences (see the web page of Reid)
-\newcommand{\sixTs}{*sixTs,F2,R2,U2,Fp,B,D2,L2,F,B}
-\newcommand{\CubeInCube}{*CubeInCube,F,L,F,Up,R,U,F2,L2,Up,Lp,B,Dp,Bp,L2,U}
-\newcommand{\sixspot}{*sixspot,U,Dp,R,Lp,F,Bp,U,Dp}
-%%==================
-\begin{document}
-
-%%------------------
-\section*{Example~1}
-
-In Figure~\ref{fig:cubeincube} we show the so-called ``sixspot'' configuration,
- generated from a solved cube using the rotation sequence
-\rrU, \rrDp, \rrR, \rrLp, \rrF, \rrBp, \rrU, \rrDp
-(see the website of Reid at \url{www.math.ucf.edu/~reid/Rubik/}).
-%%--------FIGURE 1 -----------
-\begin{figure}[hbt]
-\centering
-\begin{tikzpicture}[scale=0.7]
- \RubikCubeSolved
- \RubikRotation{*sixspot,U,Dp,R,Lp,F,Bp,U,Dp}
- \DrawRubikCubeFlat
-\end{tikzpicture}
-\caption{\label{fig:cubeincube}The so-called `sixspot' configuration (Reid).}
-\end{figure}
-%----------------
-\begin{verbatim}
-----------------
-\documentclass[a4paper]{article}
-\usepackage{tikz,rubikcube,rubikrotation}
-\thispagestyle{empty} %% disables pagenumbers
-\begin{document}
-\begin{tikzpicture}[scale=0.9]
- \RubikCubeSolved
- \RubikRotation{*sixspot,U,Dp,R,Lp,F,Bp,U,Dp}
- \DrawRubikCubeFlat
-\end{tikzpicture}
-\end{document}
---------------
-\end{verbatim}
-Note that a more flexible approach is to incorporate such rotation sequences into a `newcommand'. For example, in this case we can write
-\begin{verbatim}
-\newcommand{\sixspot}{*sixspot,U,Dp,R,Lp,F,Bp,U,Dp}
-\end{verbatim}
-which allows the code to Figure~\ref{fig:cubeincube} to be more easily written as:
-\begin{verbatim}
-\begin{tikzpicture}
- \RubikCubeSolved
- \RubikRotation{\sixspot}
- \DrawRubikCubeFlat
-\end{tikzpicture}
-\end{verbatim}
-
-
-
-\pagebreak
-%%-------------------------
-\section*{Example~2}
-
- In this example we show the use of the \verb!\ShowRubikErrors! command, which
- places a copy of the Perl output file (\verb!rubikstateERRORS.dat!) underneath the graphic
- so you can see a list of all the errors, if any (in this example we have introduced a couple
- of errors). It is important to note that the \verb!\ShowRubikErrors! command must be
- placed \textit{after} the TikZ picture environment. Note also that full details of all
- errors are included in the .log file.
-
-%%--------FIGURE 2 -----------
-
-\RubikCubeSolved
-\RubikRotation{*sixspot,U,Dp,R,Lp,F,Bp,UU,Dpp}
-
-\begin{figure}[hbt]
-\centering
-\begin{tikzpicture}[scale=0.7]
- \DrawRubikCubeFlat
-\end{tikzpicture}
-\ShowRubikErrors
-\caption{\label{fig:cubeincubeE}The same `sixspot' sequence of rotations as before, but now with some typo errors in the rotation sequence (should be \texttt{U,Dp,R,Lp,F,Bp,U,Dp}.}
-\end{figure}
-Note that only `Draw' commands really need to be inside the TikZ picture environment---see the following code which we used for the above figure.
-%-----------------
-\begin{verbatim}
-----------------
-\RubikCubeSolved
-\RubikRotation{*sixspot,U,Dp,R,Lp,F,Bp,UU,Dpp}
-%
-\begin{tikzpicture}
- \DrawRubikCubeFlat
-\end{tikzpicture}
-\ShowRubikErrors
-----------------
-\end{verbatim}
-
-
-
-
-\pagebreak
-%-------------------------------
-\section*{Example~3}
-
-In this example we use the \verb!\RubikRotation! command to scramble a `solved' Rubik
-cube via a sequence of 120 random rotations, using the following command (the details
-of the process can be seen in the \texttt{.log} file):
-\begin{verbatim}
-\RubikRotation{random,120}
-\end{verbatim}
-In this example, we also save the final configuration (state) to a file
-(\texttt{exmpfig4.tex}) using the command
-\verb!\SaveRubikState{exmpfig4.tex}!
-so we can display the cube in the same state later (see Example~4) but
-in a different format.
-Note that since we are using a random sequence, it follows that each
-time this file is run not only will a visually different cube be generated,
-but the same state will be shown in both Figures~\ref{fig:randomone} and \ref{fig:randomtwo}.
-%%--------FIGURE 3 -----------
-\begin{figure}[hbt]
-\centering
-\begin{tikzpicture}[scale=0.7]
- \RubikCubeSolved
- \RubikRotation{random,120}
- \SaveRubikState{exmpfig4.tex}
- \DrawRubikFlat
-\end{tikzpicture}
-\caption{\label{fig:randomone}This shows a cube generated by 120 random rotations}
-\end{figure}
-%----------------
-\begin{verbatim}
--------------------
-\begin{figure}[hbt]
-\centering
-\begin{tikzpicture}[scale=0.8]
- \RubikCubeSolved
- \RubikRotation{random,120}
- \SaveRubikState{exmpfig4.tex}
- \DrawRubikFlat
-\end{tikzpicture}
-\end{figure}
-------------------
-\end{verbatim}
-
-
-
-\pagebreak
-%----------------------
-\section*{Example~4}
-
-In this example we display a cube having the same state as that shown in
-Figure~\ref{fig:randomone}. The configuration state was saved from
-Figure~\ref{fig:randomone} using the command
-\verb!\SaveRubikState{exmpfig4.tex}!, and then input here
-using \verb!\input{exmpfig4.tex}!. These commands therefore allow the
-state of a previous cube to be saved to a file, and then displayed again
-later in a different format.
-%%-----------FIGURE 4 -----------
-\begin{figure}[hbt]
-\centering
-\begin{tikzpicture}[scale=0.8]
- \input{exmpfig4.tex}
- \DrawRubikCubeLD
-\end{tikzpicture}
-\caption{\label{fig:randomtwo}This shows a Rubik cube in exactly the same
-state as the one shown in Figure~\ref{fig:randomone}}
-\end{figure}
-%%---------------------------------
-\begin{verbatim}
--------------------
-\begin{figure}[hbt]
-\centering
-\begin{tikzpicture}[scale=0.8]
- \input{exmpfig4.tex}
- \DrawRubikCubeLD
-\end{tikzpicture}
-\end{figure}
-------------------
-\end{verbatim}
-
-
-
-\pagebreak
-%----------------------
-\section*{Example~5}
-
-Here we show a convenient way of displaying a series of small cubes showing
-a sequence of rotations (\rrU, \rrR, \rrF). Following each rotation
-we save the state to a file and then, finally, display each cube state in sequence,
-using a couple of useful macros (\verb!\showcube!, and \verb!\lift!),
-to `show' the cubes and to `lift' the rotation command slightly off the baseline.
-Note that embedding the TikZ picture environment in the \verb!\showcube! command brings
-considerable flexibility.
-%%-----------FIGURE 5 -----------
-\newcommand{\showcube}[1]{%
- \begin{tikzpicture}[scale=0.5]
- \input{#1}
- \DrawRubikCubeRU
- \end{tikzpicture}
-}
-\newcommand{\lift}[1]{\raisebox{8mm}{#1}\hspace{2mm}}
-%%
-\RubikCubeSolved \SaveRubikState{exmpfig5a.tex}
-\RubikRotation{U} \SaveRubikState{exmpfig5b.tex}
-\RubikRotation{R} \SaveRubikState{exmpfig5c.tex}
-\RubikRotation{F} \SaveRubikState{exmpfig5d.tex}
-%%
-\begin{figure}[hbt]
-\centering
-\noindent \showcube{exmpfig5a.tex}\hspace{-4mm}(a)
-\lift{\RubikU}\showcube{exmpfig5b.tex}\hspace{-4mm}(b)
-\lift{\RubikR}\showcube{exmpfig5c.tex}\hspace{-4mm}(c)
-\lift{\RubikF}\showcube{exmpfig5d.tex}\hspace{-4mm}(d)
-\caption{The rotations \rrU, \rrR, \rrF\ on a solved cube.}
-\end{figure}
-%%---------------------------------
-
-Note that even though the \verb!\RubikCubeSolved! command (which allocates the
- colours to the `solved' cube) is used prior to the TikZ picture environment,
- its effects are still available to the \verb!\Draw...! command inside each of the
-picture environments.
-\begin{verbatim}
--------------------
-\newcommand{\showcube}[1]{%
- \begin{tikzpicture}[scale=0.5]
- \input{#1}
- \DrawRubikCubeRU
- \end{tikzpicture}
-}
-\newcommand{\lift}[1]{\raisebox{8mm}{#1}\hspace{2mm}}
-%%
-\RubikCubeSolved \SaveRubikState{exmpfig5a.tex}
-\RubikRotation{U} \SaveRubikState{exmpfig5b.tex}
-\RubikRotation{R} \SaveRubikState{exmpfig5c.tex}
-\RubikRotation{F} \SaveRubikState{exmpfig5d.tex}
-%%
-\begin{figure}[hbt]
- \centering
- \noindent \showcube{exmpfig5a.tex}\hspace{-4mm}(a)
- \lift{\RubikU}\showcube{exmpfig5b.tex}\hspace{-4mm}(b)
- \lift{\RubikR}\showcube{exmpfig5c.tex}\hspace{-4mm}(c)
- \lift{\RubikF}\showcube{exmpfig5d.tex}\hspace{-4mm}(d)
- \ShowRubikErrors
-\caption{The rotations \rrU, \rrR, \rrF\ on a solved cube.}
-\end{figure}
-------------------
-\end{verbatim}
-
-\pagebreak
-%----------------------
-\section*{Example~6}
-
-In this example we show how commands used inside a TikZ picture environment remain
-local to that picture environment.
-
-In this case the first fig uses the \verb!\RubikCubeSolved! inside the TikZ environment.
-However, if we then perform the rotation \textRubikR\ the command \verb!RubikRotation{R}!
-results in something quite unexpected (and obviously not correct). This is because
- the effect of the \verb!\RubikCubeSolved! command is not visible outside its TikZ environment, and hence the \verb!RubikRotation{R}! command has to operate on the state of the next earliest figure
-(ie~Figure~5d), hence the strange form of the second figure below.
-
-\medskip
-
- \begin{tikzpicture}[scale=0.5]
- \RubikCubeSolved
- \DrawRubikCubeRU
- \end{tikzpicture}
-\hspace{5mm}\lift{\RubikR}\hspace{5mm}%
-\RubikRotation{R}%
- \begin{tikzpicture}[scale=0.5]
- \DrawRubikCubeRU
- \end{tikzpicture}
-
-\medskip
-
-Since we are not here using any `minipage' environments, we need to use the \verb!\lift{}! command to raise the \rrhR\ hieroglyph off the baseline.
-
-\begin{verbatim}
--------------------
-\begin{tikzpicture}[scale=0.5]
- \RubikCubeSolved
- \DrawRubikCubeRU
-\end{tikzpicture}
-\hspace{5mm}\lift{\RubikR}\hspace{5mm}%
-\RubikRotation{R}%
-\begin{tikzpicture}[scale=0.5]
- \DrawRubikCubeRU
-\end{tikzpicture}
--------------------
-\end{verbatim}
-
-\begin{center}
------- END ------
-\end{center}
-
-\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/rubik/example-rot2.pdf b/Master/texmf-dist/doc/latex/rubik/example-rot2.pdf
deleted file mode 100644
index 351ecf86d73..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/example-rot2.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/example-rot2.sh b/Master/texmf-dist/doc/latex/rubik/example-rot2.sh
deleted file mode 100644
index f44d9331a8b..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/example-rot2.sh
+++ /dev/null
@@ -1 +0,0 @@
-pdflatex --shell-escape example-rot2.tex
diff --git a/Master/texmf-dist/doc/latex/rubik/example-rot2.tex b/Master/texmf-dist/doc/latex/rubik/example-rot2.tex
deleted file mode 100644
index 688717ffcab..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/example-rot2.tex
+++ /dev/null
@@ -1,42 +0,0 @@
-%% example-rot2.tex
-%% January 20, 2014
-%% RWD Nickalls & A Syropoulos
-%% example file for rubikrotation package
-%% Requires TikZ and rubikcube, and rubikrotation packages
-%% uses Perl script rubikrotation.pl
-%% experiment by un-commenting different RubikRotation commands,
-%% and reviewing the .log file for details of rotations performed.
-%%-----------------------------------------------------
-%% USAGE: pdflatex --shell-escape example-rot2.tex
-%% ----------------------------------------------------
-\documentclass[a4paper]{article}
-\usepackage{tikz,rubikcube,rubikrotation}
-\pagestyle{myheadings}
-\markright{\textsc{rubikrotation} package; \hspace{2cm}file = example-rot2.tex}
-%%--------------
-%% some well known sequences (see the web page of Reid)
-\newcommand{\sixT}{*sixT,F2,R2,U2,Fp,B,D2,L2,F,B}
-\newcommand{\cubeincube}{*cubeincube,F,L,F,Up,R,U,F2,L2,Up,Lp,B,Dp,Bp,L2,U}
-\newcommand{\sixspot}{*sixspot,U,Dp,R,Lp,F,Bp,U,Dp}
-\newcommand{\errors}{*errors,U,Dp,RR,Lpp,Fq,Bp,U,Dp,cat}
-%================
-\begin{document}
-
-\RubikCubeSolved % sets up a solved cube
-%----------------
-%\RubikRotation{R,FFF} %%this will show up the command FFF as being an error
-%\RubikRotation{U,D,L,R,F,B} %% some basic rotations in sequence
-%\RubikRotation{U2,D2,L2,R2,F2,B2} %% makes an interesting pattern
-%\RubikRotation{\sixT} %% generates a T on each face
-%\RubikRotation{\cubeincube} %% generates a cube-in-cube effect
-%\RubikRotation{random,67} %% makes 67 random rotations
-\RubikRotation{x,y,\sixspot} %% shows a sixspot effect
-%\RubikRotation{\errors} %% sixspot with errors (errors will be shown if using \ShowRobotErrors)
-
-\begin{tikzpicture}
- \DrawRubikCubeFlat %% shows cube as half cube half flat
- %\DrawRubikFlat %% shows cube as a flat representation
-\end{tikzpicture}
-%%--------------
-\ShowRubikErrors %% will show error file underneath the image
-\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/rubik/examples.pdf b/Master/texmf-dist/doc/latex/rubik/examples.pdf
new file mode 100644
index 00000000000..7aae8f46b65
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/examples.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/examples.sh b/Master/texmf-dist/doc/latex/rubik/examples.sh
new file mode 100644
index 00000000000..a891b830979
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/examples.sh
@@ -0,0 +1,5 @@
+ latex --shell-escape examples.tex
+# latex --shell-escape examples.tex
+
+##echo "...checking error file"
+##grep ERROR ./rubikstateERRORS.dat
diff --git a/Master/texmf-dist/doc/latex/rubik/examples.tex b/Master/texmf-dist/doc/latex/rubik/examples.tex
new file mode 100644
index 00000000000..9f5a1512175
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/examples.tex
@@ -0,0 +1,467 @@
+%%
+%% examples.tex
+%% examples using the rubikrotation package v3.0
+%% Requires rubik packages (v3.0) and also the tikz package
+%% Part of the Rubik bundle (www.ctan.org/pkg/rubik)
+%% RWD Nickalls & A Syropoulos
+%% September 25, 2015
+%%--------NOTE-------------------------------------------
+%% USAGE: (pdf)latex --shell-escape example-rot1.tex
+%% run three times to get all labels and fig nos correct
+%%-------------------------------------------------------
+\documentclass[a4paper]{article}
+\usepackage{tikz} %% load tikz BEFORE rubikcube
+\usepackage{rubikcube,rubikrotation}
+\usepackage{url}
+%-------------
+\pagestyle{myheadings}
+\markright{\textsc{rubikrotation} package v3.0 (Sept 2015) \hspace{0.5cm}\texttt{www.ctan.org/pkg/rubik} \hspace{0.5cm}examples.tex}
+%-----------
+%% some well known sequences (see the web page of Reid)
+\newcommand{\sixTs}{*sixTs,F2,R2,U2,Fp,B,D2,L2,F,B}
+\newcommand{\CubeInCube}{*CubeInCube,F,L,F,Up,R,U,F2,L2,Up,Lp,B,Dp,Bp,L2,U}
+\newcommand{\sixspot}{[sixspot],U,Dp,R,Lp,F,Bp,U,Dp}
+\newcommand{\superflip}{U,R2,Fp,R,Dp,L,Bp,R,Up,R,Up,D,%
+Fp,U,Fp,Up,Dp,B,Lp,Fp,Bp,Dp,Lp}
+%--------------------
+%% brace and bracket
+\newcommand{\Rubikbracket}[1]{$\left(\mbox{#1}\right)$}
+\newcommand{\Rubikbrace}[1]{$\left\{\mbox{#1}\right\}$}
+%---------------
+%% increase text space to make room
+\addtolength{\oddsidemargin}{-1.5cm}
+\addtolength{\textwidth}{3cm}
+\addtolength{\textheight}{1cm}
+%%==================
+
+\begin{document}
+
+\begin{center}
+\Huge{Rubikrotation examples}\,\footnote{These examples are part of the
+\textsc{rubikrotation} package, and assume some familiarity with the Rubik bundle
+documentation \texttt{rubikcube.pdf} and \texttt{rubikrotation.pdf}.}
+\end{center}
+
+\bigskip
+
+\textsc{note}: Since the \verb!\RubikRotation! command calls the perl script
+\texttt{rubikrotation.pl} this \texttt{.tex}~file needs to be run using
+the \verb!--shell-escape! command-line switch, as follows:
+\begin{quote}
+\begin{verbatim}
+latex --shell-escape example-tex
+\end{verbatim}
+\end{quote}
+If you forget to use the command-line switch, the file will run OK, but the cubes
+will remain in the initial `solved' configuration. The \texttt{tikz} package must be
+loaded before the two \texttt{rubik..} packages.
+
+%%------------------
+\section*{Example~1}
+
+In Figure~\ref{fig:cubeincube} we show the so-called ``sixspot'' configuration,
+ generated from a solved cube using the rotation sequence
+\rr{U}, \rr{Dp}, \rr{R}, \rr{Lp}, \rr{F}, \rr{Bp}, \rr{U}, \rr{Dp}\
+(see the website of Reid at \url{www.cflmath.edu/~reid/Rubik/patterns.html}).
+%%--------FIGURE 1 -----------
+\begin{figure}[hbt]
+\centering
+\RubikCubeSolved
+\RubikRotation{\sixspot}
+\ShowCube{7cm}{0.7}{\DrawRubikCubeFlat}
+\caption{\label{fig:cubeincube}The so-called `sixspot' configuration (Reid).}
+\end{figure}
+%----------------
+
+{\noindent}Creating a macro to hold a rotation sequence greatly facilitates their
+use, as follows:
+\begin{quote}
+\begin{verbatim}
+\newcommand{\sixspot}{[sixspot],U,Dp,R,Lp,F,Bp,U,Dp}
+\end{verbatim}
+\end{quote}
+We can now process this sequence using its macro name as an argument for the
+\verb!\RubikRotation! command. The code used for the above Figure uses the
+\verb!\ShowCube{}{}{}! command for which \verb!#1! is the minipage width, \verb!#2!
+is the tikzpicture scale factor (0--1), and \verb!#3! is a Rubik \verb!\Draw..! command
+(see \textsc{rubikrotation} documentation for details).
+\begin{quote}
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation}
+\thispagestyle{empty} %% disables pagenumbers
+...
+\begin{figure}[hbt]
+ \centering
+ \RubikCubeSolved
+ \RubikRotation{\sixspot}
+ \ShowCube{7cm}{0.7}{\DrawRubikCubeFlat}
+ \caption{...}
+\end{figure}
+\end{verbatim}
+\end{quote}
+Note that running the `sixspot' sequence 3 times returns the cube to its original `solved'
+state (it is a so-called `order~3' sequence). The~command for processing it three times
+is \verb!\RubikRotation[3]{\sixspot}!.
+
+
+\pagebreak
+%%-------------------------
+\section*{Example~2}
+
+ In this example we demonstrate the use of the \verb!\ShowRubikErrors! command, which
+ places a copy of the Perl output file \verb!rubikstateERRORS.dat! underneath the graphic
+ so you can see a list of all the errors, if any (in this example we have introduced a few
+ errors---wrong minipage width, typos and some animals---into the rotation sequence).
+ It is important to note that the \verb!\ShowRubikErrors! command must be
+ placed \textit{after} the TikZ picture environment (i.e.,~in this case after
+the \verb!\ShowCube! command). Note that full details of all
+ errors are also included in the .log file.
+
+%%--------FIGURE 2 -----------
+
+\RubikCubeSolved
+\RubikRotation{[sixspot],U,Dp,R,Lp,F,Bp,U,Dpppp,cat,dog}
+
+\begin{figure}[hbt]
+ \centering
+ \ShowCubeF{4.5cm}{0.7}{\DrawRubikCubeFlat}
+ \ShowRubikErrors
+\parbox{0.7\textwidth}{%
+\caption{\label{fig:cubeincubeE}The same `sixspot' sequence of rotations as shown in
+Example~1, but now with some errors (wrong minipage-width, typos \& animals\,!) in the
+rotation sequence (it should be just \texttt{U,Dp,R,Lp,F,Bp,U,Dp}).}
+}
+\end{figure}
+{\noindent}In this example we have used the F version of the \verb!\ShowCube!
+command (\verb!\ShowCubeF!) which places an fbox around the image so you can see the
+extent of any white space etc. This reveals that the set minipage-width (4.5cm) in the
+\verb!\ShowCubeF! command---see code below---is too narrow: it should be 7cm ($10 \times 0.7$)
+to just include the whole image. Once fixed, we can remove the F from the \verb!\ShowCubeF! command.
+Note also that only `\verb!\Draw...!' commands really need to be inside the TikZ picture environment
+(i.e.,~inside the \verb!\ShowCube! command). The above figure was generated by the following code.
+%-----------------
+\begin{quote}
+\begin{verbatim}
+\RubikCubeSolved
+\RubikRotation{[sixspot],U,Dp,R,Lp,F,Bp,U,Dpppp,cat,dog}
+\begin{figure}[hbt]
+ \centering
+ \ShowCubeF{4.5cm}{0.7}{\DrawRubikCubeFlat}
+ \ShowRubikErrors
+\caption{....}
+\end{figure}
+\end{verbatim}
+\end{quote}
+Even if the \verb!\ShowRubikErrors! command is not used, it is always a good idea to check the
+file \verb!rubikstateERRORS.dat! after a \LaTeX\ run, since this file will reveal any errors.
+
+
+
+\pagebreak
+%-------------------------------
+\section*{Example~3}
+
+In this example we use the \verb!\RubikRotation! command to scramble a `solved' Rubik
+cube via a sequence of 120 random rotations, using the following command (the details
+of the process can be seen in the \texttt{.log} file):
+\begin{quote}
+\begin{verbatim}
+\RubikRotation{random,120}
+\end{verbatim}
+\end{quote}
+In this example, we also save the final configuration (state) to a file
+(\texttt{exampfig4.tex}) using the command
+\verb!\SaveRubikState{exampfig4.tex}!
+so we can display the cube in the same state later (see Example~4) but
+in a different format.
+Note that since we are using a random sequence, it follows that each
+time this file is run not only will a visually different cube be generated,
+but the same state will be shown in both Figures~\ref{fig:randomone} and \ref{fig:randomtwo}.
+%%--------FIGURE 3 -----------
+\begin{figure}[hbt]
+ \centering
+ \RubikCubeSolved
+ \RubikRotation{random,120}
+ \SaveRubikState{exampfig4.tex}
+ \ShowCube{8.4cm}{0.7}{\DrawRubikFlat}
+\parbox{0.7\textwidth}{%
+\caption{\label{fig:randomone}This shows a cube generated by 120 random rotations}}
+\end{figure}
+%----------------
+\begin{quote}
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation}
+...
+\begin{figure}[hbt]
+ \centering
+ \RubikCubeSolved
+ \RubikRotation{random,120}
+ \SaveRubikState{exampfig4.tex}
+ \ShowCube{8.4cm}{0.7}{\DrawRubikFlat}
+\caption{....}
+\end{figure}
+\end{verbatim}
+\end{quote}
+
+Q: How do we determine the minipage-width (8.4cm) in the \verb!\ShowCube! command?
+
+A: The object is 12 cubie squares wide (1\,cm each). Since the specified TikZ scale factor is~$0.7$
+here, then the true width of the image is $12 \times 0.7 = 8.4$\,cm. If you change the scale then
+the size of the image will change, and a new width will be required to just fit the image.
+
+Note that in this particular case (only a single image in the `figure' environment), since
+the \verb!\ShowCube! command places the image centrally inside the minipage, the image will
+in fact be centrally placed in the \verb!\textwidth! provided the image is \textit{smaller}
+than the fbox---i.e.,~if we used instead a minipage-width of, say, 12\,cm the image would still
+ appear centered in the \verb!\textwidth! in this case.
+However, when there are several images in the `figure', then the spacing may appear strange
+unless each image closely fits its own minipage-width etc.
+It is often useful, therefore, to check the size of the fbox (using the \verb!\ShowCubeF! command).
+
+
+
+\pagebreak
+
+%----------------------
+\section*{Example~4}
+
+In this example we display a cube having the same state as that shown in
+Figure~\ref{fig:randomone}. The configuration state was saved from
+Figure~\ref{fig:randomone} using the command
+\verb!\SaveRubikState{exampfig4.tex}!, and then input here
+using \verb!\input{exampfig4.tex}!. These commands therefore allow the
+state of a previous cube to be saved to a file, and then displayed again
+later in a different format.
+%%-----------FIGURE 4 -----------
+\begin{figure}[hbt]
+ \centering
+ \input{exampfig4.tex}
+ \ShowCube{4cm}{0.8}{\DrawRubikCubeLD}
+\parbox{0.7\textwidth}{%
+\caption{\label{fig:randomtwo}This shows a Rubik cube in exactly the same
+state as the one shown in Figure~\ref{fig:randomone}} }
+\end{figure}
+%%---------------------------------
+\begin{quote}
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation}
+...
+\begin{figure}[hbt]
+ \centering
+ \input{exampfig4.tex}
+ \Showcube{4cm}{0.8}{\DrawRubikCubeLD}
+\caption{....}
+\end{figure}
+\end{verbatim}
+\end{quote}
+
+
+\pagebreak
+%----------------------
+\section*{Example~5}
+
+Here we show a convenient way of displaying a series of small cubes showing
+a sequence of rotations (\rr{U}, \rr{R}, \rr{F}).
+
+\begin{figure}[hbt]
+\centering
+\RubikCubeSolved
+\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\Rubik{U}
+\RubikRotation{U}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\Rubik{R}
+\RubikRotation{R}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\Rubik{F}
+\RubikRotation{F}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\caption{The rotations \rr{U}, \rr{R}, \rr{F}\ on a solved cube.}
+\end{figure}
+The code for the above sequence is as follows:
+\begin{quote}
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation}
+...
+\begin{figure}[hbt]
+ \centering
+ \RubikCubeSolved
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+ \Rubik{U}
+ \RubikRotation{U}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+ \Rubik{R}
+ \RubikRotation{R}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+ \Rubik{F}
+ \RubikRotation{F}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\caption{The rotations \rr{U}, \rr{R}, \rr{F}\ on a solved cube.}
+\end{figure}
+\end{verbatim}
+\end{quote}
+
+
+\pagebreak
+%----------------------
+\section*{Example~6}
+
+In this example we highlight the fact that commands used inside a TikZ picture
+environment remain local to that environment. Note that this applies with other
+environments too; for example, with both the \verb!\minipage! the \verb!\figure! environments.
+Consequently, it is generally best when drawing a sequence of cubes to reserve the TikZ
+picture environment (i.e.,~the \verb!\ShowCube! command) only for Rubik \verb!\Draw..!
+commands and TikZ commands.
+
+In this example the first cube uses the \verb!\RubikCubeSolved! \textit{inside} the TikZ environment.
+However, if we then perform the rotation \textRubik{R}\ the command \verb!RubikRotation{R}!
+results in something quite unexpected (and obviously not correct). This is because
+ the effect of the \verb!\RubikCubeSolved! command is not visible outside its TikZ environment,
+and hence the \verb!RubikRotation{R}! command has to operate on the current globally available
+colour state information; i.e.,~that following the action of the
+\textbackslash\texttt{RubikRotation\{[sixspot],....\}} command in the earlier Example~2
+(shown in Figure~2) which was executed \textit{before, and outside} the \texttt{figure} environment
+ in that example, and hence the strange form of the second cube below.
+
+
+\medskip
+
+\begin{minipage}{0.4\textwidth}
+\ShowCube{2cm}{0.5}{%
+ \RubikCubeSolved
+ \DrawRubikCubeRU
+ }
+ \hspace{4mm}\Rubik{R}\hspace{5mm}%
+ \RubikRotation{R}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\end{minipage}
+%---------------
+\hspace{1cm}
+\begin{minipage}{0.5\textwidth}
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation}
+...
+\begin{minipage}{0.4\textwidth}
+ \ShowCube{2cm}{0.5}{%
+ \RubikCubeSolved
+ \DrawRubikCubeRU
+ }
+ \hspace{4mm}\Rubik{R}\hspace{5mm}%
+ \RubikRotation{R}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\end{minipage}
+\end{verbatim}
+\end{minipage}
+
+\bigskip
+
+If we now bring the \verb!\RubikCubeSolved! command out and place it before
+the \verb!\ShowCube! command then its `state' information becomes globally
+accessable, and can therefore be acted upon (\&~updated) by the \verb!\RubikRotation{R}!
+command, and hence is rendered (correctly for us) by the next \verb!\DrawRubikCubeRU! command.
+
+\bigskip
+
+
+\begin{minipage}{0.4\textwidth}
+ \RubikCubeSolved
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+ \hspace{4mm}\Rubik{R}\hspace{5mm}%
+ \RubikRotation{R}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\end{minipage}
+%---------------
+\hspace{1cm}
+\begin{minipage}{0.5\textwidth}
+\begin{verbatim}
+\begin{minipage}{0.4\textwidth}
+ \RubikCubeSolved
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+ \hspace{4mm}\Rubik{R}\hspace{5mm}%
+ \RubikRotation{R}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\end{minipage}
+\end{verbatim}
+\end{minipage}
+
+
+
+
+\pagebreak
+%----------------------
+\section*{Example~7}
+
+\subsection*{The `superflip' configuration}
+
+Once you have mastered Rubik's cube, then an interesting exercise is to generate
+the so-called `superflip' configuration, in which all the corners are correctly
+solved, while all the edges are flipped.
+
+For the impatient, the superflip sequence of 24 quarter-turn rotations (listed on
+Randelshofer's website (\url{www.randelshofer.ch/rubik/patterns/U080.01.html}) is as follows.
+This converts the solved cube on the left into the configuration shown on the right.
+
+\bigskip
+
+\begin{center}
+\Rubik{U}\Rubik{R}\Rubik{R}\Rubik{Fp}\Rubik{R}\Rubik{Dp}\Rubik{L}\Rubik{Bp}\Rubik{R}%
+\Rubik{Up}\Rubik{R}\Rubik{Up}\Rubik{D}\Rubik{Fp}\Rubik{U}\Rubik{Fp}\Rubik{Up}\Rubik{Dp}%
+\Rubik{B}\Rubik{Lp}\Rubik{Fp}\Rubik{Bp}\Rubik{Dp}\Rubik{Lp}
+\end{center}
+
+\medskip
+
+{\noindent}Surprisingly, this sequence is actually equivalent to
+\Rubikbrace{\Rubikbracket{\Rubik{M}\Rubik{Up}}4, \Rubik{yp}, \Rubik{x}}3
+
+%--------draw the images-------------
+\begin{figure}[hbt]
+ \centering
+ \RubikCubeSolved%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+ \hspace{5mm}$\Longrightarrow$\hspace{5mm}%
+ \RubikRotation{\superflip}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+ \hspace{1cm}%
+ \ShowCube{5cm}{0.5}{\DrawRubikCubeFlat}
+\caption{Two representations of the superflip configuration.}
+\end{figure}
+%----------------------
+
+%\pagebreak
+
+{\noindent}The full code for the figure above is as follows:
+\begin{quote}
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation}
+...
+\begin{center}
+\Rubik{U}\Rubik{R}\Rubik{R}\Rubik{Fp}\Rubik{R}\Rubik{Dp}\Rubik{L}\Rubik{Bp}%
+\Rubik{R}\Rubik{Up}\Rubik{R}\Rubik{Up}\Rubik{D}\Rubik{Fp}\Rubik{U}\Rubik{Fp}%
+\Rubik{Up}\Rubik{Dp}\Rubik{B}\Rubik{Lp}\Rubik{Fp}\Rubik{Bp}\Rubik{Dp}\Rubik{Lp}
+\end{center}
+
+\medskip
+
+%% brace and bracket macros
+\newcommand{\Rubikbracket}[1]{$\left(\mbox{#1}\right)$}
+\newcommand{\Rubikbrace}[1]{$\left\{\mbox{#1}\right\}$}
+
+{\noindent}Surprisingly, this sequence is actually equivalent to
+\Rubikbrace{\Rubikbracket{\Rubik{M}\Rubik{Up}}4, \Rubik{yp}, \Rubik{x}}3
+
+\newcommand{\superflip}{U,R2,Fp,R,Dp,L,Bp,R,Up,R,Up,D,%
+Fp,U,Fp,Up,Dp,B,Lp,Fp,Bp,Dp,Lp}
+
+\begin{figure}[hbt]
+ \centering
+ \RubikCubeSolved%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+ \hspace{5mm}$\Longrightarrow$\hspace{5mm}%
+ \RubikRotation{\superflip}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+ \hspace{1cm}%
+ \ShowCube{5cm}{0.5}{\DrawRubikCubeFlat}
+\caption{...}
+\end{figure}
+\end{verbatim}
+\end{quote}
+\begin{center}
+------ END ------
+\end{center}
+
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikcube.pdf b/Master/texmf-dist/doc/latex/rubik/rubikcube.pdf
index 5cffa577720..62d8671ee15 100644
--- a/Master/texmf-dist/doc/latex/rubik/rubikcube.pdf
+++ b/Master/texmf-dist/doc/latex/rubik/rubikcube.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikrotation.1 b/Master/texmf-dist/doc/latex/rubik/rubikrotation.1
new file mode 100644
index 00000000000..bfcec061deb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/rubikrotation.1
@@ -0,0 +1,48 @@
+.\" copyright (c) 2015 A Syropoulos and RWD Nickalls
+.\" rubikrotation.1
+.\" place this file in: /usr/share/man/man1/
+..
+.TH rubikrotation.1
+.SH NAME
+.B rubikrotation (v3.0)
+.SH AUTHORS
+A. Syropoulos and R.W.D. Nickalls (September 25, 2015)
+
+ asyropoulos[at]<yahoo><com>
+ dick[at]<nickalls><org>
+
+.SH DESCRIPTION
+.B rubikrotation
+is a Perl script for processing Rubik cube rotations. It is part of the LaTeX rubikrotation package, and is typically CALLed by rubikrotation.sty. See the package manual for full details (type at the commandline: texdoc rubikrotation). Both the rubikrotation and rubikcube packages are part of the LaTeX Rubik `bundle'. The latest version can be downloaded from
+.PP
+CTAN: tex-archive/tex/latex/contrib/rubik/
+.PP
+rubikrotation reads Rubik configuration data and instructions from an input file, and writes the new configuration data to an output file. The input and output filenames can be specified as command-line arguments (see: command-line use).
+
+.SH COMMAND-LINE USE
+rubikrotation [-h] [-o <outfile>] -i <infile>
+
+.B -h
+displays the help info and exits.
+
+.B -i
+defines the input filename.
+Typically the file rubikstate.dat which is generated by the LaTeX RubikRotation{} command.
+
+.B -o
+defines the output filename.
+If no output filename is given then the default filename rubikOUT.txt is used.
+
+.SH SEE ALSO
+The rubikrotation package manual (rubikrotation.pdf) and examples, and also the rubikcube package manual (rubikcube.pdf)
+
+To view rubikrotation.pdf, type: texdoc rubikrotation
+
+To view rubikrotationPL.pdf, type: texdoc rubikrotationPL
+
+To view rubikcube.pdf, type: texdoc rubikcube
+
+
+.SH BUGS
+Please report bugs to Dick Nickalls or to Apostolos Syropoulos.
+
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikrotation.pdf b/Master/texmf-dist/doc/latex/rubik/rubikrotation.pdf
index 207abac2ea7..d38932f4d62 100644
--- a/Master/texmf-dist/doc/latex/rubik/rubikrotation.pdf
+++ b/Master/texmf-dist/doc/latex/rubik/rubikrotation.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikrotationPL.pdf b/Master/texmf-dist/doc/latex/rubik/rubikrotationPL.pdf
new file mode 100644
index 00000000000..0dc64ac5426
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/rubikrotationPL.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikrotationPL.tex b/Master/texmf-dist/doc/latex/rubik/rubikrotationPL.tex
new file mode 100644
index 00000000000..8377aa25a07
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/rubikrotationPL.tex
@@ -0,0 +1,1333 @@
+%% rubikrotationPL.tex (v3.0)
+%% Sept 25, 2015
+%% document the perl program rubikrotation.pl
+%%********************************************
+%% use pdf only to get the landscape version
+%% remember to manually adjust long lines in the writestate sub
+%%********************************************
+
+\documentclass[a4paper]{article}
+
+\usepackage{url,ifpdf}
+
+%% need to widen the page for the code
+\addtolength{\textwidth}{4cm}
+\addtolength{\oddsidemargin}{-2cm}
+%-----------------------------
+%% use pdflatex only (to use landscape)
+\ifpdf
+ \usepackage{pdflscape} %% landscape environment
+ \usepackage[verbose]{microtype} %% pdftex nicer margin alignment
+ \usepackage{cmap} %% make the pdf searchable
+ %% use hyperref
+ \usepackage[pdfencoding=auto]{hyperref}
+ \hypersetup{%%% pdftex,
+ bookmarksopen=true,
+ bookmarksnumbered=true,
+ bookmarkstype=toc,
+ bookmarksopenlevel=2, %% (book=0, chap=1, article=2)
+ %---------------------
+ pdftitle={Documentation of rubikrotation.pl.},
+ pdfauthor={RWD Nickalls and A Syropoulos},
+ pdfsubject={Rubik, rubikrotation},
+ pdfkeywords={TeX, Rubik, Rubikrotation},
+ }
+\fi
+
+\begin{document}
+
+
+\title{\vspace{-3cm}%
+ \ifpdf\pdfbookmark[0]{Title}{Title}\else\fi%
+ %% \strut\vspace{\baselineskip}%
+ Documentation of \texttt{rubikrotation.pl}\\ version~3.0}
+\author{Nickalls RWD (\textsf{dick@nickalls.org})\\
+ and\\ Syropoulos A (\textsf{asyropoulos@yahoo.com})}
+\date{Last revised: 25 September 2015\\ \smallskip this file: \texttt{rubikrotationPL.tex}}
+\maketitle
+
+\tableofcontents
+\ifpdf\pdfbookmark[0]{Contents}{Contents}\else\fi
+
+\section{Overview}
+
+This Perl program, is part of the \LaTeX\ \textsf{rubikrotation} package.
+The two packages Rubikcube and Rubikrotation form the `Rubik bundle'
+(available from \url{http://www.ctan.org/pkg/rubik}).
+
+This program reads (as input) a formatted `data' file (typically the file \texttt{rubikstate.dat} when used with
+the rubikcube package). The data-file defines the
+current state of the cube (using the keywords up, down, left, right, front, back),
+and includes special keywords (checkstate, rotation, random) which trigger the relevant
+ subroutines to process the input data accordingly. Finally, the program writes the final state to
+a text-file (typically the file \texttt{rubikstateNEW.dat} when used with the Rubikcube package),
+ and writes any error messages to the file \texttt{rubikstateERRORS.dat}.
+
+Version 3 onwards uses the input and output filenames specified by the CALLing command-line,
+the usage being as follows:
+\begin{verbatim}
+rubikrotation -i <input file> [-o <out file>]
+\end{verbatim}
+If no output filename is specified, then the default filename \texttt{rubikOUT.txt} is used.
+When used in conjunction with the Rubikcube package, then \texttt{rubikcube.sty} calls the program and sets
+the input filename as \texttt{rubikstate.dat} and the output filename as \texttt{rubikstateNEW.dat}.
+
+%%================================
+\begin{landscape}
+
+\section{The code}
+\begin{verbatim}
+#!/usr/bin/env perl
+##
+use Carp;
+use Fatal;
+use warnings;
+##
+our $version = "3.0 (25 Sept 2015)";
+##---------------------------
+##
+## rubikrotation.pl
+## VERSION 3.0
+## Copyright 25 September, 2015,
+## RWD Nickalls (dick@nickalls.org}
+## A Syropoulos (asyropoulos@yahoo.com)
+##
+##--------------------------------
+## changes in v3.0:
+## 1) accepts command-line arguments for input (mandatory) and output (optional) filenames
+## default output filename is: rubikOUT.txt
+## 2) included the symbols [ and ] to denote a rotation-name label (ie as well as *)
+## 3) fixed some of the variable definitions (as highlighted by <use strict> pragma)
+##--------------------------------
+## changes in v2.3:
+## 1) accepts a single commandline argument (datafilename)
+## 2) uses the standard modules Carp and Fatal (give extra line info on error)
+##--------------------------------
+## changes in v2.2:
+## 1) changed licence --> LatexPP
+## 2) included random n errors in ERROR messages (lines 492--495)
+## 3) included version number in error message
+##------------------------------
+##
+## This file is part of the LaTeX rubikrotation package, and
+## requires rubikcube.sty and rubikrotation.sty
+##
+## rubikrotation.pl is a Perl-5 program and free software:
+## This program can be redistributed and/or modified under the terms
+## of the LaTeX Project Public License Distributed from CTAN
+## archives in directory macros/latex/base/lppl.txt; either
+## version 1 of the License, or any later version.
+##
+## rubikrotation.pl is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+##---------------------------------------------------------------------
+## OVERVIEW
+## This program is part of the rubikrotation package, and is complementary to
+## the LaTeX rubikcube package. It processes Rubik rotation sequences on-the-fly.
+## The program reads a datafile (rubikstate.dat) output by the rubikcube package
+## and writes the new state to the file rubikstateNEW.dat, which is then input
+## by the TeX file. Further documentation accompanies the rubikrotation package.
+##
+## Note that all possible state changing rotations of a 3x3x3 cube are
+## either combinations of, or the inverse of, just 9 different rotations,
+## three associated with each XYZ axis.
+##--------------------------------------------------
+\end{verbatim}
+
+
+
+\subsection{Main}
+
+\begin{verbatim}
+\begin{verbatim}
+## This main module opens three files, and
+## sets up an array for collecting all errors (%error), and sets an error flag to "",
+## reads in the rubik state data file =rubikstate.dat (output by TeXfile),
+## and calls subs to write the TeX_OUT_FILE,
+## and finally closes all files.
+## Each line of the input file consists of a comma separated list of arguments.
+## The first argument in each line of the file rubikstate.dat is the rubikkeyword.
+## Program is documented in the rubikrotation.pdf (see section ``Overview'')
+
+our $source_file="";
+our $out_file="rubikOUT.txt"; #default
+our $argc=@ARGV;
+our $commandLineArgs = join(" ", @ARGV);
+our $showargs="\tcommandline args = $commandLineArgs\n";
+our $usage="\tUsage: rubikrotation [-h|--help|-v|--version] -i <input file> [-o <out file>]\n";
+our $rubikversion="\tVersion: this is rubikrotation version $version\n";
+#
+## check for correct number of commandline arguments and allocate filenames
+#
+if ($argc == 0||$argc > 4 ){ # croak if 0 or more than 4 arguments
+ croak $rubikversion,$showargs,
+ "\tWrong no of arguments\n",
+ $usage;
+ }
+ else {
+ SWITCHES:
+ while($_ = $ARGV[0]) {
+ shift;
+ if (/^-h$/ || /^--help$/ ) {
+ die $rubikversion,$usage,
+ "\twhere,\n" .
+ "\t[-h|--help]\tgives this help listing\n" .
+ "\t[-v|--version]\tgives version\n" .
+ "\t[-i] \tcreates specified input file\n",
+ "\t[-o] \tcreates specified output file\n",
+ "\tFor documentation see: rubikrotation.pdf,\n",
+ "\trubikrotationPL.pdf and rubikcube.pdf.\n\n";
+ }
+ elsif (/^-v$/ || /^--version$/ ) {die $rubikversion;}
+ elsif (/^-i$/) {
+ if (!@ARGV){
+ croak $showargs,
+ "\tNo input file specified!\n",
+ $usage;
+ }
+ else {
+ $source_file = $ARGV[0],
+ shift;
+ }
+ }
+ elsif (/^-o$/) {
+ if (!@ARGV) {
+ croak $showargs,
+ "\tNo output file specified!\n",
+ $usage;
+ }
+ else {
+ $out_file = $ARGV[0],
+ shift;
+ }
+ }
+ elsif (/^-\w+/) {
+ croak $showargs,
+ "\t$_: Illegal command line switch!\n",
+ $usage;
+ }
+ else {
+ croak $showargs,
+ "\tmissing filenames or ? missing -i or -o switch!\n",
+ $usage;
+ }
+ } # end of while
+}; # end of else
+
+print "This is rubikrotation version $version\n";
+#================================
+ open(IN_FILE, "<$source_file") ||croak "\tCan't open source file: $source_file\n";
+ open(TeX_OUT_FILE, ">$out_file")||croak "\tCan't open output file: $out_file\n";
+
+ ## create error file (for append)
+ open (ERROR_OUT_FILE, ">>rubikstateERRORS.dat")||croak "ERROR: can't open file rubikstateERRORS.dat\n";
+
+
+ ## use dots for Perl messages (I have used dashes for LaTeX messages in the .sty)
+ ## gprint sub prints its argument (message) to both the screen and to the TeX_OUT_FILE
+
+ gprint ("...PERL process..................................");
+ gprint ("...program = rubikrotation.pl v$version");
+
+## setup global error parameters, so we can write all the errors to a file as an array
+my %error = (); # setup an array for error messages (was %)
+my $erroralert = ""; # error flag
+my $errornumber = 0; #set number of errors to zero
+
+ gprint ("...reading the current rubik state (from File: $source_file)");
+
+my $dataline = "";
+my $rubikkeyword = "";
+my $rotationcommand = "";
+my @data;
+
+ LINE: while (<IN_FILE>){
+ next LINE if /^#/; #skip comments
+ next LINE if /^%/; #skip comments
+ next LINE if /^$/; #skip blank lines
+ $dataline = $_; # grab the whole line as a string
+ chomp $dataline; # remove the line-ending characters
+ #$n++; # count the number of lines
+ @data=split (/,/, $dataline); # create an array called data
+ ## we have 10 fields (0--9)
+ ## check for rubikkeyword= up,down,left,right,front,back,checkstate,rotation:
+ gprint ("...$dataline");
+ $rubikkeyword=$data[0];
+
+ if ($rubikkeyword eq 'up') {
+ $Ult[0]=$data[1], $Umt[0]=$data[2],$Urt[0]=$data[3],
+ $Ulm[0]=$data[4], $Umm[0]=$data[5],$Urm[0]=$data[6],
+ $Ulb[0]=$data[7], $Umb[0]=$data[8],$Urb[0]=$data[9]
+ }
+
+ if ($rubikkeyword eq 'down') {
+ $Dlt[0]=$data[1], $Dmt[0]=$data[2],$Drt[0]=$data[3],
+ $Dlm[0]=$data[4], $Dmm[0]=$data[5],$Drm[0]=$data[6],
+ $Dlb[0]=$data[7], $Dmb[0]=$data[8],$Drb[0]=$data[9]
+ }
+ if ($rubikkeyword eq 'left') {
+ $Llt[0]=$data[1], $Lmt[0]=$data[2],$Lrt[0]=$data[3],
+ $Llm[0]=$data[4], $Lmm[0]=$data[5],$Lrm[0]=$data[6],
+ $Llb[0]=$data[7], $Lmb[0]=$data[8],$Lrb[0]=$data[9]
+ }
+ if ($rubikkeyword eq 'right') {
+ $Rlt[0]=$data[1], $Rmt[0]=$data[2],$Rrt[0]=$data[3],
+ $Rlm[0]=$data[4], $Rmm[0]=$data[5],$Rrm[0]=$data[6],
+ $Rlb[0]=$data[7], $Rmb[0]=$data[8],$Rrb[0]=$data[9]
+ }
+
+ if ($rubikkeyword eq 'front') {
+ $Flt[0]=$data[1], $Fmt[0]=$data[2],$Frt[0]=$data[3],
+ $Flm[0]=$data[4], $Fmm[0]=$data[5],$Frm[0]=$data[6],
+ $Flb[0]=$data[7], $Fmb[0]=$data[8],$Frb[0]=$data[9]
+ }
+ if ($rubikkeyword eq 'back') {
+ $Blt[0]=$data[1], $Bmt[0]=$data[2],$Brt[0]=$data[3],
+ $Blm[0]=$data[4], $Bmm[0]=$data[5],$Brm[0]=$data[6],
+ $Blb[0]=$data[7], $Bmb[0]=$data[8],$Brb[0]=$data[9]
+ }
+
+## if the rubikkeyword is `checkstate' we just check the
+## state and write the output data to a file.
+ if ($rubikkeyword eq 'checkstate') {
+ gprint ("...");
+ $rotationcommand=$dataline; ## used in output message
+ gprint ("...command=$rotationcommand");
+ checkstate();
+ };
+
+## if the rubikkeyword is `rotation' we first check to see if the second argument=random.
+## if so, then we check that the third argument is an integer, if so --> random sub
+## else --> exit line and get next line.
+## finally we write the output data to a file.
+
+ if ($rubikkeyword eq 'rotation')
+ {
+ gprint ("...");
+ $rotationcommand=$dataline; ## used in output message
+ gprint ("...command=$rotationcommand");
+
+
+ ##-----random-----------------
+ ## if second argument = random,
+ ## THEN we also need to check if third argument is an integer;
+ ## if so -->random sub.
+ ## if the 3rd argument is NOT an integer then reject line & get next input line
+ if ($data[1] eq 'random')
+ {
+ if ($data[2] =~/\D/) {
+ errormessage("[$data[2]] not an integer");
+ ## we reject the whole line and look at next line in the file
+ next
+ }
+ else{
+ ## data[2] must be an integer (n), so we just do n random rotations
+ random($data[2])
+ };
+ }
+ else {
+ # the line must be an ordinary rotation sequence line, so send the sequence
+ # to the rotation sub, BUT, need to first remove the
+ # rubikkeyword `rotation' from the begining of line (array)
+ # as we need to send ONLY the sequence string to the rotation sub.
+
+ ## remove keyword rotation
+ shift (@data);
+
+ ## process @data string by the rotation sub
+ rotation(@data);
+ }
+ }
+##-------------------------------
+## place additional keywords here
+##-------------------------------
+ }; ## end of while
+
+ ## we have finished reading in all the lines from the source file,
+ ## and doing all the rotations etc, so we now just write the new cube state
+ ## to the output file = TeX_OUT_FILE (so LaTeX can read it)
+ writestate();
+ close; ##close all files
+ exit;
+##==============end of main==========================
+\end{verbatim}
+
+
+%--------------------------
+\subsection{Errormessage}
+
+\begin{verbatim}
+sub errormessage{
+## writes the argument as a standard error message to out file
+ my $errormess = $_[0];
+ $erroralert = "YES"; ## set error alert flag (for use in out message)
+ $error[$errornumber] = "** ERROR: $errormess";
+ $errornumber++; ## increment number
+};
+\end{verbatim}
+
+
+%----------------------
+\subsection{Gprint}
+
+\begin{verbatim}
+## prints argument (comments) to screen and also to TeX_OUT_FILE.
+## The typeout commands will find its way into the log file when read by latex
+## Important to include trailing % for messages written to the TeX_OUT_FILE
+## to stop extra <spaces> being seen by TeX.
+sub gprint{
+ my $gmess=$_[0];
+ print "$gmess\n";
+ print (TeX_OUT_FILE "\\typeout{$gmess}\%\n");
+ };
+\end{verbatim}
+
+
+
+%------------------------
+\subsection{Checkstate}
+
+\begin{verbatim}
+sub checkstate{
+### simple check to see if wrong no of colours being used etc
+### uses the cubie colours as used by rubikcube package= ROYGBWX
+
+ gprint ("...checking state of cube");
+
+ my @cubies=($Ult[0],$Umt[0],$Urt[0], $Ulm[0],$Umm[0],$Urm[0], $Ulb[0],$Umb[0],$Urb[0],
+ $Dlt[0],$Dmt[0],$Drt[0], $Dlm[0],$Dmm[0],$Drm[0], $Dlb[0],$Dmb[0],$Drb[0],
+ $Llt[0],$Lmt[0],$Lrt[0], $Llm[0],$Lmm[0],$Lrm[0], $Llb[0],$Lmb[0],$Lrb[0],
+ $Rlt[0],$Rmt[0],$Rrt[0], $Rlm[0],$Rmm[0],$Rrm[0], $Rlb[0],$Rmb[0],$Rrb[0],
+ $Flt[0],$Fmt[0],$Frt[0], $Flm[0],$Fmm[0],$Frm[0], $Flb[0],$Fmb[0],$Frb[0],
+ $Blt[0],$Bmt[0],$Brt[0], $Blm[0],$Bmm[0],$Brm[0], $Blb[0],$Bmb[0],$Brb[0]);
+
+my $R=0,my $O=0,my $Y=0,my $G=0,my $B=0,my $W=0,my $X=0;
+
+my $cubiecolour = "";
+
+foreach $cubiecolour (@cubies)
+ {
+ if ($cubiecolour eq R) {$R = $R+1}
+ elsif ($cubiecolour eq O) {$O = $O+1}
+ elsif ($cubiecolour eq Y) {$Y = $Y+1}
+ elsif ($cubiecolour eq G) {$G = $G+1}
+ elsif ($cubiecolour eq B) {$B = $B+1}
+ elsif ($cubiecolour eq W) {$W = $W+1}
+ elsif ($cubiecolour eq X) {$X = $X+1}
+ else {print " cubiecolour counting ERROR \n";}
+ };
+my $cubiesum=0;
+$cubiesum = $R+$O+$Y+$G+$B+$W+$X;
+gprint ("...cubiesum = $cubiesum (Red=$R, Or=$O, Ye=$Y, Gr=$G, Bl=$B, Wh=$W, X=$X)");
+
+if ($cubiesum != 54) { errormessage("cubiesum not = 54")};
+if ($R >9){ errormessage("No of Red cubies > 9 (=$R)")};
+if ($O >9){ errormessage("No of Orange cubies > 9 (=$O)")};
+if ($Y >9){ errormessage("No of Yellow cubies > 9 (=$Y)")};
+if ($G >9){ errormessage("No of Green cubies > 9 (=$G)")};
+if ($B >9){ errormessage("No of Blue cubies > 9 (=$B)")};
+if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
+};
+##====================================================
+\end{verbatim}
+
+
+
+%--------------------
+\subsection{Rotation}
+
+\begin{verbatim}
+# no of arguments passed to the sub = $#_ (black book p 156)
+
+sub rotation {
+## here we process the array @data (from main) consisting of all
+## the rotation commands associated with
+## a single RubikRotation command.
+
+ my $m; #multiple associated with the char, eg D2 etc
+ my $n = ($#_ +1); ##total no of arguments passed
+ my $originalchar="";
+ my $j;
+ my $numberofchars; ## length of a string
+ my $nfrontchars;
+ my $char = "";
+
+ gprint ("...arguments passed to `rotation' sub = @_ (n= $n)");
+ foreach $char (@_) {
+ $char =~s/^\s+//, $char=~s/\s+$//; ## clean leading and trailing white space
+ ## grab a copy of the original char for use if m Mod4=0
+ $originalchar=$char;
+
+ ## if argument has a leading * or [ or ] then it is a label (not a rotation)
+ ## so jump to next one
+ if (substr ($char,0,1) =~ /[ * \[ \] ]/ ){
+ gprint ("...$char is a label OK");
+ next;
+ };
+
+ ## Need to detect any trailing integer associated with a command (eg rotation multiple, eg:U3, L2 etc)
+ ## NOTES: since we are using mod4, we are only interested in trailing digit
+ ## if trailing character is a digit, then
+ ## split char string into front chars (= $char) + trailing digit (= $m)
+ $m = 1; # initialise m
+
+ ## if terminal char is a digit (d) then let d --> m and let frontstring --> char
+ ## (Black book p 130 & 136)
+ ## if the frontstring contains any digits then it will be rejected in the filter below anyway.
+
+ if ( substr ($char,-1) =~ /(\d)/)
+ {
+ $m = $1; ## grab the trailing digit (only traps a single digit)
+ $numberofchars = 0; #initialise it
+ $numberofchars = length $originalchar;
+ $nfrontchars = $numberofchars-1;
+ ## reassign the string except the terminal digit
+ $char = substr($char,0,$nfrontchars);
+ ## use MOD 4 since we are dealing with Rubik rotations
+ $m = $m % 4;
+ ## (if MOD 4 = 0 then nothing will happen as j starts at 1)
+ ## but should generate an errormessage
+ if ( $m == 0 ){
+ gprint ("...rotation $originalchar equiv 0 (NOT IMPLEMENTED)");
+ errormessage ("[$originalchar] in RubikRotation (4 MOD 4 = 0)");
+ next;
+ };
+ };
+ ## if single trailing digit present, then we implement the rotation command m times.
+ ## if more than one trailing digit
+ ## then the error is trapped at the end (as frontstring will not be recognised
+ ## ie will not be in the following list, and hence will be trapped as an error, eg R3)
+ ##
+ if ($char eq "R") {for($j=1;$j<=$m;$j++) { gprint ("...rotation R OK"); &rrR}}
+ elsif ($char eq "Rp") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Rp OK (= rrR3)"); &rrRp}}
+ elsif ($char eq "Rw") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Rw OK (= rrR + rrSr)"); &rrRw}}
+ elsif ($char eq "Rwp") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Rwp OK (= rrRp + rrSrp)"); &rrRwp}}
+ elsif ($char eq "Rs") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Rs OK (= rrR + rrLp)"); &rrRs}}
+ elsif ($char eq "Rsp") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Rsp OK (= rrRp + rrL)"); &rrRsp}}
+ elsif ($char eq "Ra") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Ra OK (= rrR + rrL)"); &rrRa}}
+ elsif ($char eq "Rap") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Rap OK (= rrRp + rrLp)"); &rrRap}}
+ ####
+ elsif ($char eq "L") {for($j=1;$j<=$m;$j++) {gprint ("...rotation L OK (= rrLp3)"); &rrL}}
+ elsif ($char eq "Lp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lp OK"); &rrLp}}
+ elsif ($char eq "Lw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lw OK (= rrLp3 + rrSrp)"); &rrLw}}
+ elsif ($char eq "Lwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lwp OK (= rrLp + rrSr)"); &rrLwp}}
+ elsif ($char eq "Ls") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ls OK (= rrL + rrRp)"); &rrLs}}
+ elsif ($char eq "Lsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lsp OK (= rrLp + rrR)"); &rrLsp}}
+ elsif ($char eq "La") {for($j=1;$j<=$m;$j++) {gprint ("...rotation La OK (= rrL + rrR)"); &rrLa}}
+ elsif ($char eq "Lap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lap OK (= rrLp + rrRp)"); &rrLap}}
+ ####
+ elsif ($char eq "U") {for($j=1;$j<=$m;$j++) {gprint ("...rotation U OK"); &rrU}}
+ elsif ($char eq "Up") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Up OK (= rrU3)"); &rrUp}}
+ elsif ($char eq "Uw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Uw OK (= rrU + rrSu)"); &rrUw}}
+ elsif ($char eq "Uwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Uwp OK (= rrUp + rrSup)"); &rrUwp}}
+ elsif ($char eq "Us") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Us OK (= rrU + rrDp)"); &rrUs}}
+ elsif ($char eq "Usp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Usp OK (= rrUp + rrD)"); &rrUsp}}
+ elsif ($char eq "Ua") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ua OK (= rrU + rrD)"); &rrUa}}
+ elsif ($char eq "Uap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Uap OK (= rrUp + rrDp)"); &rrUap}}
+ ####
+ elsif ($char eq "D") {for($j=1;$j<=$m;$j++) {gprint ("...rotation D OK (= rrDp3)"); &rrD}}
+ elsif ($char eq "Dp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dp OK "); &rrDp}}
+ elsif ($char eq "Dw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dw OK (= rrDp3 + rrSup)"); &rrDw}}
+ elsif ($char eq "Dwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dwp OK (= rrDp + rrSu)"); &rrDwp}}
+ elsif ($char eq "Ds") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ds OK (= rrD + rrUp)"); &rrDs}}
+ elsif ($char eq "Dsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dsp OK (= rrDp + rrU)"); &rrDsp}}
+ elsif ($char eq "Da") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Da OK (= rrD + rrU)"); &rrDa}}
+ elsif ($char eq "Dap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dap OK (= rrDp + rrUp)"); &rrDap}}
+ ####
+ elsif ($char eq "F") {for($j=1;$j<=$m;$j++) {gprint ("...rotation F OK"); &rrF}}
+ elsif ($char eq "Fp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fp OK (= rrF3)"); &rrFp}}
+ elsif ($char eq "Fw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fw OK (= rrF + rrSf)"); &rrFw}}
+ elsif ($char eq "Fwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fwp OK (= rrFp + rrSfp)"); &rrFwp}}
+ elsif ($char eq "Fs") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fs OK (= rrF + rrBp)"); &rrFs}}
+ elsif ($char eq "Fsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fsp OK (= rrFp + rrB)"); &rrFsp}}
+ elsif ($char eq "Fa") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fa OK (= rrF + rrB)"); &rrFa}}
+ elsif ($char eq "Fap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fap OK (= rrFp + rrBp)"); &rrFap}}
+ ####
+ elsif ($char eq "B") {for($j=1;$j<=$m;$j++) {gprint ("...rotation B OK (= rrFp3)"); &rrB}}
+ elsif ($char eq "Bp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bp OK"); &rrBp}}
+ elsif ($char eq "Bw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bw OK (= rrFp3 + rrSfp)"); &rrBw}}
+ elsif ($char eq "Bwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bwp OK (= rrFp + rrSf)"); &rrBwp}}
+ elsif ($char eq "Bs") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bs OK (= rrB + rrFp)"); &rrBs}}
+ elsif ($char eq "Bsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bsp OK (= rrBp + rrF)"); &rrBsp}}
+ elsif ($char eq "Ba") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ba OK (= rrB + rrF)"); &rrBa}}
+ elsif ($char eq "Bap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bap OK (= rrBp + rrFp)"); &rrBap}}
+ ####
+ elsif ($char eq "Su") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Su OK "); &rrSu}}
+ elsif ($char eq "Sup") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sup OK (= rrSu3)"); &rrSup}}
+ elsif ($char eq "Sd") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sd OK (= rrSup)"); &rrSd}}
+ elsif ($char eq "Sdp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sdp OK (= rrSu)"); &rrSdp}}
+ elsif ($char eq "Sl") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sl OK (= rrSrp)"); &rrSl}}
+ elsif ($char eq "Slp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Slp OK (= rrSr)"); &rrSlp}}
+ elsif ($char eq "Sr") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sr OK"); &rrSr}}
+ elsif ($char eq "Srp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Srp OK (= rrSr3)"); &rrSrp}}
+ elsif ($char eq "Sf") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sf OK"); &rrSf}}
+ elsif ($char eq "Sfp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sfp OK (= rrSf3)"); &rrSfp}}
+ elsif ($char eq "Sb") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sb OK (= rrSfp)"); &rrSb}}
+ elsif ($char eq "Sbp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sbp OK (= rrSf)"); &rrSbp}}
+ ## XYZ stuff
+ ## need to include lowercase x,y,x, and also u,d,l,r,f,b equivalents
+ elsif ($char eq "X" or $char eq "x" or $char eq "r")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $char OK (= rrR + rrSr + rrLp)"); &rrR;&rrSr;&rrLp}}
+ elsif ($char eq "Xp" or $char eq "xp" or $char eq "l")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $char OK (= rrRp + rrSrp + rrL)");&rrRp;&rrSrp;&rrL}}
+ elsif ($char eq "Y" or $char eq "y" or $char eq "u")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $char OK (= rrU + rrSu + rrDp)"); &rrU;&rrSu;&rrDp}}
+ elsif ($char eq "Yp" or $char eq "yp" or $char eq "d")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $char OK (= rrUp + rrSup + rrD)");&rrUp;&rrSup;&rrD}}
+ elsif ($char eq "Z" or $char eq "z" or $char eq "f")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $char OK (= rrF + rrSf + rrBp)"); &rrF;&rrSf;&rrBp}}
+ elsif ($char eq "Zp" or $char eq "zp" or $char eq "b")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $char OK (= rrFp + rrSfp + rrB)");&rrFp;&rrSfp;&rrB}}
+ ## extras
+ elsif ($char eq "M") {for($j=1;$j<=$m;$j++) {gprint ("...rotation M OK (= Sl) "); &rrSl}}
+ elsif ($char eq "Mp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Mp OK (= Sr) "); &rrSr}}
+ elsif ($char eq "E") {for($j=1;$j<=$m;$j++) {gprint ("...rotation E OK (= Sd) "); &rrSd}}
+ elsif ($char eq "Ep") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ep OK (= Su) "); &rrSu}}
+ elsif ($char eq "S") {for($j=1;$j<=$m;$j++) {gprint ("...rotation S OK (= Sf) "); &rrSf}}
+ elsif ($char eq "Sp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sp OK (= Sb) "); &rrSb}}
+ ####
+ ## check for missing rotation
+ elsif ($char eq "") {for($j=1;$j<=$m;$j++)
+ {gprint ("...rotation ,$char, ERROR ? typo or missing rotation"),
+ errormessage("[,$char,] in RubikRotation: ? typo or missing rotation")}}
+ ####
+ ## rotation must be undefined
+ else {
+ gprint ("...rotation $originalchar NOT KNOWN");
+ errormessage("[$originalchar] in RubikRotation\{\}");
+ };
+ }; # end of foreach
+ }; # end of sub
+
+##---------------------------------------------
+## aNOTE we have defined (as rotation SUBs at the end) just 9 primary rotation transforms,
+## rrR, rrSr, rrLp
+## rrU, rrSu, rrDp
+## rrF, rrSf, rrBp
+## and since all the remaining ones are simply combinations of these 9
+## we now define all the other rotation subs in terms of these 9 primary moves.
+## do NOT use multiples here: write each rotation separately
+## -------------
+## derivative subs from R and Sr and Lp
+sub rrRp{&rrR;&rrR;&rrR}; # (=rrR3)
+sub rrRw{&rrR; &rrSr}; # (= rrR + rrSr)
+sub rrRwp{&rrR;&rrR;&rrR; &rrSr;&rrSr;&rrSr}; # (= rrRp + rrSrp)
+sub rrRs{&rrR;&rrLp};
+sub rrRsp{&rrRp;&rrL};
+sub rrRa{&rrR;&rrL};
+sub rrRap{&rrRp;&rrLp};
+####
+sub rrL{&rrLp;&rrLp;&rrLp}; # (= rrLp3)
+sub rrLw{&rrLp;&rrLp;&rrLp;&rrSrp}; # (=rrLp3 + rrSrp)
+sub rrLwp{&rrLp;&rrSr};
+sub rrLs{&rrL;&rrRp};
+sub rrLsp{&rrLp;&rrR};
+sub rrLa{&rrL;&rrR};
+sub rrLap{&rrLp;&rrRp};
+##-------------
+## derivative subs from U
+sub rrUp{&rrU;&rrU;&rrU}; # (=rrU3)
+sub rrUw{&rrU;&rrSu}; #
+sub rrUwp{&rrUp;&rrSup};
+sub rrUs{&rrU;&rrDp};
+sub rrUsp{&rrUp;&rrD};
+sub rrUa{&rrU;&rrD};
+sub rrUap{&rrUp;&rrDp};
+####
+sub rrD{&rrDp;&rrDp;&rrDp}; # (= rrDp3)
+sub rrDw{&rrDp;&rrDp;&rrDp;&rrSup}; # (=rrDp3 + rrSup)
+sub rrDwp{&rrDp;&rrSu};
+sub rrDs{&rrD;&rrUp};
+sub rrDsp{&rrDp;&rrU};
+sub rrDa{&rrD;&rrU};
+sub rrDap{&rrDp;&rrUp};
+##-------------
+## derivative subs from F
+sub rrFw{&rrF; &rrSf}; # (= rrF + rrSf)
+sub rrFp{ &rrF;&rrF;&rrF}; # (=rrF3)
+sub rrFwp{&rrF;&rrF;&rrF; &rrSf;&rrSf;&rrSf}; # (= rrF3 + rrSf3)
+sub rrFs{&rrF;&rrBp};
+sub rrFsp{&rrFp;&rrB};
+sub rrFa{&rrF;&rrB};
+sub rrFap{&rrFp;&rrBp};
+####
+sub rrB{&rrBp;&rrBp;&rrBp}; # (= rrBp3)
+sub rrBw{&rrBp;&rrBp;&rrBp; &rrSfp}; # (=rrBp3 + rrSfp)
+sub rrBwp{&rrBp;&rrSf};
+sub rrBs{&rrB;&rrFp};
+sub rrBsp{&rrBp;&rrF};
+sub rrBa{&rrB;&rrF};
+sub rrBap{&rrBp;&rrFp};
+####
+## bring all the S versions together
+sub rrSup{&rrSu;&rrSu;&rrSu}; # (=rrSu3)
+sub rrSd{&rrSup}; # (=rrSup)
+sub rrSdp{&rrSu}; # (=rrSu)
+sub rrSl{&rrSrp}; # (=rrSrp)
+sub rrSlp{&rrSr}; # (=rrSr)
+sub rrSrp{&rrSr;&rrSr;&rrSr}; # (=rrSr3)
+sub rrSfp{&rrSf;&rrSf;&rrSf}; # (=rrSf3)
+sub rrSb{&rrSfp}; # (=rrSfp)
+sub rrSbp{&rrSf}; # (=rrSf)
+\end{verbatim}
+
+%----------------------
+\subsection{Random}
+
+\begin{verbatim}
+# no of arguments passed to the sub = $#_ (black book p 156)
+# parameters passed = $_[0]
+
+sub random{
+## scramble randomly using n rotations
+## example command = RubikRotation{random,74}
+## if no n given (second argument = ""), then use default n=50
+## if second argument is some string (not integer) then --> ERROR
+##
+## asign numbers to the minimal set of rotations to be used using a hash array list
+## (perl 5 book page 68)
+## ? maybe we should only use the 18 rotations mentioned in Rokicki 2013 paper?
+## but here I have included all the S ones too.
+
+my @rrlist= ("U", "Up", "Su", "Sup",
+ "D", "Dp", "Sd", "Sdp",
+ "L", "Lp", "Sl", "Slp",
+ "R", "Rp", "Sr", "Srp",
+ "F", "Fp", "Sf", "Sfp",
+ "B", "Bp", "Sb", "Sbp");
+
+my $rrlistnumber=$#rrlist;
+print " rrlistnumber = $rrlistnumber\n";
+# these are numbered 0--$rrlistnumber,
+
+## let default no of random rotations for scrambling = 50
+my $defaultn = 50;
+my $maxn = 200;
+## grab the integer passed from the random() command in main
+my $s = $_[0];
+if ($s >= $maxn) {$s = $maxn;
+ gprint ("...WARNING: maximum n = 200");
+ errormessage ("random: max n =200 (n=200 was used)")}
+ elsif ($s == 0) {$s = $defaultn;
+ gprint ("...WARNING: integer = 0 or not given: using default value 50");
+ errormessage ("random: n invalid (n=50 was used)")};
+
+my @rr; ## array to hold all the random rotations
+print " randomising the available rotations\n";
+
+
+## set the seed for the randomisation (BlackBook p 235)
+srand;
+
+## now select s numbers at random (with replacement) from range 0--listnumber+1
+## Since we are using int(rand x), and using nos from 0--lastindex number,
+## then max rand vaue = (lastindexnumber -1).99999, the integer of which
+## = (lastindexnumber -1). Therefore we need to use the range 0--(lastindexnumber+1)
+## in order to randomise all posibilities on our list.
+
+my $j;
+
+for ($j = 1; $j <=$s; $j=$j+1)
+ {
+ my $p= int(rand ($rrlistnumber +1));
+ print "Rotation = $p, $rrlist[$p] \n";
+ ## push rotation code $rrlist[$p] on to END of array @rr
+ push (@rr, $rrlist[$p]);
+ };
+
+ ## we assume the user is starting from a solved cube (ie use the state given by user)
+ gprint ("...scrambling Rubik cube using $s random rotations");
+ ## now send the array off to the rotation sub
+ rotation(@rr);
+}
+##===================subs==================================
+\end{verbatim}
+
+
+%-----------------------
+\subsection{Writestate}
+
+\begin{verbatim}
+sub writestate{
+## this just writes the final state to the TeX_OUT_FILE (= rubikstateNEW.dat) will be read by latex.
+
+print (TeX_OUT_FILE "\%\% output datafile=$out_file\n");
+print (TeX_OUT_FILE "\%\% PERL prog=rubikrotation version $version\n");
+print (TeX_OUT_FILE "\\typeout{...writing new Rubik state to file $out_file}\%\n");
+print (TeX_OUT_FILE "\\RubikFaceUp\{$Ult[0]\}\{$Umt[0]\}\{$Urt[0]\}\{$Ulm[0]\}\{$Umm[0]\}\{$Urm[0]\}\{$Ulb[0]\}
+ \{$Umb[0]\}\{$Urb[0]\}\%\n");
+print (TeX_OUT_FILE "\\RubikFaceDown\{$Dlt[0]\}\{$Dmt[0]\}\{$Drt[0]\}\{$Dlm[0]\}\{$Dmm[0]\}\{$Drm[0]\}\{$Dlb[0]\}
+ \{$Dmb[0]\}\{$Drb[0]\}\%\n");
+print (TeX_OUT_FILE "\\RubikFaceLeft\{$Llt[0]\}\{$Lmt[0]\}\{$Lrt[0]\}\{$Llm[0]\}\{$Lmm[0]\}\{$Lrm[0]\}\{$Llb[0]\}
+ \{$Lmb[0]\}\{$Lrb[0]\}\%\n");
+print (TeX_OUT_FILE "\\RubikFaceRight\{$Rlt[0]\}\{$Rmt[0]\}\{$Rrt[0]\}\{$Rlm[0]\}\{$Rmm[0]\}\{$Rrm[0]\}\{$Rlb[0]\}
+ \{$Rmb[0]\}\{$Rrb[0]\}\%\n");
+print (TeX_OUT_FILE "\\RubikFaceFront\{$Flt[0]\}\{$Fmt[0]\}\{$Frt[0]\}\{$Flm[0]\}\{$Fmm[0]\}\{$Frm[0]\}\{$Flb[0]\}
+ \{$Fmb[0]\}\{$Frb[0]\}\%\n");
+print (TeX_OUT_FILE "\\RubikFaceBack\{$Blt[0]\}\{$Bmt[0]\}\{$Brt[0]\}\{$Blm[0]\}\{$Bmm[0]\}\{$Brm[0]\}\{$Blb[0]\}
+ \{$Bmb[0]\}\{$Brb[0]\}\%\n");
+
+## now include any error messages generated
+## (these are all in an array waiting to be printed out)
+
+if ($erroralert eq "YES")
+ {
+ ## write errors to a separate file (just for errors---we append the errrors to end of file)
+ ## the error file (rubikstateERRORS.dat) was created by the TeX file
+ my $ne; #number of errors
+ $ne=$#error; ## number of errors= largest index num since we started at zero
+ ### do not attach error to a <checkstate> command
+ if ($rotationcommand eq "checkstate") {}
+ else {
+ print (TeX_OUT_FILE "\\typeout{** ERROR: command=$rotationcommand}\%\n");
+ print (ERROR_OUT_FILE "** ERROR: $rotationcommand\n");
+ };
+ ## last index number or array = $#arrayname (Black book p 62)
+ my $k;
+ for ($k=0; $k<=$ne; $k=$k+1) {
+ print (TeX_OUT_FILE "\\typeout{$error[$k]}\%\n");
+ print (ERROR_OUT_FILE "$error[$k]\n");
+ };
+ };
+print " Perl output file written OK\n";
+}
+##===========================================
+\end{verbatim}
+
+%-----------------
+\subsection{rrR}
+
+
+\begin{verbatim}
+## The following 9 (90 degree) rotation transformations are used
+## to generate all the rotations used in the `rotation sub'
+## each of these is a permutation for both colours and numbers
+## of the cubie facelets.
+## The following 9 subroutines are named as follows:
+## (about X-axis) rrR, rrSr, rrLp
+## (about Y-axis) rrU, rrSu, rrDp
+## (about Z-axis) rrF, rrSf, rrBp
+## see the rubikcube package documentation for full details regarding
+## rotation notation and commands.
+## METHOD & NOTATION
+## each sub (below) starts by making an array[0] for the cubie colour
+## and an array[1] for the cubie number.
+## Each of the face rotations (rrR, rrLp, rrU, rrDp, rrF, rrBp) is involved with
+## two pairs of connected but different permutations/transformations as follows:
+## (a) one pair for the 12 Side cubies (arrays = @Xs0 (for Side colours), @Xs1 (for Side numbers)), and
+## (b) one pair for the 9 Face cubies (arrays = @Xf0 (for Face colours), @Xf1 (for Face numbers)).
+## Each of the center slice rotations (rrSr, rrSu, rrSf) is involved with just one pair of
+## permutations for the 12 Side cubies (arrays = @Xs0 (for Side colours), @Xs1 (for Side numbers)).
+## We document only the side and face of the first sub (rrR) in detail, since the other subs are of similar form.
+##================================================
+ sub rrR{
+
+## the R (slice + face) transform
+## R = RIGHT, s = side; 0=colour, 1= number
+## make the clockwise rotation permutation
+## In this permutation the Front-right-bottom (Frb) (side)facelet rotates to
+## the new position of Up-right-bottom (Urb) (side)facelet.
+##-----------SIDE-------
+## 12 side cubie facelets in arrays @Rs0 (colours) and @Rs1 (numbers)
+## these are the initial positions
+@Rs0=($Frb[0],$Frm[0],$Frt[0],
+ $Urb[0],$Urm[0],$Urt[0],
+ $Blt[0],$Blm[0],$Blb[0],
+ $Drb[0],$Drm[0],$Drt[0]);
+
+@Rs1=($Frb[1],$Frm[1],$Frt[1],
+ $Urb[1],$Urm[1],$Urt[1],
+ $Blt[1],$Blm[1],$Blb[1],
+ $Drb[1],$Drm[1],$Drt[1]);
+
+## now we reallocate the initial array elements to the new
+## post (90 degree clockwise) rotation position.
+## Cube is viewed from FRONT.
+## Positions of side facelets of Right slice are numbered 0-11 in clockwise direction,
+## (as seen from Right face) starting with Up-right-bottom facelet.
+## First line example:
+## variable $Urb[0] (Upface-right-bottom colour) <-- colour of first element in @Rs0 (=Frb[0])
+## variable $Urb[1] (Upface-right-bottom number) <-- number of first element in @Rs1 (=Frb[1])
+$Urb[0]=$Rs0[0]; $Urb[1]=$Rs1[0];
+$Urm[0]=$Rs0[1]; $Urm[1]=$Rs1[1];
+$Urt[0]=$Rs0[2]; $Urt[1]=$Rs1[2];
+
+$Blt[0]=$Rs0[3]; $Blt[1]=$Rs1[3];
+$Blm[0]=$Rs0[4]; $Blm[1]=$Rs1[4];
+$Blb[0]=$Rs0[5]; $Blb[1]=$Rs1[5];
+
+$Drb[0]=$Rs0[6]; $Drb[1]=$Rs1[6];
+$Drm[0]=$Rs0[7]; $Drm[1]=$Rs1[7];
+$Drt[0]=$Rs0[8]; $Drt[1]=$Rs1[8];
+
+$Frb[0]=$Rs0[9]; $Frb[1]=$Rs1[9];
+$Frm[0]=$Rs0[10]; $Frm[1]=$Rs1[10];
+$Frt[0]=$Rs0[11]; $Frt[1]=$Rs1[11];
+
+##-------------Right FACE---------------------
+## R FACE (9 cubies in each array)
+## (numbered in rows: 1,2,3/4,5,6/7,8,9 from top left(1) to bottom right(9))
+## R=Right, f = face; 0=colour, 1= number
+## do the Rface (90 degree) rotation transform
+## here the Right-left-bottom (Rlb) facelet rotates to the possn of Right-left-top (Rlt)
+## we start with two arrays (one for colours @Rf0, one for numbers @Rf1) with 9 elements each.
+@Rf0=($Rlb[0], $Rlm[0], $Rlt[0], $Rmb[0], $Rmm[0], $Rmt[0], $Rrb[0], $Rrm[0], $Rrt[0]);
+@Rf1=($Rlb[1], $Rlm[1], $Rlt[1], $Rmb[1], $Rmm[1], $Rmt[1], $Rrb[1], $Rrm[1], $Rrt[1]);
+
+## now we reallocate the array elements to the new
+## post (90 degree clockwise) rotation facelet position.
+## Right face is viewed from RIGHT.
+## First line example:
+## variable $Rlt[0] (=Right-left-top colour) <-- colour of first element in @Rf0 (=Rlb[0])
+## variable $Rlt[1] (=Right-left-top number) <-- number of first element in @Rf1 (=Rlb[1])
+$Rlt[0]=$Rf0[0]; $Rlt[1]=$Rf1[0];
+$Rmt[0]=$Rf0[1]; $Rmt[1]=$Rf1[1];
+$Rrt[0]=$Rf0[2]; $Rrt[1]=$Rf1[2];
+
+$Rlm[0]=$Rf0[3]; $Rlm[1]=$Rf1[3];
+$Rmm[0]=$Rf0[4]; $Rmm[1]=$Rf1[4];
+$Rrm[0]=$Rf0[5]; $Rrm[1]=$Rf1[5];
+
+$Rlb[0]=$Rf0[6]; $Rlb[1]=$Rf1[6];
+$Rmb[0]=$Rf0[7]; $Rmb[1]=$Rf1[7];
+$Rrb[0]=$Rf0[8]; $Rrb[1]=$Rf1[8];
+
+}
+#============================
+\end{verbatim}
+
+
+%--------------------
+\subsection{rrSr}
+
+
+\begin{verbatim}
+sub rrSr {
+## Sr = Right middle SLICE rotation (only 12 side facelets)
+## modified from rrR (change the U,D,F, r --> m and Back Bl-->Bm; Rs--> ?Srs)
+## change only the slice
+## s = side; 0=colour, 1= number
+## make the post rotation permutation
+
+@SRs0=($Fmb[0],$Fmm[0],$Fmt[0],
+ $Umb[0],$Umm[0],$Umt[0],
+ $Bmt[0],$Bmm[0],$Bmb[0],
+ $Dmb[0],$Dmm[0],$Dmt[0]);
+
+@SRs1=($Fmb[1],$Fmm[1],$Fmt[1],
+ $Umb[1],$Umm[1],$Umt[1],
+ $Bmt[1],$Bmm[1],$Bmb[1],
+ $Dmb[1],$Dmm[1],$Dmt[1]);
+
+
+$Umb[0]=$SRs0[0]; $Umb[1]=$SRs1[0];
+$Umm[0]=$SRs0[1]; $Umm[1]=$SRs1[1];
+$Umt[0]=$SRs0[2]; $Umt[1]=$SRs1[2];
+
+$Bmt[0]=$SRs0[3]; $Bmt[1]=$SRs1[3];
+$Bmm[0]=$SRs0[4]; $Bmm[1]=$SRs1[4];
+$Bmb[0]=$SRs0[5]; $Bmb[1]=$SRs1[5];
+
+$Dmb[0]=$SRs0[6]; $Dmb[1]=$SRs1[6];
+$Dmm[0]=$SRs0[7]; $Dmm[1]=$SRs1[7];
+$Dmt[0]=$SRs0[8]; $Dmt[1]=$SRs1[8];
+
+$Fmb[0]=$SRs0[9]; $Fmb[1]=$SRs1[9];
+$Fmm[0]=$SRs0[10]; $Fmm[1]=$SRs1[10];
+$Fmt[0]=$SRs0[11]; $Fmt[1]=$SRs1[11];
+
+}
+##===================
+\end{verbatim}
+
+
+%--------------------
+\subsection{rrLp}
+
+
+\begin{verbatim}
+sub rrLp{
+
+## Left slice (side + face) anticlockwise rotation
+## s = side; 0=colour, 1= number
+##-------------side-----------
+@LPs0=($Flb[0],$Flm[0],$Flt[0],
+ $Ulb[0],$Ulm[0],$Ult[0],
+ $Brt[0],$Brm[0],$Brb[0],
+ $Dlb[0],$Dlm[0],$Dlt[0]);
+
+@LPs1=($Flb[1],$Flm[1],$Flt[1],
+ $Ulb[1],$Ulm[1],$Ult[1],
+ $Brt[1],$Brm[1],$Brb[1],
+ $Dlb[1],$Dlm[1],$Dlt[1]);
+
+
+$Ulb[0]=$LPs0[0]; $Ulb[1]=$LPs1[0];
+$Ulm[0]=$LPs0[1]; $Ulm[1]=$LPs1[1];
+$Ult[0]=$LPs0[2]; $Ult[1]=$LPs1[2];
+
+$Brt[0]=$LPs0[3]; $Brt[1]=$LPs1[3];
+$Brm[0]=$LPs0[4]; $Brm[1]=$LPs1[4];
+$Brb[0]=$LPs0[5]; $Brb[1]=$LPs1[5];
+
+$Dlb[0]=$LPs0[6]; $Dlb[1]=$LPs1[6];
+$Dlm[0]=$LPs0[7]; $Dlm[1]=$LPs1[7];
+$Dlt[0]=$LPs0[8]; $Dlt[1]=$LPs1[8];
+
+$Flb[0]=$LPs0[9]; $Flb[1]=$LPs1[9];
+$Flm[0]=$LPs0[10]; $Flm[1]=$LPs1[10];
+$Flt[0]=$LPs0[11]; $Flt[1]=$LPs1[11];
+
+
+##---------------Left FACE-------------
+## do the Lface transform (in rows: 1,2,3//4,5,6//7,8,9)
+## f = face; 0=colour, 1= number
+## NOTES: not same as for R
+
+@LPf0=($Lrt[0], $Lrm[0], $Lrb[0], $Lmt[0], $Lmm[0], $Lmb[0], $Llt[0], $Llm[0], $Llb[0]);
+@LPf1=($Lrt[1], $Lrm[1], $Lrb[1], $Lmt[1], $Lmm[1], $Lmb[1], $Llt[1], $Llm[1], $Llb[1]);
+
+$Llt[0]=$LPf0[0]; $Llt[1]=$LPf1[0];
+$Lmt[0]=$LPf0[1]; $Lmt[1]=$LPf1[1];
+$Lrt[0]=$LPf0[2]; $Lrt[1]=$LPf1[2];
+
+$Llm[0]=$LPf0[3]; $Llm[1]=$LPf1[3];
+$Lmm[0]=$LPf0[4]; $Lmm[1]=$LPf1[4];
+$Lrm[0]=$LPf0[5]; $Lrm[1]=$LPf1[5];
+
+$Llb[0]=$LPf0[6]; $Llb[1]=$LPf1[6];
+$Lmb[0]=$LPf0[7]; $Lmb[1]=$LPf1[7];
+$Lrb[0]=$LPf0[8]; $Lrb[1]=$LPf1[8];
+}
+##==================================
+\end{verbatim}
+
+
+%------------------
+\subsection{rrU}
+
+
+\begin{verbatim}
+sub rrU{
+
+## Up slice (side + face)
+## do the Uside transform
+## s = side; 0=colour, 1= number
+## ----------SIDE--------------
+@Us0=($Lrt[0],$Lmt[0],$Llt[0],
+ $Brt[0],$Bmt[0],$Blt[0],
+ $Rrt[0],$Rmt[0],$Rlt[0],
+ $Frt[0],$Fmt[0],$Flt[0]);
+
+@Us1=($Lrt[1],$Lmt[1],$Llt[1],
+ $Brt[1],$Bmt[1],$Blt[1],
+ $Rrt[1],$Rmt[1],$Rlt[1],
+ $Frt[1],$Fmt[1],$Flt[1]);
+
+
+$Brt[0]=$Us0[0]; $Brt[1]=$Us1[0];
+$Bmt[0]=$Us0[1]; $Bmt[1]=$Us1[1];
+$Blt[0]=$Us0[2]; $Blt[1]=$Us1[2];
+
+$Rrt[0]=$Us0[3]; $Rrt[1]=$Us1[3];
+$Rmt[0]=$Us0[4]; $Rmt[1]=$Us1[4];
+$Rlt[0]=$Us0[5]; $Rlt[1]=$Us1[5];
+
+$Frt[0]=$Us0[6]; $Frt[1]=$Us1[6];
+$Fmt[0]=$Us0[7]; $Fmt[1]=$Us1[7];
+$Flt[0]=$Us0[8]; $Flt[1]=$Us1[8];
+
+$Lrt[0]=$Us0[9]; $Lrt[1]=$Us1[9];
+$Lmt[0]=$Us0[10]; $Lmt[1]=$Us1[10];
+$Llt[0]=$Us0[11]; $Llt[1]=$Us1[11];
+
+##-------------Up FACE-------------------
+## do the Rface transform (in rows: 1,2,3//4,5,6//7,8,9)
+## f = face; 0=colour, 1= number
+@Uf0=($Ulb[0], $Ulm[0], $Ult[0], $Umb[0], $Umm[0], $Umt[0], $Urb[0], $Urm[0], $Urt[0]);
+@Uf1=($Ulb[1], $Ulm[1], $Ult[1], $Umb[1], $Umm[1], $Umt[1], $Urb[1], $Urm[1], $Urt[1]);
+
+$Ult[0]=$Uf0[0]; $Ult[1]=$Uf1[0];
+$Umt[0]=$Uf0[1]; $Umt[1]=$Uf1[1];
+$Urt[0]=$Uf0[2]; $Urt[1]=$Uf1[2];
+
+$Ulm[0]=$Uf0[3]; $Ulm[1]=$Uf1[3];
+$Umm[0]=$Uf0[4]; $Umm[1]=$Uf1[4];
+$Urm[0]=$Uf0[5]; $Urm[1]=$Uf1[5];
+
+$Ulb[0]=$Uf0[6]; $Ulb[1]=$Uf1[6];
+$Umb[0]=$Uf0[7]; $Umb[1]=$Uf1[7];
+$Urb[0]=$Uf0[8]; $Urb[1]=$Uf1[8];
+}
+##==============================
+\end{verbatim}
+
+
+%----------------------
+\subsection{rrSu}
+
+
+\begin{verbatim}
+sub rrSu{
+## middle slice rotation (side only 12 facelets)
+## s = side; 0=colour, 1= number
+## make the post rotation permutation
+##-----------SIDE-------------------
+@SUs0=($Lrm[0],$Lmm[0],$Llm[0],
+ $Brm[0],$Bmm[0],$Blm[0],
+ $Rrm[0],$Rmm[0],$Rlm[0],
+ $Frm[0],$Fmm[0],$Flm[0]);
+
+@SUs1=($Lrm[1],$Lmm[1],$Llm[1],
+ $Brm[1],$Bmm[1],$Blm[1],
+ $Rrm[1],$Rmm[1],$Rlm[1],
+ $Frm[1],$Fmm[1],$Flm[1]);
+
+
+$Brm[0]=$SUs0[0]; $Brm[1]=$SUs1[0];
+$Bmm[0]=$SUs0[1]; $Bmm[1]=$SUs1[1];
+$Blm[0]=$SUs0[2]; $Blm[1]=$SUs1[2];
+
+$Rrm[0]=$SUs0[3]; $Rrm[1]=$SUs1[3];
+$Rmm[0]=$SUs0[4]; $Rmm[1]=$SUs1[4];
+$Rlm[0]=$SUs0[5]; $Rlm[1]=$SUs1[5];
+
+$Frm[0]=$SUs0[6]; $Frm[1]=$SUs1[6];
+$Fmm[0]=$SUs0[7]; $Fmm[1]=$SUs1[7];
+$Flm[0]=$SUs0[8]; $Flm[1]=$SUs1[8];
+
+$Lrm[0]=$SUs0[9]; $Lrm[1]=$SUs1[9];
+$Lmm[0]=$SUs0[10]; $Lmm[1]=$SUs1[10];
+$Llm[0]=$SUs0[11]; $Llm[1]=$SUs1[11];
+}
+##==============================
+\end{verbatim}
+
+
+%--------------------
+\subsection{rrDp}
+
+
+
+\begin{verbatim}
+sub rrDp{
+
+## Dpwn Face anticlockwise rotation (side and face)
+## s = side; 0=colour, 1= number
+## make the post rotation permutation
+##--------------SIDE----------------
+@DPs0=($Lrb[0],$Lmb[0],$Llb[0],
+ $Brb[0],$Bmb[0],$Blb[0],
+ $Rrb[0],$Rmb[0],$Rlb[0],
+ $Frb[0],$Fmb[0],$Flb[0]);
+
+@DPs1=($Lrb[1],$Lmb[1],$Llb[1],
+ $Brb[1],$Bmb[1],$Blb[1],
+ $Rrb[1],$Rmb[1],$Rlb[1],
+ $Frb[1],$Fmb[1],$Flb[1]);
+
+$Brb[0]=$DPs0[0]; $Brb[1]=$DPs1[0];
+$Bmb[0]=$DPs0[1]; $Bmb[1]=$DPs1[1];
+$Blb[0]=$DPs0[2]; $Blb[1]=$DPs1[2];
+
+$Rrb[0]=$DPs0[3]; $Rrb[1]=$DPs1[3];
+$Rmb[0]=$DPs0[4]; $Rmb[1]=$DPs1[4];
+$Rlb[0]=$DPs0[5]; $Rlb[1]=$DPs1[5];
+
+$Frb[0]=$DPs0[6]; $Frb[1]=$DPs1[6];
+$Fmb[0]=$DPs0[7]; $Fmb[1]=$DPs1[7];
+$Flb[0]=$DPs0[8]; $Flb[1]=$DPs1[8];
+
+$Lrb[0]=$DPs0[9]; $Lrb[1]=$DPs1[9];
+$Lmb[0]=$DPs0[10]; $Lmb[1]=$DPs1[10];
+$Llb[0]=$DPs0[11]; $Llb[1]=$DPs1[11];
+
+##---------------Down FACE-------------------
+## f = face; 0=colour, 1= number
+
+@DPf0=($Dlt[0], $Dlm[0], $Dlb[0], $Dmt[0], $Dmm[0], $Dmb[0], $Drt[0], $Drm[0], $Drb[0]);
+@DPf1=($Dlt[1], $Dlm[1], $Dlb[1], $Dmt[1], $Dmm[1], $Dmb[1], $Drt[1], $Drm[1], $Drb[1]);
+
+$Dlb[0]=$DPf0[0]; $Dlb[1]=$DPf1[0];
+$Dmb[0]=$DPf0[1]; $Dmb[1]=$DPf1[1];
+$Drb[0]=$DPf0[2]; $Drb[1]=$DPf1[2];
+
+$Dlm[0]=$DPf0[3]; $Dlm[1]=$DPf1[3];
+$Dmm[0]=$DPf0[4]; $Dmm[1]=$DPf1[4];
+$Drm[0]=$DPf0[5]; $Drm[1]=$DPf1[5];
+
+$Dlt[0]=$DPf0[6]; $Dlt[1]=$DPf1[6];
+$Dmt[0]=$DPf0[7]; $Dmt[1]=$DPf1[7];
+$Drt[0]=$DPf0[8]; $Drt[1]=$DPf1[8];
+}
+##==============================
+\end{verbatim}
+
+
+%%------------------
+\subsection{rrF}
+
+
+\begin{verbatim}
+sub rrF{
+
+## do the Fside transform (side and face)
+## s = side; 0=colour, 1= number
+## -----------SIDE-----------------
+@Fs0=($Lrb[0],$Lrm[0],$Lrt[0],
+ $Ulb[0],$Umb[0],$Urb[0],
+ $Rlt[0],$Rlm[0],$Rlb[0],
+ $Drt[0],$Dmt[0],$Dlt[0]);
+
+@Fs1=($Lrb[1],$Lrm[1],$Lrt[1],
+ $Ulb[1],$Umb[1],$Urb[1],
+ $Rlt[1],$Rlm[1],$Rlb[1],
+ $Drt[1],$Dmt[1],$Dlt[1]);
+
+$Ulb[0]=$Fs0[0]; $Ulb[1]=$Fs1[0];
+$Umb[0]=$Fs0[1]; $Umb[1]=$Fs1[1];
+$Urb[0]=$Fs0[2]; $Urb[1]=$Fs1[2];
+
+$Rlt[0]=$Fs0[3]; $Rlt[1]=$Fs1[3];
+$Rlm[0]=$Fs0[4]; $Rlm[1]=$Fs1[4];
+$Rlb[0]=$Fs0[5]; $Rlb[1]=$Fs1[5];
+
+$Drt[0]=$Fs0[6]; $Drt[1]=$Fs1[6];
+$Dmt[0]=$Fs0[7]; $Dmt[1]=$Fs1[7];
+$Dlt[0]=$Fs0[8]; $Dlt[1]=$Fs1[8];
+
+$Lrb[0]=$Fs0[9]; $Lrb[1]=$Fs1[9];
+$Lrm[0]=$Fs0[10]; $Lrm[1]=$Fs1[10];
+$Lrt[0]=$Fs0[11]; $Lrt[1]=$Fs1[11];
+
+## -------Front FACE-------------------
+## f = face; 0=colour, 1= number
+
+@Lf0=($Flb[0], $Flm[0], $Flt[0], $Fmb[0], $Fmm[0], $Fmt[0], $Frb[0], $Frm[0], $Frt[0]);
+@Lf1=($Flb[1], $Flm[1], $Flt[1], $Fmb[1], $Fmm[1], $Fmt[1], $Frb[1], $Frm[1], $Frt[1]);
+
+$Flt[0]=$Lf0[0]; $Flt[1]=$Lf1[0];
+$Fmt[0]=$Lf0[1]; $Fmt[1]=$Lf1[1];
+$Frt[0]=$Lf0[2]; $Frt[1]=$Lf1[2];
+
+$Flm[0]=$Lf0[3]; $Flm[1]=$Lf1[3];
+$Fmm[0]=$Lf0[4]; $Fmm[1]=$Lf1[4];
+$Frm[0]=$Lf0[5]; $Frm[1]=$Lf1[5];
+
+$Flb[0]=$Lf0[6]; $Flb[1]=$Lf1[6];
+$Fmb[0]=$Lf0[7]; $Fmb[1]=$Lf1[7];
+$Frb[0]=$Lf0[8]; $Frb[1]=$Lf1[8];
+}
+##==============================
+\end{verbatim}
+
+
+%-------------------
+\subsection{rrSf}
+
+
+\begin{verbatim}
+sub rrSf{
+
+## do the Fs transform (side only)
+## s = side; 0=colour, 1= number
+##----------SIDE---------------
+@SFs0=($Lmb[0],$Lmm[0],$Lmt[0],
+ $Ulm[0],$Umm[0],$Urm[0],
+ $Rmt[0],$Rmm[0],$Rmb[0],
+ $Drm[0],$Dmm[0],$Dlm[0]);
+
+@SFs1=($Lmb[1],$Lmm[1],$Lmt[1],
+ $Ulm[1],$Umm[1],$Urm[1],
+ $Rmt[1],$Rmm[1],$Rmb[1],
+ $Drm[1],$Dmm[1],$Dlm[1]);
+
+$Ulm[0]=$SFs0[0]; $Ulm[1]=$SFs1[0];
+$Umm[0]=$SFs0[1]; $Umm[1]=$SFs1[1];
+$Urm[0]=$SFs0[2]; $Urm[1]=$SFs1[2];
+
+$Rmt[0]=$SFs0[3]; $Rmt[1]=$SFs1[3];
+$Rmm[0]=$SFs0[4]; $Rmm[1]=$SFs1[4];
+$Rmb[0]=$SFs0[5]; $Rmb[1]=$SFs1[5];
+
+$Drm[0]=$SFs0[6]; $Drm[1]=$SFs1[6];
+$Dmm[0]=$SFs0[7]; $Dmm[1]=$SFs1[7];
+$Dlm[0]=$SFs0[8]; $Dlm[1]=$SFs1[8];
+
+$Lmb[0]=$SFs0[9]; $Lmb[1]=$SFs1[9];
+$Lmm[0]=$SFs0[10]; $Lmm[1]=$SFs1[10];
+$Lmt[0]=$SFs0[11]; $Lmt[1]=$SFs1[11];
+}
+##==============================
+\end{verbatim}
+
+
+%-------------------
+\subsection{rrBp}
+
+
+\begin{verbatim}
+sub rrBp{
+
+## Back rotation anticlockwise (side + face)
+## do the Bp side transform
+## s = side; 0=colour, 1= number
+## --------------Side-----------------
+@BPs0=($Llb[0],$Llm[0],$Llt[0],
+ $Ult[0],$Umt[0],$Urt[0],
+ $Rrt[0],$Rrm[0],$Rrb[0],
+ $Drb[0],$Dmb[0],$Dlb[0]);
+
+@BPs1=($Llb[1],$Llm[1],$Llt[1],
+ $Ult[1],$Umt[1],$Urt[1],
+ $Rrt[1],$Rrm[1],$Rrb[1],
+ $Drb[1],$Dmb[1],$Dlb[1]);
+
+$Ult[0]=$BPs0[0]; $Ult[1]=$BPs1[0];
+$Umt[0]=$BPs0[1]; $Umt[1]=$BPs1[1];
+$Urt[0]=$BPs0[2]; $Urt[1]=$BPs1[2];
+
+$Rrt[0]=$BPs0[3]; $Rrt[1]=$BPs1[3];
+$Rrm[0]=$BPs0[4]; $Rrm[1]=$BPs1[4];
+$Rrb[0]=$BPs0[5]; $Rrb[1]=$BPs1[5];
+
+$Drb[0]=$BPs0[6]; $Drb[1]=$BPs1[6];
+$Dmb[0]=$BPs0[7]; $Dmb[1]=$BPs1[7];
+$Dlb[0]=$BPs0[8]; $Dlb[1]=$BPs1[8];
+
+$Llb[0]=$BPs0[9]; $Llb[1]=$BPs1[9];
+$Llm[0]=$BPs0[10]; $Llm[1]=$BPs1[10];
+$Llt[0]=$BPs0[11]; $Llt[1]=$BPs1[11];
+
+##-----------------Back FACE-------------
+## do the B face transform (in rows: 1,2,3/4,5,6/7,8,9)
+## f = face; 0=colour, 1= number
+@BPf0=($Brb[0], $Brm[0], $Brt[0], $Bmb[0], $Bmm[0], $Bmt[0], $Blb[0], $Blm[0], $Blt[0]);
+
+@BPf1=($Brb[1], $Brm[1], $Brt[1], $Bmb[1], $Bmm[1], $Bmt[1], $Blb[1], $Blm[1], $Blt[1]);
+
+$Brt[0]=$BPf0[0]; $Brt[1]=$BPf1[0];
+$Bmt[0]=$BPf0[1]; $Bmt[1]=$BPf1[1];
+$Blt[0]=$BPf0[2]; $Blt[1]=$BPf1[2];
+
+$Brm[0]=$BPf0[3]; $Brm[1]=$BPf1[3];
+$Bmm[0]=$BPf0[4]; $Bmm[1]=$BPf1[4];
+$Blm[0]=$BPf0[5]; $Blm[1]=$BPf1[5];
+
+$Brb[0]=$BPf0[6]; $Brb[1]=$BPf1[6];
+$Bmb[0]=$BPf0[7]; $Bmb[1]=$BPf1[7];
+$Blb[0]=$BPf0[8]; $Blb[1]=$BPf1[8];
+}
+##=====================end===================================
+\end{verbatim}
+
+\begin{center}
+------ END ------
+\end{center}
+
+\end{landscape}
+
+\end{document}
diff --git a/Master/texmf-dist/scripts/rubik/rubikrotation.pl b/Master/texmf-dist/scripts/rubik/rubikrotation.pl
index c09baffa5cc..77c3dadbab3 100755
--- a/Master/texmf-dist/scripts/rubik/rubikrotation.pl
+++ b/Master/texmf-dist/scripts/rubik/rubikrotation.pl
@@ -1,22 +1,48 @@
-#!/usr/bin/perl -W
-## rubikrotation.pl (version2.0)
-##=============================
-# Copyright 20 January 2014 RWD Nickalls and A Syropoulos
+#!/usr/bin/env perl
+##
+use Carp;
+use Fatal;
+use warnings;
+##
+our $version = "3.0 (25 Sept 2015)";
+##---------------------------
+##
+## rubikrotation.pl
+## VERSION 3.0
+## Copyright 25 September, 2015,
+## RWD Nickalls (dick@nickalls.org)
+## A Syropoulos (asyropoulos@yahoo.com)
+##
+##--------------------------------
+## changes in v3.0:
+## 1) accepts command-line arguments for input (mandatory) and output (optional) filenames
+## default output filename is: rubikOUT.txt
+## 2) included the symbols [ and ] to denote a rotation-name label (ie as well as *)
+## 3) fixed some of the variable definitions (as highlighted by <use strict> pragma)
+##--------------------------------
+## changes in v2.3:
+## 1) accepts a single commandline argument (datafilename)
+## 2) uses the standard modules Carp and Fatal (give extra line info on error)
+##--------------------------------
+## changes in v2.2:
+## 1) changed licence --> LatexPP
+## 2) included random n errors in ERROR messages (lines 492--495)
+## 3) included version number in error message
+##------------------------------
#
# This file is part of the LaTeX rubikrotation package, and
# requires rubikcube.sty and rubikrotation.sty
#
# rubikrotation.pl is a Perl-5 program and free software:
-# you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# any later version.
+# This program can be redistributed and/or modified under the terms
+# of the LaTeX Project Public License Distributed from CTAN
+# archives in directory macros/latex/base/lppl.txt; either
+# version 1 of the License, or any later version.
#
# rubikrotation.pl is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-##=============================
##---------------------------------------------------------------------
## OVERVIEW
@@ -26,8 +52,8 @@
## and writes the new state to the file rubikstateNEW.dat, which is then input
## by the TeX file. Further documentation accompanies the rubikrotation package.
-## Note that all posible state changing rotations of a 3x3x3 cube are
-## either conbinations of, or the inverse of, just 9 different rotations,
+## Note that all possible state changing rotations of a 3x3x3 cube are
+## either combinations of, or the inverse of, just 9 different rotations,
## three associated with each XYZ axis.
##--------------------------------------------------
@@ -42,23 +68,97 @@
## The first argument in each line of the file rubikstate.dat is the rubikkeyword.
## Program is documented in the rubikrotation.pdf (see section ``Overview'')
-### start by opening the three working files (last one ``for append'')
+our $source_file="";
+our $out_file="rubikOUT.txt"; #default
+our $argc=@ARGV;
+our $commandLineArgs = join(" ", @ARGV);
+our $showargs="\tcommandline args = $commandLineArgs\n";
+our $usage="\tUsage: rubikrotation [-h|--help|-v|--version] -i <input file> [-o <out file>]\n";
+our $rubikversion="\tVersion: this is rubikrotation version $version\n";
+#
+## check for correct number of commandline arguments and allocate filenames
+#
+if ($argc == 0||$argc > 4 ){ # croak if 0 or more than 4 arguments
+ croak $rubikversion,$showargs,
+ "\tWrong no of arguments\n",
+ $usage;
+ }
+ else {
+ SWITCHES:
+ while($_ = $ARGV[0]) {
+ shift;
+ if (/^-h$/ || /^--help$/ ) {
+ die $rubikversion,$usage,
+ "\twhere,\n" .
+ "\t[-h|--help]\tgives this help listing\n" .
+ "\t[-v|--version]\tgives version\n" .
+ "\t[-i] \tcreates specified input file\n",
+ "\t[-o] \tcreates specified output file\n",
+ "\tFor documentation see: rubikrotation.pdf,\n",
+ "\trubikrotationPL.pdf and rubikcube.pdf.\n\n";
+ }
+ elsif (/^-v$/ || /^--version$/ ) {die $rubikversion;}
+ elsif (/^-i$/) {
+ if (!@ARGV){
+ croak $showargs,
+ "\tNo input file specified!\n",
+ $usage;
+ }
+ else {
+ $source_file = $ARGV[0],
+ shift;
+ }
+ }
+ elsif (/^-o$/) {
+ if (!@ARGV) {
+ croak $showargs,
+ "\tNo output file specified!\n",
+ $usage;
+ }
+ else {
+ $out_file = $ARGV[0],
+ shift;
+ }
+ }
+ elsif (/^-\w+/) {
+ croak $showargs,
+ "\t$_: Illegal command line switch!\n",
+ $usage;
+ }
+ else {
+ croak $showargs,
+ "\tmissing filenames or ? missing -i or -o switch!\n",
+ $usage;
+ }
+ } # end of while
+}; # end of else
+
+print "This is rubikrotation version $version\n";
+#================================
+ open(IN_FILE, "<$source_file") ||croak "\tCan't open source file: $source_file\n";
+ open(TeX_OUT_FILE, ">$out_file")||croak "\tCan't open output file: $out_file\n";
+
+ ## create error file (for append)
+ open (ERROR_OUT_FILE, ">>rubikstateERRORS.dat")||croak "ERROR: can't open file rubikstateERRORS.dat\n";
- open (IN_FILE, "<rubikstate.dat")||die "ERROR: can't open file rubikstate.dat\n";
- open (TeX_OUT_FILE, ">rubikstateNEW.dat")||die "ERROR: can't open file rubikstateNEW.dat\n";
- open (ERROR_OUT_FILE, ">>rubikstateERRORS.dat")||die "ERROR: can't open file rubikstateERRORS,dat\n";
## use dots for Perl messages (I have used dashes for LaTeX messages in the .sty)
## gprint sub prints its argument (message) to both the screen and to the TeX_OUT_FILE
- gprint ("...PERL process...................................");
+ gprint ("...PERL process..................................");
+ gprint ("...program = rubikrotation.pl v$version");
## setup global error parameters, so we can write all the errors to a file as an array
-%error = (); # setup an array for error messages (was %)
-$erroralert = ""; # error flag
-$errornumber = 0; #set number of errors to zero
+my %error = (); # setup an array for error messages (was %)
+my $erroralert = ""; # error flag
+my $errornumber = 0; #set number of errors to zero
+
+ gprint ("...reading the current rubik state (from File: $source_file)");
- gprint ("...reading the current rubik state (rubikstate.dat)");
+my $dataline = "";
+my $rubikkeyword = "";
+my $rotationcommand = "";
+my @data;
LINE: while (<IN_FILE>){
next LINE if /^#/; #skip comments
@@ -69,7 +169,7 @@ $errornumber = 0; #set number of errors to zero
#$n++; # count the number of lines
@data=split (/,/, $dataline); # create an array called data
## we have 10 fields (0--9)
- ## check for rubikkeyword= up,down,left,right,front,back,rotation, checkstate:
+ ## check for rubikkeyword= up,down,left,right,front,back,checkstate,rotation:
gprint ("...$dataline");
$rubikkeyword=$data[0];
@@ -127,11 +227,12 @@ $errornumber = 0; #set number of errors to zero
gprint ("...command=$rotationcommand");
+ ##-----random-----------------
## if second argument = random,
- ## then we also need to check if third argument is an integer;
+ ## THEN we also need to check if third argument is an integer;
## if so -->random sub.
## if the 3rd argument is NOT an integer then reject line & get next input line
- if ($data[1] eq 'random')
+ if ($data[1] eq 'random')
{
if ($data[2] =~/\D/) {
errormessage("[$data[2]] not an integer");
@@ -148,14 +249,20 @@ $errornumber = 0; #set number of errors to zero
# to the rotation sub, BUT, need to first remove the
# rubikkeyword `rotation' from the begining of line (array)
# as we need to send ONLY the sequence string to the rotation sub.
- shift (@data);
+
+ ## remove keyword rotation
+ shift (@data);
+
+ ## process @data string by the rotation sub
rotation(@data);
}
- }
-
- };
+ }
+##-------------------------------
+## place additional keywords here
+##-------------------------------
+ }; ## end of while
- ## we have finished reading in all the lines from the rubikstate.dat file,
+ ## we have finished reading in all the lines from the source file,
## and doing all the rotations etc, so we now just write the new cube state
## to the output file = TeX_OUT_FILE (so LaTeX can read it)
writestate();
@@ -174,7 +281,7 @@ sub errormessage{
};
##======================================
-## prints argument (comments) to screen and also to TeX_OUT_FILE (= rubikstateNEW.dat).
+## prints argument (comments) to screen and also to TeX_OUT_FILE.
## The typeout commands will find its way into the log file when read by latex
## Important to include trailing % for messages written to the TeX_OUT_FILE
## to stop extra <spaces> being seen by TeX.
@@ -201,6 +308,8 @@ sub checkstate{
my $R=0,my $O=0,my $Y=0,my $G=0,my $B=0,my $W=0,my $X=0;
+my $cubiecolour = "";
+
foreach $cubiecolour (@cubies)
{
if ($cubiecolour eq R) {$R = $R+1}
@@ -230,7 +339,7 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
# no of arguments passed to the sub = $#_ (black book p 156)
sub rotation {
-## here we process an array (from main) consisting of all
+## here we process the array @data (from main) consisting of all
## the rotation commands associated with
## a single RubikRotation command.
@@ -239,6 +348,8 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
my $originalchar="";
my $j;
my $numberofchars; ## length of a string
+ my $nfrontchars;
+ my $char = "";
gprint ("...arguments passed to `rotation' sub = @_ (n= $n)");
foreach $char (@_) {
@@ -246,8 +357,9 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
## grab a copy of the original char for use if m Mod4=0
$originalchar=$char;
- ## if argument has a leading * then it is a label (not a rotation) so jump to next one
- if (substr ($char,0,1) eq "*"){
+ ## if argument has a leading * or [ or ] then it is a label (not a rotation)
+ ## so jump to next one
+ if (substr ($char,0,1) =~ /[ * \[ \] ]/ ){
gprint ("...$char is a label OK");
next;
};
@@ -258,7 +370,7 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
## split char string into front chars (= $char) + trailing digit (= $m)
$m = 1; # initialise m
- ## if terminal char is a digit (d) then d --> m and let frontstring --> char
+ ## if terminal char is a digit (d) then let d --> m and let frontstring --> char
## (Black book p 130 & 136)
## if the frontstring contains any digits then it will be rejected in the filter below anyway.
@@ -275,8 +387,8 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
## (if MOD 4 = 0 then nothing will happen as j starts at 1)
## but should generate an errormessage
if ( $m == 0 ){
- gprint ("...rotation $originalchar equiv 0 MOD 4 (NOT IMPLEMENTED)");
- errormessage ("[$originalchar] in RubikRotation (= 0 MOD 4)");
+ gprint ("...rotation $originalchar equiv 0;(MOD 4) (NOT IMPLEMENTED)");
+ errormessage ("[$originalchar] in RubikRotation (4 MOD 4 = 0)");
next;
};
};
@@ -293,7 +405,7 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
elsif ($char eq "Rsp") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Rsp OK (= rrRp + rrL)"); &rrRsp}}
elsif ($char eq "Ra") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Ra OK (= rrR + rrL)"); &rrRa}}
elsif ($char eq "Rap") {for($j=1;$j<=$m;$j++) { gprint ("...rotation Rap OK (= rrRp + rrLp)"); &rrRap}}
- ####
+ ####
elsif ($char eq "L") {for($j=1;$j<=$m;$j++) {gprint ("...rotation L OK (= rrLp3)"); &rrL}}
elsif ($char eq "Lp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lp OK"); &rrLp}}
elsif ($char eq "Lw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lw OK (= rrLp3 + rrSrp)"); &rrLw}}
@@ -351,8 +463,8 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
elsif ($char eq "Sfp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sfp OK (= rrSf3)"); &rrSfp}}
elsif ($char eq "Sb") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sb OK (= rrSfp)"); &rrSb}}
elsif ($char eq "Sbp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sbp OK (= rrSf)"); &rrSbp}}
- ## XYZ stuff
- ## need to include lowercase x,y,x, and also u,d,l,r,f,b equivalents
+ ## XYZ stuff
+ ## need to include lowercase x,y,x, and also u,d,l,r,f,b equivalents
elsif ($char eq "X" or $char eq "x" or $char eq "r")
{for($j=1;$j<=$m;$j++) {gprint ("...rotation $char OK (= rrR + rrSr + rrLp)"); &rrR;&rrSr;&rrLp}}
elsif ($char eq "Xp" or $char eq "xp" or $char eq "l")
@@ -373,14 +485,21 @@ if ($W >9){ errormessage("No of White cubies > 9 (=$W)")};
elsif ($char eq "S") {for($j=1;$j<=$m;$j++) {gprint ("...rotation S OK (= Sf) "); &rrSf}}
elsif ($char eq "Sp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sp OK (= Sb) "); &rrSb}}
####
+ ## check for missing rotation
+ elsif ($char eq "") {for($j=1;$j<=$m;$j++)
+ {gprint ("...rotation ,$char, ERROR ? typo or missing rotation"),
+ errormessage("[,$char,] in RubikRotation: ? typo or missing rotation")}}
+ ####
+ ## rotation must be undefined
else {
- gprint ("...rotation $originalchar NOT KNOWN");
- errormessage("[$originalchar] in RubikRotation");
- };
- }
- };
-
-## aNOTE we only defined and determined 9 primary rotation transforms,
+ gprint ("...rotation $originalchar NOT KNOWN");
+ errormessage("[$originalchar] in RubikRotation\{\}");
+ };
+ }; # end of foreach
+ }; # end of sub
+
+##---------------------------------------------
+## aNOTE we have defined (as rotation SUBs at the end) just 9 primary rotation transforms,
## rrR, rrSr, rrLp
## rrU, rrSu, rrDp
## rrF, rrSf, rrBp
@@ -465,12 +584,14 @@ sub random{
## (perl 5 book page 68)
## ? maybe we should only use the 18 rotations mentioned in Rokicki 2013 paper?
## but here I have included all the S ones too.
-@rrlist= ("U", "Up", "Su", "Sup",
- "D", "Dp", "Sd", "Sdp",
- "L", "Lp", "Sl", "Slp",
- "R", "Rp", "Sr", "Srp",
- "F", "Fp", "Sf", "Sfp",
- "B", "Bp", "Sb", "Sbp");
+
+
+my @rrlist= ("U", "Up", "Su", "Sup",
+ "D", "Dp", "Sd", "Sdp",
+ "L", "Lp", "Sl", "Slp",
+ "R", "Rp", "Sr", "Srp",
+ "F", "Fp", "Sf", "Sfp",
+ "B", "Bp", "Sb", "Sbp");
my $rrlistnumber=$#rrlist;
print " rrlistnumber = $rrlistnumber\n";
@@ -480,12 +601,13 @@ print " rrlistnumber = $rrlistnumber\n";
my $defaultn = 50;
my $maxn = 200;
## grab the integer passed from the random() command in main
-$s = $_[0];
+my $s = $_[0];
if ($s >= $maxn) {$s = $maxn;
- gprint ("...WARNING: maximum n = 200")}
+ gprint ("...WARNING: maximum n = 200");
+ errormessage ("random: max n =200 (n=200 was used)")}
elsif ($s == 0) {$s = $defaultn;
- gprint ("...WARNING: integer = 0 or not given: using default value 50")};
-
+ gprint ("...WARNING: integer = 0 or not given: using default value 50");
+ errormessage ("random: n invalid (n=50 was used)")};
my @rr; ## array to hold all the random rotations
print " randomising the available rotations\n";
@@ -500,9 +622,11 @@ srand;
## = (lastindexnumber -1). Therefore we need to use the range 0--(lastindexnumber+1)
## in order to randomise all posibilities on our list.
+my $j;
+
for ($j = 1; $j <=$s; $j=$j+1)
{
- $p= int(rand ($rrlistnumber +1));
+ my $p= int(rand ($rrlistnumber +1));
print "Rotation = $p, $rrlist[$p] \n";
## push rotation code $rrlist[$p] on to END of array @rr
push (@rr, $rrlist[$p]);
@@ -517,24 +641,25 @@ for ($j = 1; $j <=$s; $j=$j+1)
##===================subs==================================
sub writestate{
-## this just writes the final state to the TeX_OUT_FILE (= rubikstateNEW) will be read by latex.
+## this just writes the final state to the TeX_OUT_FILE (= rubikstateNEW.dat) will be read by latex.
-print (TeX_OUT_FILE "\%\% file=rubikstateNEW.dat (Perl)\n");
+print (TeX_OUT_FILE "\%\% output datafile=$out_file\n");
+print (TeX_OUT_FILE "\%\% PERL prog=rubikrotation version $version\n");
+print (TeX_OUT_FILE "\\typeout{...writing new Rubik state to file $out_file}\%\n");
print (TeX_OUT_FILE "\\RubikFaceUp\{$Ult[0]\}\{$Umt[0]\}\{$Urt[0]\}\{$Ulm[0]\}\{$Umm[0]\}\{$Urm[0]\}\{$Ulb[0]\}\{$Umb[0]\}\{$Urb[0]\}\%\n");
print (TeX_OUT_FILE "\\RubikFaceDown\{$Dlt[0]\}\{$Dmt[0]\}\{$Drt[0]\}\{$Dlm[0]\}\{$Dmm[0]\}\{$Drm[0]\}\{$Dlb[0]\}\{$Dmb[0]\}\{$Drb[0]\}\%\n");
print (TeX_OUT_FILE "\\RubikFaceLeft\{$Llt[0]\}\{$Lmt[0]\}\{$Lrt[0]\}\{$Llm[0]\}\{$Lmm[0]\}\{$Lrm[0]\}\{$Llb[0]\}\{$Lmb[0]\}\{$Lrb[0]\}\%\n");
print (TeX_OUT_FILE "\\RubikFaceRight\{$Rlt[0]\}\{$Rmt[0]\}\{$Rrt[0]\}\{$Rlm[0]\}\{$Rmm[0]\}\{$Rrm[0]\}\{$Rlb[0]\}\{$Rmb[0]\}\{$Rrb[0]\}\%\n");
print (TeX_OUT_FILE "\\RubikFaceFront\{$Flt[0]\}\{$Fmt[0]\}\{$Frt[0]\}\{$Flm[0]\}\{$Fmm[0]\}\{$Frm[0]\}\{$Flb[0]\}\{$Fmb[0]\}\{$Frb[0]\}\%\n");
print (TeX_OUT_FILE "\\RubikFaceBack\{$Blt[0]\}\{$Bmt[0]\}\{$Brt[0]\}\{$Blm[0]\}\{$Bmm[0]\}\{$Brm[0]\}\{$Blb[0]\}\{$Bmb[0]\}\{$Brb[0]\}\%\n");
-print (TeX_OUT_FILE "\\typeout{...writing new Rubik state to file rubikstateNEW.dat}\%\n");
## now include any error messages generated
## (these are all in an array waiting to be printed out)
if ($erroralert eq "YES")
{
- ## open a separate file just for errors (we append the errrors to end of file)
- ## this file (rubikstate.cfg) was opened by the TeX file
+ ## write errors to a separate file (just for errors---we append the errrors to end of file)
+ ## the error file (rubikstateERRORS.dat) was created by the TeX file
my $ne; #number of errors
$ne=$#error; ## number of errors= largest index num since we started at zero
### do not attach error to a <checkstate> command
@@ -582,7 +707,7 @@ print " Perl output file written OK\n";
## R = RIGHT, s = side; 0=colour, 1= number
## make the clockwise rotation permutation
## In this permutation the Front-right-bottom (Frb) (side)facelet rotates to
-## the new position of Up-right-bottom (Urb) (side)facelet.
+## the new position of Up-right-bottom (Urb) (side)facelet.
##-----------SIDE-------
## 12 side cubie facelets in arrays @Rs0 (colours) and @Rs1 (numbers)
## these are the initial positions
@@ -597,11 +722,11 @@ print " Perl output file written OK\n";
$Drb[1],$Drm[1],$Drt[1]);
## now we reallocate the initial array elements to the new
-## post (90 degree clockwise) rotation position.
+## post (90 degree clockwise) rotation position.
## Cube is viewed from FRONT.
-## positions of side facelets of Right slice are numbered 0-11 in clockwise direction,
+## Positions of side facelets of Right slice are numbered 0-11 in clockwise direction,
## (as seen from Right face) starting with Up-right-bottom facelet.
-## first line example:
+## First line example:
## variable $Urb[0] (Upface-right-bottom colour) <-- colour of first element in @Rs0 (=Frb[0])
## variable $Urb[1] (Upface-right-bottom number) <-- number of first element in @Rs1 (=Frb[1])
$Urb[0]=$Rs0[0]; $Urb[1]=$Rs1[0];
diff --git a/Master/texmf-dist/source/latex/rubik/example-rot1.bat b/Master/texmf-dist/source/latex/rubik/example-rot1.bat
deleted file mode 100755
index 3fc9ec4b31e..00000000000
--- a/Master/texmf-dist/source/latex/rubik/example-rot1.bat
+++ /dev/null
@@ -1,2 +0,0 @@
- pdflatex --shell-escape example-rot1.tex
- pdflatex --shell-escape example-rot1.tex \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/rubik/example-rot2.bat b/Master/texmf-dist/source/latex/rubik/example-rot2.bat
deleted file mode 100755
index e648b587ac7..00000000000
--- a/Master/texmf-dist/source/latex/rubik/example-rot2.bat
+++ /dev/null
@@ -1 +0,0 @@
-pdflatex --shell-escape example-rot2.tex
diff --git a/Master/texmf-dist/source/latex/rubik/examples.bat b/Master/texmf-dist/source/latex/rubik/examples.bat
new file mode 100755
index 00000000000..1a67e63e77e
--- /dev/null
+++ b/Master/texmf-dist/source/latex/rubik/examples.bat
@@ -0,0 +1,4 @@
+ latex --shell-escape examples.tex
+# latex --shell-escape examples.tex
+
+
diff --git a/Master/texmf-dist/source/latex/rubik/rubikcube.dtx b/Master/texmf-dist/source/latex/rubik/rubikcube.dtx
index 053c01df17f..c2f2411d015 100644
--- a/Master/texmf-dist/source/latex/rubik/rubikcube.dtx
+++ b/Master/texmf-dist/source/latex/rubik/rubikcube.dtx
@@ -1,7 +1,12 @@
% \iffalse meta-comment
%
-%% rubikcube.dtx
-%% Copyright 2014 RWD Nickalls (dick@nickalls.org) and A Syropoulos (asyropoulos@yahoo.com)
+% rubikcube.dtx
+%
+% version 3.0 25 September 2015
+%
+% Copyright 2015
+% 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
@@ -11,10 +16,6 @@
% 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.
@@ -42,10 +43,12 @@
process rubikcube.dtx again)^^J}\stop
}%
\usepackage{ifpdf}
-\usepackage{url} %% for references
+\usepackage{url,path} %% for references
\usepackage{supertabular} %% for Notation table
+\usepackage{hypdoc} %% for hyperref documenting of LaTeX packages
%%\OnlyDescription
\EnableCrossrefs
+\PageIndex
\CodelineIndex
\CodelineNumbered
\RecordChanges
@@ -60,7 +63,7 @@
%
%
%
-% \CheckSum{3912}
+% \CheckSum{4105}
%
%%% \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
@@ -79,66 +82,32 @@
%% Right brace \} Tilde \~}
%
%
-% \title{The \textsf{rubikcube} package}
+% \title{The \textsc{rubikcube} package}
%
% \author{
% RWD Nickalls (dick@nickalls.org) \\
% A Syropoulos (asyropoulos@yahoo.com)
% }
-% \date{This file describes version \RCfileversion, last revised \RCfiledate}
+% \date{This file describes version \RCfileversion\ (\RCfiledate)\\
+% \texttt{www.ctan.org/pkg/rubik}}
% \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.
+% rotation sequences using the TikZ graphic language. It is part of the
+% rubik `bundle'.
% \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}
+% \medskip
+%
+% \begin{minipage}{11cm}
% \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}
+% \ifpdf
+% \includegraphics[width=10cm]{Rubik-doc-figF.pdf}
+% \else
+% \fi
% \end{minipage}
-% \hfil
-%
-% \bigskip
%
% \tableofcontents
%
@@ -146,58 +115,68 @@
%
% \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
+% The \rubikcube\ package (part of the \textsc{rubik} `bundle') provides a
+% collection of \LaTeX\ commands
+% and macros for typesetting Rubik cube configurations using the
+% PGF/TikZ graphic languages. Note that this package relates only to the
+% familiar 3x3x3 Rubik cube.
+% We have extended 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).
+% The \rubikcube\ package is designed to be used in conjunction
+% with the \textsc{rubikrotation} package (see below); the former deals
+% primarily with typesetting, while the latter processes rotation sequences
+% and keeps track of the cube's configuration.
+%
+% The \rubikcube\ package has been road-tested on a Microsoft
+% platform (with \textsf{MiK}\TeX), a Linux platform (Mandriva and {\TeX}Live),
+% and on a Solaris platform (OpenIndiana).
%
%
+% For the mathematics and group theory associated with the Rubik cube see Chen~(2004),
+% Davis (2006), Golomb~(1981, 1982), Joyner~(2008), Hofstadter (1981), Hutchings~(2011),
+% Kociemba web site, Rokicki~\textit{et al.} (2013), Tran~(2005).
% 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).
-%
+% maintained by Duvoid, by Fridrich, by Jelinek, by Reid, and by Vandenburgh
+% (see References).
%
-% \subsection{Requirements}
%
-% The \rubikcube\ package requires the TikZ package.
+% \subsection{Requirements}
%
+% The \rubikcube\ package requires the TikZ package.
+% In particular, we make use the \cmd{\pgfmathsetmacro} command and
+% the TikZ picture environment.
%
-% \subsection{Supporting tool---the \textsf{rubikrotation} package}
+%
+% \subsection[rubikrotation package]{Supporting tool---the
+% \textsc{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
+% The \textsc{rubikrotation} package, is a dynamic extension to
+% the \rubikcube\ package, and is part of the `Rubk bundle'. It consists of the
+% Perl program \texttt{rubikrotation.pl} and the associated style option
+% \texttt{rubikrotation.sty}.
+% The \textsc{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}
+% \texttt{rubikrotation.pl} program, it follows that the \textsc{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).
+% See the \textsc{rubikrotation} documentation for details.
%
%
% \subsection{Copyright}
-% Copyright 2014 RWD Nickalls and A Syropoulos.
+% Copyright 2014--2015 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
+% |www.latex-project.org/lppl.txt|
%
%
% \section{Installation}
@@ -207,32 +186,34 @@
%
% 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
+%\begin{verbatim}
+% rubikcube.ins
+% rubikcube.dtx
+% rubikcube.pdf
+% Rubik-doc-figA.pdf
+% Rubik-doc-figB.pdf
+% Rubik-doc-figC.pdf
+% Rubik-doc-figD.pdf
+% Rubik-doc-figE.pdf
+% Rubik-doc-figF.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
+% This documentation file (\texttt{rubikcube.pdf}) can then be generated using the following
+% steps\,\footnote{Since the documentation includes a complicated indexing
+% system as well a \textsc{pdf} index and hyperef links (the package \texttt{hypdoc}
+% is used), then several pdflatex runs are required. Prior to the first run it is
+% a good idea to delete any relevant \texttt{.toc}, \texttt{.aux}, \texttt{.out} files.}:
+%\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
+% pdflatex rubikcube.dtx
%\end{verbatim}
%
%
@@ -243,12 +224,12 @@
%
%\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/}
+% \texttt{/usr/local/texlive/texmf-local/tex/latex/rubik/}
+%{\newline}*.pdf $\rightarrow$ \texttt{/usr/local/texlive/texmf-local/doc/rubik/}
%
% \medskip
-% {\noindent}Finally, (depending on your system) update the \TeX\ file database using the
-% \texttt{texhash} command.
+% {\noindent}Finally, (depending on your system) update the \TeX\ file database.
+% For example, on a Linux system one uses the \texttt{texhash} command.
%
%
% \subsection{Usage}
@@ -259,117 +240,181 @@
% \begin{quote}
%\begin{verbatim}
% \usepackage{tikz}
-% \usepackage{rubikcube}
+% \usepackage{rubikcube,rubikrotation}
%\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.
+% While \rubikcube\ is a stand-alone package, it is best to also load the complementary
+% \textsc{rubikrotation} package.
%
%
% \section{TikZ picture environment}
+% \label{sec:tikz}
%
% 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 \texttt{pgfmanual.pdf}, version 3.0.1a (August 2015) (1161 pages)
+% \item \texttt{pgfplot.pdf}, version 1.12.1 (2015) (504 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.
+% An example of the TikZ picture environment for use with the \rubikcube\ package
+% is as follows:
% \begin{quote}
%\begin{verbatim}
% \begin{tikzpicture}[scale=0.5]
% ....
-% \end{tikzpicture}
+% \end{tikzpicture}%
%\end{verbatim}
% \end{quote}
+% If no scale is used (default scale = 1), then each of the small
+% cubie sides will have a length of 1~cm.
+%
% A very useful feature of TikZ is that it automatically
% minimises the surrounding white-space, and consequently this is
-% mostly quite sufficient.
+% mostly quite sufficient. However, it is good practice to place
+% a \% symbol after the \verb!\end{tikzpicture}! command *see above)
+% to avoid additional white space (see Section~\ref{sec:trailingpercent}).
%
-% However, when making complicated side-by-side figures it is
-% sometimes helpful to place each sub-figure in a surrounding minipage.
+%
+% \subsection[ShowCube command]{\cmd{\ShowCube} command}
+% \label{sec:showcube}
+%
+% \DescribeMacro{\ShowCube}
+% \DescribeMacro{\ShowCubeF}
+% When making side-by-side figures it can be very helpful
+% to place each sub-figure inside a 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.
+% the tikzpicture `scale' parameter to obtain the appropriate size, and
+% then adjust the minipage width as necessary
+% (see Section~\ref{sec:sizeofminipage}).
+% The \cmd{\ShowCube} macro (See Section~\ref{sec:showcubecode}) places one
+% or more commands inside a tikzpicture environment and places all of
+% these inside a minipage. It takes three arguments: the first is the
+% minipage width (\verb!#1!), second is the tikzpicture scale
+% factor (\verb!#2!), and third is a \cmd{\Draw..} command (|#3|).
%
-% 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}
+% \noindent\textsc{usage}:
+% The following command would display a Rubik cube in a
+% minipage of width 2cm using a tikzpicture scale factor of 0.5:
%\begin{verbatim}
-% \fbox{%
-% \begin{minipage}{2cm}
-% \centering
-% \begin{tikzpicture}[scale=0.5]
-% ....
-% \end{tikzpicture}
-% \end{minipage}
-% }
+% \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
%\end{verbatim}
-% \end{quote}
+% For example, the following two sets of commands are equivalent (see
+% Section~\ref{sec:showcubecode} for the code); i.e.,~any commands which are valid in
+% a \texttt{tikzpicture} environment may be used as the main argument for the
+% \cmd{\ShowCube} command.
+% $$
+% \left.
+% \begin{array}{l}
+% \verb!\RubikCubeSolved!\\
+% \verb!\begin{minipage}{2cm}!\\
+% \ \ \verb!\centering!\\
+% \ \ \verb!\begin{tikzpicture}[scale=0.5]!\\
+% \ \ \ \ \ \verb!\DrawRubikCubeRU!\\
+% \ \ \ \ \ \verb!\draw[->] (0.5,5) -- (0.5,4);!\\
+% \ \ \verb!\end{tikzpicture}!\\
+% \verb!\end{minipage}!\\
+% \end{array}
+% \right\}
+% \begin{array}{l}
+% \verb!\RubikCubeSolved!\\
+% \verb!\ShowCube{2cm}{0.5}{%!\\
+% \ \ \ \ \verb!\DrawRubikCubeRU!\\
+% \ \ \ \ \verb!\draw[->] (0.5,5) -- (0.5,4);!\\
+% \ \verb!}!\\
+% \end{array}
+% $$
+%
+% The \cmd{\ShowCubeF} command is similar in all respects except that it places
+% an fbox around the minipage in order to enable users to see the extent of any
+% associated white space.
+%
% 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}.
+% image and adjacent text, is usually related to
+% `hidden' white-space associated with the image itself or excessive width
+% of the associated \cmd{\minipage} (see also Section~\ref{sec:trailingpercent}).
+% Consequently, a temporary fbox around the minipage can be a
+% useful aid when trying to visualise the full extent of the minipage
+% (and its associated whitespace). Use the \cmd{\ShowCubeF} command for this, as follows:
%
-%
-% \subsection{\rubikcube\ commands}
+% \medskip
%
-% 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.
+% \RubikCubeSolved
+% \ShowCubeF{4cm}{0.3}{\DrawRubikCubeRU}
+%\begin{minipage}{5cm}
+%\begin{verbatim}
+% \ShowCubeF{4cm}{0.3}{\DrawRubikCubeRU}
+%\end{verbatim}
+%\end{minipage}
+%
+% \medskip
+% {\noindent}Clearly either the minipage is too wide (4cm) or the \texttt{tikzpicture}
+% scale factor is too small (0.3). Once the figure/code has been corrected, then the
+% \texttt{F} in the \cmd{\ShowCubeF} command can be removed. Note that while
+% the \cmd{\ShowCube} command centers the image inside the minipage, \LaTeX\ positions
+% the minipage in the \cmd{\textwidth}, and hence it is generally best to minimise
+% the white-space as revealed by the \cmd{\ShowCubeF} command. The relationship
+% between the required width of the minipage and the TikZ scale factor for the various
+% Rubik cube images is detailed in Section~\ref{sec:sizeofminipage}.
%
-% 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}
+% \subsection[Draw.. error message]{\cmd{\Draw} error message}
+% \label{sec: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.
+% If a \rubikcube\ \cmd{\Draw..} command is used \textit{outside} a
+% TikZ picture environment, then \LaTeX\ issues an
+% ``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
+% For example, if we use the \rubikcube\ command
% \cmd{\DrawRubikFlat} without a surrounding TikZ picture environment
-% you will see something like the following error message.
+% then something similar to the following error message will be generated.
%\begin{verbatim}
%! Undefined control sequence.
-%\FlatUp ... }{#1}\pgfmathsetmacro {\uy }{#2}\draw
-% [line join=round,...
+%\DrawFlatUp ... }{#1}\pgfmathsetmacro {\uy }{#2}\draw
+% [line join=round,...
%l.56 \DrawRubikFlat
%\end{verbatim}
%
%
-% \section{Command conventions}
-% \label{sec:conventions}
%
+% \section{Command conventions}
+% \label{sec:conventions}
%
-% \DescribeMacro{\rubikcube}
-% This command generates the logo \rubikcube.
+% \subsection{Commands and environments}
%
+% 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 Rubik \cmd{\Draw...} commands and TikZ commands actually
+% have to be used inside a TikZ picture environment.
+%
+% Indeed, using \rubikcube\ commands which influence the Rubik colour state
+% (configuration) outside the \texttt{tikzpicture}, \texttt{minipage} or
+% \texttt{figure} environments can make for useful
+% flexibility when a document is generating more than one figure
+% or image. This is because the scope of any colours specified by commands inside
+% these environments is constrained to
+% be `local' to that particular environment, and hence any change in the
+% Rubik colour state brought about by such commands is not accessable
+% globally (i.e.,~outside the environment) ---see also Section~5 in the documentation
+% of the \textsc{rubikrotation} package.
+%
+% Consequently users need to be mindful of the environments when
+% drawing long sequences of rotations across several figures; for example, keeping
+% \cmd{\RubikRotation} commands outside the environments keeps their effects global.
%
% \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';
+% However, as 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}).
+% always written in uppercase.
+%
%
% \subsection{XYZ argument ordering}
%
@@ -378,189 +423,371 @@
% 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;
+% i.e.,~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}
+% \subsection{Trailing \% on the end of commands}
+% \label{sec:trailingpercent}
%
% It is important to include a trailing \% on the end of \rubikcube\
-% commands when used \textit{outside} a TikZ picture environment.
+% commands when used \textit{outside} a TikZ picture environment, and
+% also on the end of each \cmd{\end\{tikzpicture\}} environment command.
% 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.
+% the graphics. In \TeX\ every newline character is automatically converted
+% to a white space---unless you have an empty line
+% (Feuers\"{a}nger 2015, \S\,3.2.3, page~20).
+%
+%
+%
+% \subsection{Cubies, cubicles, faces and facelets}
+%
+% The sub-cubes which make up the Rubik cube are known as `cubies'; the small
+% coloured face of a cubie is known as a `facelet'. The cubies
+% are named either according to the colours of their two or three facelets, or
+% according to their physical position.
+%
+% We distinguish three types of cubie:
+% centre-cubies (single colour), edge-cubies (two colours) and corner-cubies
+% (three colours). For example, the red/white edge-cubie is called
+% the RW cubie, and the red/white/green corner-cubie is called the
+% RWG cubie etc. Note that the colour of a particular face of a 3x3x3 Rubik
+% cube is determined by the colour of its centre-cubie.
+%
+% Similarly, the positions (known as `cubicles') occupied by cubies are
+% defined using either a two or three letter face code. For example the
+% right edge position in the Up-layer is termed the Up/Right position,
+% or just the UR position, and the corner joining the \textsc{down}
+% \textsc{front} and \textsc{right} faces is the DFR position.
+%
+%
+%
+% \section{Colours}
+%
+% The \rubikcube\ package uses 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{We thank Peter Bartal
+% for bringing this to our attention.}
+%
+% \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 implemented by
+% the \rubikcube\ package are as follows
+% (see Section~\ref{sec:codecolours}):
+%
+% \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 rotation commands and notation}
-% \label{sec:RubikCommands}
%
-% We use the standard Rubik cube notation of WCA (2012)---see article~12---and
+% \subsection{Colour state of the cube}
+% \label{sec:colourstate}
+%
+% Initially, when \LaTeX\ reads the file \texttt{rubikcube.sty} all facelets
+% are allocated the code X, which can be regarded as a zero-colour state.
+% Until a facelet is allocated one of the six Rubik colours it will be rendered as
+% grey by a command which just draws the current colour state of the cube or a face
+% (e.g.,~\cmd{\DrawFlatUpSide}).
+%
+% It is important to appreciate that the various commands which typeset faces
+% or facelets with colours differ in whether they derive the colours
+% from the current internal colour `state' (configuration) of the Rubik cube, or not.
+%
+% The colour state of cubies in faces and slices can be allocated using \cmd{\RubikFace...}
+% and \cmd{\RubikSlice...} (see Sections~\ref{sec:facecommands} and \ref{sec:slicecommands}).
+% The commands \cmd{\RubikCubeSolved} and \cmd{RubikCubeGrey} allocate the colour state
+% for the whole cube, and are useful starting points for subsequent rotations.
+% Note that cubies will retain their colour allocation even if the cubies are are moved by
+% rotation commands, unless they are overwritten by a subsequent colour allocation command.
+% To then visualise the cube one has to use a \cmd{\Draw...} command.
+%
+% The \textsc{rubikrotation} package keeps track of the Rubik state following
+% rotations and sequences of rotations processed by its \cmd{\RubikRotation} command.
+% The current colour state of the Rubik cube can be saved and written to a named file
+% using its \cmd{\SaveRubikState} command; this file can then be \cmd{\input} when required.
+%
+% Note that although some \cmd{\Draw...} commands (e.g.,~\cmd{\DrawRubikLayerFace...}) use
+% colours as arguments, these commands really only `paint' colours onto cubie positions
+% (on the page, so to speak); i.e.,~these commands do not update the internal Rubik
+% colour state, and hence these colours do not exist outside the particular
+% \texttt{tikzpicture} environment the \cmd{\Draw..} command was used in.
+%
+%
+% \section{Rubik cube 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.
+%
+% Using the \textsc{front} bottom-left corner as the origin
+% is an important feature since knowing the location of the
+% origin enables one to easily use any of the TikZ commands
+% (e.g.,~\cmd{\draw} and \cmd{\node} commands) to superimpose lines,
+% arrows and text etc.\ onto the Rubik cube (see Section~\ref{sec:arrows}).
+%
+% \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}
+%
+%
+%
+% \subsection[Size of cube minipage]{Size of cube \cmd{\minipage}}
+% \label{sec:sizeofminipage}
+%
+% 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
+% \texttt{tikzpicture} environment can be easily calculated. For example,
+% if the \texttt{tikzpicture} scale factor used is $0.5$, then the minimum
+% width of the required minipage for the \cmd{\DrawRubikCubeLD} view (shown above)
+% is therefore $0.5 \times 4\mbox{cm} = 2\mbox{cm}$.
+%
+% The default width of the semi-flat cube representation is 10cm ($=3+3+1+3$),
+% and that of the flat cube is 12cm ($=3+3+3+3$). If in doubt check the extent of
+% any horizontal white-space using an fbox, or the \cmd{\ShowCubeF} command.
+%
+%
+%
+% \section{Rotation commands}
+% \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).
+% Fridrich (see References).
%
-% It is recommended that commas are used to separate sequestial
+% It is recommended that commas are used to separate sequential
% 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|).
+% For example, in the following sequence the commas remove any ambiguity:
+% \rr{U},\rr{Lw}2,\rr{Usp},\rr{Da} \ \ (|\rr{U},\rr{Lw}2,\rr{Usp},\rr{Da}|).
%
%
%
-% \subsection{Overview}
+% \subsection{Overview}
+% \label{sec: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.
+% commands for moves or rotations (e.g.,~\rr{R}, \rr{y}, \rr{Bw}) and their equivalent hieroglyphs
+% (e.g.,~\rrh{R}, \rrh{y}, \rrh{Bw}), 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.
+% in the form of the rotation-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}.
+% \DescribeMacro{\rr}
+% The rotation-code of a rotation is typeset (as in text) using the rubik-rotation
+% \cmd{\rr\marg{rotation-code}} command: i.e.,~\rr{R}\ is typeset using the command \cmd{\rr\{R\}}.
% 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{\rrh}
+% using instead the command \cmd{\rrh\marg{rotation-code}}. Thus the command \cmd{\rrh\{R\}} generates
+% \rrh{R}\ which is the hieroglyph associated with \rr{R}.
%
-% \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},
+% \DescribeMacro{\Rubik}
+% A vertically combined rotation-code and its hieroglyph is generated using the command
+% \cmd{\Rubik\marg{rotation-code}}. For example, \Rubik{R}\ is generated by the command \cmd{\Rubik\{R\}},
% 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.
+% For some hieroglyphs (e.g.,~\rrh{x}, \rrh{y}, \rrh{z}\ denoting 90~degree axis rotations)
+% the only difference between the \cmd{\rrh\{\}} and \cmd{\Rubik\{\}} forms is that
+% the \cmd{\Rubik\{\}} form is elevated to sit on the baseline just like the other
+% \cmd{\Rubik\{\}} hieroglyphs.
+% For example \cmd{\rrh\{yp\}} generates \rrh{yp}, while
+% \cmd{\Rubik\{yp\}} generates \Rubik{yp}.
%
-% \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}.
+% \DescribeMacro{\textRubik}
+% A horizontally combined rotation-code and its hieroglyph (in sequence as in text)
+% is generated using the command stem \cmd{\textRubik\marg{rotation-code}}.
+% For example, \textRubik{R}\ is typeset using the command \cmd{\textRubik\{R\}}.
% A list of all commands and their associated hieroglyphs is given in
% Section~\ref{sec:listofcommands}.
%
-%
+% \pagebreak
%
% \subsection{Face rotations}
%
-% \DescribeMacro{\rrU}
-% \DescribeMacro{\rrD}
-% \DescribeMacro{\rrL}
-% \DescribeMacro{\rrR}
-% \DescribeMacro{\rrF}
-% \DescribeMacro{\rrB}
+% \DescribeMacro{U}
+% \DescribeMacro{D}
+% \DescribeMacro{L}
+% \DescribeMacro{R}
+% \DescribeMacro{F}
+% \DescribeMacro{B}
% 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)
+% The uppercase initial letter of each face-name (\rr{F}, \rr{B}, \rr{L}, \rr{R}, \rr{U}, \rr{D})
% 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}.
-%
+% For example, \rr{D}\ is generated by the `rubik rotation' command \cmd{\rr\{D\}}.
+%
+% \DescribeMacro{Up}
+% \DescribeMacro{Dp}
+% \DescribeMacro{Lp}
+% \DescribeMacro{Rp}
+% \DescribeMacro{Fp}
+% \DescribeMacro{Bp}
+% An appended prime~$^\prime$ indicates an anticlockwise rotation; e.g.,~\rr{Fp}.
+% This is sometimes written as \rr{F}$\boldmath{^{-1}}$. The `prime' notation is
+% achieved by appending a lowercase `p' to the face rotation command. For example, \rr{Rp}\
+% is generated by \cmd{\rr\{Rp\}}.
+%
+% \vspace{-0.2cm}
% \begin{figure}[hbt]
% \centering
% \ifpdf
-% \includegraphics[height=6cm]{Rubik_doc_figA.pdf}
+% \includegraphics[height=5cm]{Rubik-doc-figA.pdf}
% \fi
% \caption{\label{fig:notation}}
% \end{figure}
%
%
-% \subsection{Slice rotations}
+% \subsection{Slice rotations}
+% \label{sec:slicerotations}
%
-% \DescribeMacro{\rrSu}
-% \DescribeMacro{\rrSd}
-% \DescribeMacro{\rrSl}
-% \DescribeMacro{\rrSr}
-% \DescribeMacro{\rrSf}
-% \DescribeMacro{\rrSb}
+% \DescribeMacro{Su}
+% \DescribeMacro{Sd}
+% \DescribeMacro{Sl}
+% \DescribeMacro{Sr}
+% \DescribeMacro{Sf}
+% \DescribeMacro{Sb}
% 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
+% direction follows the rotation \rr{R}\ (rotation is isomorphic to \rr{R}) is denoted
+% as \rr{Sr}, which is typeset using the command \cmd{\rr\{Sr\}}. 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}
+% \bigskip\bigskip\bigskip
+%
+% \DescribeMacro{Sup}
+% \DescribeMacro{Sdp}
+% \DescribeMacro{Slp}
+% \DescribeMacro{Srp}
+% \DescribeMacro{Sfp}
+% \DescribeMacro{Sbp}
% 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.
+% For example the inner slice rotations \rr{Slp}\ (\cmd{\rr\{Slp\}}) and
+% \rr{Sr}\ (\cmd{\rr\{Sr\}}) 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}).
+% For example, in this case \linebreak \rr{Slp}\ (\cmd{\rr\{Slp\}})
+% $\equiv$ \rrh{Slp}\ (\cmd{\rrh\{Slp\}}),
+% and \rr{Sr}\ (\cmd{\rr\{Sr\}}) $\equiv$ \rrh{Sr}\ (\cmd{\rrh\{Sr\}}).
+%
+% \bigskip
%
% \pagebreak
%
-% \subsubsection*{MES slice notation}
+% \subsubsection*{MES slice notation}
%
-% \DescribeMacro{\rrM}
-% \DescribeMacro{\rrE}
-% \DescribeMacro{\rrS}
-% \DescribeMacro{\rrMp}
-% \DescribeMacro{\rrEp}
-% \DescribeMacro{\rrSp}
+% \DescribeMacro{M}
+% \DescribeMacro{E}
+% \DescribeMacro{S}
+% \DescribeMacro{Mp}
+% \DescribeMacro{Ep}
+% \DescribeMacro{Sp}
% 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).
+% \item[\rr{M}] \ (\textsc{middle} \rrh{M}, between the \textsc{left}
+% and \textsc{right} faces; direction follows \rr{L}),
+% \item[\rr{E}] \ (\textsc{equator} \rrh{E}, between the \textsc{up} and \textsc{down}
+% faces; direction follows \rr{D}),
+% \item[\rr{S}] \ (\textsc{standing} \rrh{S}, between the \textsc{front} and
+% \textsc{back} faces; direction follows \rr{F}).
% \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.
+% Each of these also has a reversed (prime) version, and a hieroglyph
+% (see Section~\ref{sec:listofcommands}).
+% The equivalent S notation (see above) is therefore
+% as follows: \rr{E}\ $\equiv$ \rr{Sd}, \rr{Ep}\ $\equiv$ \rr{Su},
+% \rr{M}\ $\equiv$ \rr{Sl}, \rr{Mp}\ $\equiv$ \rr{Sr}, \rr{S}\ $\equiv$ \rr{Sf},
+% \rr{Sp}\ $\equiv$ \rr{Sb}.
%
%
%
% \subsubsection*{Singmaster slice notation}
%
-% \DescribeMacro{\rrUs}
-% \DescribeMacro{\rrDs}
-% \DescribeMacro{\rrLs}
-% \DescribeMacro{\rrRs}
-% \DescribeMacro{\rrFs}
-% \DescribeMacro{\rrBs}
+% \DescribeMacro{Us}
+% \DescribeMacro{Ds}
+% \DescribeMacro{Ls}
+% \DescribeMacro{Rs}
+% \DescribeMacro{Fs}
+% \DescribeMacro{Bs}
% 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
@@ -569,195 +796,194 @@
% Fridrich website.
%
% Each of these commands denotes a rotation of two opposite faces
-% in the same direction. For example, \textRubikUs\ $\equiv$ \textRubikU\ + \textRubikDp,
+% in the same direction. For example, \textRubik{Us}\ $\equiv$ \textRubik{U}\ + \textRubik{Dp},
% which is typeset as:
-% \newline |\textRubikUs\ $\equiv$ \textRubikU\ + \textRubikDp|,
-% i.e., for \rrUs\ both face-rotations are in the \textit{same} direction
-% as \rrU.
+% \newline |\textRubik{Us}\ $\equiv$ \textRubik{U}\ + \textRubik{Dp}|,
+% i.e.,~for \rr{Us}\ both face-rotations are in the \textit{same} direction
+% as \rr{U}.
%
%
% \subsubsection*{Anti-slice notation}
%
-% \DescribeMacro{\rrUa}
-% \DescribeMacro{\rrDa}
-% \DescribeMacro{\rrLa}
-% \DescribeMacro{\rrRa}
-% \DescribeMacro{\rrFa}
-% \DescribeMacro{\rrBa}
+% \DescribeMacro{Ua}
+% \DescribeMacro{Da}
+% \DescribeMacro{La}
+% \DescribeMacro{Ra}
+% \DescribeMacro{Fa}
+% \DescribeMacro{Ba}
% Each of these commands denotes a rotation of two opposite faces
% in \textit{opposite} directions.
-% For example, \textRubikUa\ $\equiv$ \textRubikU\ + \textRubikD,
+% For example, \textRubik{Ua}\ $\equiv$ \textRubik{U}\ + \textRubik{D},
% which is typeset as:
-% \newline |\textRubikUa\ $\equiv$ \textRubikU\ + \textRubikD|.
+% \newline |\textRubik{Ua}\ $\equiv$ \textRubik{U}\ + \textRubik{D}|.
% See the link to `notation' on the `Pretty patterns' page of the
% Fridrich website.
%
+% \bigskip\bigskip
%
% \subsection{Wide rotations}
%
-% \DescribeMacro{\rrUw}
-% \DescribeMacro{\rrDw}
-% \DescribeMacro{\rrLw}
-% \DescribeMacro{\rrRw}
-% \DescribeMacro{\rrFw}
-% \DescribeMacro{\rrBw}
+% \DescribeMacro{Uw}
+% \DescribeMacro{Dw}
+% \DescribeMacro{Lw}
+% \DescribeMacro{Rw}
+% \DescribeMacro{Fw}
+% \DescribeMacro{Bw}
% 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}.
+% For example, a \textsc{right} double outer slice rotation is denoted as \rr{Rw}.
+% Similarly, the prime $^\prime$ version \rr{Lwp}\ is generated by \cmd{\rr\{Lwp\}}.
%
% 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}
+% is applied twice. For example \rr{R}\textbf{$^2$} or \rr{R}\textbf{2}
% denote \textit{two} successive 90~degree clockwise rotations of the \textsc{right} face.
+% Clearly \rr{R}\textbf{$^3$} is equivalent to \rr{Rp} etc.
+%
%
%
%
% \subsection{Axis rotations}
%
-% \DescribeMacro{\rrx}
-% \DescribeMacro{\rry}
-% \DescribeMacro{\rrz}
-% \DescribeMacro{\rrhx}
-% \DescribeMacro{\rrhy}
-% \DescribeMacro{\rrhz}
+% \DescribeMacro{x}
+% \DescribeMacro{y}
+% \DescribeMacro{z}
% 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
+% as \rr{x}, \rr{y}, \rr{z}\ (the \cmd{\rr\{\}} forms) respectively (see Figure~\ref{fig:notation}),
+% with their hieroglyphs (the \cmd{\rrh\{\}} forms) being denoted
+% as \rrh{x}, \rrh{y}, \rrh{z}\ 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.
+% Note that since \rr{x}, \rr{y}, \rr{z}\ rotations are always expressed in lowercase,
+% 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
+% An \rr{x}\textbf{2} rotation (two \rr{x}\ rotations one after
+% the other, i.e.,~\rrh{x}\ \rrh{x}) 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.
+% for example, \rr{xp}\ (which is generated by appending a `p' to the end of
+% the command, i.e.,~\cmd{\rr\{xp\}}).
+%
+% The \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
+% \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
+% \DescribeMacro{u}
+% \DescribeMacro{d}
+% \DescribeMacro{l}
+% \DescribeMacro{r}
+% \DescribeMacro{f}
+% \DescribeMacro{b}
+% A commonly used alternative for the \rr{x}, \rr{y}, \rr{z}\ notation
+% (and endorsed by the WCA) uses these
% lowercase face letter to denote a 90~degree whole-cube rotation in the same
-% sense as that of the standard face rotations.
+% directional 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,
+% \rr{u}\ $\equiv$ \rr{y}, \ \rr{d}\ $\equiv$ \rr{yp}, \
+% \rr{l}\ $\equiv$ \rr{xp}, \ \rr{r}\ $\equiv$ \rr{x}, \
+% \rr{f}\ $\equiv$ \rr{z}, \ \rr{b}\ $\equiv$ \rr{zp},
%
-% {\noindent}For example, \rrd\ is generated by the command \cmd{\rrd}.
+% {\noindent}For example, \rr{d}\ is generated by the command \cmd{\rr\{d\}}.
%
-% {\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.
+% {\noindent}Note that these rotations do not have prime $^\prime$ versions
+% since \rr{u}~is the opposite of \rr{d}, \rr{l}~is the opposite of \rr{r}, and
+% \rr{f}~is the opposite of \rr{b}.
+%
+% As with the \rrh{x}, \rrh{y}, \rrh{z}\ forms (described above) there also
+% equivalent \cmd{\rrh\{\}} and \cmd{\Rubik\{\}} forms. For example,
+% \rrh{d}\ is generated by the command \cmd{\rrh\{d\}}.
%
-% \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}
+%
+% {\noindent}\rr{R}\ is generated by the `rubik rotation' command \cmd{\rr\{R\}}
%
-% \rrFw\ is generated by the `rubik rotation' command \cmd{\rrFw}
+% {\noindent}\rr{Fw}\ is generated by the `rubik rotation' command \cmd{\rr\{Fw\}}
%
-% \rrL$^2$ is generated by \cmd{\rrL}\verb!$^2$!
+% {\noindent}\rr{L}$^2$ is generated by \cmd{\rr\{L\}}\verb!$^2$!
%
-% \rrRp\ is generated by \cmd{\rrRp}
+% {\noindent}\rr{L}2 is generated by \cmd{\rr\{L\}2}
%
-% \rrFwp\ is generated by \cmd{\rrFwp}
+% {\noindent}\rr{Rp}\ is generated by \cmd{\rr\{Rp\}}
%
-% \rrx\ and \rrhy\ and \Rubikzp\ are generated by
-% \cmd{\rrx} and \cmd{\rrhy} and \cmd{\Rubikzp}
+% {\noindent}\rr{Fwp}\ is generated by \cmd{\rr\{Fwp\}}
%
-% \rrf\ and \rrhb\ are generated by \cmd{\rrf} and \cmd{\rrhb}
+% {\noindent}\rr{x}\ and \rrh{y}\ and \Rubik{zp}\ are generated by
+% \cmd{\rr\{x\}} and \cmd{\rrh\{y\}} and \cmd{\Rubik\{zp\}}
%
-% 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!
+% {\noindent}\rr{f}\ and \rrh{b}\ are generated by \cmd{\rr\{f\}} and \cmd{\rrh\{b\}}
+%
+% {\noindent}\rr{U}\rr{U}\rr{R}\rr{R}\ is generated by
+% \cmd{\rr\{U\}}\cmd{\rr\{U\}}\cmd{\rr\{R\}}\cmd{\rr\{R\}}
%
% \bigskip
-%
-% {\noindent}The equivalent `text' version of the first three
-% rotations above (and their commands) are as follows:
+%
+% {\noindent}\Rubik{F}\Rubik{U}\Rubik{y}\Rubik{Rp}\Rubik{Lwp}\
+% \ \ \verb!\Rubik{F}\Rubik{U}\Rubik{y}\Rubik{Rp}\Rubik{Lwp}!
%
% \bigskip
%
-% {\noindent}\textRubikF\ \textRubikR\ \textRubikU\ \ \ \
-% \verb!\textRubikF\ \textRubikR\ \textRubikU!
+% {\noindent}\textRubik{F}\ \textRubik{U}\ \ \ \
+% \verb!\textRubik{F}\ \textRubik{U}!
%
% \bigskip
-% {\noindent}Writing the first sequence using only letter-codes or only hieroglyphs, we have:
-%
+%
+% {\noindent}Commas can be important in avoiding ambiguity; for example
+%
+% \bigskip
+%
+% {\noindent}\rr{D},\rr{U}2,\rr{F}2,\rr{Ds}2,\rr{B}, \ \ \ \ \verb!\rr{U}2,\rr{F}2,\rr{Ds}2,\rr{B},!
+%
% \bigskip
-%
-% {\noindent}\rrF\rrR\rrU\rry\rrRp \ \ \ \
-% \verb!\rrF\rrR\rrU\rry\rrRp!
-%
+%
+% {\noindent}\rrh{U}2,\,\rrh{F}2,\,\rrh{Ds}2,\, \ \ \ \ \verb!\rrh{U}2,\,\rrh{F}2,\,\rrh{Ds}2,!
+%
% \bigskip
%
-% {\noindent}\rrhF\rrhR\rrhU\rrhy\rrhRp \ \ \ \
-% \verb!\rrhF\rrhR\rrhU\rrhy\rrhRp\!
+% {\noindent}\rrh{F}\rrh{U}\rrh{y}\rrh{Rp}\rrh{Lwp} \ \ \ \
+% \verb!\rrh{F}\rrh{U}\rrh{y}\rrh{Rp}\rrh{Lwp}!
+%
+%
%
% \bigskip
-%
-% The following shows the importance of using commas to avoid ambiguity:
%
-% \bigskip
+% \subsection{Backwards compatibility}
+% \label{sec:backwardscompat}
%
-% {\noindent}\rrD,\rrU2,\rrF2,\rrDs2,\rrB, \ \ \ \ \verb!\rrD,\rrU2,\rrF2,\rrDs2,\rrB,!
+% Note that in keeping with `backwards compatibility' all rotation commands (see below)
+% can still be written without the usual curley braces \verb!{}!.
+% For example, the hieroglyph \rrhD\ (\cmd{\rrh\{D\}}) can also be generated using the command
+% \cmd{\rrhD}.
%
% \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
+%
+% Note that all the commands presented here 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
+% as shown in the `Examples' section above. 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
+% Note also that some \cmd{\rrh\{\}} commands (eg~the \cmd{\rrh\{B\}} command)
+% show only the lettercode in a square box, e.g.,~\rrh{B}. This is because these rotations
% 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).
+% and hence can be somewhat ambiguous unless typeset with their associated
+% lettercode.
%
% \newcommand{\dnstrut}{\rule{0pt}{17pt}}
% \newcommand{\dns}{\hspace{2mm}}
@@ -765,413 +991,321 @@
%
%
%
-% \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\\
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dnstrut\rr{U}\dns\cmd{\rr\{U\}}
+% & \rrh{U}\dns\cmd{\rrh\{U\}}
+% & \textRubik{U}\dns\cmd{\textRubik\{U\}} \nonumber\\
+% \dnstrut\rr{Up}\dns\cmd{\rr\{Up\}}
+% & \rrh{Up}\dns\cmd{\rrh\{Up\}}
+% & \textRubik{Up}\dns\cmd{\textRubik\{Up\}} \nonumber\\
+% \dnstrut\rr{Uw}\dns\cmd{\rr\{Uw\}}
+% & \rrh{Uw}\dns\cmd{\rrh\{Uw\}}
+% & \textRubik{Uw}\dns\cmd{\textRubik\{Uw\}} \nonumber\\
+% \dnstrut\rr{Uwp}\dns\cmd{\rr\{Uwp\}}
+% & \rrh{Uwp}\dns\cmd{\rrh\{Uwp\}}
+% & \textRubik{Uwp}\dns\cmd{\textRubik\{Uwp\}} \nonumber\\
+% \dnstrut\rr{Us}\dns\cmd{\rr\{Us\}}
+% & \rrh{Us}\dns\cmd{\rrh\{Us\}}
+% & \textRubik{Us}\dns\cmd{\textRubik\{Us\}} \nonumber\\
+% \dnstrut\rr{Usp}\dns\cmd{\rr\{Usp\}}
+% & \rrh{Usp}\dns\cmd{\rrh\{Usp\}}
+% & \textRubik{Usp}\dns\cmd{\textRubik\{Usp\}} \nonumber\\
+% \dnstrut\rr{Ua}\dns\cmd{\rr\{Ua\}}
+% & \rrh{Ua}\dns\cmd{\rrh\{Ua\}}
+% & \textRubik{Ua}\dns\cmd{\textRubik\{Ua\}} \nonumber\\
+% \dnstrut\rr{Uap}\dns\cmd{\rr\{Uap\}}
+% & \rrh{Uap}\dns\cmd{\rrh\{Uap\}}
+% & \textRubik{Uap}\dns\cmd{\textRubik\{Uap\}} \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\\
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dnstrut\rr{D}\dns\cmd{\rr\{D\}}
+% & \rrh{D}\dns\cmd{\rrh\{D\}}
+% & \textRubik{D}\dns\cmd{\textRubik\{D\}} \nonumber\\
+% \dnstrut\rr{Dp}\dns\cmd{\rr\{Dp\}}
+% & \rrh{Dp}\dns\cmd{\rrh\{Dp\}}
+% & \textRubik{Dp}\dns\cmd{\textRubik\{Dp\}} \nonumber\\
+% \dnstrut\rr{Dw}\dns\cmd{\rr\{Dw\}}
+% & \rrh{Dw}\dns\cmd{\rrh\{Dw\}}
+% & \textRubik{Dw}\dns\cmd{\textRubik\{Dw\}} \nonumber\\
+% \dnstrut\rr{Dwp}\dns\cmd{\rr\{Dwp\}}
+% & \rrh{Dwp}\dns\cmd{\rrh\{Dwp\}}
+% & \textRubik{Dwp}\dns\cmd{\textRubik\{Dwp\}} \nonumber\\
+% \dnstrut\rr{Ds}\dns\cmd{\rr\{Ds\}}
+% & \rrh{Ds}\dns\cmd{\rrh\{Ds\}}
+% & \textRubik{Ds}\dns\cmd{\textRubik\{Ds\}} \nonumber\\
+% \dnstrut\rr{Dsp}\dns\cmd{\rr\{Dsp\}}
+% & \rrh{Dsp}\dns\cmd{\rrh\{Dsp\}}
+% & \textRubik{Dsp}\dns\cmd{\textRubik\{Dsp\}} \nonumber\\
+% \dnstrut\rr{Da}\dns\cmd{\rr\{Da\}}
+% & \rrh{Da}\dns\cmd{\rrh\{Da\}}
+% & \textRubik{Da}\dns\cmd{\textRubik\{Da\}} \nonumber\\
+% \dnstrut\rr{Dap}\dns\cmd{\rr\{Dap\}}
+% & \rrh{Dap}\dns\cmd{\rrh\{Dap\}}
+% & \textRubik{Dap}\dns\cmd{\textRubik\{Dap\}} \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\\
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dnstrut\rr{L}\dns\cmd{\rr\{L\}}
+% & \rrh{L}\dns\cmd{\rrh\{L\}}
+% & \textRubik{L}\dns\cmd{\textRubik\{L\}} \nonumber\\
+% \dnstrut\rr{Lp}\dns\cmd{\rr\{Lp\}}
+% & \rrh{Lp}\dns\cmd{\rrh\{Lp\}}
+% & \textRubik{Lp}\dns\cmd{\textRubik\{Lp\}} \nonumber\\
+% \dnstrut\rr{Lw}\dns\cmd{\rr\{Lw\}}
+% & \rrh{Lw}\dns\cmd{\rrh\{Lw\}}
+% & \textRubik{Lw}\dns\cmd{\textRubik\{Lw\}} \nonumber\\
+% \dnstrut\rr{Lwp}\dns\cmd{\rr\{Lwp\}}
+% & \rrh{Lwp}\dns\cmd{\rrh\{Lwp\}}
+% & \textRubik{Lwp}\dns\cmd{\textRubik\{Lwp\}} \nonumber\\
+% \dnstrut\rr{Ls}\dns\cmd{\rr\{Ls\}}
+% & \rrh{Ls}\dns\cmd{\rrh\{Ls\}}
+% & \textRubik{Ls}\dns\cmd{\textRubik\{Ls\}} \nonumber\\
+% \dnstrut\rr{Lsp}\dns\cmd{\rr\{Lsp\}}
+% & \rrh{Lsp}\dns\cmd{\rrh\{Lsp\}}
+% & \textRubik{Lsp}\dns\cmd{\textRubik\{Lsp\}} \nonumber\\
+% \dnstrut\rr{La}\dns\cmd{\rr\{La\}}
+% & \rrh{La}\dns\cmd{\rrh\{La\}}
+% & \textRubik{La}\dns\cmd{\textRubik\{La\}} \nonumber\\
+% \dnstrut\rr{Lap}\dns\cmd{\rr\{Lap\}}
+% & \rrh{Lap}\dns\cmd{\rrh\{Lap\}}
+% & \textRubik{Lap}\dns\cmd{\textRubik\{Lap\}} \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\\
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dnstrut\rr{R}\dns\cmd{\rr\{R\}}
+% & \rrh{R}\dns\cmd{\rrh\{R\}}
+% & \textRubik{R}\dns\cmd{\textRubik\{R\}} \nonumber\\
+% \dnstrut\rr{Rp}\dns\cmd{\rr\{Rp\}}
+% & \rrh{Rp}\dns\cmd{\rrh\{Rp\}}
+% & \textRubik{Rp}\dns\cmd{\textRubik\{Rp\}} \nonumber\\
+% \dnstrut\rr{Rw}\dns\cmd{\rr\{Rw\}}
+% & \rrh{Rw}\dns\cmd{\rrh\{Rw\}}
+% & \textRubik{Rw}\dns\cmd{\textRubik\{Rw\}} \nonumber\\
+% \dnstrut\rr{Rwp}\dns\cmd{\rr\{Rwp\}}
+% & \rrh{Rwp}\dns\cmd{\rrh\{Rwp\}}
+% & \textRubik{Rwp}\dns\cmd{\textRubik\{Rwp\}} \nonumber\\
+% \dnstrut\rr{Rs}\dns\cmd{\rr\{Rs\}}
+% & \rrh{Rs}\dns\cmd{\rrh\{Rs\}}
+% & \textRubik{Rs}\dns\cmd{\textRubik\{Rs\}} \nonumber\\
+% \dnstrut\rr{Rsp}\dns\cmd{\rr\{Rsp\}}
+% & \rrh{Rsp}\dns\cmd{\rrh\{Rsp\}}
+% & \textRubik{Rsp}\dns\cmd{\textRubik\{Rsp\}} \nonumber\\
+% \dnstrut\rr{Ra}\dns\cmd{\rr\{Ra\}}
+% & \rrh{Ra}\dns\cmd{\rrh\{Ra\}}
+% & \textRubik{Ra}\dns\cmd{\textRubik\{Ra\}} \nonumber\\
+% \dnstrut\rr{Rap}\dns\cmd{\rr\{Rap\}}
+% & \rrh{Rap}\dns\cmd{\rrh\{Rap\}}
+% & \textRubik{Rap}\dns\cmd{\textRubik\{Rap\}} \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\\
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dnstrut\rr{F}\dns\cmd{\rr\{F\}}
+% & \rrh{F}\dns\cmd{\rrh\{F\}}
+% & \textRubik{F}\dns\cmd{\textRubik\{F\}} \nonumber\\
+% \dnstrut\rr{Fp}\dns\cmd{\rr\{Fp\}}
+% & \rrh{Fp}\dns\cmd{\rrh\{Fp\}}
+% & \textRubik{Fp}\dns\cmd{\textRubik\{Fp\}} \nonumber\\
+% \dnstrut\rr{Fw}\dns\cmd{\rr\{Fw\}}
+% & \rrh{Fw}\dns\cmd{\rrh\{Fw\}}
+% & \textRubik{Fw}\dns\cmd{\textRubik\{Fw\}} \nonumber\\
+% \dnstrut\rr{Fwp}\dns\cmd{\rr\{Fwp\}}
+% & \rrh{Fwp}\dns\cmd{\rrh\{Fwp\}}
+% & \textRubik{Fwp}\dns\cmd{\textRubik\{Fwp\}} \nonumber\\
+% \dnstrut\rr{Fs}\dns\cmd{\rr\{Fs\}}
+% & \rrh{Fs}\dns\cmd{\rrh\{Fs\}}
+% & \textRubik{Fs}\dns\cmd{\textRubik\{Fs\}} \nonumber\\
+% \dnstrut\rr{Fsp}\dns\cmd{\rr\{Fsp\}}
+% & \rrh{Fsp}\dns\cmd{\rrh\{Fsp\}}
+% & \textRubik{Fsp}\dns\cmd{\textRubik\{Fsp\}} \nonumber\\
+% \dnstrut\rr{Fa}\dns\cmd{\rr\{Fa\}}
+% & \rrh{Fa}\dns\cmd{\rrh\{Fa\}}
+% & \textRubik{Fa}\dns\cmd{\textRubik\{Fa\}} \nonumber\\
+% \dnstrut\rr{Fap}\dns\cmd{\rr\{Fap\}}
+% & \rrh{Fap}\dns\cmd{\rrh\{Fap\}}
+% & \textRubik{Fap}\dns\cmd{\textRubik\{Fap\}} \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\\
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dnstrut\rr{B}\dns\cmd{\rr\{B\}}
+% & \rrh{B}\dns\cmd{\rrh\{B\}}
+% & \textRubik{B}\dns\cmd{\textRubik\{B\}} \nonumber\\
+% \dnstrut\rr{Bp}\dns\cmd{\rr\{Bp\}}
+% & \rrh{Bp}\dns\cmd{\rrh\{Bp\}}
+% & \textRubik{Bp}\dns\cmd{\textRubik\{Bp\}} \nonumber\\
+% \dnstrut\rr{Bw}\dns\cmd{\rr\{Bw\}}
+% & \rrh{Bw}\dns\cmd{\rrh\{Bw\}}
+% & \textRubik{Bw}\dns\cmd{\textRubik\{Bw\}} \nonumber\\
+% \dnstrut\rr{Bwp}\dns\cmd{\rr\{Bwp\}}
+% & \rrh{Bwp}\dns\cmd{\rrh\{Bwp\}}
+% & \textRubik{Bwp}\dns\cmd{\textRubik\{Bwp\}} \nonumber\\
+% \dnstrut\rr{Bs}\dns\cmd{\rr\{Bs\}}
+% & \rrh{Bs}\dns\cmd{\rrh\{Bs\}}
+% & \textRubik{Bs}\dns\cmd{\textRubik\{Bs\}} \nonumber\\
+% \dnstrut\rr{Bsp}\dns\cmd{\rr\{Bsp\}}
+% & \rrh{Bsp}\dns\cmd{\rrh\{Bsp\}}
+% & \textRubik{Bsp}\dns\cmd{\textRubik\{Bsp\}} \nonumber\\
+% \dnstrut\rr{Ba}\dns\cmd{\rr\{Ba\}}
+% & \rrh{Ba}\dns\cmd{\rrh\{Ba\}}
+% & \textRubik{Ba}\dns\cmd{\textRubik\{Ba\}} \nonumber\\
+% \dnstrut\rr{Bap}\dns\cmd{\rr\{Bap\}}
+% & \rrh{Bap}\dns\cmd{\rrh\{Bap\}}
+% & \textRubik{Bap}\dns\cmd{\textRubik\{Bap\}} \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\\
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dnstrut\rr{Su}\dns\cmd{\rr\{Su\}}
+% & \rrh{Su}\dns\cmd{\rrh\{Su\}}
+% & \textRubik{Su}\dns\cmd{\textRubik\{Su\}} \nonumber\\
+% \dnstrut\rr{Sup}\dns\cmd{\rr\{Sup\}}
+% & \rrh{Sup}\dns\cmd{\rrh\{Sup\}}
+% & \textRubik{Sup}\dns\cmd{\textRubik\{Sup\}} \nonumber\\
+% \dnstrut\rr{Sd}\dns\cmd{\rr\{Sd\}}
+% & \rrh{Sd}\dns\cmd{\rrh\{Sd\}}
+% & \textRubik{Sd}\dns\cmd{\textRubik\{Sd\}} \nonumber\\
+% \dnstrut\rr{Sdp}\dns\cmd{\rr\{Sdp\}}
+% & \rrh{Sdp}\dns\cmd{\rrh\{Sdp\}}
+% & \textRubik{Sdp}\dns\cmd{\textRubik\{Sdp\}} \nonumber\\
+% \dnstrut\rr{Sl}\dns\cmd{\rr\{Sl\}}
+% & \rrh{Sl}\dns\cmd{\rrh\{Sl\}}
+% & \textRubik{Sl}\dns\cmd{\textRubik\{Sl\}} \nonumber\\
+% \dnstrut\rr{Slp}\dns\cmd{\rr\{Slp\}}
+% & \rrh{Slp}\dns\cmd{\rrh\{Slp\}}
+% & \textRubik{Slp}\dns\cmd{\textRubik\{Slp\}} \nonumber\\
+% \dnstrut\rr{Sr}\dns\cmd{\rr\{Sr\}}
+% & \rrh{Sr}\dns\cmd{\rrh\{Sr\}}
+% & \textRubik{Sr}\dns\cmd{\textRubik\{Sr\}} \nonumber\\
+% \dnstrut\rr{Srp}\dns\cmd{\rr\{Srp\}}
+% & \rrh{Srp}\dns\cmd{\rrh\{Srp\}}
+% & \textRubik{Srp}\dns\cmd{\textRubik\{Srp\}} \nonumber\\
+% \dnstrut\rr{Sf}\dns\cmd{\rr\{Sf\}}
+% & \rrh{Sf}\dns\cmd{\rrh\{Sf\}}
+% & \textRubik{Sf}\dns\cmd{\textRubik\{Sf\}} \nonumber\\
+% \dnstrut\rr{Sfp}\dns\cmd{\rr\{Sfp\}}
+% & \rrh{Sfp}\dns\cmd{\rrh\{Sfp\}}
+% & \textRubik{Sfp}\dns\cmd{\textRubik\{Sfp\}} \nonumber\\
+% \dnstrut\rr{Sb}\dns\cmd{\rr\{Sb\}}
+% & \rrh{Sb}\dns\cmd{\rrh\{Sb\}}
+% & \textRubik{Sb}\dns\cmd{\textRubik\{Sb\}} \nonumber\\
+% \dnstrut\rr{Sbp}\dns\cmd{\rr\{Sbp\}}
+% & \rrh{Sbp}\dns\cmd{\rrh\{Sbp\}}
+% & \textRubik{Sbp}\dns\cmd{\textRubik\{Sbp\}} \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\\
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dnstrut\rr{E}\dns\cmd{\rr\{E\}}
+% & \rrh{E}\dns\cmd{\rrh\{E\}}
+% & \textRubik{E}\dns\cmd{\textRubik\{E\}} \nonumber\\
+% \dnstrut\rr{Ep}\dns\cmd{\rr\{Ep\}}
+% & \rrh{Ep}\dns\cmd{\rrh\{Ep\}}
+% & \textRubik{Ep}\dns\cmd{\textRubik\{Ep\}} \nonumber\\
+% \dnstrut\rr{M}\dns\cmd{\rr\{M\}}
+% & \rrh{M}\dns\cmd{\rrh\{M\}}
+% & \textRubik{M}\dns\cmd{\textRubik\{M\}} \nonumber\\
+% \dnstrut\rr{Mp}\dns\cmd{\rr\{Mp\}}
+% & \rrh{Mp}\dns\cmd{\rrh\{Mp\}}
+% & \textRubik{Mp}\dns\cmd{\textRubik\{Mp\}} \nonumber\\
+% \dnstrut\rr{S}\dns\cmd{\rr\{S\}}
+% & \rrh{S}\dns\cmd{\rrh\{S\}}
+% & \textRubik{S}\dns\cmd{\textRubik\{S\}} \nonumber\\
+% \dnstrut\rr{Sp}\dns\cmd{\rr\{Sp\}}
+% & \rrh{Sp}\dns\cmd{\rrh\{Sp\}}
+% & \textRubik{Sp}\dns\cmd{\textRubik\{Sp\}} \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\\
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dnstrut\rr{x}\dns\cmd{\rr\{x\}}
+% & \rrh{x}\dns\cmd{\rrh\{x\}}
+% & \Rubik{x}\dns\cmd{\Rubik\{x\}} \nonumber\\
+% \dnstrut\rr{xp}\dns\cmd{\rr\{xp\}}
+% & \rrh{xp}\dns\cmd{\rrh\{xp\}}
+% & \Rubik{xp}\dns\cmd{\Rubik\{xp\}} \nonumber\\
+% \dnstrut\rr{y}\dns\cmd{\rr\{y\}}
+% & \rrh{y}\dns\cmd{\rrh\{y\}}
+% & \Rubik{y}\dns\cmd{\Rubik\{y\}} \nonumber\\
+% \dnstrut\rr{yp}\dns\cmd{\rr\{yp\}}
+% & \rrh{yp}\dns\cmd{\rrh\{yp\}}
+% & \Rubik{yp}\dns\cmd{\Rubik\{yp\}} \nonumber\\
+% \dnstrut\rr{z}\dns\cmd{\rr\{z\}}
+% & \rrh{z}\dns\cmd{\rrh\{z\}}
+% & \Rubik{z}\dns\cmd{\Rubik\{z\}} \nonumber\\
+% \dnstrut\rr{zp}\dns\cmd{\rr\{zp\}}
+% & \rrh{zp}\dns\cmd{\rrh\{zp\}}
+% & \Rubik{zp}\dns\cmd{\Rubik\{zp\}} \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\\
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dnstrut\rr{u}\dns\cmd{\rr\{u\}}
+% & \rrh{u}\dns\cmd{\rrh\{u\}}
+% & \Rubik{u}\dns\cmd{\Rubik\{u\}} \nonumber\\
+% \dnstrut\rr{d}\dns\cmd{\rr\{d\}}
+% & \rrh{d}\dns\cmd{\rrh\{d\}}
+% & \Rubik{d}\dns\cmd{\Rubik\{d\}} \nonumber\\
+% \dnstrut\rr{l}\dns\cmd{\rr\{l\}}
+% & \rrh{l}\dns\cmd{\rrh\{l\}}
+% & \Rubik{l}\dns\cmd{\Rubik\{l\}} \nonumber\\
+% \dnstrut\rr{r}\dns\cmd{\rr\{r\}}
+% & \rrh{r}\dns\cmd{\rrh\{r\}}
+% & \Rubik{r}\dns\cmd{\Rubik\{r\}} \nonumber\\
+% \dnstrut\rr{f}\dns\cmd{\rr\{f\}}
+% & \rrh{f}\dns\cmd{\rrh\{f\}}
+% & \Rubik{f}\dns\cmd{\Rubik\{f\}} \nonumber\\
+% \dnstrut\rr{b}\dns\cmd{\rr\{b\}}
+% & \rrh{b}\dns\cmd{\rrh\{b\}}
+% & \Rubik{b}\dns\cmd{\Rubik\{b\}} \nonumber\\
% \end{supertabular}
%
%
+% \pagebreak
%
-% \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
+% \section{Other commands}
%
-% \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}).
+% \DescribeMacro{\rubikcube}
+% This command generates the logo \rubikcube.
%
%
-% \subsection{Size of cube \cmd{\minipage}}
+% All \rubikcube\ commands assume a 3x3x3 cube by default.
+% There are three primary command categories: (a)~\cmd{\Draw..} commands
+% (which must always be used \textit{inside} a TikZ picture environment),
+% (b)~parameter-allocation' commands---e.g.,~\cmd{\RubikCubeSolved}---which can
+% be used either inside or outside a TikZ environment),
+% and (c)~commands which can be used in ordinary text
+% (e.g.,~|\rr{}| rotation commands).
%
-% 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}$.
+% Since \LaTeX\ commands have a maximum limit of only 9 parameters,
+% it is necessary to use separate `Face' and `Slice' commands (see below)
+% in order to accommodate all 27 visible colours of a 3D~Rubik cube.
%
-% 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).
+% \subsection{Draw 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).
+% Furthermore, \cmd{\Draw..} commands can only be used \textit{inside} a TikZ
+% picture environment (see section~\ref{sec:drawerrormessage}).
%
%
-% \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
+% This command draws Rubik cubes in one of four
+% orientations as denoted by the following terminal XY viewing-direction
+% codes: 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
+% will draw a Rubik cube as viewed from the RightUp direction (RU), as
% shown in the following figure.
%
% \bigskip
@@ -1179,66 +1313,76 @@
% \begin{minipage}{2.8cm}
% \begin{tikzpicture}[scale=0.7]
% \DrawRubikCubeRU
-% \end{tikzpicture}
+% \end{tikzpicture}%
% \end{minipage}
% \hspace{5mm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
+% \RubikCubeSolved
% \begin{tikzpicture}[scale=0.7]
% \DrawRubikCubeRU
-% \end{tikzpicture}
+% \end{tikzpicture}%
+%\end{verbatim}
+% Note that these commands are equivalent to:
+%\begin{verbatim}
+% \RubikCubeSolved
+% \ShowCube{3cm}{0.7}{\DrawRubikCubeRU}
%\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.
%
+%
+% \DescribeMacro{\DrawCubieXYxyz}
+% This command draws a single cubie in one of four
+% orientations as denoted by the terminal XY viewing-direction
+% codes.
% 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.
+% where the XY pair denotes the viewing direction as before, and
+% the xyz parameters 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
+% \medskip
%
% \begin{minipage}{1.35cm}
% \begin{tikzpicture}[scale=1]
% \DrawCubieRU{O}{Y}{G}
-% \end{tikzpicture}
+% \end{tikzpicture}%
% \end{minipage}
% \hspace{1cm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
% \begin{tikzpicture}[scale=1]
% \DrawCubieRU{O}{Y}{G}
-% \end{tikzpicture}
+% \end{tikzpicture}%
%\end{verbatim}
% \end{minipage}
%
-% \bigskip
+% \medskip
%
+% {\noindent}Since the front face is a unit 1cm and the width of the side approx 1/3cm,
+% and the scale factor =1, then the the minimum minipage width required for the cubie
+% $=(1.33 \times 1) = 1.33$cm, and hence the above commands are equivalent to
+% \begin{verbatim}
+% \ShowCube{1.33cm}{1}{\DrawCubieRU{O}{Y}{G}}
+% \end{verbatim}
%
%
% \begin{figure}[hbt]
% \centering
% \ifpdf
-% \includegraphics[height=4cm]{Rubik_doc_figC.pdf}
+% \includegraphics[height=4cm]{Rubik-doc-figC.pdf}
% \else
-% \includegraphics[height=4cm]{Rubik_doc_figC.eps}
+% \includegraphics[height=4cm]{Rubik-doc-figC.eps}
% \fi
% \vspace{-5mm}\caption{\label{fig:cubiedydx}Cubie dy dx parameters}
% \end{figure}
@@ -1246,9 +1390,8 @@
% \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
+% 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\{\}}
@@ -1262,7 +1405,7 @@
% \Cubiedy{0.4}
% \Cubiedx{0.8}
% \DrawCubieRU{O}{Y}{G}
-% \end{tikzpicture}
+% \end{tikzpicture}%
% \end{minipage}
% \hspace{2cm}
% \begin{minipage}{0.6\textwidth}
@@ -1271,15 +1414,15 @@
% \Cubiedy{0.4}
% \Cubiedx{0.8}
% \DrawCubieRU{O}{Y}{G}
-% \end{tikzpicture}
+% \end{tikzpicture}%
%\end{verbatim}
% \end{minipage}
%
% \bigskip
%
-% {\noindent}Note that the \textsc{front} of the cubie is a unit square,
+% {\noindent}Note that the \textsc{front} face 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).
+% \textsc{front} face (see also the section on Arrows: Section~\ref{sec:arrows}).
% The default values of dy and dx are 0.4.
%
% \medskip
@@ -1289,8 +1432,7 @@
% \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:
+% of the four \cmd{\DrawCubie} commands for use in ordinary text, as follows:
% \begin{quote}
% \textCubieRU{O}{Y}{G} \ \ |\textCubieRU{O}{Y}{G}|
%
@@ -1306,21 +1448,18 @@
%
% \textCubieLD{O}{Y}{G} \ \ |\textCubieLD{O}{Y}{G}|
% \end{quote}
-% Note that the \cmd{\textCubieXY} commands are not influenced by the
+% Note that these \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}
+% \subsubsection[Draw.. error message]{\cmd{\draw} error message}
%
-% See also section~\ref{drawerrormessage} regarding the error message associated with
+% See also section~\ref{sec:drawerrormessage} regarding the error message associated with
% using a \cmd{\Draw...} command \textit{outside} a TikZ picture environment.
%
%
% \subsection{Face commands}
+% \label{sec:facecommands}
%
% \DescribeMacro{\RubikFaceUp}
% \DescribeMacro{\RubikFaceDown}
@@ -1366,15 +1505,15 @@
% \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):
+% `\texttt{All}' command which allocates the same colour to all the cubies
+% on a 9-face (i.e.,~only a single colour argument is required).
%
-% If you want a particular face to be \textsc{all} grey, then one can
+% If you want a particular face to be 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
+% colour arguments must be allocated, 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.
@@ -1382,36 +1521,34 @@
% \bigskip
%
% \begin{minipage}{2.8cm}
-% \begin{tikzpicture}[scale=0.7]
% \RubikFaceUpAll{X}
% \RubikFaceRightAll{R}
% \RubikFaceFront{W}{Y}{G}
% {W}{Y}{G}
% {W}{Y}{G}
+% \begin{tikzpicture}[scale=0.7]
% \DrawRubikCubeRU
-% \end{tikzpicture}
+% \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}
+% \RubikFaceUpAll{X}
+% \RubikFaceRightAll{R}
+% \RubikFaceFront{W}{Y}{G}
+% {W}{Y}{G}
+% {W}{Y}{G}
+% \ShowCube{3cm}{0.7}{\DrawRubikCubeRU}
+% \end{verbatim}
% \end{minipage}
%
%
-% \subsection{RubikCubeSolved command}
+% \subsection{RubikCubeSolved command}
+% \label{sec:rubikcubesolved}
%
% \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:
+% and is equivalent to the following set of face commands
%\begin{verbatim}
% \RubikFaceUpAll{W}%
% \RubikFaceDownAll{Y}%
@@ -1420,15 +1557,63 @@
% \RubikFaceFrontAll{O}%
% \RubikFaceBackAll{R}%
%\end{verbatim}
+% as shown in the following semi-flat image.
%
-% \begin{tikzpicture}[scale=0.6]
+% \bigskip
+%
+% \begin{minipage}{5cm}
+% \centering
+% \begin{tikzpicture}[scale=0.5]
% \RubikCubeSolved
% \DrawRubikCubeFlat
-% \end{tikzpicture}
+% \end{tikzpicture}%
+% \end{minipage}
+% \begin{minipage}{0.5\textwidth}
+%\begin{verbatim}
+% \RubikCubeSolved
+% \showcube{5cm}{0.5}{\DrawRubikCubeFlat}
+%\end{verbatim}
+% \end{minipage}
+%
+% \bigskip
+%
+% Note that the width of the minipage above is set to 5cm. This is derived from the fact
+% that the unscaled width of the semi-flat image is 10cm, and hence if
+% the TikZ scale factor is to be 0.5 then the minimum minipage width = $10 \times 0.5 = 5$cm
+% (see Section~\ref{sec:coordinates} for details).
+%
+% If other orientations of the solved cube are required, this can be easily achieved
+% using the \cmd{\RubikRotation} command (from the \texttt{RubikRotation} package).
+% For example, if one wants to show the solved cube upsidedown, then this format
+% could be defined as follows (here we have used the rotations \rrx, \rrx, \rry, to
+% invert the cube):
+%\begin{verbatim}
+%\newcommand{\CubeUpSideDown}{\RubikCubeSolved\RubikRotation{x2,y}}
+%\end{verbatim}
+% This command would then generate the following:
+%
+% \bigskip
+%
+% \begin{minipage}{2.8cm}
+% \centering
+% \begin{tikzpicture}[scale=0.6]
+% \DrawNCubeAll{3}{O}{Y}{G}
+% \end{tikzpicture}%
+% \end{minipage}
+% \hspace{5mm}
+% \begin{minipage}{0.6\textwidth}
+%\begin{verbatim}
+% \CubeUpSideDown
+% \ShowCube{2.4cm}{0.6}\DrawRubikCubeRU}
+%\end{verbatim}
+% \end{minipage}
+%
+% \bigskip
%
% 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).
+% the \cmd{\RubikCubeSolved} command as follows---remember to include the trailing \% (note also
+% that the colours ROYGBWX are currently hardwired so do not use a different set
+% of uppercase letters).
%\begin{verbatim}
% \renewcommand{\RubikCubeSolved}{%
% \RubikFaceUpAll{..}%
@@ -1441,21 +1626,51 @@
%\end{verbatim}
%
%
+%
+% \subsection{RubikCubeGrey command}
+% \label{sec:rubikcubegrey}
+%
+% \DescribeMacro{\RubikCubeGrey}
+% This command generates a 3x3x3 cube with no colours allocated except for the central
+% cubie of each face, which takes the same colour configuration as defined for the
+% \cmd{\RubikCubeSolved} command.
+% This command, which is useful starting point when wanting to describe the movement of
+% particular cubies, generates the following cube:
+%
+% \bigskip
+%
+% \RubikCubeGrey
+% \ShowCube{3cm}{0.5}{\DrawRubikCubeRU}
+% \hspace{5mm}
+% \begin{minipage}{0.6\textwidth}
+%\begin{verbatim}
+% \RubikCubeGrey
+% \ShowCube{3cm}{0.5}{\DrawRubikCubeRU}
+%\end{verbatim}
+% \end{minipage}
+%
+% \bigskip
+% Users can easily set their own alternative face/colour configuration by `renewing'
+% the \cmd{\RubikCubeGrey} command along the lines shown above (the code is in Section~\ref{sec:codegrey}).
+%
+%
+%
% \subsection{Slice commands}
+% \label{sec:slicecommands}
%
% \DescribeMacro{\RubikSliceTopX}
-% \DescribeMacro{\RubikSliceEquatorX}
+% \DescribeMacro{\RubikSliceMiddleX}
% \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.
+% (Left view \& Right view) for each of the horizontal slices Top, Middle, 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.
+% from left to right irrespective of the viewpoint, e.g.,~\#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.
+% to have the view (R or L) specified 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
@@ -1463,28 +1678,29 @@
% particular example ends in L, consistent with
% the final \cmd{\DrawRubikCubeLD} command.
%
+% Note that the two legacy `Equator' versions (now replaced by `Middle')
+% are retained to allow backward compatibility.
+%
% \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}
+% \RubikSliceMiddleL {R}{R}{R} {B}{B}{B}
% \RubikSliceBottomL {O}{O}{O} {G}{G}{G}
+% \begin{tikzpicture}[scale=0.7]
% \DrawRubikCubeLD
-% \end{tikzpicture}
+% \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}
+% \RubikSliceMiddleL {R}{R}{R} {B}{B}{B}
% \RubikSliceBottomL {O}{O}{O} {G}{G}{G}
-% \DrawRubikCubeLD
-% \end{tikzpicture}
+% \ShowCube{3cm}{0.7}{\DrawRubikCubeLD}
%\end{verbatim}
% \end{minipage}
%
@@ -1492,14 +1708,16 @@
% \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.
+% These commands are intended for drawing final layer
+% configurations (i.e.,~typically using the yellow face in the \textsc{up} position)
+% with or without the associated side faces of the cubies of the top layer
+% (see also the \cmd{\DrawFlatUpSide} command in Section~\ref{sec:flatcommands})
%
% \subsubsection{LayerFace}
%
% \DescribeMacro{\DrawRubikLayerFace}
-% This LayerFace command draws a simple Rubik cube 3x3 face and allocates colours to the 9 cubies.
+% 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.
%
@@ -1511,45 +1729,46 @@
% \DrawRubikLayerFace{X}{Y}{X}
% {Y}{Y}{Y}
% {X}{Y}{X}
-% \end{tikzpicture}
+% \end{tikzpicture}%
% \end{minipage}
% \hspace{1cm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
-% \begin{tikzpicture}[scale=0.7]
+% \ShowCube{2.1cm}{0.7}{%
% \DrawRubikLayerFace{X}{Y}{X}
% {Y}{Y}{Y}
% {X}{Y}{X}
-% \end{tikzpicture}
+% }
%\end{verbatim}
% \end{minipage}
%
% \medskip
%
-% \subsubsection{\cmd{\draw} error message}
+% \subsubsection[Draw.. error message]{\cmd{\draw} error message}
%
-% See also section~\ref{drawerrormessage} regarding the error message associated with
+% See also section~\ref{sec:drawerrormessage} regarding the error message associated with
% using a \cmd{\Draw...} command \textit{outside} a TikZ picture environment.
%
% \medskip
%
-% \subsubsection{LayerSide}
+% \subsubsection{LayerSide}
+% \label{sec:layerside}
%
-% \DescribeMacro{\DrawLayerSideXYp}
+% \DescribeMacro{\DrawRubikLayerSideXYp}
% 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.
+% Y:[Top \verb!|! Middle \verb!|! Bottom]) of a particular cubie in the layer face.
%
% \begin{figure}[hbt]
% \centering
% \ifpdf
-% \includegraphics[height=3cm]{Rubik_doc_figD.pdf}
+% \includegraphics[height=3cm]{Rubik-doc-figD.pdf}
% \else
-% \includegraphics[height=3cm]{Rubik_doc_figD.eps}
+% \includegraphics[height=3cm]{Rubik-doc-figD.eps}
% \fi
-% \vspace{-5mm}\caption{\label{fig:facenotation}LayerSide letter-codes }
+% \vspace{-5mm}\caption{\label{fig:facenotation}LayerSide rotation-codes }
% \end{figure}
%
% Since corner cubies have two side faces, the `p' parameter
@@ -1567,15 +1786,15 @@
%
% \begin{quote}
%\begin{verbatim}
-% \DrawRubikLayerSideLE{G}
-% \DrawRubikLayerSideLEx{G}
+% \DrawRubikLayerSideLM{G}
+% \DrawRubikLayerSideLMx{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.
+% \DrawRubikLayerSideLMx{G}
+% \end{tikzpicture}%
+% just to the left of the Left Middle (LM) 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}
@@ -1588,7 +1807,7 @@
% 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).
+% vertical order (eg, top, middle, 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}
@@ -1621,35 +1840,35 @@
%
% \DrawRubikLayerSideLTy{B}
% \DrawRubikLayerSideLTx{O}
-% \DrawRubikLayerSideLE{G}
+% \DrawRubikLayerSideLM{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}
+% \node (LM) at (0.5, 1.5) [red]{\small\textsf{LM}};
+% \end{tikzpicture}%
% \end{minipage}
% \hspace{1cm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
-% \begin{tikzpicture}[scale=0.7]
+% \ShowCube{3cm}{0.7}{%
% \DrawRubikLayerFace{X}{Y}{X}
% {Y}{Y}{Y}
% {X}{Y}{X}
%
% \DrawRubikLayerSideLTy{B}
% \DrawRubikLayerSideLTx{O}
-% \DrawRubikLayerSideLE{G}
+% \DrawRubikLayerSideLM{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}
+% \node (LM) at (0.5, 1.5)
+% [red]{\small\textsf{LM}};
+% }
%\end{verbatim}
% \end{minipage}
%
@@ -1669,12 +1888,12 @@
% {Y} {O}
% \DrawRubikLayerSideB {O}{G}{G}
%
-% \end{tikzpicture}
+% \end{tikzpicture}%
% \end{minipage}
% \hspace{1cm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
-% \begin{tikzpicture}[scale=0.7]
+% \ShowCube{3cm}{0.7}{%
% \DrawRubikLayerFace{G}{Y}{R}
% {Y}{Y}{Y}
% {B}{Y}{Y}
@@ -1684,12 +1903,27 @@
% {R} {O}
% {Y} {O}
% \DrawRubikLayerSideB {O}{G}{G}
-% \end{tikzpicture}
+% }
%\end{verbatim}
% \end{minipage}
%
% \bigskip
+%
+% \DescribeMacro{\DrawFlatUpSide}
+% \textsc{important note}: If the colour configuration of the \textit{whole}
+% cube is already known to the system (i.e.,~it has been specified before,
+% and (possibly) been manipulated using the \cmd{\RubikRotation..} command
+% from \textsc{rubikrotation} package), then the above figure could be
+% drawn much more simply using just the single \cmd{\DrawFlatUpSide} command,
+% as described in Section~\ref{sec:flatcommands}. In short, using the
+% \texttt{rubikrotation} package to keep track of the Rubik cube configuration makes
+% drawing these images considerably simpler.
%
+% \bigskip
+%
+% \DescribeMacro{\RubikSideBarWidth}
+% \DescribeMacro{\RubikSideBarLength}
+% \DescribeMacro{\RubikSideBarSep}
% 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.
@@ -1719,19 +1953,19 @@
% \RubikSideBarWidth{0.7}
% \RubikSideBarLength{0.7}
% \DrawRubikLayerSideMTy{G}
-% \end{tikzpicture}
+% \end{tikzpicture}%
% \end{minipage}
% \hspace{1cm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
-% \begin{tikzpicture}[scale=0.7]
+% \ShowCube{3cm}{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}
%
@@ -1746,13 +1980,16 @@
% 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.
+% shown in the following example. Note that in this example we have used the
+% \cmd{\ShowCubeF} command as an exercise to implement the fbox and reveal
+% the extent of the surrounding white space associated with a minipage width of
+% 3.5cm ($=5 \times 0.7$) ---showing that a sidebar increases the image width by about
+% 0.5 the width of a cubie.
%
% \bigskip
%
-% \begin{minipage}{2.5cm}
+% \begin{minipage}{4cm}
% \centering
-% \begin{tikzpicture}[scale=0.7]
% \RubikFaceUp {X}{W}{X}%
% {W}{W}{W}%
% {X}{W}{X}%
@@ -1764,16 +2001,15 @@
% \RubikFaceRight{X}{G}{G}%
% {X}{G}{G}%
% {G}{X}{X}%
-% \DrawRubikCubeRU
-%
-% \DrawRubikLayerSideL{O}{B}{R}
+% \ShowCubeF{3.5cm}{0.7}{%
+% \DrawRubikCubeRU
+% \DrawRubikLayerSideL{G}{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}%
@@ -1785,11 +2021,11 @@
% \RubikFaceRight{X}{G}{G}%
% {X}{G}{G}%
% {G}{X}{X}%
-% \DrawRubikCubeRU
-%
-% \DrawRubikLayerSideL{O}{B}{R}
+% \ShowCubeF{3.5cm}{0.7}{%
+% \DrawRubikCubeRU
+% \DrawRubikLayerSideL{G}{B}{R}
% \DrawRubikLayerSideB{R}{G}{O}
-% \end{tikzpicture}
+% }
%\end{verbatim}
% \end{minipage}
%
@@ -1800,23 +2036,111 @@
% increase the width of the image, one may also have to adjust the width of
% the associated minipage.
%
+% \pagebreak
%
% \subsection{Flat commands}
% \label{sec:flatcommands}
+%
+% \DescribeMacro{\DrawFlatUp}
+% \DescribeMacro{\DrawFlatDown}
+% \DescribeMacro{\DrawFlatLeft}
+% \DescribeMacro{\DrawFlatRight}
+% \DescribeMacro{\DrawFlatFront}
+% \DescribeMacro{\DrawFlatBack}
+% These commands \cmd{\DrawFlat..}\marg{x}\marg{y} draw a `flat' (square)
+% representation of a specified face such that its bottom left corner
+% is positioned at ($x$, $y$).
+% They are designed to supplement the \cmd{\DrawRubikCube...} commands and
+% allow hidden faces to be represented.
+% Each command (except \cmd{\DrawFlatFront}) takes two arguments,
+% namely the 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 Y-argument set for the \cmd{\DrawFlatLeft}
+% and \cmd{\DrawFlatRight} commands is not currently actioned
+% (see Section~\ref{sec:drawflatxcommands}),
+% since both the \textsc{left} and \textsc{right} faces as used by the
+% \cmd{\DrawRubikCubeFlat} command---since this shows the RU view---requires only Y=0
+% (this (x,y) facility will be fully extended to the left and right forms in a
+% later version).
+% Note also that the \cmd{\DrawFlatFront} command currently takes no arguments,
+% since by definition the bottom left corner of this face is always at (0,0),
+% and there seems to be no reason (just now) for this face to have the
+% (x,y) facility.
+%
+% In the following example we use the command \verb!\DrawFlatBack{4}{1}! to
+% append the \textsc{back} face to the side of a 3D cube. Note that since
+% the coordinates of the bottom/back/right corner of the cube rendered by the
+% command \cmd{\DrawRubikCubeRU} is (4,1)
+% (see Section~\ref{sec:coordinates}), we can position the
+% lower/left corner of the \textsc{back} face at this point using the command
+% \verb!\DrawFlatBack{4}{1}! as follows:
+%
+% \bigskip
%
-% \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.
+% \begin{minipage}{0.4\textwidth}
+% \centering
+% \RubikCubeSolved
+% \begin{tikzpicture}[scale=0.4]
+% \DrawRubikCubeRU
+% \DrawFlatBack{4}{1}
+% \end{tikzpicture}%
+% \end{minipage}
+% \begin{minipage}{5cm}
+%\begin{verbatim}
+% \RubikCubeSolved
+% \ShowCube{3cm}{0.4}{%
+% \DrawRubikCubeRU
+% \DrawFlatBack{4}{1}
+% }
+%\end{verbatim}
+% \end{minipage}
%
% \bigskip
+%
+%
+% \DescribeMacro{\DrawFlatUpSide}
+% \DescribeMacro{\DrawFlatDownSide}
+% \DescribeMacro{\DrawFlatLeftSide}
+% \DescribeMacro{\DrawFlatRightSide}
+% \DescribeMacro{\DrawFlatFrontSide}
+% \DescribeMacro{\DrawFlatBackSide}
+% These commands draw a face and all the associated side facelets.
+% In the following example we use the \cmd{\DrawFlatUpSide} command to
+% draw the \textsc{up} face and all its side-bars of a cube having
+% a `solved' configuration.
+%
+%
+% \bigskip
%
% \begin{minipage}{0.4\textwidth}
% \centering
+% \RubikCubeSolved
% \begin{tikzpicture}[scale=0.4]
+% \DrawFlatUpSide
+% \end{tikzpicture}%
+% \end{minipage}
+% \begin{minipage}{5cm}
+%\begin{verbatim}
% \RubikCubeSolved
+% \ShowCube{1.6cm}{0.4}{%
+% \DrawFlatUpSide
+% }
+%\end{verbatim}
+% \end{minipage}
+%
+% \bigskip
%
+% \DescribeMacro{\DrawRubikFlat}
+% This command draws the completely flat format of the cube, as 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}};
@@ -1824,15 +2148,13 @@
% \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}
+% \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}
+% \RubikCubeSolved
+% \ShowCube{5cm}{0.4}{\DrawRubikFlat}
%\end{verbatim}
% \end{minipage}
%
@@ -1840,21 +2162,27 @@
%
% 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:
+% bottom left corner of the front face (orange here).
+% The letters were placed using the following TikZ code inside the
+% TikZ picture environment.
%
%\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}};
+% \RubikCubeSolved
+% \ShowCube{5cm}{0.4}{%
+% \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{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
+% \DescribeMacro{\DrawRubikCubeFlat}
+% {\noindent}A useful `semi-flat' alternative format, which uses
+% the standard RU view of the cube and appends the three hidden
+% sides (see Rokicki \textit{etal.}, 2013), is generated by the
% command \cmd{\DrawRubikCubeFlat} as follows.
%
% \bigskip
@@ -1863,31 +2191,37 @@
% \begin{tikzpicture}[scale=0.5]
% \RubikCubeSolved
% \DrawRubikCubeFlat
-% \end{tikzpicture}
+% \node (B) at (5.5, 2.5) [white]{\small\textsf{B}};
+% \end{tikzpicture}%
% \end{minipage}
% \begin{minipage}{5cm}
%\begin{verbatim}
-% \begin{tikzpicture}[scale=0.5]
-% \RubikCubeSolved
+% \RubikCubeSolved
+% \ShowCube{5cm}{0.5}{%
% \DrawRubikCubeFlat
-% \end{tikzpicture}
+% \node (B) at (5.5, 2.5)
+% [white]{\small\textsf{B}};
+% }
%\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.
+% \bigskip
%
+% Note that even in this configuration it is straight-forward to
+% write text on the graphic, since the width (on the page) of
+% the green \textsc{right} face is exactly 1-unit, and the
+% bottom right-hand corner of the green face is raised exactly 1-unit
+% (see Figure~\ref{fig:cubesquaregraph}).
+% Consequently, since the origin of the grid is at the bottom left
+% corner of the front face, the coordinates of the center of the
+% red \textsc{back} face is (5.5, 2.5).
%
-% \section[NCube]{NCube (NxNxN)}
-% \label{sec:NCube}
+% \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}).
+% (i.e.,~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\}}.
@@ -1900,29 +2234,28 @@
%
% \bigskip
%
-% \begin{minipage}{0.4\textwidth}
+% \begin{minipage}{0.3\textwidth}
% \begin{tikzpicture}[scale=0.5]
% \DrawNCubeAll{5}{O}{Y}{G}
-% \end{tikzpicture}
+% \end{tikzpicture}%
% \end{minipage}
% \begin{minipage}{0.5\textwidth}
%\begin{verbatim}
-% \begin{tikzpicture}[scale=0.5]
-% \DrawNCubeAll{5}{O}{Y}{G}
-% \end{tikzpicture}
+% \ShowCube{3.5cm}{0.5}{\DrawNCubeAll{5}{O}{Y}{G}}
%\end{verbatim}
% \end{minipage}
%
% \medskip
%
-% \subsubsection{\cmd{\draw} error message}
+% \subsubsection[Draw.. error message]{\cmd{\draw} error message}
%
-% See also section~\ref{drawerrormessage} regarding the error message associated with
+% See also section~\ref{sec:drawerrormessage} regarding the error message associated with
% using a \cmd{\Draw...} command \textit{outside} a TikZ picture environment.
%
%
-% \section{Arrows}
-% \label{sec:arrows}
+%
+% \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
@@ -1938,57 +2271,52 @@
% \begin{figure}[hbt]
% \centering
% \ifpdf
-% \includegraphics[height=3cm]{Rubik_doc_figE.pdf}
+% \includegraphics[height=3cm]{Rubik-doc-figE.pdf}
% \else
-% \includegraphics[height=3cm]{Rubik_doc_figE.eps}
+% \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.
+% For example, in Figure~\ref{fig:facegraph} we have drawn a green
+% arrow from the centre of cubie LB $(0.5, 0.5)$ to the centre of
+% cubie MM\,\footnote{The code MM stands for x=Middle, y=Middle;
+% see also Figure~\ref{fig:facenotation} on Rubik face-notation} $(1.5, 1.5)$.
+% To do this 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);
+% \draw[->,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}
+% \ShowCube{2.5cm}{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);
+% }
% \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}
+% \ShowCube{2.5cm}{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{verbatim}
% \end{minipage}
%
@@ -1996,48 +2324,40 @@
% 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
+% is shown in the following example, where we have changed the \texttt{tikzpicture} scale
+% factor to~0.4 in order to generate a small figure 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]
-%
+% \ShowCube{1.8cm}{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}
-%
+% \noindent
+% \ShowCube{1.8cm}{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}
+% \DrawRubikLayerSideB {O}{G}{G}
% \draw[->,ultra thick,color=green] (0.5,5) -- (0.5, 4);
-% \end{tikzpicture}
-% \end{minipage}
+% }
%\end{verbatim}
% \end{minipage}
%
@@ -2068,29 +2388,27 @@
% \DrawRubikCubeRD
% \draw[ultra thick,->,color=blue]
% (1.5,0.5) -- (2.5, 1.5);
-% \end{tikzpicture}
+% \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}
+% \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}
+% \RubikFaceRight{G}{G}{G}
+% {X}{G}{G}
+% {X}{X}{X}
%
+% \RubikFaceDown {X}{G}{X}
+% {X}{Y}{X}
+% {X}{X}{X}
+% \ShowCube{3cm}{0.7}{%
% \DrawRubikCubeRD
% \draw[ultra thick,->,color=blue]
% (1.5,0.5) -- (2.5, 1.5);
-% \end{tikzpicture}
+% }
%\end{verbatim}
% \end{minipage}
%
@@ -2098,82 +2416,79 @@
%
% \section{Final example}
%
-% We now present, as a final example, the code used to draw the front page figure:
+% We now present, as a final example, the code used to draw the front page
+% figure\,\footnote{This is a sequence of order 6 used to generate the `cross'
+% configuration when solving the cube. Doing it on a `solved' cube allows you
+% to see how the three edge cubies move, and either flip (magenta arrows) or do
+% not flip (black arrow).}.
+% This code uses both the \rubikcube\ and \textsc{rubikrotation} packages,
+% and therefore needs to be run using the \LaTeX\ \verb!--shell-escape! command-line switch,
+% as described in the \textsc{rubikrotation} package.
+%
%
% \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}
+% \ShowCube{2cm}{0.4}{\DrawRubikCubeRU}
+% \ShowCube{2cm}{0.4}{%
+% \DrawFlatUpSide
+% \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);
+% }
+% \Rubik{F}\Rubik{R}\Rubik{U}\Rubik{Rp}\Rubik{Up}\Rubik{Fp}%
+% \ \ \ $\longrightarrow$
+% \ShowCube{2cm}{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}
+% }
% \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]
+% \RubikCubeSolved
+% \ShowCube{2cm}{0.4}{\DrawRubikCubeRU}
+% \ShowCube{2cm}{0.4}{%
+% \DrawFlatUpSide
+% \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);
+% }
+% \Rubik{F}\Rubik{R}\Rubik{U}\Rubik{Rp}\Rubik{Up}\Rubik{Fp}%
+% \ \ \ $\longrightarrow$
+% \RubikRotation{F,R,U,Rp,Up,Fp}
+% \ShowCubeF{2cm}{0.4}{\DrawFlatUpSide}
+% \hfil
+%\end{verbatim}
+%
+%
+%
+% \subsection[Without using {\textbackslash}RubikRotation]{Without using \cmd{\RubikRotation..}}
+%
+% If you really need to draw the above figure \textit{without} using
+% the \textsc{rubikrotation} package (as we had to in order to write
+% this particular document) then you would need to replace the
+% commands
+%\begin{verbatim}
+% \RubikRotation{F,R,U,Rp,Up,Fp}
+% \ShowCubeF{2cm}{0.4}{\DrawFlatUpSide}
+%\end{verbatim}
+% with the following set of \cmd{\DrawRubikLayer...} commands.
+%
+%\begin{verbatim}
+% \ShowCube{2cm}{0.4}{%
% \DrawRubikLayerFace{W}{W}{B}
% {W}{W}{O}
% {W}{R}{B}
@@ -2182,31 +2497,25 @@
% {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.
+% Please contact the authors regarding any ideas, errors or shortcomings 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.
+% not scale with document font size. However, they do
+% seem to work reasonably well with both 11pt and 12pt fonts.
+% Any suggestions are welcome.
+%
+% \item The sidebars cannot be arbitrarily positioned.
%
% \end{itemize}
%
@@ -2214,8 +2523,9 @@
% \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.
+% suggestions. We have built on some of their ideas and have acknowledged
+% these instances in the documentation.
+% We would also like to thank Christian Tellechea for the \cmd{\@join\{\}\{\}} command.
%
%
%
@@ -2224,10 +2534,12 @@
% 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
+% using various programming languages, e.g.,~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.
+%
+% In the event of new packages being made, we suggest that a CTAN directory structure
+% along the following lines might be appropriate.
%
% $$
% \textsc{rubik} \left\{
@@ -2241,9 +2553,78 @@
% \right.\\
% $$
%
+%
+%
+% \section{History}
+%
+% \begin{itemize}
+
+% \item Version 3.0 (September 2015)
+%
+% ---All rotation commands can now use the rotation-code as an argument; for example,
+% the rotation \rr{D} can now be typeset using the command \cmd{\rr\{D\}} etc
+% (see Section~\ref{sec:RubikCommands}).
+% The new rotation commands are:
+% \begin{quote}
+% \cmd{\rr\marg{rotation-code}}
+% \newline\cmd{\rrh\marg{rotation-code}}
+% \newline\cmd{\Rubik\marg{rotation-code}}
+% \newline\cmd{\textRubik\marg{rotation-code}}
+%\end{quote}
+% The original rotation command formats (e.g.,~\cmd{\rrD}) are still supported for backwards compatibility.
+%
+% --- \cmd{\ShowCube} and \cmd{\ShowCubeF} are new commands for displaying
+% a cube inside a minipage (see Sections~\ref{sec:showcube} and \ref{sec:showcubecode}).
+%
+% --- \cmd{\RubikCubeGrey} is a new command for setting up a `starter cube' for which the
+% only allocated colours are those for the centre cubies (see Section~\ref{sec:rubikcubegrey}).
+% The colour configuration matches that of the \cmd{\RubikCubeSolved}.
+%
+% \item Version 2.2 (January 2015)
+%
+% ---Fixed typos and minor errors in the documentation.
+%
+% ---Added the following commands to facilitate typesetting a face,
+% as described in Section~\ref{sec:flatcommands}.
+%\begin{quote}
+%\begin{verbatim}
+%\DrawFlatUp
+%\DrawFlatDown
+%\DrawFlatLeft
+%\DrawFlatRight
+%\DrawFlatFront
+%\DrawFlatBack
+%\DrawFlatUpSide
+%\DrawFlatDownSide
+%\DrawFlatLeftSide
+%\DrawFlatRightSide
+%\DrawFlatFrontSide
+%\DrawFlatBackSide
+%\end{verbatim}
+%\end{quote}
+%
+% ---Changed `Equator' $\rightarrow$ `Middle' in all \cmd{\DrawLayer..}
+% commands (for consistency). Hence `E' $\rightarrow$ `M' in all Flat
+% commands and Slice commands. Note although former use of `Equator' is
+% retained for backward compatibility (for the moment) it is now deprecated.
+%
+% ---Fixed a conflict with the \TeX\ \cmd{\sb} command as used by the \textbf{url}
+% package which resulted in reference chaos when the \textbf{url} package was used with
+% the \Rubikcube\ package (internalised \cmd{\sb} to \cmd{\@sb}). Also internalised for
+% convenience \cmd{\sd} to \cmd{\@sd}; \cmd{\sh} to \cmd{\@sh}; \cmd{\sc} to \cmd{\@sc};
+% \cmd{\sq} to \cmd{\@sq}.
+%
+%
+% \item Version 2.0 (February 5, 2014)
+%
+% ---First release.
+%
+% \end{itemize}
+%
+%
+%
% \section{References}
%
-%
% \begin{itemize}
%
%
@@ -2252,8 +2633,12 @@
% \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}
-%
+% \url{http://www.math.harvard.edu/~jjchen/docs/rubik.pdf}
+%
+%
+% \item Davis T (2006). Group theory via Rubik's cube.
+% \url{http://www.geometer.org/rubik/group.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/}
@@ -2272,42 +2657,51 @@
% 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 Feuers\"{a}nger (2015). Manual for package \textsc{pgfplots}
+% (\texttt{pgfplots.pdf}). v\,1.12.1 (2015/05/02), \S\,3.2.3, page~20.
+% \url{http://www.ctan.org/pkg/pgfplots}.
%
% \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 Golomb SW (1981). Rubik's cube and a model of quark confinement.
+% \textit{Am.\ J.\ Phys.}; vol~49, pp~1030--1031.
+%
+% \item Golomb SW (1982). Rubik's cube and quarks: twists on the eight corner cells
+% of Rubik's cube provide a model for many aspects of quark behaviour.
+% \textit{American Scientist};
+% \underline{70}, pp.~257--259. \url{http://www.jstor.org/stable/27851433}
%
-% \item Gymrek M (2009). The mathematics of toys and games.
-% \newline\url{http://wen.mit.edu/sp.268/www/rubik.pdf}
+% \item Gymrek M (2009). The mathematics of the Rubik's cube.
+% \newline\url{http://web.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/}
+% \url{http://math.berkeley.edu/~hutching/rubik.pdf}
%
%
-% \item Jelinek website (Jelinek J). Rubik's cube solution method. \url{http://rubikscube.info/}
+% \item Jelinek website (Jelinek J). Rubik's cube solution methods.
+% \url{http://www.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}
-%
+% Rubik's cube, Merlin's machine and other mathematical toys}; pp~322.
+% \url{http://www.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 Kociemba website (Kociemba H). \url{http://www.kociemba.org/cube.htm}
%
+% \item Kriz I 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 Randelshofer website (Randelshofer W). Pretty patterns.
+% \url{http://www.randelshofer.ch/rubik/patterns/}
%
-% \item Reid M. \ \ \url{http://www.math.ucf.edu/~reid/Rubik/}
+% \item Reid website (Reid M) \ \ \url{http://www.cflmath.com/Rubik/},
+% for patterns see \url{http://www.cflmath.com/Rubik/patterns.html}
%
%
% \item Rokicki T, Kociemba H, Davidson M and Dethridge J (2013). The diameter of the
@@ -2326,11 +2720,11 @@
% \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 Vandenbergh L. \ \ \textsc{cubezone} \url{http://www.cubezone.be}
%
-% \item WCA (2012). World Cube Association Regulations. See Section~12 for notation.
+% \item WCA (2015). World Cube Association Regulations. See Section~12 for notation.
% \url{http://www.worldcubeassociation.org/regulations.htm}
%
%
@@ -2343,22 +2737,26 @@
%
%
%
-% \section{The code}
+% \section{The code (\texttt{rubikcube.sty})}
%
% The conventions we adopt regarding capital letters and the
% XYZ argument ordering are detailed in Section~\ref{sec:conventions}.
%
+% Note that it is important in a graphics package to use a trailing \% on
+% the end of lines which break before the terminal curley bracket of a newcommand.
+% This is to prevent accumulating spurious spaces which may otherwise appear in
+% figures and diagrams as a strange or unexpected horizontal shift or whitespace.
%
-% \subsection{ Package heading}
+% \subsection{\hspace{3mm}Package heading}
%
% \begin{macrocode}
%<*rubikcube>
-\def\RCfileversion{2.0}%
-\def\RCfiledate{2014/01/20}%
+\def\RCfileversion{3.0}%
+\def\RCfiledate{2015/09/25}%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rubikcube}[\RCfiledate\space (v\RCfileversion)]
% \end{macrocode}
-% The package requires TikZ
+% The package requires TikZ---so we load it if not already loaded.
% \begin{macrocode}
\@ifpackageloaded{tikz}{}{%
\typeout{---rubikcube requires the TikZ package.}%
@@ -2368,12 +2766,14 @@
% \begin{macro}{\rubikcube}
% First we create a suitable logo
% \begin{macrocode}
-\newcommand{\rubikcube}{\textsf{rubikcube}}%
+\newcommand{\rubikcube}{\textsc{rubikcube}}%
+\newcommand{\Rubikcube}{\textsc{Rubikcube}}%
% \end{macrocode}
% \end{macro}
%
%
-% \subsection{ Some useful internal commands}
+% \subsection{\hspace{3mm}Some useful internal commands}
+% \label{sec:usefulinternalcommands}
%
% \begin{macro}{\@rr}
% \begin{macro}{\@rrp}
@@ -2394,10 +2794,10 @@
% 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).
+% used for rotations with no visible representation from the front
+% (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.
+% rotation-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
@@ -2437,10 +2837,27 @@
% \end{macro}
%
%
-% \subsection{ Colours}
+% \begin{macro}{\@join}
+% We also require a macro for joining two strings so we can convert
+% a rotation-code, say U, into a macro which typesets it in some form, say \cmd{\rrhU}.
+% The following \cmd{\@join\{\}\{\}} command is by Christian Tellechea.
+% {\newline}Usage: \cmd{\@join\marg{command-stem}\marg{rotation-code}}. For example,
+% to create the command \cmd{\rrhU} we would write |\@join{\rrh}{U}|, and hence
+% the command |\rrh{U}| is equivalent to \cmd{\rrhU} (see Section~\ref{sec:cmdsusingjoin}).
+% {\newline}Since this macro is also useful for processing rotation-codes in a list,
+% which may also include macros, it is important that |#2| is not detokenized.
+% \begin{macrocode}
+\newcommand*\@join[2]{%
+ \csname\expandafter\@gobble\string#1#2\endcsname}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{\hspace{3mm}Colours}
+% \label{sec:codecolours}
%
% These colour allocations were initially defined by Peter Bartal (2011).
-% Now modified so that grey is defined as {black!30}.
+% We have modified only the colour grey, which is now defined as {black!30}.
%
% \begin{macrocode}
\definecolor{R}{HTML}{C41E33}%
@@ -2452,13 +2869,52 @@
\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
+%
+% \subsection{\hspace{3mm}ShowCube command}
+% \label{sec:showcubecode}
+%
+% \begin{macro}{\ShowCube}
+% \begin{macro}{\ShowCubeF}
+% The macro \cmd{\ShowCube}\marg{minipage width}\marg{TikZ scale factor}\marg{Draw.. cmd}
+% displays the cube inside a minipage, so that we can easily tailor the minipage
+% width (|#1|) and also the TikZ scale factor (|#2|). The \cmd{\ShowCubeF} command
+% places an fbox around the minipage so users can see the extent of any white space.
+% {\newline}\textsc{usage}: |\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}|
+% \begin{macrocode}
+\newcommand{\ShowCube}[3]{%
+ \begin{minipage}{#1}%
+ \centering%
+ \begin{tikzpicture}[scale=#2]%
+ #3%
+ \end{tikzpicture}%
+ \end{minipage}%
+}
+\newcommand{\ShowCubeF}[3]{%
+ \fbox{%
+ \begin{minipage}{#1}%
+ \centering%
+ \begin{tikzpicture}[scale=#2]%
+ #3%
+ \end{tikzpicture}%
+ \end{minipage}%
+}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsection{\hspace{3mm}Face commands}
+%
+% Cube face notation = U, D, L, R, F, B (Singmaster)
+% {\newline}Cubie-square notation = t, m, b, l, m, r = top, middle,
+% bottom, left, middle, right.
+% We use t,b for cubie-squares (facelets) to avoid confusion with cube Face notation.
+% We number the cubie-squares on a face 1--9 reading from left-to-right,
+% starting top-left, ending bottom-right, as follows
+% (see also Figure~\ref{fig:facenotation}):
+% {\newline}\strut\hspace{1cm}top 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
%
@@ -2468,24 +2924,26 @@
% \begin{macro}{\RubikFaceRight}
% \begin{macro}{\RubikFaceFront}
% \begin{macro}{\RubikFaceBack}
-% These 5 commands allocate a colour to each of the 9 cubiesquares in the
+% These 5 commands allocate a colour to each of the 9 cubie-squares 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}\textsc{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.
+% to a specific cubie-square (facelet), 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\}}
+%
+% 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$
+% for the ``right-top'' facelet on this face. Note that the order
+% of the two lowercase letters (in this case \texttt{rt}) are always written
+% in the $x,y$ order; i.e.,~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)
+% relates to the $y$ direction (either top, middle, or bottom)---this rule makes it
+% easy to remember the order.
% \end{macro}
% \end{macro}
% \end{macro}
@@ -2585,7 +3043,29 @@
% \end{macrocode}
%
%
-% \subsection{ RubikCubeSolved command}
+
+%
+% \subsection{\hspace{3mm}RubikCubeGrey command}
+% \label{sec:codegrey}
+%
+% \begin{macro}{\RubikCubeGrey}
+% This command sets the face/colour configuration (state) of a 3x3x3
+% Rubik cube with no colours allocated except for the central cubie of each face.
+% These central colours match those defined for the RubikCubeSolved command.
+% \begin{macrocode}
+\newcommand{\RubikCubeGrey}{%
+\RubikFaceUp {X}{X}{X}{X}{W}{X}{X}{X}{X}%
+\RubikFaceDown {X}{X}{X}{X}{Y}{X}{X}{X}{X}%
+\RubikFaceLeft {X}{X}{X}{X}{B}{X}{X}{X}{X}%
+\RubikFaceRight{X}{X}{X}{X}{G}{X}{X}{X}{X}%
+\RubikFaceFront{X}{X}{X}{X}{O}{X}{X}{X}{X}%
+\RubikFaceBack {X}{X}{X}{X}{R}{X}{X}{X}{X}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{\hspace{3mm}RubikCubeSolved command}
%
% \begin{macro}{\RubikCubeSolved}
% This command sets the face/colour configuration (state) of a typical
@@ -2603,18 +3083,23 @@
% \end{macro}
%
%
-% \subsection{ Slice macros}
+%
+% \subsection{\hspace{3mm}Slice commands}
%
% \begin{macro}{\RubikSliceTopR}
% \begin{macro}{\RubikSliceTopL}
-% \begin{macro}{\RubikSliceEquatorR}
-% \begin{macro}{\RubikSliceEquatorL}
+% \begin{macro}{\RubikSliceMiddleR}
+% \begin{macro}{\RubikSliceMiddleL}
% \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.
+% These 6~commands allocate the colour arguments for the 6~visible ordered
+% facelets along a horizontal slice. There are three horizontal
+% slices to consider (Top, Middle, Bottom) and each has two viewpoints.
+% The colour-code arguments are ordered 1--6 from left to right.
+% The terminal L and R denote the Left (L) viewpoint and Right (R)
+% viewpoint versions.
+% Note that the two legacy `Equator' versions (now replaced by `Middle')
+% are retained (below) to allow backward compatibility.
% \begin{macrocode}
\newcommand{\RubikSliceTopR}[6]{%
\def\Flt{#1}\def\Fmt{#2}\def\Frt{#3}%
@@ -2624,6 +3109,14 @@
\def\Llt{#1}\def\Lmt{#2}\def\Lrt{#3}%
\def\Flt{#4}\def\Fmt{#5}\def\Frt{#6}%
}
+\newcommand{\RubikSliceMiddleR}[6]{%
+\def\Flm{#1}\def\Fmm{#2}\def\Frm{#3}%
+\def\Rlm{#4}\def\Rmm{#5}\def\Rrm{#6}%
+}
+\newcommand{\RubikSliceMiddleL}[6]{%
+\def\Llm{#1}\def\Lmm{#2}\def\Lrm{#3}%
+\def\Flm{#4}\def\Fmm{#5}\def\Frm{#6}%
+}
\newcommand{\RubikSliceEquatorR}[6]{%
\def\Flm{#1}\def\Fmm{#2}\def\Frm{#3}%
\def\Rlm{#4}\def\Rmm{#5}\def\Rrm{#6}%
@@ -2631,7 +3124,7 @@
\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}%
@@ -2649,29 +3142,30 @@
% \end{macro}
%
%
-% \subsection{ Cube drawing macros}
+% \subsection{\hspace{3mm}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.
+% The order of the XY code is important: X~first, Y~second (so it is easy to remember).
%
-% On each face the cubies are drawn in the following order: Top row
+% On each face the facelets 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.
+% The TikZ draw cycle for each facelet square on a Rubik cube face cycles
+% through the four corners of the facelet 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); the grid origin is at the bottom-left corner of the
+% \textsc{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.
+% all the facelets on the \textsc{front} face of a Rubik cube. It is used by all
+% of the cube drawing macros which display the \textsc{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}{%
@@ -2700,20 +3194,29 @@
% \end{macrocode}
% \end{macro}
%
-% \subsubsection{ Viewing direction}
+% \subsubsection{\hspace{3mm}Viewing direction}
%
-% The command `DrawRubikCubeXY' command uses a trailing XY code
+% The command `DrawRubikCubeXY' command uses the 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
+% The order of the XY code is important: X~first, Y~second (so it is 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.
+% command \cmd{\DrawRubikCubeFrontFace} to draw the \textsc{front} face,
+% and then draws the \textsc{up} face followed by the \textsc{right} face.
+% The colours are allocated to particular facelets using the \cmd{\RubikFaceUp},
+% \cmd{\RubikFaceRight} and \cmd{\RubikFaceFront} commands.
+%
+% The (x,y) grid origin is at the bottom-left corner of the \textsc{front} face.
+% The perspective is designed so that the 2D~graphic image of the side face
+% (\textsc{right} in this particular case) has its `horizontal' lines running
+% at 45~degrees. This has the useful advantage that the 2D~width of the side is
+% exactly 1-unit, and so makes it easy to determine the 2D~(x,y) coordinates
+% of any position, and hence facilitates typesetting text onto the image of
+% the cube using TikZ commands.
+
% \end{macro}
% \begin{macrocode}
\newcommand{\DrawRubikCubeRU}{%
@@ -2767,8 +3270,8 @@
%
% \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).
+% and hence is the default form (i.e.,~if the trailing XY
+% viewpoint code is accidentally omitted).
% \end{macro}
% \begin{macrocode}
\newcommand{\DrawRubikCube}{\DrawRubikCubeRU}
@@ -2940,21 +3443,21 @@
% \end{macrocode}
%
%
-% \subsection{ LayerFace commands}
+% \subsection{\hspace{3mm}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,
+% These two LayerFace commands each draw and paint a single
+% face of 9~facelets. 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
+% is the placeholder for the colour of the TopLeft facelet etc.)
+% The second takes only one colour parameter (since \texttt{All} the
% colours are the same).
-% The drawing origin (0,0) = bottom left corner. Cubies are drawn
+% The drawing origin (0,0) = bottom left corner. The facelets 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.
+% which is used for drawing the front face of a Rubik cube.
% \end{macro}
% \end{macro}
% \begin{macrocode}
@@ -3009,29 +3512,51 @@
% \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).
+% \subsection{\hspace{3mm}DrawFlatX commands}
+% \label{sec:drawflatxcommands}
+%
+% [\textsc{note}: These new commands (version 3.0) were modified from the
+% earlier \cmd{\FlatUp}, \cmd{\FlatDown} etc., commands; i.e.,~they were
+% reformulated as a set of \cmd{\Draw...} commands to make them consistent
+% with all the other \cmd{\Draw..} commands].
+%
+% \begin{macro}{\DrawFlatUp}
+% \begin{macro}{\DrawFlatDown}
+% \begin{macro}{\DrawFlatLeft}
+% \begin{macro}{\DrawFlatRight}
+% \begin{macro}{\DrawFlatFront}
+% \begin{macro}{\DrawFlatBack}
+% Each of these commands draws a separate (flat) face (9~facelets).
+% Each command (except \cmd{\DrawFlatFront}) takes two arguments,
+% namely the X-coordinate and Y-coordinate of the bottom-left
+% corner of the face. This (X,Y) pair of coordinates therefore allows
+% the user to position the face. These commands were motivated by a need to
+% be able to show hidden faces under certain circumstances.
+%
+% Note that the Y-argument currently only works fully
+% with the \cmd{\DrawFlatUp}, \cmd{\DrawFlatDown} and \cmd{\DrawFlatBack}
+% commands, since all the other faces currently only require Y=0
+% (this will be made more flexible in a later version).
+%
+% Note also that the \cmd{\DrawFlatFront} command takes no arguments,
+% since by definition the bottom left corner of this face is at (0,0),
+% and there seems to be no reason (just now) for this face to have the
+% facility to be positioned otherwise.
%
% \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\}}
+% \cmd{\DrawFlatUp\{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.
+% These new commands are also used by the commands \cmd{\DrawRubikFlat} and
+% \cmd{\DrawRubikCubeFlat} to draw various `flat' representations
+% of a Rubik cube.
+%
+% The (x,y) variables are here encoded as (\cmd{\ux}, \cmd{\uy}) where the
+% `u' stands for Up etc. However, since we are unable to use `dx, dy' with the
+% \cmd{\DrawFlatDown} command (since dx and dy are already used in the
+% \cmd{\cube@dxdydz...} command) we encode these instead as (\cmd{\ddx}, \cmd{\ddy}).
+%
% \end{macro}
% \end{macro}
% \end{macro}
@@ -3039,7 +3564,7 @@
% \end{macro}
% \end{macro}
% \begin{macrocode}
-\newcommand{\FlatUp}[2]{%
+\newcommand{\DrawFlatUp}[2]{%
\pgfmathsetmacro{\ux}{#1}%
\pgfmathsetmacro{\uy}{#2}%
%%---top row
@@ -3074,7 +3599,7 @@
-- (\ux + 3,\uy + 0) -- cycle;
}
%%-------------------------
-\newcommand{\FlatDown}[2]{%
+\newcommand{\DrawFlatDown}[2]{%
\pgfmathsetmacro{\ddx}{#1}%
\pgfmathsetmacro{\ddy}{#2}%
%%---top row
@@ -3108,8 +3633,64 @@
(\ddx + 2,\ddy + 0) -- (\ddx + 2,\ddy + 1) -- (\ddx + 3,\ddy + 1)%
-- (\ddx + 3,\ddy + 0) -- cycle;
}
+%%-------------------------
+\newcommand{\DrawFlatLeft}[2]{%
+\pgfmathsetmacro{\lx}{#1}%
+\pgfmathsetmacro{\ly}{#2}%
+%% NOTE: y variable coord not yet implemented
+%%---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{\DrawFlatRight}[2]{%
+\pgfmathsetmacro{\rx}{#1}% %3
+\pgfmathsetmacro{\ry}{#2}% %0
+%% NOTE: y variable coord not yet implemented
+%%---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;
+}
%%-----------------------
-\newcommand{\FlatFront}{%
+\newcommand{\DrawFlatFront}{%
+%% This command is used /only/ by the \cmd{\DrawRubikFlat} command.
+%% NOTE: x, y variables not implemented as not required here
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Flt]%
(0,2) -- (0, 3) -- (1,3) -- (1,2) -- cycle;
@@ -3139,7 +3720,7 @@
(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle;
}
%%-------------------------
-\newcommand{\FlatBack}[2]{%
+\newcommand{\DrawFlatBack}[2]{%
\pgfmathsetmacro{\bx}{#1}%
\pgfmathsetmacro{\by}{#2}%
%%---top row
@@ -3173,101 +3754,155 @@
(\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)
+% Draws a standard flat representation of the Rubik
+% cube (colours only). Note that \cmd{\DrawFlatFront} does not
+% take any arguments (x,y) arguments.
% \begin{macrocode}
\newcommand{\DrawRubikFlat}{%
- \FlatUp{0}{3}%
- \FlatDown{0}{-3}%
- \FlatLeft{-3}{0}%
- \FlatFront%
- \FlatRight{3}{0}%
- \FlatBack{6}{0}%
+ \DrawFlatUp{0}{3}%
+ \DrawFlatDown{0}{-3}%
+ \DrawFlatLeft{-3}{0}%
+ \DrawFlatFront%
+ \DrawFlatRight{3}{0}%
+ \DrawFlatBack{6}{0}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\DrawRubikCubeFlat}
-% Draws a Rubik's cube together with the three hidden faces
-% (colours only)
+% Draws a Rubik cube together with the three hidden faces
+% (colours only) in a semi-flat representation. The (x,y)
+% arguments are for the bottom-left corner of the face.
% \begin{macrocode}
\newcommand{\DrawRubikCubeFlat}{%
\DrawRubikCube%
- \FlatDown{0}{-3}%
- \FlatLeft{-3}{0}%
- \FlatBack{4}{1}%
+ \DrawFlatDown{0}{-3}%
+ \DrawFlatLeft{-3}{0}%
+ \DrawFlatBack{4}{1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsubsection{DrawFlatXSide commands}
+%
+% These six commands draw a face together with all four sidebars
+% (colours only). We use the \cmd{\DrawFlatX} commands to draw the face.
+% We use the \cmd{\DrawRubikLayerSideX} commands to draw the sidebars.
+% The parameter orders for the \cmd{\DrawRubikLayerSideX}
+% commands are as follows:
+% Top (T) and Bottom (B) = left to right;
+% Left (L) and Right (R) = top to bottom;
+% (see the \cmd{\DrawRubikLayerSideX} command for details of the arguments).
+%
+%
+% \begin{macro}{\DrawFlatUpSide}
+% Draws the \textsc{up} face together with all four sidebars
+% (colours only).
+% \begin{macrocode}
+\newcommand{\DrawFlatUpSide}{%
+\DrawFlatUp{0}{0}%
+\DrawRubikLayerSideT{\Brt}{\Bmt}{\Blt}%
+\DrawRubikLayerSideL{\Llt}{\Lmt}{\Lrt}%
+\DrawRubikLayerSideR{\Rrt}{\Rmt}{\Rlt}%
+\DrawRubikLayerSideB{\Flt}{\Fmt}{\Frt}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\DrawFlatFrontSide}
+% Draws the \textsc{front} face together with all four sidebars
+% (colours only).
+% \begin{macrocode}
+\newcommand{\DrawFlatFrontSide}{%
+\DrawFlatFront{0}{0}%
+\DrawRubikLayerSideT{\Ulb}{\Umb}{\Urb}%
+\DrawRubikLayerSideL{\Lrt}{\Lrm}{\Lrb}%
+\DrawRubikLayerSideR{\Rlt}{\Rlm}{\Rlb}%
+\DrawRubikLayerSideB{\Dlt}{\Dmt}{\Drt}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\DrawFlatRightSide}
+% Draws the \textsc{right} face together with all four sidebars
+% (colours only).
+% \begin{macrocode}
+\newcommand{\DrawFlatRightSide}{%
+\DrawFlatRight{0}{0}%
+\DrawRubikLayerSideT{\Urb}{\Urm}{\Urt}%
+\DrawRubikLayerSideL{\Frt}{\Frm}{\Frb}%
+\DrawRubikLayerSideR{\Blt}{\Blm}{\Blb}%
+\DrawRubikLayerSideB{\Drt}{\Drm}{\Drb}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\DrawFlatLeftSide}
+% Draws the \textsc{left} face together with all four sidebars
+% (colours only).
+% \begin{macrocode}
+\newcommand{\DrawFlatLeftSide}{%
+\DrawFlatLeft{0}{0}%
+\DrawRubikLayerSideT{\Ult}{\Ulm}{\Ulb}%
+\DrawRubikLayerSideL{\Brt}{\Brm}{\Brb}%
+\DrawRubikLayerSideR{\Flt}{\Flm}{\Flb}%
+\DrawRubikLayerSideB{\Dlb}{\Dlm}{\Dlt}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\DrawFlatBackSide}
+% Draws the \textsc{back} face together with all four sidebars
+% (colours only).
+% \begin{macrocode}
+\newcommand{\DrawFlatBackSide}{%
+\DrawFlatBack{0}{0}%
+\DrawRubikLayerSideT{\Urt}{\Umt}{\Ult}%
+\DrawRubikLayerSideL{\Rrt}{\Rrm}{\Rrb}%
+\DrawRubikLayerSideR{\Llt}{\Llm}{\Llb}%
+\DrawRubikLayerSideB{\Drb}{\Dmb}{\Dlb}%
}
% \end{macrocode}
% \end{macro}
%
%
-% \subsection{ SideBar commands}
+% \begin{macro}{\DrawFlatDownSide}
+% Draws the \textsc{down} face together with all four sidebars
+% (colours only).
+% \begin{macrocode}
+\newcommand{\DrawFlatDownSide}{%
+\DrawFlatDown{0}{0}%
+\DrawRubikLayerSideT{\Flb}{\Fmb}{\Frb}%
+\DrawRubikLayerSideL{\Lrb}{\Lmb}{\Llb}%
+\DrawRubikLayerSideR{\Rlb}{\Rmb}{\Rrb}%
+\DrawRubikLayerSideB{\Brb}{\Bmb}{\Blb}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{\hspace{3mm}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).
+% side colours of each of the facelets forming the side of
+% a given layer (face). Each SideBar is the length of a single facelet.
%
% \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).
+% where 1~is equivalent to the length of the side of a facelet).
% \end{macro}
% \end{macro}
% \end{macro}
@@ -3284,7 +3919,7 @@
% \end{macrocode}
%
%
-% \subsubsection{ Allocating a colour to a single cubie sidebar}
+% \subsubsection{\hspace{3mm}Allocating a colour to a single facelet sidebar}
%
% \begin{macro}{\side@barT}
% \begin{macro}{\side@barB}
@@ -3292,20 +3927,20 @@
% \begin{macro}{\side@barR}
% Internal commands.
% Full length face SideBars are really multiple instances of
-% single cubie bars,
+% single facelet 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
+% Each SideBar command takes two arguments: one for facelet 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:
+% facelet sidebar on the Left of a Rubik face:
% \begin{quote}
-% \cmd{\side@barL}\marg{cubie-position}\marg{colour-code}
+% \cmd{\side@barL}\marg{facelet-position}\marg{colour-code}
% \end{quote}
-% There are three cubie positions on each of the four sides
+% There are three facelet 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)
@@ -3313,7 +3948,7 @@
% 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
+% The start point of the TikZ \cmd{\draw} command for each bar rectangle
% is botton Left corner of the bar =(\cmd{\dx},\cmd{\dy})
% \end{macro}
% \end{macro}
@@ -3356,15 +3991,15 @@
% \end{macrocode}
%
%
-% \subsubsection{ Drawing a single cubie sidebar}
+% \subsubsection{\hspace{3mm}Drawing a single facelet 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:
+% This command draws a single facelet sidebar using the above \cmd{\sidebar} command.
+% The X$_1$X$_2$X$_3$ parameters refer to the options Left, Middle,
+% Right, Top, Middle, 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$_2$ is an $y$ parameter: either $\langle T\mid M \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
@@ -3382,13 +4017,13 @@
% \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{\DrawRubikLayerSideLMx}[1]{\side@barL{2}{#1}}
+\newcommand{\DrawRubikLayerSideLM}[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{\DrawRubikLayerSideRMx}[1]{\side@barR{2}{#1}}
+\newcommand{\DrawRubikLayerSideRM}[1]{\side@barR{2}{#1}}
\newcommand{\DrawRubikLayerSideRBx}[1]{\side@barR{1}{#1}}
%---Top side
\newcommand{\DrawRubikLayerSideLTy}[1]{\side@barT{1}{#1}}
@@ -3403,7 +4038,7 @@
% \end{macrocode}
%
%
-% \subsubsection{ Drawing multiple cubie sidebars}
+% \subsubsection{\hspace{3mm}Drawing multiple cubie sidebars}
%
% \begin{macro}{\DrawRubikLayerSideT}
% \begin{macro}{\DrawRubikLayerSideB}
@@ -3436,14 +4071,14 @@
%% colours run vertically DOWN
\newcommand{\DrawRubikLayerSideL}[3]{%
\DrawRubikLayerSideLTx{#1}%
- \DrawRubikLayerSideLEx{#2}%
+ \DrawRubikLayerSideLMx{#2}%
\DrawRubikLayerSideLBx{#3}%
}
%%--Right side--------
%% colours run vertically DOWN
\newcommand{\DrawRubikLayerSideR}[3]{%
\DrawRubikLayerSideRTx{#1}%
- \DrawRubikLayerSideREx{#2}%
+ \DrawRubikLayerSideRMx{#2}%
\DrawRubikLayerSideRBx{#3}%
}
% \end{macrocode}
@@ -3463,8 +4098,8 @@
\newcommand{\DrawRubikLayerSideLR}[6]{%
\DrawRubikLayerSideLTx{#1}%
\DrawRubikLayerSideRTx{#2}%
- \DrawRubikLayerSideLEx{#3}%
- \DrawRubikLayerSideREx{#4}%
+ \DrawRubikLayerSideLMx{#3}%
+ \DrawRubikLayerSideRMx{#4}%
\DrawRubikLayerSideLBx{#5}%
\DrawRubikLayerSideRBx{#6}%
}
@@ -3472,21 +4107,28 @@
% \end{macro}
%
%
-% \subsection{ NCube command}
+%
+% \subsection{\hspace{3mm}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}(1) adjusted to use the
+% TikZ \cmd{\pgfmathsetmacro\{\}\{\}} command (suggested by Peter Grill),
% \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{quote}
+% \#1 = number of cubies ($n>0$) along each side,
+% {\newline}\#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.
+% \end{quote}
+% We use the \cmd{\pgfmathsetmacro}\marg{variable-name}\marg{numeric value or maths}
+% command. Note that the second argument must not involve any units---just numeric
+% values or mathematics.
%
% \begin{macrocode}
\newcommand{\DrawNCubeAll}[4]{%
@@ -3505,21 +4147,23 @@
% 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).
+% intuitive X, Y, Z ordering of parameters).
%
% The cube need not be in the origin, the distances of
-% the Down-behind [L] corner from
-% the origin are taken as parameters.
+% the \textsc{down}-behind [L] corner from
+% the origin are taken as parameters 5,6,7.
% 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
+% \begin{quote}
+% 1 - length of an edge
+% {\newline}2 - X-face colour (\textsc{right} face)
+% {\newline}3 - Y-face colour (\textsc{up} face)
+% {\newline}4 - Z-face colour (\textsc{front} face)
+% {\newline}5 - x-position in space
+% {\newline}6 - y-position in space
+% {\newline}7 - z-position in space
+% \end{quote}
%
-% \textsc{usage}: |\cube@dxdydz{1}{cX}{cY}{cZ}{x}{y}{z}|
+% \textsc{usage}: |\cube@dxdydz{1}{X}{Y}{Z}{x}{y}{z}|
%
% {\noindent}The original code
% |\pgfmathparse{#1+#5}\let\dy\pgfmathresult|
@@ -3528,10 +4172,11 @@
%
% \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
+% options to each of the TikZ \cmd{\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}%
@@ -3559,7 +4204,8 @@
% \end{macro}
%
%
-% \subsection{ Drawing single cubies}
+%
+% \subsection{\hspace{3mm}Drawing single cubies}
%
% \begin{macro}{\Cubiedx}
% \begin{macro}{\Cubiedy}
@@ -3568,9 +4214,10 @@
% (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.
+% Note that we cannot use the names \texttt{dx}, \texttt{dy} for variables since
+% these have been allocated already (see above). However, we do use
+% \texttt{dx}, \texttt{dy} in the command names as these will be more
+% readily understood by the user.
% \begin{macrocode}
\newcommand{\Cubiedx}[1]{\pgfmathsetmacro{\cx}{#1}}
\newcommand{\Cubiedy}[1]{\pgfmathsetmacro{\cy}{#1}}
@@ -3593,7 +4240,7 @@
% 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{format}: \cmd{\DrawCubieRU}\marg{Xcolour}\marg{Ycolour}\marg{Zcolour}
% \newline\textsc{usage}: |\DrawCubieRU{G}{B}{W}|
% \end{macro}
% \end{macro}
@@ -3647,7 +4294,7 @@
% \end{macrocode}
%
%
-% \subsection{ Text cubies}
+% \subsection{\hspace{3mm}Text cubies}
%
% \begin{macro}{\textCubieRU}
% \begin{macro}{\textCubieRD}
@@ -3655,14 +4302,14 @@
% \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.
+% They are `text' forms of the \cmd{\DrawCubie} commands described above.
+% Their size was chosen 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{format}: \cmd{\textCubieRU}\marg{Xcolour}\marg{Ycolour}\marg{Zcolour}
% \newline\textsc{usage}: |\textCubieRU{G}{B}{W}|
% \end{macro}
% \end{macro}
@@ -3675,7 +4322,7 @@
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieRU{#1}{#2}{#3}
-\end{tikzpicture}
+\end{tikzpicture}%
\end{minipage}
}
\newcommand{\textCubieRD}[3]{%
@@ -3684,7 +4331,7 @@
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieRD{#1}{#2}{#3}
-\end{tikzpicture}
+\end{tikzpicture}%
\end{minipage}
}
\newcommand{\textCubieLD}[3]{%
@@ -3693,7 +4340,7 @@
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieLD{#1}{#2}{#3}
-\end{tikzpicture}
+\end{tikzpicture}%
\end{minipage}
}
\newcommand{\textCubieLU}[3]{%
@@ -3702,41 +4349,49 @@
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieLU{#1}{#2}{#3}
-\end{tikzpicture}
+\end{tikzpicture}%
\end{minipage}
}
% \end{macrocode}
%
%
-% \subsection{ Rotation commands --- face and slice}
+% \subsection{\hspace{3mm}Rotation commands}
+% \label{sec:rotationcommands}
+%
%
-% \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).
+% \subsubsection{\hspace{3mm}Introduction}
%
+% We use a special prefix notation to denote each of four different repreresentations
+% of the various Rubik cube rotations as follows: the name of the rotation (rr), its
+% associated hieroglyph (rrh), and combinations of name and hieroglyph both vertical (Rubik)
+% and horizontal (textRubik). A rotation command is a combination of a rotation-code appended
+% to one of the four prefixes.
+%
+% For example, the command \cmd{\rrhD} generates the hieroglyph (rrh) associated with
+% the rotation-code D. In this form it is used internally, but it is also available for the user.
+% However, it is also made available to the user in the more intuitive form
+% |\rrh{D}| by the use of the internal macro |\@join| (see Sections~\ref{sec:cmdsusingjoin}
+% and \ref{sec:usefulinternalcommands}).
+%
% 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)).
+% (for the TikZ ARC command see TikZ pgfmanual (2012) page~146 (\S 14.8)).
%
-% The presence of small overfilled hboxes associated with these squares
-% were originally checked using the ltugboat.cls, and all fixed mainly
+% The presence of small overfilled \cmd{\hbox}es associated with these squares
+% were originally checked using the \texttt{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.
-%
+% and using TikZ scale=0.5.
+%
%
% \begin{macro}{\DrawNotationBox}
-% This command draws the surrounding square box of all the hieroglyphs.
+% This internal 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.
%
+% TODO: ? make this a proper internal command
+% using \verb!@! sometime.
+%
% \begin{macrocode}
\newcommand{\DrawNotationBox}{%
\draw [thick] (0,0) -- (0,1) -- (1,1) -- (1,0) -- (0,0) -- (0,1)%
@@ -3745,33 +4400,74 @@
% \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
+% (e.g.,~\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.
+% and these arcs require both a center and a start point.
+% Note that the final argument does not use any units.
+%
+% TODO: make a small diagram to illustrate the position of these
+% parameters and make things a bit clearer sometime.
%
%\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
+\pgfmathsetmacro{\@sd}{0.25} % a small horiz space
+\pgfmathsetmacro{\@sdd}{2*\@sd} % 2x horiz space
+\pgfmathsetmacro{\@sddd}{3*\@sd} % 3x horiz space
+\pgfmathsetmacro{\@sh}{0.6} % height
+\pgfmathsetmacro{\@sb}{0.2} % base
+\pgfmathsetmacro{\@sbh}{\@sb + \@sh} % UP
+\pgfmathsetmacro{\@scx}{\@sdd+0.2} % Start of CircleX arc
+\pgfmathsetmacro{\@scy}{\@sd*2/3} % Start of CircleY arc
+\pgfmathsetmacro{\@sqcx}{\@scx-0.13} %% SQuare CenterX coord
+\pgfmathsetmacro{\@sqcy}{\@scy+0.25} %% SQuare CenterY cpprd
% \end{macrocode}
%
+% All the \verb!@! internal commands used in the following commands
+% and macros are described in Section~\ref{sec:usefulinternalcommands}.
+%
+%
+%
+% \subsubsection{\hspace{3mm}Using {\textbackslash}\texttt{join}}
+% \label{sec:cmdsusingjoin}
%
-% \subsubsection{ Rotation B}
+% \begin{macro}{\textRubik}
+% \begin{macro}{\Rubik}
+% \begin{macro}{\rr}
+% \begin{macro}{\rrh}
+% The following four commands typeset a single rotation, where the rotation-code (eg~U) is
+% the argument (see Section~\ref{sec:overview}). As an example, the format for
+% the \cmd{\rrh\{\}} command is
+% \cmd{\rrh}\marg{rotation-code}. In practice, these four commands are really a
+% sort of front-end for all the commands which follow this section. For example, the
+% command \cmd{\rrh\{U\}} generates the command \cmd{\rrhU} which itself typesets the
+% rotation hieroglyph for the rotation~U, etc.
+%
+% These four commands, which use the
+% internal \cmd{\@join} command (see Section~\ref{sec:usefulinternalcommands}), are
+% especially useful when typesetting a list of rotation-codes.
+% Furthermore, it seems more intuitive to specify a rotation command
+% using the rotation-code as an argument.
+% \begin{macrocode}
+\newcommand*{\Rubik}[1]{\@join{\Rubik}{#1}}
+\newcommand*{\textRubik}[1]{\@join{\textRubik}{#1}}
+\newcommand*{\rr}[1]{\@join{\rr}{#1}}
+\newcommand*{\rrh}[1]{\@join{\rrh}{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsubsection{\hspace{3mm}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.
+% These commands all draw forms which denote the B (\textsc{back}-face) rotation.
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrB}{\@rr{B}}
@@ -3787,7 +4483,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Bp}
+% \subsubsection{\hspace{3mm}Rotation Bp}
%
% \begin{macro}{\rrBp}
% \begin{macro}{\SquareBp}
@@ -3810,7 +4506,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Bw}
+% \subsubsection{\hspace{3mm}Rotation Bw}
%
% \begin{macro}{\rrBw}
% \begin{macro}{\SquareBw}
@@ -3834,7 +4530,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Bwp}
+% \subsubsection{\hspace{3mm}Rotation Bwp}
%
% \begin{macro}{\rrBwp}
% \begin{macro}{\SquareBwp}
@@ -3858,7 +4554,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Bs}
+% \subsubsection{\hspace{3mm}Rotation Bs}
%
% \begin{macro}{\rrBs}
% \begin{macro}{\SquareBs}
@@ -3882,7 +4578,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Bsp}
+% \subsubsection{\hspace{3mm}Rotation Bsp}
%
% \begin{macro}{\rrBsp}
% \begin{macro}{\SquareBsp}
@@ -3906,7 +4602,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Ba}
+% \subsubsection{\hspace{3mm}Rotation Ba}
%
% \begin{macro}{\rrBa}
% \begin{macro}{\SquareBa}
@@ -3930,7 +4626,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Bap}
+% \subsubsection{\hspace{3mm}Rotation Bap}
%
% \begin{macro}{\rrBap}
% \begin{macro}{\SquareBap}
@@ -3954,7 +4650,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation D}
+% \subsubsection{\hspace{3mm}Rotation D}
%
% \begin{macro}{\rrD}
% \begin{macro}{\SquareD}
@@ -3968,10 +4664,10 @@
\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}%%
+\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}\,}
%%
@@ -3991,7 +4687,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Dp}
+% \subsubsection{\hspace{3mm}Rotation Dp}
%
% \begin{macro}{\rrDp}
% \begin{macro}{\SquareDp}
@@ -4005,9 +4701,9 @@
\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);
+\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}\,}
@@ -4028,7 +4724,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Dw}
+% \subsubsection{\hspace{3mm}Rotation Dw}
%
% \begin{macro}{\rrDw}
% \begin{macro}{\SquareDw}
@@ -4042,9 +4738,9 @@
\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);
+\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}\,}
@@ -4065,7 +4761,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Dwp}
+% \subsubsection{\hspace{3mm}Rotation Dwp}
%
% \begin{macro}{\rrDwp}
% \begin{macro}{\SquareDwp}
@@ -4079,9 +4775,9 @@
\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);
+\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}\,}
@@ -4102,7 +4798,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Ds}
+% \subsubsection{\hspace{3mm}Rotation Ds}
%
% \begin{macro}{\rrDs}
% \begin{macro}{\SquareDs}
@@ -4116,9 +4812,9 @@
\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);
+\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}\,}
@@ -4139,7 +4835,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Dsp}
+% \subsubsection{\hspace{3mm}Rotation Dsp}
%
% \begin{macro}{\rrDsp}
% \begin{macro}{\SquareDsp}
@@ -4153,9 +4849,9 @@
\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);
+\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}\,}
@@ -4176,7 +4872,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Da}
+% \subsubsection{\hspace{3mm}Rotation Da}
%
% \begin{macro}{\rrDa}
% \begin{macro}{\SquareDa}
@@ -4190,9 +4886,9 @@
\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);
+\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}\,}
@@ -4213,7 +4909,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Dap}
+% \subsubsection{\hspace{3mm}Rotation Dap}
%
% \begin{macro}{\rrDap}
% \begin{macro}{\SquareDap}
@@ -4227,9 +4923,9 @@
\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);
+\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}\,}
@@ -4250,7 +4946,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation E}
+% \subsubsection{\hspace{3mm}Rotation E}
%
% \begin{macro}{\rrE}
% \begin{macro}{\SquareE}
@@ -4264,9 +4960,9 @@
\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);
+\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}\,}
@@ -4287,7 +4983,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Ep}
+% \subsubsection{\hspace{3mm}Rotation Ep}
%
% \begin{macro}{\rrEp}
% \begin{macro}{\SquareEp}
@@ -4301,9 +4997,9 @@
\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);
+\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}\,}
@@ -4324,7 +5020,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation F}
+% \subsubsection{\hspace{3mm}Rotation F}
%
% \begin{macro}{\rrF}
% \begin{macro}{\SquareF}
@@ -4338,7 +5034,7 @@
\newcommand{\SquareF}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
-\draw [thick, <-] (\scx, \scy) arc[radius=0.35, start angle=-60, delta angle=290];
+\draw [thick, <-] (\@scx, \@scy) arc[radius=0.35, start angle=-60, delta angle=290];
\end{tikzpicture}%
}
\newcommand{\rrhF}{\raisebox{-0.333\height}{\SquareF}\,}
@@ -4359,7 +5055,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Fp}
+% \subsubsection{\hspace{3mm}Rotation Fp}
%
% \begin{macro}{\rrFp}
% \begin{macro}{\SquareFp}
@@ -4373,7 +5069,7 @@
\newcommand{\SquareFp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
-\draw [thick, ->] (\scx, \scy) arc[radius=0.35, start angle=-60, delta angle=290];
+\draw [thick, ->] (\@scx, \@scy) arc[radius=0.35, start angle=-60, delta angle=290];
\end{tikzpicture}%
}
\newcommand{\rrhFp}{\raisebox{-0.333\height}{\SquareFp}\,}
@@ -4394,7 +5090,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Fw}
+% \subsubsection{\hspace{3mm}Rotation Fw}
%
% \begin{macro}{\rrFw}
% \begin{macro}{\SquareFw}
@@ -4408,8 +5104,8 @@
\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];
+\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}%
}
@@ -4431,7 +5127,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Fwp}
+% \subsubsection{\hspace{3mm}Rotation Fwp}
%
% \begin{macro}{\rrFwp}
% \begin{macro}{\SquareFwp}
@@ -4445,8 +5141,8 @@
\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];
+\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}\,}
@@ -4468,7 +5164,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Fs}
+% \subsubsection{\hspace{3mm}Rotation Fs}
%
% \begin{macro}{\rrFs}
% \begin{macro}{\rrhFs}
@@ -4494,7 +5190,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Fsp}
+% \subsubsection{\hspace{3mm}Rotation Fsp}
%
% \begin{macro}{\rrFsp}
% \begin{macro}{\rrhFsp}
@@ -4520,7 +5216,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Fa}
+% \subsubsection{\hspace{3mm}Rotation Fa}
%
% \begin{macro}{\rrFa}
% \begin{macro}{\rrhFa}
@@ -4546,7 +5242,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Fap}
+% \subsubsection{\hspace{3mm}Rotation Fap}
%
% \begin{macro}{\rrFap}
% \begin{macro}{\rrhFap}
@@ -4572,7 +5268,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation L}
+% \subsubsection{\hspace{3mm}Rotation L}
%
% \begin{macro}{\rrL}
% \begin{macro}{\SquareL}
@@ -4586,9 +5282,9 @@
\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);
+\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}\,}
@@ -4609,7 +5305,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Lp}
+% \subsubsection{\hspace{3mm}Rotation Lp}
%
% \begin{macro}{\rrLp}
% \begin{macro}{\SquareLp}
@@ -4623,9 +5319,9 @@
\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);
+\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}\,}
@@ -4646,7 +5342,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Lw}
+% \subsubsection{\hspace{3mm}Rotation Lw}
%
% \begin{macro}{\rrLw}
% \begin{macro}{\SquareLw}
@@ -4660,9 +5356,9 @@
\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);
+\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}\,}
@@ -4683,7 +5379,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Lwp}
+% \subsubsection{\hspace{3mm}Rotation Lwp}
%
% \begin{macro}{\rrLwp}
% \begin{macro}{\SquareLwp}
@@ -4697,9 +5393,9 @@
\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);
+\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}\,}
@@ -4720,7 +5416,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Ls}
+% \subsubsection{\hspace{3mm}Rotation Ls}
%
% \begin{macro}{\rrLs}
% \begin{macro}{\SquareLs}
@@ -4734,9 +5430,9 @@
\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);
+\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}\,}
@@ -4757,7 +5453,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Lsp}
+% \subsubsection{\hspace{3mm}Rotation Lsp}
%
% \begin{macro}{\rrLsp}
% \begin{macro}{\SquareLsp}
@@ -4771,9 +5467,9 @@
\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);
+\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}\,}
@@ -4794,7 +5490,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation La}
+% \subsubsection{\hspace{3mm}Rotation La}
%
% \begin{macro}{\rrLa}
% \begin{macro}{\SquareLa}
@@ -4808,9 +5504,9 @@
\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);
+\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}\,}
@@ -4831,7 +5527,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Lap}
+% \subsubsection{\hspace{3mm}Rotation Lap}
%
% \begin{macro}{\rrLap}
% \begin{macro}{\SquareLap}
@@ -4845,9 +5541,9 @@
\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);
+\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}\,}
@@ -4868,7 +5564,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation M}
+% \subsubsection{\hspace{3mm}Rotation M}
%
% \begin{macro}{\rrM}
% \begin{macro}{\SquareM}
@@ -4882,9 +5578,9 @@
\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);
+\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}\,}
@@ -4905,7 +5601,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Mp}
+% \subsubsection{\hspace{3mm}Rotation Mp}
%
% \begin{macro}{\rrMp}
% \begin{macro}{\SquareMp}
@@ -4919,9 +5615,9 @@
\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);
+\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}\,}
@@ -4942,7 +5638,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation R}
+% \subsubsection{\hspace{3mm}Rotation R}
%
% \begin{macro}{\rrR}
% \begin{macro}{\SquareR}
@@ -4957,9 +5653,9 @@
\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);
+\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}\,}
@@ -4980,7 +5676,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Rp}
+% \subsubsection{\hspace{3mm}Rotation Rp}
%
% \begin{macro}{\rrRp}
% \begin{macro}{\SquareRp}
@@ -4994,9 +5690,9 @@
\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);
+\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}\,}
@@ -5017,7 +5713,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Rw}
+% \subsubsection{\hspace{3mm}Rotation Rw}
%
% \begin{macro}{\rrRw}
% \begin{macro}{\SquareRw}
@@ -5031,9 +5727,9 @@
\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);
+\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}\,}
@@ -5054,7 +5750,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Rwp}
+% \subsubsection{\hspace{3mm}Rotation Rwp}
%
% \begin{macro}{\rrRwp}
% \begin{macro}{\SquareRwp}
@@ -5068,9 +5764,9 @@
\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);
+\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}\,}
@@ -5091,7 +5787,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Rs}
+% \subsubsection{\hspace{3mm}Rotation Rs}
%
% \begin{macro}{\rrRs}
% \begin{macro}{\SquareRs}
@@ -5105,9 +5801,9 @@
\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);
+\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}\,}
@@ -5128,7 +5824,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Rsp}
+% \subsubsection{\hspace{3mm}Rotation Rsp}
%
% \begin{macro}{\rrRsp}
% \begin{macro}{\SquareRsp}
@@ -5142,9 +5838,9 @@
\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);
+\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}\,}
@@ -5165,7 +5861,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Ra}
+% \subsubsection{\hspace{3mm}Rotation Ra}
%
% \begin{macro}{\rrRa}
% \begin{macro}{\SquareRa}
@@ -5179,9 +5875,9 @@
\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);
+\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}\,}
@@ -5202,7 +5898,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Rap}
+% \subsubsection{\hspace{3mm}Rotation Rap}
%
% \begin{macro}{\rrRap}
% \begin{macro}{\SquareRap}
@@ -5216,9 +5912,9 @@
\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);
+\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}\,}
@@ -5239,7 +5935,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation S}
+% \subsubsection{\hspace{3mm}Rotation S}
%
% \begin{macro}{\rrS}
% \begin{macro}{\SquareS}
@@ -5262,7 +5958,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Sp}
+% \subsubsection{\hspace{3mm}Rotation Sp}
%
% \begin{macro}{\rrSp}
% \begin{macro}{\SquareSp}
@@ -5285,7 +5981,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Su}
+% \subsubsection{\hspace{3mm}Rotation Su}
%
% \begin{macro}{\rrSu}
% \begin{macro}{\rrhSu}
@@ -5312,7 +6008,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Sup}
+% \subsubsection{\hspace{3mm}Rotation Sup}
%
% \begin{macro}{\rrSup}
% \begin{macro}{\rrhSup}
@@ -5339,7 +6035,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Sd}
+% \subsubsection{\hspace{3mm}Rotation Sd}
%
% \begin{macro}{\rrSd}
% \begin{macro}{\rrhSd}
@@ -5364,7 +6060,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Sdp}
+% \subsubsection{\hspace{3mm}Rotation Sdp}
%
% \begin{macro}{\rrSdp}
% \begin{macro}{\rrhSdp}
@@ -5389,7 +6085,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Sl}
+% \subsubsection{\hspace{3mm}Rotation Sl}
%
% \begin{macro}{\rrSl}
% \begin{macro}{\rrhSl}
@@ -5414,7 +6110,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Slp}
+% \subsubsection{\hspace{3mm}Rotation Slp}
%
% \begin{macro}{\rrSlp}
% \begin{macro}{\rrhSlp}
@@ -5439,7 +6135,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Sr}
+% \subsubsection{\hspace{3mm}Rotation Sr}
%
% \begin{macro}{\rrSr}
% \begin{macro}{\rrhSr}
@@ -5464,7 +6160,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Srp}
+% \subsubsection{\hspace{3mm}Rotation Srp}
%
% \begin{macro}{\rrSrp}
% \begin{macro}{\rrhSrp}
@@ -5489,7 +6185,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Sf}
+% \subsubsection{\hspace{3mm}Rotation Sf}
%
% \begin{macro}{\rrSf}
% \begin{macro}{\rrhSf}
@@ -5515,7 +6211,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Sfp}
+% \subsubsection{\hspace{3mm}Rotation Sfp}
%
% \begin{macro}{\rrSfp}
% \begin{macro}{\rrhSfp}
@@ -5541,7 +6237,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Sb}
+% \subsubsection{\hspace{3mm}Rotation Sb}
%
% \begin{macro}{\rrSb}
% \begin{macro}{\rrhSb}
@@ -5567,7 +6263,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Sbp}
+% \subsubsection{\hspace{3mm}Rotation Sbp}
%
% \begin{macro}{\rrSbp}
% \begin{macro}{\rrhSbp}
@@ -5593,7 +6289,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation U}
+% \subsubsection{\hspace{3mm}Rotation U}
%
% \begin{macro}{\rrU}
% \begin{macro}{\SquareU}
@@ -5607,9 +6303,9 @@
\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);
+\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}\,}
@@ -5630,7 +6326,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Uw}
+% \subsubsection{\hspace{3mm}Rotation Uw}
%
% \begin{macro}{\rrUw}
% \begin{macro}{\SquareUw}
@@ -5644,9 +6340,9 @@
\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);
+\draw [thick, <-] (\@sb,\@sddd) -- (\@sbh, \@sddd);
+\draw [thick, <-] (\@sb,\@sdd) -- (\@sbh, \@sdd);
+\draw [thick] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
%
@@ -5669,7 +6365,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Up}
+% \subsubsection{\hspace{3mm}Rotation Up}
%
% \begin{macro}{\rrUp}
% \begin{macro}{\SquareUp}
@@ -5683,9 +6379,9 @@
\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);
+\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}\,}
@@ -5706,7 +6402,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Uwp}
+% \subsubsection{\hspace{3mm}Rotation Uwp}
%
% \begin{macro}{\rrUwp}
% \begin{macro}{\SquareUwp}
@@ -5720,9 +6416,9 @@
\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);
+\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}\,}
@@ -5743,7 +6439,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Us}
+% \subsubsection{\hspace{3mm}Rotation Us}
%
% \begin{macro}{\rrUs}
% \begin{macro}{\SquareUs}
@@ -5757,9 +6453,9 @@
\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);
+\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}\,}
@@ -5780,7 +6476,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Usp}
+% \subsubsection{\hspace{3mm}Rotation Usp}
%
% \begin{macro}{\rrUsp}
% \begin{macro}{\SquareUsp}
@@ -5794,9 +6490,9 @@
\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);
+\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}\,}
@@ -5817,7 +6513,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Ua}
+% \subsubsection{\hspace{3mm}Rotation Ua}
%
% \begin{macro}{\rrUa}
% \begin{macro}{\SquareUa}
@@ -5831,9 +6527,9 @@
\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);
+\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}\,}
@@ -5854,7 +6550,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotation Uap}
+% \subsubsection{\hspace{3mm}Rotation Uap}
%
% \begin{macro}{\rrUap}
% \begin{macro}{\SquareUap}
@@ -5868,9 +6564,9 @@
\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);
+\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}\,}
@@ -5891,9 +6587,8 @@
% \end{macro}
%
%
-% \subsection{ Rotation commands --- axis rotations}
%
-% \subsubsection{ Rotations x and xp}
+% \subsubsection{\hspace{3mm}Rotations x and xp}
%
% \begin{macro}{\rrx}
% \begin{macro}{\rrhx}
@@ -5921,7 +6616,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotations y and yp}
+% \subsubsection{\hspace{3mm}Rotations y and yp}
%
% \begin{macro}{\rry}
% \begin{macro}{\rrhy}
@@ -5949,7 +6644,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotations z and zp}
+% \subsubsection{\hspace{3mm}Rotations z and zp}
%
% \begin{macro}{\rrz}
% \begin{macro}{\rrhz}
@@ -5977,7 +6672,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotations u and d}
+% \subsubsection{\hspace{3mm}Rotations u and d}
%
% \begin{macro}{\rru}
% \begin{macro}{\rrhu}
@@ -6005,7 +6700,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotations l and r}
+% \subsubsection{\hspace{3mm}Rotations l and r}
%
% \begin{macro}{\rrl}
% \begin{macro}{\rrhl}
@@ -6033,7 +6728,7 @@
% \end{macro}
%
%
-% \subsubsection{ Rotations f and b}
+% \subsubsection{\hspace{3mm}Rotations f and b}
%
% \begin{macro}{\rrf}
% \begin{macro}{\rrhf}
diff --git a/Master/texmf-dist/source/latex/rubik/rubikcube.ins b/Master/texmf-dist/source/latex/rubik/rubikcube.ins
index 5b5d6d5f45a..a50acb88fd4 100644
--- a/Master/texmf-dist/source/latex/rubik/rubikcube.ins
+++ b/Master/texmf-dist/source/latex/rubik/rubikcube.ins
@@ -1,21 +1,24 @@
-%% 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.
+%% rubikcube.ins
+%%
+%% --- automatic overwriting of .sty is disabled-------
+%% =========================================================
+%% Authors: RWD Nickalls (dick@nickalls.org)
+%% and Apostolos Syropoulos (asyropoulos@yahoo.com)
%%
-%% This work has the LPPL maintenance status `maintained'.
+%% VERSION 3.0 September 25, 2015
+%% Copyright 2015 RWD Nickalls + A Syropoulos
%%
-%% The Current Maintainer of this work are RWD Nickalls and A Syropoulos
%%
+%% 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 (at your option) any
+%% later version: <http://www.latex-project.org/lppl.txt>
+%%
+%% This work consists of the files listed in the README file.
%%
-%% This work consists of the files rubikcube.dtx and rubikcube.ins
-%% and the derived file rubikcube.sty.
+%% This file will generate fast loadable files and documentation
+%% driver files from the doc files in this work when run through
+%% LaTeX.
%%
%% --------------- start of docstrip commands ------------------
%%
@@ -28,12 +31,12 @@
Authors: RWD Nickalls (dick@nickalls.org)
and Apostolos Syropoulos (asyropoulos@yahoo.com)
- Copyright 2014 RWD Nickalls and A Syropoulos
+ Copyright 2015 RWD Nickalls and A Syropoulos
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
+ version 1.3c of this license or (at your option) any
later version: <http://www.latex-project.org/lppl.txt>
This work consists of the files listed in the README file.
@@ -60,10 +63,10 @@
\Msg{* To finish the installation you have to move the *}
\Msg{* following file into a directory searched by TeX: *}
\Msg{* *}
-\Msg{* rubikcube.sty *}
+\Msg{* rubikcube.sty *}
\Msg{* *}
\Msg{* To produce the documentation run the file *}
-\Msg{* rubikcube.dtx through LaTeX. *}
+\Msg{* rubikcube.dtx through LaTeX. *}
\Msg{* For an index, process any filename.idx file by *}
\Msg{* makeindex -s gind.ist filename *}
\Msg{* For list of changes, process any filename.glo file *}
diff --git a/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx b/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx
index 8ffc824499a..57302ac37a7 100644
--- a/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx
+++ b/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx
@@ -1,10 +1,12 @@
% \iffalse meta-comment
% rubikrotation.dtx
%
+% version 3.0
+%
% Authors: RWD Nickalls (dick@nickalls.org)
% and Apostolos Syropoulos (asyropoulos@yahoo.com)
-% Copyright 2014 RWD Nickalls + A Syropoulos
+% Copyright 25 September 2015 RWD Nickalls + A Syropoulos
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -36,10 +38,12 @@
process rubikrotation.dtx again)^^J}\stop
}%
\usepackage{ifpdf}
-\usepackage{url} %% for references
-\usepackage{graphicx} %% for the two pdf figs
+\usepackage{url,path} %% for references and paths
+\usepackage{graphicx} %% for the two pdf figs
+\usepackage{hypdoc} %% for pdf bookmarks + hyperref documenting of packages
%%\OnlyDescription
\EnableCrossrefs
+\PageIndex
\CodelineIndex
\CodelineNumbered
\RecordChanges
@@ -54,7 +58,7 @@
%
%
%
-% \CheckSum{302}
+% \CheckSum{310}
%
%%% \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
@@ -74,65 +78,72 @@
%
%
%
-% \title{The \textsf{rubikrotation} package}
+% \title{The \rubikrotation\ package}
%
% \author{
% RWD Nickalls (dick@nickalls.org) \\
% A Syropoulos (asyropoulos@yahoo.com)
% }
-% \date{This file describes version \RRfileversion, last revised \RRfiledate}
+% \date{This file describes version \RRfileversion\ (\RRfiledate)\\
+% \texttt{www.ctan.org/pkg/rubik}}
% \maketitle
%
% \begin{abstract}
-% The \rubikrotation\ package is an extension for the
-% \textsf{rubikcube} package. It provides the \cmd{\RubikRotation} command which
-% processes on-the-fly a sequence of Rubik rotation moves (using the Perl script
-% \texttt{rubikrotation.pl}) and returns the new Rubik cube state. It implements
-% some basic checking of the Rubik state, and also offers a command for displaying
-% any errors (\cmd{\ShowRubikErrors}).
-% This package requires access to the \TeX\ \texttt{write18} facility by using the
-% \texttt{--shell-escape} commandline switch.
-% The \textsf{rubikrotation} package has been road-tested on a Microsoft
-% platform (with MikTeX and Strawberry Perl), on a Linux platform ({\TeX}Live and Mandriva),
-% and on OpenIndiana (a Solaris platform).
+% The \rubikrotation\ package is a dynamic extension for the
+% \textsc{rubikcube} package (both are part of the Rubik `bundle').
+% The package provides the \cmd{\RubikRotation} command which
+% processes a sequence of Rubik rotation moves on-the-fly (using the Perl script
+% \texttt{rubikrotation.pl}), and returns the new Rubik cube state (configuration).
+% The \rubikrotation\ package also provides a command for implementing some basic
+% checking of the Rubik cube state (\cmd{\CheckRubikState}), and one
+% for displaying any errors (\cmd{\ShowRubikErrors}).
+%
+% The \rubikrotation\ package requires access to the \TeX\ \texttt{write18}
+% facility, which is enabled by using the \texttt{--shell-escape} command-line switch.
+% The~\rubikrotation\ package has been road-tested on a Microsoft
+% platform (with MiKTeX and Strawberry Perl), on a Linux platform
+% (Mandriva using {\TeX}Live), and on a Solaris platform (OpenIndiana).
% \end{abstract}
%
+% \begin{minipage}{11cm}
+% \centering
+% \ifpdf
+% \includegraphics[width=10cm]{Rubikrot-doc-figD.pdf}
+% \else
+% \fi
+% \end{minipage}
%
-% \bigskip
+% \vspace{-1\baselineskip}
%
% \tableofcontents
%
% \section{Introduction}
%
% The \rubikrotation\ package is a dynamic extension to the \textsc{rubikcube} package.
-% It consists of a style option (\texttt{rubikrotation.sty}) and a
-% Perl script (\texttt{rubikrotation.pl}).
+% It consists of a style option (\texttt{rubikrotation.sty}), a
+% Perl script (\texttt{rubikrotation.pl}) and some examples.
%
-% The primary role of the \rubikrotation\ package is to implement on-the-fly Rubik
-% rotation sequences using the \cmd{\RubikRotation} command. Consequently, this
+% The primary role of the \rubikrotation\ package is to implement a sequence of
+% Rubik rotation moves on-the-fly using the \cmd{\RubikRotation} command. Consequently, this
% package requires the use of the \texttt{--shell-escape} switch to allow
-% commandline control of the Perl script, which is really the `engine' of this package.
-% The \textsf{rubikrotation} package has been road-tested on a Microsoft
-% platform (with MikTeX and Strawberry Perl\,\footnote{`Strawberry Perl'
+% command-line control of the Perl script, which is really the `engine' of this package.
+%
+% The \rubikrotation\ package has been road-tested on a Microsoft
+% platform (with MiKTeX and Strawberry Perl\,\footnote{`Strawberry Perl'
% (\texttt{http://strawberryperl.com}) is a free Perl
% environment for MS Windows, designed to be as close as possible to the Perl
-% environment of Unix/Linux systems.})
-% and on a Linux platform ({\TeX}Live and Mandriva).
+% environment of Unix/Linux systems.}), on a Linux platform (Mandriva using
+% {\TeX}Live), and on a Solaris platform (OpenIndiana).
%
-% The following commands are made available by \texttt{rubikrotation.sty}.
+% The following commands are made available by \texttt{rubikrotation.sty}:
% \begin{quote}
% \begin{verbatim}
-% \RubikRotation{}
+% \RubikRotation[]{}
% \SaveRubikState
% \CheckRubikState
% \ShowRubikErrors
%\end{verbatim}
% \end{quote}
-% Note that if the Perl script is not located in the local working directory, then
-% some care is needed regarding placing it where your system can both find it and
-% also run it. In this case, the setting up of a simple one or two-line configuration
-% file may be useful or even necessary, depending on your system
-% (see section on `installation' below).
%
%
% \section{Requirements}
@@ -146,277 +157,403 @@
%
% Place the file \texttt{rubikrotation.zip} into a temporary directory, and unzip it.
% This will generate the following files:
+%\begin{quote}
% \begin{verbatim}
% rubikrotation.ins
% rubikrotation.dtx
-% rubikrotation.sty
-% rubikrotation.pl
-% rubikrotation.PDF
-% example-rot1.tex
-% example-rot1.PDF
-% example-rot2.tex
-% example-rot2.PDF
-%\end{verbatim}
-% The style option \texttt{rubikrotation.sty} is generated by running (pdf)\LaTeX\ on
+% rubikrotation.pdf --this document
+% rubikrotation.pl --Perl script
+% rubikrotationPL.pdf --documentation of rubikrotation.pl
+% rubikrotation.1 --the man file
+% Rubikrot-doc-figA.pdf
+% Rubikrot-doc-figB.pdf
+% Rubikrot-doc-figC.pdf
+% Rubikrot-doc-figD.pdf
+% examples.tex
+% examples.pdf
+% examples.sh
+% examples.bat
+%\end{verbatim}
+%\end{quote}
+% Note that the package includes an `examples' file (\texttt{examples.tex})
+% as well as associated \texttt{.sh} (Linux) and \texttt{.bat} (Microsoft) batch
+% files which can be used to facilitate processing the file.
+% The main package documentation is the file \texttt{rubikrotation.pdf}.
+%
+% The style option \texttt{rubikrotation.sty} is generated by running (pdf)\LaTeX\ on
% the file \texttt{rubikrotation.ins} as follows:
+%\begin{quote}
%\begin{verbatim}
% pdflatex rubikrotation.ins
%\end{verbatim}
-% The documentation file (\texttt{rubikrotation.pdf}) was generated using the following
-% steps:
+%\end{quote}
+% The documentation file (\texttt{rubikrotation.pdf}) is then generated using the following
+% sequence of steps\,\footnote{Since the documentation includes a complicated indexing
+% system as well a \textsc{pdf} index and hyperef links (the package \texttt{hypdoc}
+% is used), then a lot of pdflatex runs are required. Prior to the first run it is
+% a good idea to delete any relevant \texttt{.toc}, \texttt{.aux}, \texttt{.out} files.}:
+%\begin{quote}
% \begin{verbatim}
-% pdflatex --shell-escape rubikrotation.dtx
-% pdflatex --shell-escape rubikrotation.dtx
+% pdflatex rubikrotation.dtx
+% pdflatex rubikrotation.dtx
% makeindex -s gind.ist rubikrotation
% makeindex -s gglo.ist -o rubikrotation.gls rubikrotation.glo
-% pdflatex --shell-escape rubikrotation.dtx
+% pdflatex rubikrotation.dtx
+% pdflatex rubikrotation.dtx
%\end{verbatim}
+%\end{quote}
%
-
%
+%
% \subsection{Placing the files}
% \label{sec:placingfiles}
%
-% 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:
+% Place the files either in a working directory, or where your system
+% will find them, e.g.,~in your \texttt{/texmf-local/} directory tree.
+% For example, on a Linux platform with a standard \TeX\ Directory Structure (TDS), then:
%
%\medskip
-%{\noindent}*.sty $\rightarrow$
-% \texttt{/usr/local/texlive/texmf-local/tex/latex/local/rubikrotation/}
-%{\newline}*.cfg $\rightarrow$
-% \texttt{/usr/local/texlive/texmf-local/tex/latex/local/rubikrotation/}
-%{\newline}*.pdf $\rightarrow$ \texttt{/usr/local/texlive/texmf-local/doc/rubikrotation/}
-%{\newline}*.pl $\rightarrow$ \texttt{/usr/local/bin/}
-%
-% \medskip
-% {\noindent}Finally, (depending on your system) update the \TeX\ file database using the
-% \texttt{texhash} command.
-
-%
-% \subsection{Configuration file}
-% \label{sec:configfile}
-%
-% A plane text configuration file with the name \texttt{rubikrotation.cfg} (if one exists)
-% will be read by the system. Such a file allows the user to
-% adjust (a)~the filename of the Perl script (\texttt{rubikrotation.pl})
-% and (b)~the commandline code used by \texttt{rubikrotation.sty} for calling the
-% Perl script. This sort of fine-tuning is sometimes convenient, and even necessary
-% (depending on your system), for locating and running the Perl script.
-% For example, on some systems it maybe preferable to use a different \textsc{path},
-% file name and/or a different commandline code to call the script.
+%{\noindent}*.sty $\rightarrow$ \texttt{/usr/local/texlive/texmf-local/tex/latex/rubik/}
+%{\newline}*.cfg $\rightarrow$ \texttt{/usr/local/texlive/texmf-local/tex/latex/rubik/}
+%{\newline}*.pdf $\rightarrow$ \texttt{/usr/local/texlive/texmf-local/doc/rubik/}
+%{\newline}*.pl $\rightarrow$ \texttt{/usr/local/texlive/texmf-local/scripts/rubik/}
%
+%\medskip
+%{\noindent}\textsc{perl script}:\ \ Make the perl script executable
+% (\texttt{chmod +x rubikrotation.pl}), and then
+% rename the file as `rubikrotation' (i.e.,~with no file extension), and then place
+% the executable script into your current TeXLive binary directory,
+% e.g.,~\path!/user/local/texlive/YYYY/bin/i386-linux!.
+%
+% Sometimes the setting up of a simple one or two-line plain-text
+% configuration-file may be useful or even necessary, depending on your system
+% (see Section~\ref{sec:configfile} below). Such a file (if one exists) will
+% automatically be read by \texttt{rubikrotation.sty} providing the
+% file is named \texttt{rubikrotation.cfg}.
%
-% \DescribeMacro{\rubikperlname}
-% \DescribeMacro{\rubikperlcmd}
-% The configuration file is essentially a convenient software vehicle for feeding some
-% additional \LaTeX\ code to the style option, and hence allow the contents of some
-% commands to be adjusted and/or fine-tuned.
-% For the \rubikrotation\ package there are two particular commands we may wish to adjust.
-% The first is that defining the filename of the Perl script, namely
-% \cmd{\rubikperlname}. The second is that defining the commandline call,
-% namely \cmd{\rubikperlcmd}.
-% The default definitions for these (detailed in Section~\ref{sec:usefulcommands})
-% are as follows:
-%\begin{verbatim}
-% \newcommand{\rubikperlname}{rubikrotation.pl}
-% \newcommand{\rubikperlcmd}{perl \rubikperlname}
-%\end{verbatim}
+%\medskip
+%{\noindent}\textsc{the `man' file}:\ \ On a Linux platform this file
+% (\texttt{rubikrotation.1}) would be typically located in the
+% directory \verb!/usr/share/man/man1!.
%
+%\medskip
+%{\noindent}\textsc{file database}:\ \ Finally, (depending on your system) update the
+% \TeX\ file database.
+% For example, on a Linux platform this is achieved using the \texttt{texhash} command.
%
-% For example, we might wish to test out a slightly modified Perl script, say
-% with the name \texttt{rubikrotationV3.pl}. In this case we simply create,
-% in the local working directory, a plane text configuration file
-% (called \texttt{rubikrotation.cfg}) which includes the following line:
-%\begin{verbatim}
-%\renewcommand{\rubikperlname}{rubikrotationV3.pl}
+%\medskip
+%{\noindent}\textsc{quick test}:\ \ To test that your system can now run the perl
+% script, just type at the command-line
+%\begin{quote}
+% \begin{verbatim}
+% rubikrotation -h
%\end{verbatim}
-%
-% Alternatively, say, if the Perl script is being installed on a Linux platform, then
-% it would be standard to install it in the directory \texttt{/usr/local/bin}.
-% A convenient approach in this case, therefore, would be to indicate this new \textsc{path}
-% by including the following line in the configuration file:
-%\begin{verbatim}
-%\renewcommand{\rubikperlname}{/usr/local/bin/rubikrotation.pl}
-%\end{verbatim}
-% and, since this would then be an essentially permanent feature, we would then
-% place the configuration file with the style option in the
-% \texttt{texmf-local/...} directory as described in section~\ref{sec:placingfiles}
-% (placing files). Note that in this case, we have \textit{not} made the Perl script
-% `executable', since the default commandline code is effectively
-% \texttt{perl \rubikperlname}, and this works just as it is.
-%
-% However, if the Perl script \textit{is} made `executable', then
-% a different commandline code will have to be used instead.
-% For example, suppose the Perl script is made executable and renamed to just
-% \texttt{rubikrotation} (ie with no filename extension), then we now have to
-% omit the `perl' from the default commandline. Consequently, we now need to make
-% two command changes, which we implement by including the following
-% two lines in the configuration file:
-%\begin{verbatim}
-%\renewcommand{\rubikperlname}{/usr/local/bin/rubikrotation}
-%\renewcommand{\rubikperlcmd}{\rubikperlname}
+%\end{quote}
+% which should generate something like the following:
+% \begin{verbatim}
+% This is rubikrotation version 3.0
+% Usage: rubikrotation [-h] -i <input file> [-o <out file>]
+% where,
+% [-h] gives this help listing
+% [-i] creates specified input file
+% [-o] creates specified output file
+% For documentation see: rubikrotation.pdf,
+% rubikrotationPL.pdf and rubikcube.pdf
%\end{verbatim}
%
%
% \section{Usage}
-%
+% \label{sec:usage}
% Load the packages \texttt{rubikcube.sty}
-% and \texttt{rubikrotation.sty} in the \TeX\ file \textit{after} loading
-% the TikZ package, as follows:
-% \begin{verbatim}
-% \usepackage{tikz}
-% \usepackage{rubikcube,rubikrotation}
+% and \texttt{rubikrotation.sty} in the \TeX\ file preamble \textit{after} loading
+% the TikZ package (both Rubik packages require the TikZ package), for example, as follows:
+%\begin{quote}
+% \begin{verbatim}
+% \usepackage{tikz}
+% \usepackage{rubikcube,rubikrotation}
%\end{verbatim}
-% and run (pdf)\LaTeX\ using the \texttt{--shell-escape} commandline switch
-% (see following section).
+%\end{quote}
+% and run (pdf)\LaTeX\ using the \texttt{--shell-escape} command-line switch
+% (see the following section).
%
%
% \subsection{Enabling the \TeX\ `shell' facility}
%
% In order to enable the \TeX\ `write18' facility (so it can run the Perl script)
-% we will need to invoke (pdf)\LaTeX\ using the \texttt{--shell-escape} switch; say, as follows.
+% it is necessary to invoke (pdf)\LaTeX\ using the \texttt{--shell-escape} switch
+% as follows:
+%\begin{quote}
% \begin{verbatim}
% pdflatex --shell-escape filename.tex
%\end{verbatim}
-% In practice, it is probably most convenient to run this via a
-% bash/batch file---something like the following, both of which
-% automatically show the graphic output:
+%\end{quote}
+% In practice, it is probably most convenient to run this command via a
+% bash/batch file. For example, on a Linux platform the following bash file
+% will run the file, show any errors, and open the \textsc{pdf} using AcrobatReader.
+%\begin{quote}
% \begin{verbatim}
% pdflatex --shell-escape filename.tex
-% xpdf filename.pdf
-%\end{verbatim}
-% or
-% \begin{verbatim}
-% latex --shell-escape filename.tex
-% dvips filename.dvi
-% gv filename.ps
+% echo "...checking error file"
+% grep ERROR ./rubikstateERRORS.dat
+% acroread filename.pdf &
%\end{verbatim}
+%\end{quote}
%
%
-% \subsection{Test files}
+% \subsection{Test file}
%
-% Two example tex files (which demonstrate the use of the package commands) are
-% included in the package, namely:
+% An example tex file (which demonstrates the use of some of the package commands)
+% is included in the package, namely:
+%\begin{quote}
% \begin{verbatim}
-% example-rot1.tex (shows 5 worked examples)
-% example-rot2.tex (is a `test' file for experimenting with different commands)
+% example-rot.tex (shows 8 worked examples)
%\end{verbatim}
-% These need to be run using \texttt{--shell-escape} switch; for example:
+%\end{quote}
+% This file needs to be run using \texttt{--shell-escape} switch; for example:
+%\begin{quote}
% \begin{verbatim}
-% pdflatex --shell-escape example-rot1.tex
+% pdflatex --shell-escape example-rot.tex
%\end{verbatim}
-% If the files give unexpected results, check-out the log file to see if the system
-% has had any difficulties finding files etc.
+%\end{quote}
+% Batch files (\texttt{.sh} for Linux, and \texttt{.bat} for Microsoft) are also provided
+% to facilitate running the `example' file.
+% For example, on a Linux platform one would run a \texttt{bash} file as follows:
+%\begin{quote}
+% \begin{verbatim}
+% bash example-rot.sh
+%\end{verbatim}
+%\end{quote}
+% If processing this file gives unexpected results (e.g.,~the cubes appear not to
+% have experienced any rotations) check-out the associated log file to see if
+% the operating system had any difficulties finding files etc.
+%
%
+% \subsection{Configuration-file}
+% \label{sec:configfile}
%
+% A plain-text configuration-file with the name \texttt{rubikrotation.cfg}
+% (if one exists) will automatically be read by \texttt{rubikrotation.sty}.
+% The \rubikrotation\ package's facility to use a configuration-file allows the
+% user to change not only (a)~the filename of the Perl script (\texttt{rubikrotation.pl}),
+% but also (b)~the command-line code used by \texttt{rubikrotation.sty} for calling the
+% Perl script. This~sort of fine-tuning can be very useful, and sometimes may
+% even be necessary (depending on your system) for running the Perl script.
%
+% For example, on some systems it maybe preferable to use a different \textsc{path},
+% file-name and/or a different command-line code to call the script.
+% Such~a configuration-file can also facilitate testing a new Perl script having
+% a different name and location.
+%
+%
+% \DescribeMacro{\rubikperlname}
+% \DescribeMacro{\rubikperlcmd}
+% The configuration-file is essentially a convenient software vehicle for feeding
+% additional \LaTeX\ code to the style option \texttt{rubikrotation.sty}, and hence
+% allows the contents of some commands to be easily adjusted and/or fine-tuned.
+% For~the \rubikrotation\ package there are two particular commands we may wish to adjust.
+% The~first is that defining the filename of the Perl script, namely
+% \cmd{\rubikperlname}. The second is that defining the command-line call,
+% namely \cmd{\rubikperlcmd}.
+% The~default definitions in \texttt{rubikrotation.sty} (which assume the Perl
+% script is executable), are as follows: (they are detailed in
+% Section~\ref{sec:usefulcommands})
+%\begin{quote}
+%\begin{verbatim}
+% \newcommand{\rubikperlname}{rubikrotation}
+% \newcommand{\rubikperlcmd}{\rubikperlname\space%
+% -i rubikstate.dat -o rubikstateNEW.dat}
+%\end{verbatim}
+%\end{quote}
+% Note the need here to use the \cmd{\space} command on the end of the backslash
+% command (\cmd{\rubikperlname}) in order to force a following
+% space---i.e.,~before the first command-line argument. The following examples
+% illustrate how the configuration-file may be used.
+%
+% \medskip
+% {\noindent}\textsc{example~1}:\ \ Suppose we wish to test out
+% a slightly modified Perl script
+% with the working (executable) name \texttt{rubikrotationR77}. In this case we
+% simply create, in the local working directory, a plain-text configuration-file
+% (called \texttt{rubikrotation.cfg}) which contains just the following line:
+%\begin{quote}
+%\begin{verbatim}
+%\renewcommand{\rubikperlname}{rubikrotationR77}
+%\end{verbatim}
+%\end{quote}
+%
+% \medskip
+% {\noindent}\textsc{example~2}:\ \ Alternatively, suppose we wish to test out
+% a new Perl script with the (non-executable) name \texttt{rubikrotationR55.pl}.
+% Now, in this particular case we will need to run the script using a
+% slightly different command, namely,
+% {\linebreak}\texttt{perl rubikrotationR55.pl ...}, and consequently we
+% need to implement both these changes in the configuration-file, as follows:
+%\begin{quote}
+%\begin{verbatim}
+%\renewcommand{\rubikperlname}{rubikrotationR55.pl}
+%\renewcommand{\rubikperlcmd}{perl \rubikperlname\space\%
+% -i rubikstate.dat -o rubikstateNEW.dat}
+%\end{verbatim}
+%\end{quote}
+%{\noindent}\textsc{placing the configuration-file}:\ \ The simplest arrangement is
+% just to include the \texttt{.cfg} file in the working `test' directory.
+% Alternatively, the \texttt{.cfg} file could be placed in the \texttt{/texmf-local/}
+% directory tree (say, in \path!/usr/local/texlive/texmf-local/tex/latex/rubik/!),
+% but in this case one would then have to be careful to specify the
+% correct PATH for everything in order to enable your system to find all the
+% various components etc.
+%
+% Note that you can, of course, have several \texttt{.cfg} files, since the system will
+% read only one such file (the first one it finds starting with the current working
+% directory). Consequently, it may be useful to have one \texttt{.cfg} file in
+% your \texttt{/texmf-local/} dir (for running the standard Rubik package),
+% and another (different) \texttt{.cfg} file in your `test' directory.
+%
+%
% \section{Commands}
%
-% The \textit{only} commands which \textit{must} be used inside a TikZ picture
+% The \textit{only} `Rubik bundle' commands which \textit{must} be used inside a TikZ picture
% environment are the \cmd{\Draw...} commands (these are all provided by
% the \textsc{rubikcube} package), although most commands can be placed
-% inside a TikZ environment if necessary. However, using commands outside the environment
-% generally offers maximum flexibility, since the effects of commands used inside
-% a TikZ picture environment are `local' to that picture environment, and are not
-% therefore accessable outside the environment.
-%
-% The only command which must \textit{not}
-% be inside a TikZ environment is the \cmd{\ShowRubikErrors} command
+% inside a TikZ environment if you wish.
+%
+% However, using commands which influence the Rubik colour state
+% (e.g.,~the \cmd{\RubikRotation} command) outside the \texttt{tikzpicture},
+% \texttt{minipage} or \texttt{figure} environments
+% generally offers maximum flexibility, since the effects of such commands when
+% used inside these environments remain `local' to the environment, and are not
+% therefore accessable outside that \textit{particular} environment
+% (see also Section~4.1 in the \textsc{rubikcube} documentation).
+%
+% Conversely, the only \rubikrotation\ command which should \textit{not}
+% be used inside a TikZ environment is the \cmd{\ShowRubikErrors} command
% (see the notes on this command below).
%
%
-% \subsection{\cmd{\RubikRotation} command}
+% \subsection[RubikRotation command]{\cmd{\RubikRotation} command}
+% \label{sec:rubikrotationcmd}
%
% \DescribeMacro{\RubikRotation}
-% The \cmd{\RubikRotation}\marg{comma separated sequence} command processes
-% a comma separated sequence of rotations, and returns the final state.
+% The \cmd{\RubikRotation}\oarg{integer}\marg{comma separated sequence}
+% command processes a comma separated sequence of rotations, and returns
+% the final state. The optional \oarg{integer} argument specifies the number
+% of times the command should be repeated.
+%
% For example, if we wanted to see the effect of the rotations
% \textbf{R, R, L, U, D} on a solved Rubik cube, we could use the
% following commands.
+%\begin{quote}
% \begin{verbatim}
+% \RubikCubeSolved % sets up the colours for a solved cube state
+% \RubikRotation{R2,L,U,D}
% \begin{tikzpicture}[scale=0.7]
-% \RubikCubeSolved
-% \RubikRotation{R2,L,U,D}
% \DrawRubikCubeRU
-% \end{tikzpicture}
+% \end{tikzpicture}%
%\end{verbatim}
+%\end{quote}
% The \cmd{\RubikRotation} command results in \LaTeX\ first writing
% the current Rubik state to a text file (\texttt{rubikstate.dat}),
-% and then calling the Perl program \texttt{rubikrotation.pl}. The Perl
-% program then reads the current rubik state from the (\texttt{rubikstate.dat})
-% file, performs all the rotations, and then writes the new rubik state
+% and then calling the Perl script \texttt{rubikrotation.pl}. The Perl
+% script then reads the current Rubik state from the (\texttt{rubikstate.dat})
+% file, performs all the rotations, and then writes the new Rubik state
% (and any error messages) to the file \texttt{rubikstateNEW.dat},
-% which is then input on-the-fly by the \LaTeX\ file and used to generate
-% some graphic image of the cube.
-%
-% Note that the \cmd{\RubikRotation} command can be either inside
-% or before the Tikz picture environment. In fact only the `\cmd{\Draw...}'
-% commands (from the \textsc{rubikcube} package) actually need to be inside
-% a TikZ picture environment. Consequently this makes for great flexibility.
-%
-% \subsubsection{Arguments prefixed with a *}
-%
-% If any of the comma separated arguments (strings) is prefixed with a * it is
-% not processed as a rotation. This feature therefore allows a string argument
-% to be used as a label, which can be very useful.
-% For example, we can use the * feature to label the following
-% sequence as generating the so-called
-% `sixspot' configuration (described by Reid):
+% which is then input on-the-fly by the \LaTeX\ file. This new Rubik state
+% can then either used as the input for another \cmd{\RubikRotation}, or used
+% to generate a graphic image of the cube.
+%
+% A given rotation sequence can be repeated multiple times, say $n$ times, by
+% using the optional \verb![n]!. For example, the following two commands are equivalent:
+%\begin{quote}
% \begin{verbatim}
-% \RubikRotation{*sixspot,U,Dp,R,Lp,F,Bp,U,Dp}
+% \RubikRotation[3]{x,R,U}
+% \RubikRotation{x,R,U,x,R,U,x,R,U}
%\end{verbatim}
-% Alternatively, and probably more conveniently, we could simply use
-% the name `sixspot' to define a new command, as follows (which therefore allows
-% one to store lots of different rotation sequences by name alone):
+%\end{quote}
+%
+
+% \subsubsection{Sequences as macros}
+% \label{sec:seq-as-macros}
+%
+% Macros which are arguments of the \TeX\ \cmd{\write} command are expanded
+% on writing (Eijkhout 1992, \S\,30.2.3, p.\,238)[\,see refs Section~\ref{sec:references}\,].
+% Consequently we are able to use a sequence-defining macro as an argument for
+% the \cmd{\RubikRotation} command. In fact this is very convenient, since it allows
+% one to store lots of different rotation sequences by name alone.
+%
+% For example, we can use the name `sixspot' for a macro denoting the rotation sequence
+% which generates the well known `sixspot' configuration (see the `patterns' page on the
+% Reid website)[\,see refs Section~\ref{sec:references}\,], as follows:
+%\begin{quote}
% \begin{verbatim}
% \newcommand{\sixspot}{U,Dp,R,Lp,F,Bp,U,Dp}
%\end{verbatim}
-% With this `newcommand' we are now able to generate the graphic (sixspot cube)
-% much more easily using the following code:
+%\end{quote}
+% With this new \cmd{\sixspot} command we are now able to generate the graphic (sixspot cube)
+% very easily using the following code---this time we demonstrate the use of the more convenient
+% \cmd{\ShowCube} command (which includes the \texttt{tikzpicture} environment):
%
% \medskip
%
% \begin{minipage}{6cm}
% \begin{verbatim}
-% \begin{tikzpicture}[scale=0.7]
-% \RubikCubeSolved
-% \RubikRotation{\sixspot}
-% \DrawRubikCubeRU
-% \end{tikzpicture}
+% \RubikCubeSolved
+% \RubikRotation{\sixspot}
+% \ShowCube{3cm}{0.7}{\DrawRubikCubeRU}
%\end{verbatim}
% \end{minipage}
% \begin{minipage}{3.4cm}
% \centering
% \ifpdf
-% \includegraphics[height=3cm]{Rubikrot_doc_figA.pdf}
+% \includegraphics[height=3cm]{Rubikrot-doc-figA.pdf}
% \else
% \fi
% \end{minipage}
%
-%
% \medskip
+% Providing such macros (when used as arguments) are comma separated (as the rotation codes
+% must be), then the \cmd{\RubikRotation} command can accommodate both rotation codes
+% and macros; for example, \verb!\RubikRotation{x,y,\sixspot,x}!.
%
+%
+% \subsubsection{Arguments prefixed with *, [, ]}
+% \label{sec:prefixedargument}
+%
+% If any of the comma separated arguments is prefixed with either *, [ or ] they are
+% interpreted as an inactive `string', and not as a rotation. This feature therefore
+% allows a string argument to be used as a label, which can be very useful.
+%
+% For example, we can use this facility to label the `sixspot' configuration mentioned above,
+% as follows:
+%\begin{quote}
+% \begin{verbatim}
+% \RubikRotation{[sixspot],U,Dp,R,Lp,F,Bp,U,Dp}
+%\end{verbatim}
+%\end{quote}
% In practice, it is quite useful to go one step further and include
-% the \texttt{*} label feature as well in the newcommand, as follows:
+% the [\,] label feature in the \cmd{\sixspot} command, as follows,
+%\begin{quote}
% \begin{verbatim}
-% \newcommand{\sixspot}{*sixspot,U,Dp,R,Lp,F,Bp,U,Dp}
+% \newcommand{\sixspot}{[sixspot],U,Dp,R,Lp,F,Bp,U,Dp}
%\end{verbatim}
-% since this has the great advantage of making the particular
-% rotation sequence identified by the label-name visible in the log file.
-% For example, the following command, which uses the rotations \textbf{x2}
+%\end{quote}
+% since this has the great advantage of making the label-name visible in the log file.
+% For example, the following command, which uses the rotations \textbf{x}, \textbf{x}
% and \textbf{y} to initially rotate the `solved' cube before applying
% the `sixspot' sequence of rotations,
+%\begin{quote}
% \begin{verbatim}
% \RubikRotation{x2,y,\sixspot}
%\end{verbatim}
+%\end{quote}
% will then be represented in the log file as
+%\begin{quote}
% \begin{verbatim}
-% ...command=rotation,x2,y,*sixspot,U,Dp,R,Lp,F,Bp,U,Dp
-% ...arguments passed to `rotation' sub = x2 y *sixspot U Dp R Lp F Bp U Dp (n= 11)
+% ...command=rotation,x2,y,[sixspot],U,Dp,R,Lp,F,Bp,U,Dp
+% ...arguments passed to `rotation' sub = x2 y [sixspot] U Dp R Lp F ...
% ...rotation x OK (= rrR + rrSr + rrLp)
% ...rotation x OK (= rrR + rrSr + rrLp)
% ...rotation y OK (= rrU + rrSu + rrDp)
-% ...*sixspot is a label OK
+% ...[sixspot] is a label OK
% ...rotation U OK
% ...rotation Dp OK
% ...rotation R OK
@@ -426,8 +563,60 @@
% ...rotation U OK
% ...rotation Dp OK
%\end{verbatim}
+%\end{quote}
% In this way, several named rotation sequences can be easily distinguished
-% in the log file from adjacent rotation commands.
+% in the log file from adjacent rotation sequences.
+% This feature is also useful when typesetting a sequence of rotation codes, since the first
+% element will then appear in the form \verb![name]!, obviating the need to typeset the
+% name of the sequence separately.
+%
+% To this end, the
+% \verb!ForEachX! macro---from the \verb!forarray! package---can be very useful.
+% For example, this macro is central to the following example macro for typesetting
+% a rotation sequence using the Rubik \cmd{\rr} command:
+%\begin{quote}
+%\begin{verbatim}
+%\def\x{\thislevelitem}
+%\def\xcount{\thislevelcount}
+%
+%\newcommand{\showseq}[1]{%
+% \ForEachX{,}{%
+% \ifthenelse{\xcount=1}{\texttt{\x}}{,\ \rr{\x}}%
+% }{#1}.
+%}
+%\end{verbatim}
+%\end{quote}
+% Now, for a sequence defined as |\newcommand{\myseq}{[myseq],U,D,Lwp,R}|, then
+% the command |\showseq{\myseq}| will result in the following output:
+%\begin{quote}
+% \texttt{[myseq]},\ \textbf{U},\ \textbf{D},\ \textbf{Lwp},\ \textbf{R}.
+%\end{quote}
+% Note that we are able to typeset the name \texttt{[myseq]} differently from the
+% remaining sequence since the counter \verb!\xcount! allows us to locate the first item.
+% However, this macro as it stands needs further development in order to handle
+% sequence elements with a terminal digit (e.g.,~\texttt{R2})---the macro will need
+% to first expand this to \texttt{R, R} if the Rubik commands are to be used.
+%
+% \subsubsection{Groups}
+%
+% The \cmd{\RubikRotation} command is a convenient tool for
+% illustrating how Rubik rotations and sequences of rotations are elements
+% of groups and subgroups.
+% For~example, using the \rubikrotation\ package it is easy to
+% show that three cycles of the `sixspot' sequence return the Rubik cube to its
+% original state. More formally this is equivalent to $($\cmd{\sixspot}$)3 \equiv 0$,
+% and can be nicely illustrated by implementing the following pseudocode:
+%\begin{verbatim}
+% \RubikCubeSolved . \RubikRotation[3]{\sixspot} = \RubikCubeSolved
+%\end{verbatim}
+%
+% \begin{minipage}{11cm}
+% \centering
+% \ifpdf
+% \includegraphics[width=10cm]{Rubikrot-doc-figC.pdf}
+% \else
+% \fi
+% \end{minipage}
%
%
% \subsubsection{Random rotations}
@@ -438,65 +627,78 @@
% is an integer $n$, ($1\leq n \leq 200$), then a random sequence
% of $n$ rotations will be performed; otherwise a default value
% of 50 is used (for example, if the second argument is not an integer).
-% If $n > 200$ then the value $n=200$ will be used.
-%
+% If $n > 200$ then the currently set maximum value $n=200$ will be used.
+%
+% As a safety feature the maximum $n$ can be changed only by editing the
+% set value of the Perl variable \verb!$maxn! in the Perl script
+% \texttt{rubikrotation.pl}, where (see line~583) we currently have
+%\begin{quote}
+%\begin{verbatim}
+% my $maxn=200;
+%\end{verbatim}
+%\end{quote}
+%
% For example, the following commands will scramble a solved cube using a
% sequence of 120 random rotations, and display the state in the form of
% a semi-flat cube.
%
-% \medskip
-%
-% \begin{minipage}{5.5cm}
-%\begin{verbatim}
-% \RubikCubeSolved%
-% \RubikRotation{random,120}%
-% \begin{tikzpicture}[scale=0.5]
-% \DrawRubikCubeFlat
-% \end{tikzpicture}
-%\end{verbatim}
-% \end{minipage}
+
% \begin{minipage}{3.4cm}
% \centering
% \ifpdf
-% \includegraphics[height=4cm]{Rubikrot_doc_figB.pdf}
+% \includegraphics[height=4cm]{Rubikrot-doc-figB.pdf}
% \else
% \fi
% \end{minipage}
+% \begin{minipage}{6cm}
+% \vspace{1.6cm}
+%\begin{verbatim}
+% \RubikCubeSolved%
+% \RubikRotation{random,120}%
+% \ShowCube{5.5cm}{0.5}{\DrawRubikCubeFlat}
+%\end{verbatim}
+% \end{minipage}
%
% Note that in this particular example (above), only
-% the \cmd{\Draw..} command is inside the TikZ picture environment---a useful
-% method when more than one figure is being drawn. Note also, that when such
+% the \cmd{\Draw..} command is inside the TikZ picture environment (i.e.,~inside
+% the \cmd{\ShowCube} command). Note also that when Rubik
% commands are outside a TikZ picture environment, they should have a
% trailing \% to stop additional white space being included.
%
% \medskip
%
-% The procedure is that all the possible rotations are first allocated
-% a different number (integer) and collected into an array. Then a
-% sequence of $n$ randomised numbers is generated and mapped to the array
-% to generate the associated sequence of random rotations.
+% The randomisation procedure is as follows: all the possible rotations are first allocated
+% a different cardinal number (positive integer) and collected into an array.
+% Then a sequence of $n$ randomised numbers is generated and mapped to
+% the array to generate the associated sequence of random rotations.
% The sequence used is detailed in the \texttt{.log} file.
%
%
-% \subsection{\cmd{\SaveRubikState}}
+% \subsection[SaveRubikState]{\cmd{\SaveRubikState} command}
+% \label{saverubikstate}
%
% \DescribeMacro{\SaveRubikState}
% The command \cmd{\SaveRubikState}\marg{filename} saves the state (configuration)
% of the Rubik cube to the file \marg{filename} in the standard \cmd{\RubikFace...}
-% format. Consequently such a file can then be input at a later stage so it can be
-% drawn or processed in the usual way (inside the TikZ picture environment).
+% format so that it can be read by \LaTeX. Consequently such a file can then be input
+% so it can be drawn or processed in the usual way. The output file is `closed' immediately
+% following the `write' in order to allow it to be available for input later by the same
+% file if required.
%
% For example, the following commands would save the so-called `sixspot' configuration
% (generated by the rotations \textbf{U, Dp, R, Lp, F, Bp, U, Dp})
% to the file \verb!sixspot.tex!.
+%\begin{quote}
%\begin{verbatim}
% \RubikCubeSolved%
% \RubikRotation{*sixspot,U,Dp,R,Lp,F,Bp,U,Dp}%
% \SaveRubikState{sixspot.tex}%
%\end{verbatim}
+%\end{quote}
% The form of the file \verb!sixspot.tex! will then be as follows---the
% filename (commented out) is automatically written to the top of the
% file for convenience.
+%\begin{quote}
%\begin{verbatim}
% % filename: sixspot.tex
% \RubikFaceUp{O}{O}{O}{O}{W}{O}{O}{O}{O}%
@@ -506,75 +708,81 @@
% \RubikFaceFront{G}{G}{G}{G}{O}{G}{G}{G}{G}%
% \RubikFaceBack{B}{B}{B}{B}{R}{B}{B}{B}{B}%
%\end{verbatim}
+%\end{quote}
% We can therefore access and draw this configuration later, when required,
% simply by inputting the file as follows:
+%\begin{quote}
%\begin{verbatim}
-%\begin{tikzpicture}
-% \input{sixspot.tex}
-% \DrawRubikCubeFlat
-%\end{tikzpicture}
+%\input{sixspot.tex}
+%\ShowCube{7cm}{0.7}{\DrawRubikCubeFlat}
%\end{verbatim}
+%\end{quote}
%
%
-% \subsection{\cmd{\CheckRubikState} command}
+% \subsection[CheckRubikState]{\cmd{\CheckRubikState} command}
%
% \DescribeMacro{\CheckRubikState}
% Since it is easy to inadvertently define an invalid Rubik cube
-% (eg enter an invalid number of, say, yellow cubies), this command
+% (e.g.,~enter an invalid number of, say, yellow facelets), this command
% checks the current colour state of all the cubies
-% of a 3x3x3 Rubik cube, and shows the number of cubies of each colour.
-% An ERROR: code is issued if the number of cubies having a given colour exceeds 6.
+% of a 3x3x3 Rubik cube, and shows the number of facelets of each colour.
+% An ERROR: code is issued if the number of facelets having a given colour exceeds~6.
% The results are written to the the \texttt{.log} file, and displayed under
% the graphic if the \cmd{\ShowRubikErrors} command is used.
%
% One can check the current Rubik state (for errors) by issuing the command
+%\begin{quote}
%\begin{verbatim}
% \CheckRubikState%
%\end{verbatim}
+%\end{quote}
% Note that such a check is implemented automatically with each \cmd{\RubikRotation} command.
%
%
%
%
-% \subsection{\cmd{\ShowRubikErrors} command}
+% \subsection[ShowRubikErrors]{\cmd{\ShowRubikErrors} command}
%
% \DescribeMacro{\ShowRubikErrors}
-%
% Any errors which arise can be made visible using the
% command \cmd{\ShowRubikErrors}.
% This command places a copy of the `error' file (\texttt{rubikstateERRORS.dat})
-% underneath the image so you can see any errors if there are any---all this
+% underneath the graphic image so you can see any errors if there are any---all this
% detail can also be found in the \texttt{.log} file.
%
% Consequently, this command must be placed \textit{after} a TikZ picture
% environment---it cannot be used inside a TikZ environment. In fact this command
% is probably best placed at the end of the document (if there are several such
% environments), where it will reveal all rotation errors generated while
-% processing the document.
-%
+% processing the whole document.
+% Once the document is free of errors this command can be removed or just commented out.
+% Run the test file \texttt{example-rot.tex} to see an example of the use of this command.
%
% \section{Files generated}
%
%
% Whenever the \cmd{\RubikRotation} or \cmd{\CheckRubikState} commands are used,
-% three small temporary plain text files for holding data are generated as
+% three small temporary plain-text files for holding data are generated as
% follows (they are refreshed with each \LaTeX\ run, and are not actively deleted).
% \begin{itemize}
% \item \LaTeX\ writes Rubik state data to the file \texttt{rubikstate.dat}.
%
-% \item Perl reads the file \texttt{rubikstate.dat} and then writes
+% \item The Perl script \texttt{rubikrotation.pl} reads the file
+% \texttt{rubikstate.dat} and then writes
% the new rubik state to the file \texttt{rubikstateNEW.dat}.
%
-% \item Perl also writes error data to the file \texttt{rubikstateERRORS.dat}.
-% A copy of this file is displayed under the image when the command
-% \cmd{\ShowRubikErrors} is used after (outside) the TikZ picture environment.
+% \item The Perl script \texttt{rubikrotation.pl} also writes error data
+% to the file \texttt{rubikstateERRORS.dat}. A copy of this file is displayed
+% under the graphic image when the command
+% \cmd{\ShowRubikErrors} is used after the TikZ picture environment.
%
% \end{itemize}
%
%
% \section{General overview}
-%
-% When \LaTeX\ loads the \rubikrotation\ package the following steps are implemented.
+% \label{generaloverview}
+% When \LaTeX\ processes \texttt{rubikrotation.sty} the following steps
+% are implemented.
% \begin{itemize}
%
%
@@ -582,13 +790,13 @@
% then this package is loaded if it is available (this package is required
% for inputting the file \texttt{rubikstateERRORS.dat}).
%
-% \item[2.] A check is made to see if a configuration file (\texttt{rubikrotation.cfg})
+% \item[2.] A check is made to see if a configuration-file (\texttt{rubikrotation.cfg})
% exists: if so then this file is input.
%
% \item[3.] The text file \texttt{rubikstateNEW.dat} is overwritten (if it exists):
% otherwise the file is created (this prevents an `old' file being used by \LaTeX).
%
-% \item[4.] The plain text file \texttt{rubikstateERRORS.dat} is created.
+% \item[4.] The plain-text file \texttt{rubikstateERRORS.dat} is created.
% This file collects error messages generated by the Perl script.
%
% \end{itemize}
@@ -597,13 +805,14 @@
% When a \cmd{\RubikRotation} command is processed it first writes the current
% colour configuration of each face (the `rubik state') to the temporary file
% \texttt{rubikstate.dat} (to be read by the Perl script \texttt{rubikrotation.pl}).
-% The \cmd{\RubikRotation} command also appends the keyword `
-% \texttt{checkrubik}' as well as a copy of the string of Rubik rotations.
-% It then calls the Perl script \texttt{rubikrotation.pl}.
+% The \cmd{\RubikRotation} command also appends the keyword `\texttt{checkrubik}'
+% as well as a copy of the string of Rubik rotations.
+% It~then calls the Perl script \texttt{rubikrotation.pl}.
%
% For example, if we use the command \cmd{\RubikCubeSolved}
-% followed by the command \verb!\RubikRotation{U,D,L,R}! then the associated
+% followed by the command \verb!\RubikRotation[2]{U,D,L,R}!, then the associated
% \texttt{rubikstate.dat} file would be as follows:
+%\begin{quote}
% \begin{verbatim}
% % filename: rubikstate.dat
% up,W,W,W,W,W,W,W,W,W
@@ -614,39 +823,141 @@
% back,R,R,R,R,R,R,R,R,R
% checkstate
% rotation,U,D,L,R
+% rotation,U,D,L,R
%\end{verbatim}
-% Alternatively, if the \cmd{\RubikRotation} command was
+%\end{quote}
+% Note that the \cmd{\RubikRotation} option \texttt{[2]} results in the line \texttt{rotation,U,D,L,R}
+% being written twice to the \texttt{rubikstate.dat} file, as shown above.
+%
+% Alternatively, if we used the command
% \verb!\RubikRotation{random, 45}! then the last line written to the file
-% would be the string `\texttt{rotation,random,45}'
+% would be the string `\texttt{rotation,random,45}', as follows:
+%\begin{quote}
+% \begin{verbatim}
+% % filename: rubikstate.dat
+% up,W,W,W,W,W,W,W,W,W
+% down,Y,Y,Y,Y,Y,Y,Y,Y,Y
+% left,B,B,B,B,B,B,B,B,B
+% right,G,G,G,G,G,G,G,G,G
+% front,O,O,O,O,O,O,O,O,O
+% back,R,R,R,R,R,R,R,R,R
+% checkstate
+% rotation,random,45
+%\end{verbatim}
+%\end{quote}
% A \cmd{\CheckRubikState} command triggers the same sequence of events except
% no `rotation' line is written.
%
-% The action of the Perl program is controlled by the keywords (first argument of
+% The action of the Perl script \texttt{rubikrotation.pl} is controlled by
+% the keywords (first argument of
% each line) associated with each line of the file \texttt{rubikstate.dat}.
-% When control passes to Perl, the Perl program starts by loading the
-% rubikstate (prompted by the keywords up, down,
-% left, right, front, back). Next the program performs
-% some basic checks (prompted by the key word `checkstate'), and then it processes
-% the sequence of Rubik rotations (prompted by the keyword `rotation').
-% If, instead, the second argument of the `rotation' string is the keyword `random', and
-% provided this is followed by a valid integer, say $n$, then the Perl program performs
-% a sequence of $n$ random rotations.
-% Finally, the Perl program writes the final `rubikstate' to the text file
+% When control passes to Perl, the script \texttt{rubikrotation.pl} starts
+% by loading the current rubikstate (prompted by the keywords \texttt{up}, \texttt{down},
+% \texttt{left}, \texttt{right}, \texttt{front}, \texttt{back}, in the file
+% \texttt{rubikstate.dat}). Next the Perl script
+% performs some basic checks (prompted by the key word \texttt{checkstate}), and
+% then it processes the sequence of Rubik rotations (prompted by the keyword
+% \texttt{rotation}). If, instead, the second argument of the `rotation' string
+% is the keyword `random', and provided this is followed by a valid integer, say $n$,
+% then the Perl script performs a sequence of $n$ random rotations.
+% Finally, the Perl script writes the final `rubikstate' to the text file
% \texttt{rubikstateNEW.dat}. All error messages are written to the
% text file \texttt{rubikstateERRORS.dat} and also to the \LaTeX\ log file.
%
% Control then reverts to \LaTeX\ which then inputs the file
% \texttt{rubikstateNEW.dat}. If there are more \cmd{\RubikRotation} commands
-% then this cycle repeats accordingly. Eventually a `\texttt{Draw...}' command
+% then this cycle repeats accordingly. Eventually a \cmd{\Draw...} command
% of some form is reached and the final rubikstate is drawn in a TikZ picture
% environment.
%
% If the TikZ picture environment is followed by a \cmd{\ShowRubikErrors} command,
% then a `verbatim' copy of the \texttt{rubikstateERRORS.dat} file is displayed
% immediately under the graphic. Once the graphic is error-free, then the
-% \cmd{\ShowRubikErrors} can be removed or commented out.
+% \cmd{\ShowRubikErrors} command can be removed or commented out.
+%
+% Note that if a \textsc{bash} file is used to coordinate the process then it is often
+% convenient to use the linux \texttt{grep} utility to alert the user to any run-time errors,
+% by using \texttt{grep} to scan the \texttt{rubikstateERRORS.dat} file at the end of
+% the run; for example, as follows:
+%\begin{quote}
+%\begin{verbatim}
+% pdflatex --shell-escape myfile.tex
+% echo "...checking error file"
+% grep ERROR ./rubikstateERRORS.dat
+%\end{verbatim}
+%\end{quote}
+%
+%
+% \section{References}
+% \label{sec:references}
+%
+%\begin{itemize}
+%
+% \item Abrahams PW, Berry K and Hargreaves KA (1990). \textit{\TeX\ for the impatient}
+% (Addison-Wesley Publishing Company), page~292.
+% {\newline}Available from: \url{http://www.ctan.org/pkg/impatient}
+% {\newline}[\,re:~\cmd{\rubikpercentchar} and \cmd{\@comment} in Section~\ref{sec:abrahams}\,]
+%
+%
+% \item Eijkhout V (1992). \textit{\TeX\ by topic: a {\TeX}nician's reference}.
+% (Addison-Wesley Publishing Company), pages~232 \&~238.
+% {\newline}Available from: \url{https://bitbucket.org/VictorEijkhout/tex-by-topic/}
+% [\,re:~\cmd{\string} in Section~\ref{sec:eijkhout}\,]
+% [\,re:~\cmd{\write} in Section~\ref{sec:seq-as-macros}\,]
+%
+%
+% \item Feuers\"{a}nger C (2015). Notes on programming in \TeX.
+% {\newline}(revision: 1.12.1-32-gc90572c; 2015/07/29)
+% \newline\url{http://pgfplots.sourceforge.net/TeX-programming-notes.pdf}
+% {\newline}[\,re:~loop macros in Section~\ref{sec:feuersanger}\,]
+%
+%
+% \item Nickalls RWD and Syropoulos A (2015). The \textsc{rubikcube} package.
+% \newline\url{http://www.ctan.org/pkg/rubik},
+%
+% \item Reid M. \ Patterns. \url{http://www.cflmath.com/Rubik/patterns.html}
+% {\newline}[\,re:~sequences as macros; in Section~\ref{sec:seq-as-macros}\,]
+%
+%\end{itemize}
+%
+%
%
+% \section{Change history}
%
+% \begin{itemize}
+% \item Version 3.0 (25 September 2015)
+%
+% --- The \cmd{\RubikRotation} command now actions multiple instances of its argument
+% as determined by an optional `repeat' \oarg{integer}. For example the command
+% \cmd{\RubikRotation[3]\{R,x\}} is equivalent to the command \cmd{\RubikRotation\{R,x,R,x,R,x\}}
+% (see Sections~\ref{sec:rubikrotationcmd} and \ref{sec:rubikrotationcode}).
+%
+% --- If a comma separated element used as an argument for the \cmd{\RubkRotation}
+% command is prefixed with either a * or [ or ] character then it is not actioned
+% as a rotation (see Section~\ref{sec:prefixedargument}).
+%
+% --- The Perl script \texttt{rubikrotation.pl} now has command-line switches,
+% including \texttt{-h} to show some `help' and `usage' information
+% (see Section~\ref{sec:placingfiles}).
+%
+% --- A `man' file for the Perl script \texttt{rubikrotation.pl} is now included in the package.
+%
+% --- The Perl script \texttt{rubikrotation.pl} now uses as input and output filenames
+% those specified in the command-line of the CALLing program. This now allows the
+% script \texttt{rubikrotation.pl} to be used as a stand-alone tool (see the
+% \texttt{rubikrotation} `man' file for details).
+%
+% --- The documentation for the Perl script \texttt{rubikrotation.pl} is in the
+% accompanying file \texttt{rubikrotationPL.pdf}.
+%
+% --- Fixed typos, index and minor errors in the documentation.
+%
+%
+% \item Version 2.0 (5 February, 2014)
+%
+% --- First release.
+%
+% \end{itemize}
%
% ^^A ==================================================
% \StopEventually{\PrintIndex}
@@ -654,21 +965,27 @@
%
%
% \section{The code (\texttt{rubikrotation.sty})}
-%
+%
+% {\noindent}In the following, the term `Perl script' denotes the script
+% \texttt{rubikrotation.pl}. Useful information regarding the
+% \TeX\ \cmd{\write} command is given in Eijkhout (1992), \S\,30.2.3 (page~238).
+% For the means of including a `\%' character in the token list of \cmd{\write} see
+% Abrahams \textit{et.~al} (1990).
+%
% \subsection{Package heading}
%
% \begin{macrocode}
%<*rubikrotation>
-\def\RRfileversion{2.0}%
-\def\RRfiledate{2014/01/20}%
+\def\RRfileversion{3.0}%
+\def\RRfiledate{2015/09/25}%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rubikrotation}[\RRfiledate\space (v\RRfileversion)]
% \end{macrocode}
%
%
-% {\noindent}The package requires rubikcube.sty. Do not automatically
-% load rubikcube.sty since this makes it difficult to errorcheck new
-% versions (for the moment at least).
+% {\noindent}The package requires \texttt{rubikcube.sty}. However \texttt{rubikcube.sty}
+% is not automatically loaded (for the moment at least) since this makes it difficult
+% to errorcheck new versions.
% \begin{macrocode}
\@ifpackageloaded{rubikcube}{}{%
\typeout{---rubikrotation requires the rubikcube package.}%
@@ -678,23 +995,34 @@
%
%
% {\noindent}The \rubikrotation\ package requires access to the fancyvrb package
-% for the \cmd{\VerbatimInput\{\}} command which we use for inputting and displaying
-% the error file.
+% for the \cmd{\VerbatimInput\{\}} command which we use for inputting and displaying
+% the error file (see Section~\ref{sec:showrubikerrors}).
% \begin{macrocode}
\@ifpackageloaded{fancyvrb}{}{%
\typeout{---rubikrotation requires the fancyvrb package%
for VerbatimInput{} command.}%
\RequirePackage{fancyvrb}}
% \end{macrocode}
-% \medskip
%
+% \medskip
%
-%\subsection{Some useful commands}
-% \label{sec:usefulcommands}
+% \subsection{Some useful commands}
+% \label{sec:usefulcommands}
+%
% \begin{macro}{\rubikrotation}
% First we create a suitable logo
% \begin{macrocode}
-\newcommand{\rubikrotation}{\textsf{rubikrotation}}
+\newcommand{\rubikrotation}{\textsc{rubikrotation}}
+\newcommand{\Rubikrotation}{\textsc{Rubikrotation}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\@print}
+% We need a simple print command to facilitate writing output to a file.
+% \begin{macrocode}
+\newcommand{\@print}[1]{\immediate\write\outfile{#1}}
% \end{macrocode}
% \end{macro}
%
@@ -702,11 +1030,17 @@
%
% \begin{macro}{\@comment}
% \begin{macro}{\@commentone}
-% We require access to the percent character so we can write comments
-% in files, including the log file.
-% We first define percentchar for the write statement
-% (From Abrahams PW, Berry K and Hargreaves KA (1990), ``TeX for the Impatient'', p~292;
-% available from: CTAN.../info/impatient/)
+% We also require access to the `\%' character so we can (a)~write comments to
+% files, including the log file, and (b)~place a trailing `\%' in a line of code
+% written to a file.
+%
+% To achieve this we define the `\%' character as \cmd{\rubikpercentchar}
+% (modified from: Abrahams PW, Berry K and Hargreaves KA (1990), p~292)
+% [see refs Section~\ref{sec:references}]\label{sec:abrahams},
+% and also two `comment' commands which implement it. This `workaround'
+% is necessary because \TeX\ does not allow the use of the \cmd{\%} command
+% for placing a `\%' character in the token list of \cmd{\write}.
+% See Abrahams \textit{et.~al} (1990) for details.
% \begin{macrocode}
{\catcode`\%=12 \global\def\rubikpercentchar{%}}%
\newcommand{\@comment}{\rubikpercentchar\rubikpercentchar\space}%
@@ -716,39 +1050,50 @@
% \end{macro}
%
%
-% \begin{macro}{\@print}
-%% We need a simple print command for writing comments to a file.
-% \begin{macrocode}
-\newcommand{\@print}[1]{\immediate\write\outfile{#1}}
-% \end{macrocode}
-% \end{macro}
-%
-%
%
% \begin{macro}{\rubikperlname}
-% This holds the name of the Perl-5 script . It is used later to check
-% whether the Perl script exists or not. A plain text configuration file
-% \verb!rubikrotation.cfg! can be used to change the default name of the
-% Perl script using a renewcommand.
+% This holds the name of the Perl script. A configuration-file
+% (\verb!rubikrotation.cfg!) can be used to change the default name of the
+% Perl script using a renewcommand (see Section~\ref{sec:configfile}).
% \begin{macrocode}
-\newcommand{\rubikperlname}{rubikrotation.pl}
+\newcommand{\rubikperlname}{rubikrotation}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\rubikperlcmd}
-% This holds the commandline code for calling the the Perl script.
-% A plain text configuration file \verb!rubikrotation.cfg! can be used to
-% change the default commandline code using a renewcommand.
+% This holds the command-line code for calling the Perl script
+% (assumed to be an executable file).
+% Note that the command-line requires a mandatory input filename preceded
+% by the \texttt{-i}~switch. An optional output filename (preceded by the
+% \texttt{-o}~switch) may be used, otherwise the default output filename of
+% \texttt{rubik-OUT.dat} will be used.
+%
+% Note that it is very important that this .sty file actually specifies an
+% output filename (for receiving data from the Perl script). This is because
+% (a)~The Perl script \texttt{rubikrotation.pl} is currently configured to read its
+% output filename as an argument from the command-line (so it can be flexibly
+% used as a stand-alone script for processing a given Rubik state through a
+% sequence of rotations), and (b)~\texttt{rubikrotation.sty} is currently
+% configured to read its input from the file \texttt{rubikstateNEW.dat}.
% \begin{macrocode}
-\newcommand{\rubikperlcmd}{perl \rubikperlname}
+\newcommand{\rubikperlcmd}{\rubikperlname\space%
+ -i rubikstate.dat -o rubikstateNEW.dat}
% \end{macrocode}
+% Remember to use the \cmd{\space} command following the \LaTeX\ backslash
+% command in order to generate the mandatory space between it and the first
+% command-line argument).
+%
+% A plain-text configuration-file \verb!rubikrotation.cfg! can be used to
+% change the default command-line code using a renewcommand
+% (see Section~\ref{sec:configfile}).
% \end{macro}
%
%
-%\subsection{Configuration file}
-% If a config file exists (rubikrotation.cfg) then input it here,
-% ie \textit{after} defining the \cmd{\rubikperlname} and \cmd{\rubikperlcmd}
+% \subsection{Configuration file}
+%
+% If a configuration file exists (\texttt{rubikrotation.cfg}) then input it here,
+% i.e.,~\textit{after} defining the \cmd{\rubikperlname} and \cmd{\rubikperlcmd}
% commands and \textit{before} creating the \texttt{rubikstateERRORS.dat} file.
% \begin{macrocode}
\typeout{---checking for config file (rubikrotation.cfg)...}
@@ -761,71 +1106,61 @@
%
% \subsection{Clean file rubikstateNEW.dat}
%
-% {\noindent}We need to clean any existing (old) rubikstateNEW.dat file,
-% since if the TeX shell switch is accidentally not used then Perl will
-% not be CALLed and hence this file will not be renewed
-% (ie an `old' image may be used).
+% {\noindent}We need to clean out any existing (old) rubikstateNEW.dat file,
+% since if the TeX shell command-line switch is accidentally not used then the Perl script
+% \texttt{rubikrotation.pl} will not be CALLed, and hence this file will not be renewed
+% (i.e.,~an `old' image may be used).
% \begin{macrocode}
\typeout{---cleaning file rubikstateNEW.dat}%
\newwrite\outfile%
\immediate\openout\outfile=rubikstateNEW.dat%
-\@print{\@comment rubikstateNEW.dat (by TeX)}%
+\@print{\@comment rubikstateNEW.dat}%
\immediate\closeout\outfile%
% \end{macrocode}
%
%
% \subsection{rubikstateERRORS.dat}
%
-% {\noindent}The \rubikrotation\ package requires the Perl program.
-% We first open the file \texttt{rubikstateERRORS.dat} which is used
-% by the Perl program (\texttt{rubikrotation.pl}) for writing its error
-% messages to. This file is accessed and displayed by the command
+% {\noindent}We first open the file \texttt{rubikstateERRORS.dat} which is used
+% by the Perl script \texttt{rubikrotation.pl} for writing its error-messages to.
+% This file is displayed by the command
% \cmd{\ShowRubikErrors}.
%
-% \textsc{important note}: this file is created fresh each time LaTeX is run
-% and hence the Perl program only appends data to it during the \LaTeX\ run,
-% so this file just grows until either it is destroyed or recreated---a useful
-% feature to keep since the file accumulates all error messages as the
-% .tex file is processed.
-% We can't make the Perl program create the file since the Perl program is only
+% \textsc{important note}: this file is created fresh each time LaTeX is run,
+% and hence the Perl script only appends data to it during the \LaTeX\ run,
+% so this file just grows until either it is destroyed or recreated---this is
+% a useful feature since the file accumulates all error messages as the
+% \texttt{.tex} file is processed.
+% We can't make the Perl script create the file since the Perl script is only
% CALLed if we use a \cmd{\RubikRotation} or \cmd{\CheckRubikState}
-% command (which we may not!)---so it has to be created (opened) here.
-%
-% The following code first opens the file, and then checks to see if
-% the Perl program (\cmd{\rubikperlname}) exists;
-% if the Perl prog does exist then all is OK,
-% otherwise we write an error message to the file.
+% command (which we may not\,!)---so it has to be created here.
% \begin{macrocode}
\typeout{---creating file rubikstateERRORS.dat}%
\newwrite\outfile%
\immediate\openout\outfile=rubikstateERRORS.dat%
\@print{\@comment rubikstateERRORS.dat}%
-\typeout{---checking for Perl script \rubikperlname...}
- \IfFileExists{\rubikperlname}{%
- \typeout{---\rubikperlname\space exists OK}%
- }{\typeout{** ERROR: cannot find Perl program \rubikperlname}%
- \@print{\@comment ** ERROR: cannot find Perl program \rubikperlname}}%
+\@print{\@comment ---(RR.sty v\RRfileversion): comments output by Perl script}%
\immediate\closeout\outfile%
% \end{macrocode}
%
%
-% \subsection{Setting up a newwrite and file-access for new files}
+% \subsection{Setting up file-access for new files}
%
% Having set up all the primary files, we now need to set up a newwrite for
-% all subsequent files openings (eg for rubikstate.dat and saving
+% all subsequent file openings (e.g.,~for \texttt{rubikstate.dat} and saving
% to arbitrary filenames by the \cmd{\SaveRubikState} command). Otherwise, we
-% can easily exceed the LaTeX limit of 15. From here-on \TeX\ will use openout7
-% when opening and writing to files. We will implement new openings using
-% the command \verb!\@openstatefile! (see below).
+% can easily exceed the LaTeX limit of 15. From here-on \TeX\ will use
+% \texttt{openout7} when opening and writing to files. We will implement new
+% openings using the command \verb!\@openstatefile! (see below).
% \begin{macrocode}
-\typeout{---setting up newwrite for rubikrotation to use...}%
+\typeout{---setting up newwrite for rubikrotation.sty to use...}%
\newwrite\outfile%
% \end{macrocode}
%
%
% \begin{macro}{\@openstatefile}
% \begin{macro}{\@closestatefile}
-% We also need commands for easy file opening and and closing
+% We also need commands for easy file opening and closing
% for new instances of the file \texttt{rubikstate.dat} etc.
% Note that for this we are therefore using the same outfile number as set up
% by the \verb!\newwrite...! above.
@@ -840,12 +1175,19 @@
% \subsection{Saving the Rubik state}
%
% \begin{macro}{\@printrubikstate}
-% This command writes the Rubik configuration (state) to
-% the file \texttt{rubikstate.dat}, and is used by the \cmd{\RubikRotation} command.
-% The file \texttt{rubikstate.dat} is read by the Perl program, and represents
+% This internal command writes the Rubik configuration to
+% the file \texttt{rubikstate.dat}, and is used by the \cmd{\RubikRotation} command
+% (see Sections~\ref{saverubikstate} and \ref{generaloverview}).
+% The file \texttt{rubikstate.dat} is read by the Perl script, and represents
% the state on which the new \cmd{\RubikRotation} command acts.
% Note that we append the key-word \texttt{checkstate} to the end of the file
-% in order to trigger the Perl program to implement its \texttt{checkstate} subroutine.
+% in order to trigger the Perl script to implement its \texttt{checkstate} subroutine.
+%
+% The actual state is simply an ordered sequence of the faces and the colours
+% associated with each facelet of that face. The colour associated with a particular facelet
+% is held by the variable for that facelet. For example, the top-left facelet associated with
+% the \textsc{front} face is held in the variable \cmd{\Flt} (see Section~\ref{saverubikstate}).
+% Further relevant documentation is in the \textsc{rubikcube} package.
% \begin{macrocode}
\newcommand{\@printrubikstate}{%
\@print{up,\Ult,\Umt,\Urt,\Ulm,\Umm,\Urm,\Ulb,\Umb,\Urb}%
@@ -860,43 +1202,123 @@
% \end{macro}
%
%
+% \subsection{SaveRubikState command}
+% \label{sec:eijkhout}
+%
+% \begin{macro}{\SaveRubikState}
+% The command \cmd{\SaveRubikState}\marg{filename} saves the Rubik state
+% to a named file in the format of a Rubik command (so it can then be processed
+% by \LaTeX). Note that in order to actually write a LaTeX
+% command to a file without a trailing space one must prefix the command with the
+% \cmd{\string} command (see Eijkhout (1992), p~238)
+% [see refs Section~\ref{sec:references}]\label{sec:eijkhout}.
+%
+% Note that this macro uses the internal commands \cmd{\@comment} (`\%\%'),
+% \cmd{\@commentone} (`\%') and \cmd{\@print}. \#1 is the output filename.
+% We use several \cmd{\typeout} commands to write to the log file.
+% An example of the line of code we are trying to output to the
+%\texttt{rubikstateNEW.dat} file is as follows:
+% {\newline}\verb!\RubikFaceUp{W}{W}{G}{W}{W}{G}{B}{B}{Y}%!
+% \begin{macrocode}
+\newcommand{\SaveRubikState}[1]{%
+\typeout{---NEW save command------------------}%
+\typeout{---command = SaveRubikState{#1}}%
+\typeout{---saving Rubik state data to file #1}%
+\immediate\openout\outfile=#1%
+\@print{\@comment filename: #1\@commentone}%
+\@print{\string\RubikFaceUp%
+ {\Ult}{\Umt}{\Urt}{\Ulm}{\Umm}{\Urm}{\Ulb}{\Umb}{\Urb}\@commentone}%
+\@print{\string\RubikFaceDown%
+ {\Dlt}{\Dmt}{\Drt}{\Dlm}{\Dmm}{\Drm}{\Dlb}{\Dmb}{\Drb}\@commentone}%
+\@print{\string\RubikFaceLeft%
+ {\Llt}{\Lmt}{\Lrt}{\Llm}{\Lmm}{\Lrm}{\Llb}{\Lmb}{\Lrb}\@commentone}%
+\@print{\string\RubikFaceRight%
+ {\Rlt}{\Rmt}{\Rrt}{\Rlm}{\Rmm}{\Rrm}{\Rlb}{\Rmb}{\Rrb}\@commentone}%
+\@print{\string\RubikFaceFront%
+ {\Flt}{\Fmt}{\Frt}{\Flm}{\Fmm}{\Frm}{\Flb}{\Fmb}{\Frb}\@commentone}%
+\@print{\string\RubikFaceBack%
+ {\Blt}{\Bmt}{\Brt}{\Blm}{\Bmm}{\Brm}{\Blb}{\Bmb}{\Brb}\@commentone}%
+\immediate\closeout\outfile%
+\typeout{-----------------------------------------}%
+}%
+% \end{macrocode}
+% \end{macro}
+%
+%
% \subsection{RubikRotation command}
+% \label{sec:rubikrotationcode}
%
% \begin{macro}{\RubikRotation}
-% The \cmd{\RubikRotation}\marg{comma separated sequence}
-% command (a)~writes the current Rubik state to the file
-% \texttt{rubikstate.dat}, and then (b)~CALLs the Perl program.
-% It also writes comments to the data file and also to the log file.
+% The \cmd{\RubikRotation}\oarg{integer}\marg{comma separated sequence}
+% command (a)~writes the current Rubik state to the file \texttt{rubikstate.dat},
+% (b)~writes the rotation sequence (either once or multiple times depending
+% on the value of the optional integer argument), and then (c)~CALLs the
+% Perl script \texttt{rubikrotation.pl}. It~also writes comments to the
+% data file and also to the log file.
+%
+% In order to allow the user to (optionally) write the main argument multiple
+% times to the output data-file, we require this command to allow an optional
+% argument (a non-negative integer) to specify the number of such repeats.
+% In order to implement an optional argument facility we use two macros
+% (countingloop and loopcounter) detailed by Feuers\"{a}nger (2015)
+% [\,see refs Section~\ref{sec:references}\,]\label{sec:feuersanger},
+% as follows:
% \begin{macrocode}
-\newcommand{\RubikRotation}[1]{\IfFileExists{\rubikperlname}{%
+%% Two macros detailed by Feuersaenger (2015)
+\long\def\@countingloop#1 in #2:#3#4{%
+ #1=#2 %
+ \@loopcounter{#1}{#3}{#4}%
+}
+%%--------------------------
+\long\def\@loopcounter#1#2#3{%
+ #3%
+ \ifnum#1=#2 %
+ \let\next=\relax%
+ \else
+ \advance#1 by1 %
+ \def\next{\@loopcounter{#1}{#2}{#3}}%
+ \fi
+ \next
+}
+% \end{macrocode}
+% Having defined the above two macros we can now implement an optional
+% argument (a repeat number) indicating the number of times we want
+% the command to write the main argument to the output data file.
+% \begin{macrocode}
+\newcommand{\RubikRotation}[2][1]{%
\typeout{---NEW rotation command------------------}%
\typeout{---command = RubikRotation{#1}}%
- \typeout{---Perl script \rubikperlname\space exists OK}%
\typeout{---writing current Rubik state to file rubikstate.dat}%
\@openstatefile% open data file
\@print{\@comment filename: rubikstate.dat}%
+ \@print{\@comment written by rubikrotation.sty%
+ =v\RRfileversion\space (\RRfiledate)}%
\@printrubikstate%
- \@print{rotation,#1}%
+%% countingloop code from Feuersaenger (2015)
+ \newcount\ourRRcounter%
+ \@countingloop{\ourRRcounter} in 1:{#1}{%
+ \immediate\write\outfile{rotation,#2}}%
\@closestatefile% close data file
- \typeout{---running Perl script}%
+ \typeout{---running Perl script (rubikrotation)}%
\immediate\write18{\rubikperlcmd}%
- \typeout{---inputting NEW datafile (from Perl)}%
+ \typeout{---inputting NEW datafile (written by Perl script)}%
\input{rubikstateNEW.dat}%
\typeout{-----------------------------------------}%
- }{\typeout{** ERROR: \rubikperlname\space does not exist}%
-}}
+ }
% \end{macrocode}
% \end{macro}
%
%
% \subsection{ShowRubikErrors command}
+% \label{sec:showrubikerrors}
%
% \begin{macro}{\ShowRubikErrors}
% This command inputs the file \texttt{rubikstateERRORS.dat}.
% \begin{macrocode}
\newcommand{\ShowRubikErrors}{%
\typeout{---ShowRubikErrors: inputting file rubikstateERRORS.dat}%
- \VerbatimInput{rubikstateERRORS.dat}}
+ \VerbatimInput{rubikstateERRORS.dat}%
+ }
% \end{macrocode}
% \end{macro}
%
@@ -904,69 +1326,30 @@
% \subsection{CheckRubikState command}
%
% \begin{macro}{\CheckRubikState}
-% This command triggers the Perl program to implement
+% This command triggers the Perl script to implement
% some simple error checking of the Rubik configuration (state).
% This command (a)~writes the current Rubik state to the file
-% \texttt{rubikstate.dat}, and then (b)~CALLs the Perl program.
+% \texttt{rubikstate.dat}, and then (b)~CALLs the Perl script.
% It also writes comments to the data file and also to the log file..
% \begin{macrocode}
-\newcommand{\CheckRubikState}{\IfFileExists{\rubikperlname}{%
+\newcommand{\CheckRubikState}{%
\typeout{---NEW check command------------------}%
\typeout{---command = CheckRubikState}%
- \typeout{---Perl script \rubikperlname\space exists OK}%
\typeout{---writing current Rubik state to file rubikstate.dat}%
\@openstatefile% opens data file
\@print{\@comment filename: rubikstate.dat}%
\@printrubikstate%
\@closestatefile% close data file
- \typeout{---running Perl script}%
+ \typeout{---running Perl script (rubikrotation)}%
\immediate\write18{\rubikperlcmd}%
- \typeout{---inputting NEW datafile (from Perl)}%
+ \typeout{---inputting NEW datafile (written by Perl script)}%
\input{rubikstateNEW.dat}%
\typeout{-----------------------------------------}%
- }{\typeout{** ERROR: \rubikperlname\space does not exist}%
-}}
+ }
% \end{macrocode}
% \end{macro}
%
%
-%
-% \subsection{SaveRubikState macro}
-%
-% \begin{macro}{\SaveRubikState}
-% The command \cmd{\SaveRubikState}\marg{filename} saves the Rubik state
-% to a file. Note that in order to actually write a LaTeX
-% command to a file without a trailing space one must use the
-% \cmd{\string} command (see the book ``TeX by Topic'', p~238).
-% Note that this macro uses the two internal commands \cmd{\Rubik@comment}
-% and \cmd{\Rubik@print}. \#1 is the output filename.
-% We use several \cmd{\typeout} commands to write to the log file.
-% \begin{macrocode}
-\newcommand{\SaveRubikState}[1]{%
-\typeout{---NEW save command------------------}%
-\typeout{---command = SaveRubikState{#1}}%
-\typeout{---saving Rubik state data to file #1}%
-\immediate\openout\outfile=#1%
-\@print{\@comment filename: #1\@commentone}%
-\@print{\string\RubikFaceUp%
- {\Ult}{\Umt}{\Urt}{\Ulm}{\Umm}{\Urm}{\Ulb}{\Umb}{\Urb}\@commentone}%
-\@print{\string\RubikFaceDown%
- {\Dlt}{\Dmt}{\Drt}{\Dlm}{\Dmm}{\Drm}{\Dlb}{\Dmb}{\Drb}\@commentone}%
-\@print{\string\RubikFaceLeft%
- {\Llt}{\Lmt}{\Lrt}{\Llm}{\Lmm}{\Lrm}{\Llb}{\Lmb}{\Lrb}\@commentone}%
-\@print{\string\RubikFaceRight%
- {\Rlt}{\Rmt}{\Rrt}{\Rlm}{\Rmm}{\Rrm}{\Rlb}{\Rmb}{\Rrb}\@commentone}%
-\@print{\string\RubikFaceFront%
- {\Flt}{\Fmt}{\Frt}{\Flm}{\Fmm}{\Frm}{\Flb}{\Fmb}{\Frb}\@commentone}%
-\@print{\string\RubikFaceBack%
- {\Blt}{\Bmt}{\Brt}{\Blm}{\Bmm}{\Brm}{\Blb}{\Bmb}{\Brb}\@commentone}%
-\immediate\closeout\outfile%
-\typeout{-----------------------------------------}%
-}%
-% \end{macrocode}
-% \end{macro}
-%
-%
% --------------------------
% End of this package
% --------------------------
diff --git a/Master/texmf-dist/source/latex/rubik/rubikrotation.ins b/Master/texmf-dist/source/latex/rubik/rubikrotation.ins
index 3f1f2f1f354..99384f15aa4 100644
--- a/Master/texmf-dist/source/latex/rubik/rubikrotation.ins
+++ b/Master/texmf-dist/source/latex/rubik/rubikrotation.ins
@@ -1,9 +1,14 @@
%% rubikrotation.ins
+%%
+%% version 3.0
+%%
%% --- automatic overwriting of .sty is disabled-------
%% =========================================================
%% Authors: RWD Nickalls (dick@nickalls.org)
-%% and Apostolos Syropoulos (asyropoulos@yahoo.com)
-%% Copyright January 20, 2014 RWD Nickalls + A Syropoulos
+%% and
+%% Apostolos Syropoulos (asyropoulos@yahoo.com)
+%%
+%% Copyright 25 September 2015 RWD Nickalls + A Syropoulos
%%
%%
%% This work may be distributed and/or modified under the
@@ -27,7 +32,8 @@
-----------------------------------------------------------------
Authors: RWD Nickalls (dick@nickalls.org)
and Apostolos Syropoulos (asyropoulos@yahoo.com)
- Copyright January 2014 RWD Nickalls and A Syropoulos
+
+ Copyright 25 September 2015 RWD Nickalls and A Syropoulos
This work may be distributed and/or modified under the
diff --git a/Master/texmf-dist/tex/latex/rubik/rubikcube.sty b/Master/texmf-dist/tex/latex/rubik/rubikcube.sty
index 0737dc74aca..f86987c7092 100644
--- a/Master/texmf-dist/tex/latex/rubik/rubikcube.sty
+++ b/Master/texmf-dist/tex/latex/rubik/rubikcube.sty
@@ -10,12 +10,12 @@
%% Authors: RWD Nickalls (dick@nickalls.org)
%% and Apostolos Syropoulos (asyropoulos@yahoo.com)
%%
-%% Copyright 2014 RWD Nickalls and A Syropoulos
+%% Copyright 2015 RWD Nickalls and A Syropoulos
%%
%%
%% 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
+%% version 1.3c of this license or (at your option) any
%% later version: <http://www.latex-project.org/lppl.txt>
%%
%% This work consists of the files listed in the README file.
@@ -29,8 +29,6 @@
%%
%% This package requires the basic TikZ package to be loaded already
%% ------------------------------------------------------------------
-%% rubikcube.dtx
-%% Copyright 2014 RWD Nickalls (dick@nickalls.org) and A Syropoulos (asyropoulos@yahoo.com)
%%% \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
@@ -48,14 +46,15 @@
%% Right brace \} Tilde \~}
-\def\RCfileversion{2.0}%
-\def\RCfiledate{2014/01/20}%
+\def\RCfileversion{3.0}%
+\def\RCfiledate{2015/09/25}%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rubikcube}[\RCfiledate\space (v\RCfileversion)]
\@ifpackageloaded{tikz}{}{%
\typeout{---rubikcube requires the TikZ package.}%
\RequirePackage{tikz}}%
-\newcommand{\rubikcube}{\textsf{rubikcube}}%
+\newcommand{\rubikcube}{\textsc{rubikcube}}%
+\newcommand{\Rubikcube}{\textsc{Rubikcube}}%
\newcommand{\@rr}[1]{\textbf{\textsf{#1}}}
\newcommand{\@rrp}[1]{\textbf{\textsf{#1}$^\prime$}}
\newcommand{\@rrw}[1]{\textbf{\textsf{#1\footnotesize{w}}}}
@@ -72,6 +71,8 @@
\fbox{\rule[-1pt]{0pt}{8.5pt}\raisebox{-0.5pt}{#1}}}
\newlength\@hRubik%
\setlength{\@hRubik}{0.185cm}%
+\newcommand*\@join[2]{%
+ \csname\expandafter\@gobble\string#1#2\endcsname}
\definecolor{R}{HTML}{C41E33}%
\definecolor{G}{HTML}{00BE38}%
\definecolor{B}{HTML}{0051BA}%
@@ -79,6 +80,23 @@
\colorlet{X}{black!30}% grey
\colorlet{O}{orange}%
\colorlet{W}{white}%
+\newcommand{\ShowCube}[3]{%
+ \begin{minipage}{#1}%
+ \centering%
+ \begin{tikzpicture}[scale=#2]%
+ #3%
+ \end{tikzpicture}%
+ \end{minipage}%
+}
+\newcommand{\ShowCubeF}[3]{%
+ \fbox{%
+ \begin{minipage}{#1}%
+ \centering%
+ \begin{tikzpicture}[scale=#2]%
+ #3%
+ \end{tikzpicture}%
+ \end{minipage}%
+}}
\newcommand{\RubikFaceUp}[9]{%
\def\Ult{#1}\def\Umt{#2}\def\Urt{#3}%
\def\Ulm{#4}\def\Umm{#5}\def\Urm{#6}%
@@ -145,6 +163,15 @@
\RubikFaceRightAll{X}%
\RubikFaceFrontAll{X}%
\RubikFaceBackAll{X}%
+
+\newcommand{\RubikCubeGrey}{%
+\RubikFaceUp {X}{X}{X}{X}{W}{X}{X}{X}{X}%
+\RubikFaceDown {X}{X}{X}{X}{Y}{X}{X}{X}{X}%
+\RubikFaceLeft {X}{X}{X}{X}{B}{X}{X}{X}{X}%
+\RubikFaceRight{X}{X}{X}{X}{G}{X}{X}{X}{X}%
+\RubikFaceFront{X}{X}{X}{X}{O}{X}{X}{X}{X}%
+\RubikFaceBack {X}{X}{X}{X}{R}{X}{X}{X}{X}%
+}
\newcommand{\RubikCubeSolved}{%
\RubikFaceUpAll{W}%
\RubikFaceDownAll{Y}%
@@ -161,6 +188,14 @@
\def\Llt{#1}\def\Lmt{#2}\def\Lrt{#3}%
\def\Flt{#4}\def\Fmt{#5}\def\Frt{#6}%
}
+\newcommand{\RubikSliceMiddleR}[6]{%
+\def\Flm{#1}\def\Fmm{#2}\def\Frm{#3}%
+\def\Rlm{#4}\def\Rmm{#5}\def\Rrm{#6}%
+}
+\newcommand{\RubikSliceMiddleL}[6]{%
+\def\Llm{#1}\def\Lmm{#2}\def\Lrm{#3}%
+\def\Flm{#4}\def\Fmm{#5}\def\Frm{#6}%
+}
\newcommand{\RubikSliceEquatorR}[6]{%
\def\Flm{#1}\def\Fmm{#2}\def\Frm{#3}%
\def\Rlm{#4}\def\Rmm{#5}\def\Rrm{#6}%
@@ -197,6 +232,7 @@
\draw[line join=round,line cap=round,ultra thick,fill=\Frb]%
(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle;
}
+
\newcommand{\DrawRubikCubeRU}{%
\DrawRubikCubeFrontFace %% frontface
%%-----------Up face----------
@@ -435,7 +471,7 @@
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle;
}
-\newcommand{\FlatUp}[2]{%
+\newcommand{\DrawFlatUp}[2]{%
\pgfmathsetmacro{\ux}{#1}%
\pgfmathsetmacro{\uy}{#2}%
%%---top row
@@ -470,7 +506,7 @@
-- (\ux + 3,\uy + 0) -- cycle;
}
%%-------------------------
-\newcommand{\FlatDown}[2]{%
+\newcommand{\DrawFlatDown}[2]{%
\pgfmathsetmacro{\ddx}{#1}%
\pgfmathsetmacro{\ddy}{#2}%
%%---top row
@@ -504,8 +540,64 @@
(\ddx + 2,\ddy + 0) -- (\ddx + 2,\ddy + 1) -- (\ddx + 3,\ddy + 1)%
-- (\ddx + 3,\ddy + 0) -- cycle;
}
+%%-------------------------
+\newcommand{\DrawFlatLeft}[2]{%
+\pgfmathsetmacro{\lx}{#1}%
+\pgfmathsetmacro{\ly}{#2}%
+%% NOTE: y variable coord not yet implemented
+%%---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{\DrawFlatRight}[2]{%
+\pgfmathsetmacro{\rx}{#1}% %3
+\pgfmathsetmacro{\ry}{#2}% %0
+%% NOTE: y variable coord not yet implemented
+%%---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;
+}
%%-----------------------
-\newcommand{\FlatFront}{%
+\newcommand{\DrawFlatFront}{%
+%% This command is used /only/ by the \cmd{\DrawRubikFlat} command.
+%% NOTE: x, y variables not implemented as not required here
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Flt]%
(0,2) -- (0, 3) -- (1,3) -- (1,2) -- cycle;
@@ -535,7 +627,7 @@
(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle;
}
%%-------------------------
-\newcommand{\FlatBack}[2]{%
+\newcommand{\DrawFlatBack}[2]{%
\pgfmathsetmacro{\bx}{#1}%
\pgfmathsetmacro{\by}{#2}%
%%---top row
@@ -569,71 +661,61 @@
(\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;
-}
\newcommand{\DrawRubikFlat}{%
- \FlatUp{0}{3}%
- \FlatDown{0}{-3}%
- \FlatLeft{-3}{0}%
- \FlatFront%
- \FlatRight{3}{0}%
- \FlatBack{6}{0}%
+ \DrawFlatUp{0}{3}%
+ \DrawFlatDown{0}{-3}%
+ \DrawFlatLeft{-3}{0}%
+ \DrawFlatFront%
+ \DrawFlatRight{3}{0}%
+ \DrawFlatBack{6}{0}%
}
\newcommand{\DrawRubikCubeFlat}{%
\DrawRubikCube%
- \FlatDown{0}{-3}%
- \FlatLeft{-3}{0}%
- \FlatBack{4}{1}%
+ \DrawFlatDown{0}{-3}%
+ \DrawFlatLeft{-3}{0}%
+ \DrawFlatBack{4}{1}%
+}
+\newcommand{\DrawFlatUpSide}{%
+\DrawFlatUp{0}{0}%
+\DrawRubikLayerSideT{\Brt}{\Bmt}{\Blt}%
+\DrawRubikLayerSideL{\Llt}{\Lmt}{\Lrt}%
+\DrawRubikLayerSideR{\Rrt}{\Rmt}{\Rlt}%
+\DrawRubikLayerSideB{\Flt}{\Fmt}{\Frt}%
+}
+\newcommand{\DrawFlatFrontSide}{%
+\DrawFlatFront{0}{0}%
+\DrawRubikLayerSideT{\Ulb}{\Umb}{\Urb}%
+\DrawRubikLayerSideL{\Lrt}{\Lrm}{\Lrb}%
+\DrawRubikLayerSideR{\Rlt}{\Rlm}{\Rlb}%
+\DrawRubikLayerSideB{\Dlt}{\Dmt}{\Drt}%
+}
+\newcommand{\DrawFlatRightSide}{%
+\DrawFlatRight{0}{0}%
+\DrawRubikLayerSideT{\Urb}{\Urm}{\Urt}%
+\DrawRubikLayerSideL{\Frt}{\Frm}{\Frb}%
+\DrawRubikLayerSideR{\Blt}{\Blm}{\Blb}%
+\DrawRubikLayerSideB{\Drt}{\Drm}{\Drb}%
+}
+\newcommand{\DrawFlatLeftSide}{%
+\DrawFlatLeft{0}{0}%
+\DrawRubikLayerSideT{\Ult}{\Ulm}{\Ulb}%
+\DrawRubikLayerSideL{\Brt}{\Brm}{\Brb}%
+\DrawRubikLayerSideR{\Flt}{\Flm}{\Flb}%
+\DrawRubikLayerSideB{\Dlb}{\Dlm}{\Dlt}%
+}
+\newcommand{\DrawFlatBackSide}{%
+\DrawFlatBack{0}{0}%
+\DrawRubikLayerSideT{\Urt}{\Umt}{\Ult}%
+\DrawRubikLayerSideL{\Rrt}{\Rrm}{\Rrb}%
+\DrawRubikLayerSideR{\Llt}{\Llm}{\Llb}%
+\DrawRubikLayerSideB{\Drb}{\Dmb}{\Dlb}%
+}
+\newcommand{\DrawFlatDownSide}{%
+\DrawFlatDown{0}{0}%
+\DrawRubikLayerSideT{\Flb}{\Fmb}{\Frb}%
+\DrawRubikLayerSideL{\Lrb}{\Lmb}{\Llb}%
+\DrawRubikLayerSideR{\Rlb}{\Rmb}{\Rrb}%
+\DrawRubikLayerSideB{\Brb}{\Bmb}{\Blb}%
}
\newcommand{\RubikSideBarWidth}[1]{\pgfmathsetmacro{\bw}{#1}}
\newcommand{\RubikSideBarLength}[1]{\pgfmathsetmacro{\bl}{#1}}
@@ -675,12 +757,12 @@
}
%%---Left side
\newcommand{\DrawRubikLayerSideLTx}[1]{\side@barL{3}{#1}}
-\newcommand{\DrawRubikLayerSideLEx}[1]{\side@barL{2}{#1}}
-\newcommand{\DrawRubikLayerSideLE}[1]{\side@barL{2}{#1}}
+\newcommand{\DrawRubikLayerSideLMx}[1]{\side@barL{2}{#1}}
+\newcommand{\DrawRubikLayerSideLM}[1]{\side@barL{2}{#1}}
\newcommand{\DrawRubikLayerSideLBx}[1]{\side@barL{1}{#1}}
\newcommand{\DrawRubikLayerSideRTx}[1]{\side@barR{3}{#1}}
-\newcommand{\DrawRubikLayerSideREx}[1]{\side@barR{2}{#1}}
-\newcommand{\DrawRubikLayerSideRE}[1]{\side@barR{2}{#1}}
+\newcommand{\DrawRubikLayerSideRMx}[1]{\side@barR{2}{#1}}
+\newcommand{\DrawRubikLayerSideRM}[1]{\side@barR{2}{#1}}
\newcommand{\DrawRubikLayerSideRBx}[1]{\side@barR{1}{#1}}
\newcommand{\DrawRubikLayerSideLTy}[1]{\side@barT{1}{#1}}
\newcommand{\DrawRubikLayerSideMTy}[1]{\side@barT{2}{#1}}
@@ -706,21 +788,21 @@
%% colours run vertically DOWN
\newcommand{\DrawRubikLayerSideL}[3]{%
\DrawRubikLayerSideLTx{#1}%
- \DrawRubikLayerSideLEx{#2}%
+ \DrawRubikLayerSideLMx{#2}%
\DrawRubikLayerSideLBx{#3}%
}
%%--Right side--------
%% colours run vertically DOWN
\newcommand{\DrawRubikLayerSideR}[3]{%
\DrawRubikLayerSideRTx{#1}%
- \DrawRubikLayerSideREx{#2}%
+ \DrawRubikLayerSideRMx{#2}%
\DrawRubikLayerSideRBx{#3}%
}
\newcommand{\DrawRubikLayerSideLR}[6]{%
\DrawRubikLayerSideLTx{#1}%
\DrawRubikLayerSideRTx{#2}%
- \DrawRubikLayerSideLEx{#3}%
- \DrawRubikLayerSideREx{#4}%
+ \DrawRubikLayerSideLMx{#3}%
+ \DrawRubikLayerSideRMx{#4}%
\DrawRubikLayerSideLBx{#5}%
\DrawRubikLayerSideRBx{#6}%
}
@@ -809,7 +891,7 @@
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieRU{#1}{#2}{#3}
-\end{tikzpicture}
+\end{tikzpicture}%
\end{minipage}
}
\newcommand{\textCubieRD}[3]{%
@@ -818,7 +900,7 @@
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieRD{#1}{#2}{#3}
-\end{tikzpicture}
+\end{tikzpicture}%
\end{minipage}
}
\newcommand{\textCubieLD}[3]{%
@@ -827,7 +909,7 @@
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieLD{#1}{#2}{#3}
-\end{tikzpicture}
+\end{tikzpicture}%
\end{minipage}
}
\newcommand{\textCubieLU}[3]{%
@@ -836,22 +918,26 @@
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieLU{#1}{#2}{#3}
-\end{tikzpicture}
+\end{tikzpicture}%
\end{minipage}
}
\newcommand{\DrawNotationBox}{%
\draw [thick] (0,0) -- (0,1) -- (1,1) -- (1,0) -- (0,0) -- (0,1)%
}
-\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
+\pgfmathsetmacro{\@sd}{0.25} % a small horiz space
+\pgfmathsetmacro{\@sdd}{2*\@sd} % 2x horiz space
+\pgfmathsetmacro{\@sddd}{3*\@sd} % 3x horiz space
+\pgfmathsetmacro{\@sh}{0.6} % height
+\pgfmathsetmacro{\@sb}{0.2} % base
+\pgfmathsetmacro{\@sbh}{\@sb + \@sh} % UP
+\pgfmathsetmacro{\@scx}{\@sdd+0.2} % Start of CircleX arc
+\pgfmathsetmacro{\@scy}{\@sd*2/3} % Start of CircleY arc
+\pgfmathsetmacro{\@sqcx}{\@scx-0.13} %% SQuare CenterX coord
+\pgfmathsetmacro{\@sqcy}{\@scy+0.25} %% SQuare CenterY cpprd
+\newcommand*{\Rubik}[1]{\@join{\Rubik}{#1}}
+\newcommand*{\textRubik}[1]{\@join{\textRubik}{#1}}
+\newcommand*{\rr}[1]{\@join{\rr}{#1}}
+\newcommand*{\rrh}[1]{\@join{\rrh}{#1}}
\newcommand{\rrB}{\@rr{B}}
\newcommand{\SquareB}{\@SquareLetter{\rrB}}
\newcommand{\rrhB}{\raisebox{-0.25mm}{\SquareB}\,}
@@ -897,10 +983,10 @@
\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}%%
+\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}\,}
%%
@@ -917,9 +1003,9 @@
\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);
+\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}\,}
@@ -937,9 +1023,9 @@
\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);
+\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}\,}
@@ -957,9 +1043,9 @@
\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);
+\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}\,}
@@ -977,9 +1063,9 @@
\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);
+\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}\,}
@@ -997,9 +1083,9 @@
\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);
+\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}\,}
@@ -1017,9 +1103,9 @@
\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);
+\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}\,}
@@ -1037,9 +1123,9 @@
\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);
+\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}\,}
@@ -1057,9 +1143,9 @@
\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);
+\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}\,}
@@ -1077,9 +1163,9 @@
\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);
+\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}\,}
@@ -1097,7 +1183,7 @@
\newcommand{\SquareF}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
-\draw [thick, <-] (\scx, \scy) arc[radius=0.35, start angle=-60, delta angle=290];
+\draw [thick, <-] (\@scx, \@scy) arc[radius=0.35, start angle=-60, delta angle=290];
\end{tikzpicture}%
}
\newcommand{\rrhF}{\raisebox{-0.333\height}{\SquareF}\,}
@@ -1115,7 +1201,7 @@
\newcommand{\SquareFp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
-\draw [thick, ->] (\scx, \scy) arc[radius=0.35, start angle=-60, delta angle=290];
+\draw [thick, ->] (\@scx, \@scy) arc[radius=0.35, start angle=-60, delta angle=290];
\end{tikzpicture}%
}
\newcommand{\rrhFp}{\raisebox{-0.333\height}{\SquareFp}\,}
@@ -1133,8 +1219,8 @@
\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];
+\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{\rrhFw}{\raisebox{-0.333\height}{\SquareFw}\,}
@@ -1152,8 +1238,8 @@
\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];
+\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}\,}
@@ -1192,9 +1278,9 @@
\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);
+\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}\,}
@@ -1212,9 +1298,9 @@
\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);
+\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}\,}
@@ -1232,9 +1318,9 @@
\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);
+\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}\,}
@@ -1252,9 +1338,9 @@
\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);
+\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}\,}
@@ -1272,9 +1358,9 @@
\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);
+\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}\,}
@@ -1292,9 +1378,9 @@
\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);
+\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}\,}
@@ -1312,9 +1398,9 @@
\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);
+\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}\,}
@@ -1332,9 +1418,9 @@
\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);
+\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}\,}
@@ -1352,9 +1438,9 @@
\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);
+\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}\,}
@@ -1372,9 +1458,9 @@
\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);
+\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}\,}
@@ -1393,9 +1479,9 @@
\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);
+\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}\,}
@@ -1413,9 +1499,9 @@
\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);
+\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}\,}
@@ -1433,9 +1519,9 @@
\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);
+\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}\,}
@@ -1453,9 +1539,9 @@
\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);
+\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}\,}
@@ -1473,9 +1559,9 @@
\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);
+\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}\,}
@@ -1493,9 +1579,9 @@
\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);
+\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}\,}
@@ -1513,9 +1599,9 @@
\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);
+\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}\,}
@@ -1533,9 +1619,9 @@
\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);
+\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}\,}
@@ -1663,9 +1749,9 @@
\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);
+\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}\,}
@@ -1683,9 +1769,9 @@
\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);
+\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}\,}
@@ -1704,9 +1790,9 @@
\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);
+\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}\,}
@@ -1724,9 +1810,9 @@
\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);
+\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}\,}
@@ -1744,9 +1830,9 @@
\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);
+\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}\,}
@@ -1764,9 +1850,9 @@
\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);
+\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}\,}
@@ -1784,9 +1870,9 @@
\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);
+\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}\,}
@@ -1804,9 +1890,9 @@
\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);
+\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}\,}
diff --git a/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty b/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty
index bbb8d0f1a43..6a8e25d6561 100644
--- a/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty
+++ b/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty
@@ -9,7 +9,8 @@
%% -----------------------------------------------------------------
%% Authors: RWD Nickalls (dick@nickalls.org)
%% and Apostolos Syropoulos (asyropoulos@yahoo.com)
-%% Copyright January 2014 RWD Nickalls and A Syropoulos
+%%
+%% Copyright 25 September 2015 RWD Nickalls and A Syropoulos
%%
%%
%% This work may be distributed and/or modified under the
@@ -46,8 +47,8 @@
%% Right brace \} Tilde \~}
-\def\RRfileversion{2.0}%
-\def\RRfiledate{2014/01/20}%
+\def\RRfileversion{3.0}%
+\def\RRfiledate{2015/09/25}%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rubikrotation}[\RRfiledate\space (v\RRfileversion)]
\@ifpackageloaded{rubikcube}{}{%
@@ -57,14 +58,15 @@
\typeout{---rubikrotation requires the fancyvrb package%
for VerbatimInput{} command.}%
\RequirePackage{fancyvrb}}
-\newcommand{\rubikrotation}{\textsf{rubikrotation}}
+\newcommand{\rubikrotation}{\textsc{rubikrotation}}
+\newcommand{\Rubikrotation}{\textsc{Rubikrotation}}
+\newcommand{\@print}[1]{\immediate\write\outfile{#1}}
{\catcode`\%=12 \global\def\rubikpercentchar{%}}%
\newcommand{\@comment}{\rubikpercentchar\rubikpercentchar\space}%
\newcommand{\@commentone}{\rubikpercentchar}%
-%% We need a simple print command for writing comments to a file.
-\newcommand{\@print}[1]{\immediate\write\outfile{#1}}
-\newcommand{\rubikperlname}{rubikrotation.pl}
-\newcommand{\rubikperlcmd}{perl \rubikperlname}
+\newcommand{\rubikperlname}{rubikrotation}
+\newcommand{\rubikperlcmd}{\rubikperlname\space%
+ -i rubikstate.dat -o rubikstateNEW.dat}
\typeout{---checking for config file (rubikrotation.cfg)...}
\IfFileExists{rubikrotation.cfg}{%
\input{rubikrotation.cfg}%
@@ -73,19 +75,15 @@
\typeout{---cleaning file rubikstateNEW.dat}%
\newwrite\outfile%
\immediate\openout\outfile=rubikstateNEW.dat%
-\@print{\@comment rubikstateNEW.dat (by TeX)}%
+\@print{\@comment rubikstateNEW.dat}%
\immediate\closeout\outfile%
\typeout{---creating file rubikstateERRORS.dat}%
\newwrite\outfile%
\immediate\openout\outfile=rubikstateERRORS.dat%
\@print{\@comment rubikstateERRORS.dat}%
-\typeout{---checking for Perl script \rubikperlname...}
- \IfFileExists{\rubikperlname}{%
- \typeout{---\rubikperlname\space exists OK}%
- }{\typeout{** ERROR: cannot find Perl program \rubikperlname}%
- \@print{\@comment ** ERROR: cannot find Perl program \rubikperlname}}%
+\@print{\@comment ---(RR.sty v\RRfileversion): comments output by Perl script}%
\immediate\closeout\outfile%
-\typeout{---setting up newwrite for rubikrotation to use...}%
+\typeout{---setting up newwrite for rubikrotation.sty to use...}%
\newwrite\outfile%
\newcommand{\@openstatefile}{\immediate\openout\outfile=rubikstate.dat}
\newcommand{\@closestatefile}{\immediate\closeout\outfile}
@@ -98,63 +96,81 @@
\@print{back,\Blt,\Bmt,\Brt,\Blm,\Bmm,\Brm,\Blb,\Bmb,\Brb}%
\@print{checkstate}%
}
-\newcommand{\RubikRotation}[1]{\IfFileExists{\rubikperlname}{%
+\newcommand{\SaveRubikState}[1]{%
+\typeout{---NEW save command------------------}%
+\typeout{---command = SaveRubikState{#1}}%
+\typeout{---saving Rubik state data to file #1}%
+\immediate\openout\outfile=#1%
+\@print{\@comment filename: #1\@commentone}%
+\@print{\string\RubikFaceUp%
+ {\Ult}{\Umt}{\Urt}{\Ulm}{\Umm}{\Urm}{\Ulb}{\Umb}{\Urb}\@commentone}%
+\@print{\string\RubikFaceDown%
+ {\Dlt}{\Dmt}{\Drt}{\Dlm}{\Dmm}{\Drm}{\Dlb}{\Dmb}{\Drb}\@commentone}%
+\@print{\string\RubikFaceLeft%
+ {\Llt}{\Lmt}{\Lrt}{\Llm}{\Lmm}{\Lrm}{\Llb}{\Lmb}{\Lrb}\@commentone}%
+\@print{\string\RubikFaceRight%
+ {\Rlt}{\Rmt}{\Rrt}{\Rlm}{\Rmm}{\Rrm}{\Rlb}{\Rmb}{\Rrb}\@commentone}%
+\@print{\string\RubikFaceFront%
+ {\Flt}{\Fmt}{\Frt}{\Flm}{\Fmm}{\Frm}{\Flb}{\Fmb}{\Frb}\@commentone}%
+\@print{\string\RubikFaceBack%
+ {\Blt}{\Bmt}{\Brt}{\Blm}{\Bmm}{\Brm}{\Blb}{\Bmb}{\Brb}\@commentone}%
+\immediate\closeout\outfile%
+\typeout{-----------------------------------------}%
+}%
+%% Two macros detailed by Feuersaenger (2015)
+\long\def\@countingloop#1 in #2:#3#4{%
+ #1=#2 %
+ \@loopcounter{#1}{#3}{#4}%
+}
+%%--------------------------
+\long\def\@loopcounter#1#2#3{%
+ #3%
+ \ifnum#1=#2 %
+ \let\next=\relax%
+ \else
+ \advance#1 by1 %
+ \def\next{\@loopcounter{#1}{#2}{#3}}%
+ \fi
+ \next
+}
+\newcommand{\RubikRotation}[2][1]{%
\typeout{---NEW rotation command------------------}%
\typeout{---command = RubikRotation{#1}}%
- \typeout{---Perl script \rubikperlname\space exists OK}%
\typeout{---writing current Rubik state to file rubikstate.dat}%
\@openstatefile% open data file
\@print{\@comment filename: rubikstate.dat}%
+ \@print{\@comment written by rubikrotation.sty%
+ =v\RRfileversion\space (\RRfiledate)}%
\@printrubikstate%
- \@print{rotation,#1}%
+%% countingloop code from Feuersaenger (2015)
+ \newcount\ourRRcounter%
+ \@countingloop{\ourRRcounter} in 1:{#1}{%
+ \immediate\write\outfile{rotation,#2}}%
\@closestatefile% close data file
- \typeout{---running Perl script}%
+ \typeout{---running Perl script (rubikrotation)}%
\immediate\write18{\rubikperlcmd}%
- \typeout{---inputting NEW datafile (from Perl)}%
+ \typeout{---inputting NEW datafile (written by Perl script)}%
\input{rubikstateNEW.dat}%
\typeout{-----------------------------------------}%
- }{\typeout{** ERROR: \rubikperlname\space does not exist}%
-}}
+ }
\newcommand{\ShowRubikErrors}{%
\typeout{---ShowRubikErrors: inputting file rubikstateERRORS.dat}%
- \VerbatimInput{rubikstateERRORS.dat}}
-\newcommand{\CheckRubikState}{\IfFileExists{\rubikperlname}{%
+ \VerbatimInput{rubikstateERRORS.dat}%
+ }
+\newcommand{\CheckRubikState}{%
\typeout{---NEW check command------------------}%
\typeout{---command = CheckRubikState}%
- \typeout{---Perl script \rubikperlname\space exists OK}%
\typeout{---writing current Rubik state to file rubikstate.dat}%
\@openstatefile% opens data file
\@print{\@comment filename: rubikstate.dat}%
\@printrubikstate%
\@closestatefile% close data file
- \typeout{---running Perl script}%
+ \typeout{---running Perl script (rubikrotation)}%
\immediate\write18{\rubikperlcmd}%
- \typeout{---inputting NEW datafile (from Perl)}%
+ \typeout{---inputting NEW datafile (written by Perl script)}%
\input{rubikstateNEW.dat}%
\typeout{-----------------------------------------}%
- }{\typeout{** ERROR: \rubikperlname\space does not exist}%
-}}
-\newcommand{\SaveRubikState}[1]{%
-\typeout{---NEW save command------------------}%
-\typeout{---command = SaveRubikState{#1}}%
-\typeout{---saving Rubik state data to file #1}%
-\immediate\openout\outfile=#1%
-\@print{\@comment filename: #1\@commentone}%
-\@print{\string\RubikFaceUp%
- {\Ult}{\Umt}{\Urt}{\Ulm}{\Umm}{\Urm}{\Ulb}{\Umb}{\Urb}\@commentone}%
-\@print{\string\RubikFaceDown%
- {\Dlt}{\Dmt}{\Drt}{\Dlm}{\Dmm}{\Drm}{\Dlb}{\Dmb}{\Drb}\@commentone}%
-\@print{\string\RubikFaceLeft%
- {\Llt}{\Lmt}{\Lrt}{\Llm}{\Lmm}{\Lrm}{\Llb}{\Lmb}{\Lrb}\@commentone}%
-\@print{\string\RubikFaceRight%
- {\Rlt}{\Rmt}{\Rrt}{\Rlm}{\Rmm}{\Rrm}{\Rlb}{\Rmb}{\Rrb}\@commentone}%
-\@print{\string\RubikFaceFront%
- {\Flt}{\Fmt}{\Frt}{\Flm}{\Fmm}{\Frm}{\Flb}{\Fmb}{\Frb}\@commentone}%
-\@print{\string\RubikFaceBack%
- {\Blt}{\Bmt}{\Brt}{\Blm}{\Bmm}{\Brm}{\Blb}{\Bmb}{\Brb}\@commentone}%
-\immediate\closeout\outfile%
-\typeout{-----------------------------------------}%
-}%
+ }
\endinput
%%
%% End of file `rubikrotation.sty'.