summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-03-06 21:58:50 +0000
committerKarl Berry <karl@freefriends.org>2017-03-06 21:58:50 +0000
commitaba00871ee9f5f5ac8d46fe9d0b8e29cd8ce1e8b (patch)
tree98276bb92499bc5ceb7c72cda4393f028520fc4a
parent346afec669dbe142884f0794af09981c591e6afd (diff)
rubik (6mar17)
git-svn-id: svn://tug.org/texlive/trunk@43415 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl2504
-rw-r--r--Master/texmf-dist/doc/latex/rubik/README.txt88
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubik-doc-figB.pdfbin4076 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubik-doc-figF.pdfbin7033 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figD.pdfbin9342 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/examples.pdfbin204366 -> 0 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/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.pdfbin0 -> 7192 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.pdf (renamed from Master/texmf-dist/doc/latex/rubik/Rubik-doc-figD.pdf)bin2908 -> 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 -> 7608 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikcube.pdfbin724329 -> 937760 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikexampfig4.tex7
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikexamples.pdfbin0 -> 197642 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikexamples.sh9
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikexamples.tex1313
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikpatterns-doc-figA.pdfbin0 -> 9503 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikpatterns.pdfbin0 -> 277967 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.pdfbin0 -> 89246 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.sh9
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.tex305
-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.pdf (renamed from Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figC.pdf)bin3864 -> 3864 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikrot-doc-figD.pdfbin0 -> 10217 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikrotation.122
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikrotation.pdfbin372478 -> 420220 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikrotationPL.pdfbin163436 -> 266913 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rubik/rubikrotationPL.tex1333
-rwxr-xr-xMaster/texmf-dist/scripts/rubik/rubikrotation.pl2504
-rwxr-xr-xMaster/texmf-dist/source/latex/rubik/examples.bat4
-rw-r--r--Master/texmf-dist/source/latex/rubik/rubikcube.dtx6209
-rw-r--r--Master/texmf-dist/source/latex/rubik/rubikcube.ins19
-rw-r--r--Master/texmf-dist/source/latex/rubik/rubikexamples.bat3
-rw-r--r--Master/texmf-dist/source/latex/rubik/rubikpatterns.dtx540
-rw-r--r--Master/texmf-dist/source/latex/rubik/rubikpatterns.ins65
-rw-r--r--Master/texmf-dist/source/latex/rubik/rubikpatternsLIST.bat3
-rw-r--r--Master/texmf-dist/source/latex/rubik/rubikrotation.dtx715
-rw-r--r--Master/texmf-dist/source/latex/rubik/rubikrotation.ins22
-rw-r--r--Master/texmf-dist/tex/latex/rubik/rubikcube.sty1382
-rw-r--r--Master/texmf-dist/tex/latex/rubik/rubikpatterns.sty148
-rw-r--r--Master/texmf-dist/tex/latex/rubik/rubikrotation.sty32
45 files changed, 12615 insertions, 5093 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl b/Build/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl
index 77c3dadbab3..05e69ef0049 100755
--- a/Build/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl
+++ b/Build/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl
@@ -1,84 +1,128 @@
#!/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.
-##--------------------------------------------------
-
-##=============main===================================================
-
-## 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
+ use Carp;
+ use Fatal;
+ use warnings;
+ ##
+ our $version = "v4.0 (03 March 2017)";
+ ##
+ ## rubikrotation.pl
+ ## VERSION 4.0
+ ##
+ ## Copyright 03 March 2017,
+ ## RWD Nickalls (dick@nickalls.org)
+ ## A Syropoulos (asyropoulos@yahoo.com)
+ ##
+ ##-------------------------------
+ ## changes in v3.6 (January 2017)
+ ## (1) included Jaap Rm and Rc notation
+ ## (2) new sub for improved expansion of mod-4 multiples of rotations (Oct 2016)
+ ## (3) restructured to facilitate processing arrays through the rotation sub
+ ## (4) included option for an <info> block
+ ## (5) included Randelshofer superset ENG 3x3 notation
+ ## (6) implemented an `inverse' mode
+ ## (7) improved syntax checking
+ ## (8) used perltidy to polish the program layout
+ ## (but only when making the pdf documentation-- see file rubikrotationPL.pdf)
+ ## (9) included a lot of new subroutines
+ ##--------------------------------
+ ## changes in v3.2:
+ ## 1) changed program, prog --> script
+ ## 2) added leading ... to the comments written by the <writestate> sub
+ ## (the ... code indicates that comments are written by the Perl script)
+ ##
+ ## 3) v3.2a added a \RubikSeqNEW{...} output line in the output file
+ ## to facilitate typesetting the rotation sequence (works OK just now)
+ ##
+ ## 4) v3.2c: added new commands:
+ ## \RotationSequenceName{}
+ ## \RotationSequenceClean{}
+ ##
+ ## 5) v3.2d: changed the returned command names (removed the Rotation part to keep it simple)
+ ## \Sequence{} = orig seq + NO NAME
+ ## \SequenceName{} = NAME only
+ ## \SequenceClean{} = clean seq + NO NAME
+ ##
+ ## 6) v3.2e:(25 Sept 2016)
+ ## changed some command names: use short & long for the Rubik R2 --> R,R code
+ ## (more intuitive than Clean)
+ ## \Sequence{} --> SecquenceShort{}
+ ## \SequenceClean{} --> SecquenceLong{}
+ ## removed the [ and ] around [name] variable
+ ##
+ ## 7) v3.2h: (2 Oct 2016)
+ ## improved the mod 4 routine using SUB rubikmod()
+ ## improved comments to log file re: rotation processing
+ ##
+ ##--------------------------------
+ ## 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.
+ ##----------------------------------------------------------------------
+
+ ##------------------ MAIN --------------------------
+
+ ## 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'')
+ ##---------------
+ ## set autoflush for outputs
+ ## $|=1;
+ ##--------------
+ 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;
@@ -86,8 +130,8 @@ if ($argc == 0||$argc > 4 ){ # croak if 0 or more than 4 arguments
else {
SWITCHES:
while($_ = $ARGV[0]) {
- shift;
- if (/^-h$/ || /^--help$/ ) {
+ shift;
+ if (/^-h$/ || /^--help$/ ) {
die $rubikversion,$usage,
"\twhere,\n" .
"\t[-h|--help]\tgives this help listing\n" .
@@ -96,10 +140,10 @@ if ($argc == 0||$argc > 4 ){ # croak if 0 or more than 4 arguments
"\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){
+ }
+ elsif (/^-v$/ || /^--version$/ ) {die $rubikversion;}
+ elsif (/^-i$/) {
+ if (!@ARGV){
croak $showargs,
"\tNo input file specified!\n",
$usage;
@@ -108,8 +152,8 @@ if ($argc == 0||$argc > 4 ){ # croak if 0 or more than 4 arguments
$source_file = $ARGV[0],
shift;
}
- }
- elsif (/^-o$/) {
+ }
+ elsif (/^-o$/) {
if (!@ARGV) {
croak $showargs,
"\tNo output file specified!\n",
@@ -119,114 +163,184 @@ if ($argc == 0||$argc > 4 ){ # croak if 0 or more than 4 arguments
$out_file = $ARGV[0],
shift;
}
- }
- elsif (/^-\w+/) {
+ }
+ elsif (/^-\w+/) {
croak $showargs,
"\t$_: Illegal command line switch!\n",
$usage;
- }
- else {
+ }
+ else {
croak $showargs,
"\tmissing filenames or ? missing -i or -o switch!\n",
$usage;
- }
- } # end of while
-}; # end of else
+ }
+ } # 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, "<$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 (""); # newline
gprint ("...PERL process..................................");
- gprint ("...program = rubikrotation.pl v$version");
+ gprint ("...script = rubikrotation.pl $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
+ ## setup global error parameters, so we can write all the errors to a file as an array
+ our %error = (); # setup an array for error messages (was %)
+ our $erroralert = ""; # error flag
+ our $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;
+ our $dataline = "";
+ our $newdataline ="";
+ our $rubikkeyword = "";
+ our $rotationcommand = "";
+ our @data=();
+
+ our $Sequence=""; ## will hold the original (SHORT) sequence
+ our $rotationseqNEW = ""; ## will hold the LONG sequence
+ our $RotationSequenceName="";
+
+ our $SequenceName="";
+ our $SequenceShort="";
+ our $SequenceLong="";
+ our $SequenceInfo="";
+
+ #---------inverse mode------------
+ # a keyword INVERSE or inverse in an infoblock <..>
+ # FLAG is set (line 400) in response to detecting an infloblock.
+ # A set FLAG triggers (a) reversing rotation sequence (line 484),
+ # and (b) inverting each rotation (to generate the inverse sequence).
+ # Here we define direction FLAG for the INVERSE sequence of rotations.
+ # The conditional test is in the SUB rotation
+ our $inverse="INV";
+ our $directionflag="";
+ #-------------------------
+
LINE: while (<IN_FILE>){
next LINE if /^#/; #skip comments
next LINE if /^%/; #skip comments
- next LINE if /^$/; #skip blank lines
+ next LINE if /^$/; #skip blank lines
+
+
+ print " \n TOP --------- (new line)\n\n";
+
$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') {
+ chomp $dataline; # remove the line-ending character
+
+ ## now we can clean whitespace
+ $dataline = cleanstring($dataline);
+
+ #check syntax of the string
+ $rotationcommand=$dataline; ## needed for error messages
+ CheckSyntax($dataline);
+
+ ## form an array so we can process the (rubik)keywords.
+ @data=split (/,/, $dataline); # create an array called data
+
+ print " dataline array = @data\n";
+ #-------------------------
+
+ ## we have 10 fields (0--9)
+ ## check for rubikkeyword= up,down,left,right,front,back,checkstate,rotation:
+ $rubikkeyword=$data[0];
+
+ if ($rubikkeyword eq 'up') { gprint ("...$dataline");
$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]
- }
+ $Ulb[0]=$data[7], $Umb[0]=$data[8],$Urb[0]=$data[9];
+ next LINE;
+ };
- if ($rubikkeyword eq 'down') {
+ if ($rubikkeyword eq 'down') { gprint ("...$dataline");
$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') {
+ $Dlb[0]=$data[7], $Dmb[0]=$data[8],$Drb[0]=$data[9];
+ next LINE;
+ };
+
+ if ($rubikkeyword eq 'left') { gprint ("...$dataline");
$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') {
+ $Llb[0]=$data[7], $Lmb[0]=$data[8],$Lrb[0]=$data[9];
+ next LINE;
+ };
+
+ if ($rubikkeyword eq 'right') { gprint ("...$dataline");
$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') {
+ $Rlb[0]=$data[7], $Rmb[0]=$data[8],$Rrb[0]=$data[9];
+ next LINE;
+ };
+
+ if ($rubikkeyword eq 'front') { gprint ("...$dataline");
$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') {
+ $Flb[0]=$data[7], $Fmb[0]=$data[8],$Frb[0]=$data[9];
+ next LINE;
+ };
+
+ if ($rubikkeyword eq 'back') { gprint ("...$dataline");
$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.
+ $Blb[0]=$data[7], $Bmb[0]=$data[8],$Brb[0]=$data[9];
+ next LINE;
+ };
+
+ ## 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 ("...");
+ next LINE ;
+ };
+
+ ## 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 it is an integer n --> random => random(n)
+ ## ELSE it must be a rotation sequence --> send elements to rotation sub.
+
+
+ #------------------------
+ if ($rubikkeyword eq 'rotation')
+ {
+ gprint ("...");
+
+ # we now grab a copy of the dataline, and we shall use this
+ # in the ErrorMessage SUB to indicate which command
+ # an error is in.
$rotationcommand=$dataline; ## used in output message
gprint ("...command=$rotationcommand");
+ # need to check that a second argument exists (else --> ErrorMessage).
+ # ---should be either `random',
+ # ---or a macroname for a rotation sequence,
+ # ---or the first element of a rotation sequence.
+
+ if ($data[1] eq "")
+ { # no second argument
+ gprint ("..*missing second argument");
+ ErrorMessage ("QUITTING PERL PROGRAM --- missing second argument:");
+ ErrorMessage ("--- ? bad rotation macro-name");
+ quitprogram();
+ };
+
+
+
##-----random-----------------
## if second argument = random,
## THEN we also need to check if third argument is an integer;
@@ -235,363 +349,654 @@ my @data;
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
+ ## if true then cannot be a number (D matches for word elements)
+ ErrorMessage("[$data[2]] is not an integer");
+ ## we reject the command (as bad syntax) and get next line
+ next LINE;
}
else{
- ## data[2] must be an integer (n), so we just do n random rotations
- random($data[2])
+ ## the next argument is an integer (n), so we do n random rotations
+ random($data[2]);
+ next LINE;
};
- }
+ } ## end of IF
+ #---------------
+
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
+ # -----rotation sequence---------
+ # the line must be a rotation sequence line, so send the sequence
+ # to the rotation sub;
+
+ # Note that a copy of the rotation command is already held in the
+ # variable rotationcommand (see above). It is used in the
+ # ErrorMessage SUB.
+
+
+ #-------------------------------
+
+ # Process and remove any infoblocks if they exist
+ # infoblocks are text delimited by <...>
+ # The SUB cutinfoblock returns the name of the new revised string = newdataline,
+ # and also the contents of the infoblock = $SequenceInfo
+ # RubikRotation command uses infoblocks to cary keywords, eg INVERSE or inverse
+ # If several infoblocks exist, then we collect the contents into
+ # variable SequenceInfo, and separate them with a colon;
+
+ infoblockcolon($dataline);
+ $dataline=$newdataline;
+ $newdataline=""; ## reset the variable
+
+
+ gprint ("...dataline = $dataline");
+
+
+ ## now pass the string to cutinfoblock
+ local @seq=();
+
+ while ( (index $dataline, '<') !=-1 ){
+
+ cutinfoblock($dataline);
+ # best to use the whole word <inverse> to avoid errors
+ if ($SequenceInfo =~ m/(inverse|INVERSE)/) {$directionflag=$inverse;
+ print " FLAG set to = $inverse\n";
+ };
+ # append each infoblock to an array
+ push @seq, $SequenceInfo;
+ $dataline = $newdataline;
+ };
+
+ # finally, we join the seqInfo array into a string so we can print it
+ $SequenceInfo = join ("; ", @seq);
+
+
+ #----------------------------------
+ ## there are now no more infoblocks, so we now look for repeat-blocks.
+
+ ## reformulate any repeat blocks (,) --> {;} if they exist
+ ## this is to allow us to process any repeat blocks as separate elements
+ # this sub returns the name of the new revised string.
+ while ( (index $dataline, '(') !=-1 ){
+ fixrepeatelement ($dataline);
+ $dataline=$newdataline;
+ $newdataline=""; ## reset the variable
+ };
+
+ ## rename remaining dataline string as SequenceShortBrace
+ ## since if there are any repeat blocks, they are now reformulated with braces
+ $SequenceShortBrace=$dataline;
- ## 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
+
+ ## clean leading and trailing whitespace
+ $SequenceShortBrace = cleanstring($SequenceShortBrace);
+
+ ##----------------
+ ## form a new array from $SequenceShortBrace (since we have changed the format
+ ## slightly; ie some commands may have been reformulated as semicolons).
+ @data=split (/,/, $SequenceShortBrace);
+
+
+ ## need to remove keyword <rotation> (= first element in the array)
+ ## removing it late like this is convenient for error checking purposes,
+ ## as then the keyword `rotation' is on the string
+ shift (@data);
+
+
+
+ ## now need to recreate the string from the array @data for use later
+ ## (as rotation keyword has been removed)
+
+ $SequenceShortBrace = join (",", @data);
+
+
+ #-----create SequenceShort, so we can output it later----
+
+ # since the `rotating' keyword has been removed, we can
+ # replace any braces around repeat strings (if exist) and
+ # rename it as SequenceShort which we will output at the end.
+ if ( (index $SequenceShortBrace, '{') !=-1 )
+ {
+ print " repairing braces--> ()\n";
+ ## swap: BBook p 138--139
+ $SequenceShortBrace =~ tr/\{/(/; # swap , --> ;
+ $SequenceShortBrace =~ tr/\}/)/; # swap ( --> {
+ $SequenceShortBrace =~ tr/;/,/; # swap ) --> }
+ };
+
+ #rename to SequenceShort
+ $SequenceShort = $SequenceShortBrace;
+
+ print " SequenceShort = $SequenceShort\n";
+ ##----------------------------
+
+
+ ## now we continue processing the array "data"
+
+ my $n = 0; ##total no of array elements in "data"
+ $n = ($#data +1);
+ print " processing rotation arguments: = @data (n= $n)\n";
+
+
+ # setup a loop counter (for use in the rotation sub)
+ # this is used to identify the first element (rcode)
+ # and used to grab [name] --> SequenceName.
+ our $jrcode=0;
+
+ ## --------check for state of direction flag----------------------
+ ## FLAG defined in line 224.
+ ## FLAG is set in line 400 on detecting <..> delimeters = infoblock
+ ## if flag set (by inverse keyword) then reverse the sequence array
+ if ( $directionflag eq $inverse){
+ # FLAG is set, so we need to inverse the array
+ gprint ("...directionFLAG set; reversing array...");
+ # but before reversing, look at the first array element
+ # to see if it is a square bracket element = NAME element
+ # so check the first char to see if it is [
+ if (substr ($data[0], 0,1) eq '[') {
+ $SequenceName=$data[0];
+ print " SequenceName (inv) = $SequenceName \n";
+ };
+
+ @data = reverse @data;
+ print " processing rotation arguments: = @data (n= $n)\n";
+ };
+
+ # send each rotation element to the sub rotation()
+ print " CALLing SUB rotation\n";
+
+ foreach $element (@data) {
+ ## clean leading and trailing white space
+ $element = cleanstring($element);
+ ## send element to rotation SUB
+ rotation($element);
+ };
+
+ } # end of else
+ }; # end of IF (rotation keyword)
+
+ #----------------------------------------------
+ ## place any new keywords for processing here
+ ##---------------------------------------------
+
+ }; ## end of while
+
+ ## we have now finished reading in all the lines from the source file,
+ ## and processing 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;
+ ## plus any ErrorMessages
+ ## -- all these are handled by the quitprogram sub
+
+ quitprogram();
+
##==============end of main==========================
-##=============================subs====================
-
-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
-};
-
-##======================================
-## 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");
- };
-##========================================
+ sub rotation {
-sub checkstate{
-### simple check to see if wrong no of colours being used etc
-### uses the cubie colours as used by rubikcube package= ROYGBWX
+print " SUB rotation\n";
- gprint ("...checking state of cube");
+ ## here we process the array @data (from main) consisting of all
+ ## the rotation commands associated with
+ ## a single RubikRotation command -- the `rotation' key word has already been removed
+ ## so we start here with [name] if it exists.
- 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]);
+ ##---------------------------
+ ## variables used in SUBs rotation() and rubikmod()
+ ## need to be defined outside the SUBs
-my $R=0,my $O=0,my $Y=0,my $G=0,my $B=0,my $W=0,my $X=0;
+ $modnumber=-1; #multiple associated with the char, eg D2 etc
+ $rotcode="";
+ $rotnumber=0;
+ #------------------
+ my @repeatcode = ();
-my $cubiecolour = "";
+ my $m=-1;
+ my $originalrcode="";
+ my $j; ## used with m below
+ my $numberofchars; ## length of a string
+ my $nfrontchars;
-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)")};
-};
+ ## grab the rotation code passed to this sub from MAIN
+ my $rcode = $_[0];
-##====================================================
-# no of arguments passed to the sub = $#_ (black book p 156)
+ ## now we start a big loop processing each cs-element (= rcode),
+ ## and collecting these elements into two cs-strings
+ ## ($Sequence --> original string output as SHORT string (has codes like R2,L3 etc),
+ ## and $rotationseqNEW --> output as LONG string -- all short codes expanded)
- 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;(MOD 4) (NOT IMPLEMENTED)");
- errormessage ("[$originalchar] in RubikRotation (4 MOD 4 = 0)");
- next;
- };
+
+ ## first, clean leading and trailing white space (eg between, R ,)
+ $rcode = cleanstring($rcode);
+
+
+ ## grab a copy of the element (char) for use if m Mod4=0
+ $originalrcode=$rcode;
+
+ ## increment the loop counter (initialised in MAIN)
+ $jrcode=$jrcode+1; ## increment rotation element (char) counter
+
+
+ ## ----------------------------------
+ ## We look at the first character of each element in the sequence
+ ## if an element has a leading [ then it is a label (not a rotation)
+ ## should really be matched, but this is not checked for at present.
+ ## If this is the case, then jump to next element in the array
+
+ ## BUT if trailing comma is missing, then next rotation is included as part of the label
+ ## so need to trap this and test: is first AND last char a sq bracket?
+
+ if ( (substr ($rcode,0,1) =~ /\[/) and (substr ($rcode,-1) ) =~ /\]/) {
+
+ gprint ("...$rcode is a label OK");
+
+ if ($directionflag eq $inverse) {
+ # do nothing
+ }
+
+ else{
+ ## if this `label' is also the FIRST element, then label = name
+ if ($jrcode ==1) {$SequenceName=$rcode};
+ }; # end of IF
+
+ ## now get next rotation element
+ next;
+ }; ## end of if
+
+ ##--------------
+
+ ## the rcode must therefore be either a rotation code or a repeat-block.
+
+ ##----------------------------------------
+ ## we have already replaced any repeat (,) with {;}
+ ## so we now check for elements with leading { and then expand them.
+
+ ## Note that if there is NO comma before the {} of a {repeat block}, then
+ ## the true repeat block will not be recognised by the
+ ## usual test -- since the test is looking for a leading { etc.
+ ## However, in this event, the string being handled (not a true element)
+ ## will be processed as if it were a rotation, and an
+ ## error will be thrown, so it will get picked up OK.
+
+ if (substr ($rcode,0,1) =~ /\{/ )
+ {
+ print " repeat block found = $rcode \n";
+
+ ## since we now want to send each rotation element in the repeat block to
+ ## the rotation sub, we need to replace any ; with commas
+ ## therefore translate ; --> , but retain the {}
+ $rcode =~ tr/;/,/;
+
+ print " repeat block reformulated = $rcode \n";
+
+
+ #-------log file message--------
+ ## log file: we want to show the repeat string in the users original form
+ ## so we translate it back to the user's orig form {,} --> (,)
+ $origrcode=$rcode;
+ $origrcode =~ tr/\{/(/;
+ $origrcode =~ tr/\}/)/;
+ gprint ("...Expanding: $origrcode ...");
+ #-------------
+
+
+ #-----------
+ ## expand the code in the repeat block
+ print " CALLing SUB: repeat($rcode)\n";
+
+ repeat($rcode); # this expands the repeated elements in the block
+
+ ## this sub returns the expanded form as $insert
+ $expanded_repeatcode=$insert;
+
+ print " expanded_repeatcode = $expanded_repeatcode\n\n";
+ #------------
+
+ #----------------
+ # process each new element in the expanded_repeatcode --> rotation
+ # make expanded_repeatcode into an array, and send each element on
+
+ @repeatcode = split (/,/, $expanded_repeatcode) ;
+
+
+ ## -----------check for direction flag-----------------
+ ## if flag set then reverse the array
+ if ( $directionflag eq $inverse){@repeatcode = reverse @repeatcode};
+
+
+ # send each element to rotation SUB for processing
+ print " CALLing SUB rotation\n";
+ foreach $E (@repeatcode) {
+ print " sending repeat element $E to rotation SUB\n";
+ rotation($E)
+ };
+
+ # when this foreach is finished, then get next rotation element from
+ # the original @data array (see foreach.. near end of MAIN)
+ next;
+
+ }; ## end of if
+
+ ##================================
+
+ ## if an element has got this far, it must be a single rotation code
+ ## (maybe with a trailing digit), so it needs processing as a rotation
+ ## and appending the code to what will become the SequenceLONG string.
+
+ ##------------------------
+
+ ## CALL the sub rubikmod to process the rotation element,
+ ## and to return the front code (= $rotcode), orig no = $rotnumber,
+ ## and mod4 value (= $modnumber).
+
+ rubikmod($rcode);
+
+ ## update rcode <--- rotcode (returned by the SUB rubikmod() )
+ ## collect $m <--- modnumber (returned by the SUB rubikmod() )
+ $rcode = $rotcode;
+ $m = $modnumber;
+
+ ## we collect all the new versions of rcode into a cs-string = $SequenceLong
+ ## which will finally be output as the LONG string
+
+#-----------------------
+# check with directionflag
+ if ($directionflag eq $inverse) {$rcode = inverse ($rcode)};
+#-------------------------
+
+ ##--------------------
+ if ( $m == 0 )
+ {
+ ## do NOT implement the rotation code, and do NOT append to SequenceLong
+ ## print the /original/ rcode (eg R4, or D0 etc)
+ gprint ("..*rotation ,$originalrcode, ERROR ($rotnumber = 0 mod 4) not implemented");
+ ErrorMessage(",$originalrcode, -- ($rotnumber = 0 mod 4) not implemented");
+ next;
};
- ## if single trailing digit present, then we implement the rotation command m times.
+
+ if ( $m == 1 )
+ {
+ if($rotnumber >=5)
+ {gprint ("...Expanding $originalrcode ($rotnumber = $m mod 4) ...")};
+ $SequenceLong=$SequenceLong.$rcode.",";
+ }
+ else {
+ # m = 2 or 3
+ if($rotnumber >=5)
+ {gprint ("...Expanding $originalrcode ($rotnumber = $m mod 4) ...")}
+ else {gprint ("...Expanding $originalrcode ...")};
+
+ for($j=1; $j<=$m; $j++)
+ {## append rcode m times to sequenceLONG
+ $SequenceLong=$SequenceLong.$rcode.","
+ };
+ }; ## end of else
+
+ ##-------------------
+
+ ## 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}}
+
+
+ if ($rcode eq "L") {for($j=1;$j<=$m;$j++) {gprint ("...rotation L, OK (= Lp3)"); &rrL}}
+ elsif ($rcode eq "Lp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lp, OK"); &rrLp}}
+ elsif ($rcode eq "Lw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lw, OK (= Lp3 + Srp)"); &rrLw}}
+ elsif ($rcode eq "Lwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lwp, OK (= Lp + Sr)"); &rrLwp}}
+ elsif ($rcode eq "Ls") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ls, OK (= L + Rp)"); &rrLs}}
+ elsif ($rcode eq "Lsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lsp, OK (= Lp + R)"); &rrLsp}}
+ elsif ($rcode eq "La") {for($j=1;$j<=$m;$j++) {gprint ("...rotation La, OK (= L + R)"); &rrLa}}
+ elsif ($rcode eq "Lap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lap, OK (= Lp + Rp)"); &rrLap}}
+ ####
+ elsif ($rcode eq "R") {for($j=1;$j<=$m;$j++) {gprint ("...rotation R, OK"); &rrR}}
+ elsif ($rcode eq "Rp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Rp, OK (= R3)"); &rrRp}}
+ elsif ($rcode eq "Rw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Rw, OK (= R + Sr)"); &rrRw}}
+ elsif ($rcode eq "Rwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Rwp, OK (= Rp + Srp)"); &rrRwp}}
+ elsif ($rcode eq "Rs") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Rs, OK (= R + Lp)"); &rrRs}}
+ elsif ($rcode eq "Rsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Rsp, OK (= Rp + L)"); &rrRsp}}
+ elsif ($rcode eq "Ra") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ra, OK (= R + L)"); &rrRa}}
+ elsif ($rcode eq "Rap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Rap, OK (= Rp + Lp)"); &rrRap}}
####
- 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 ($rcode eq "U") {for($j=1;$j<=$m;$j++) {gprint ("...rotation U, OK"); &rrU}}
+ elsif ($rcode eq "Up") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Up, OK (= U3)"); &rrUp}}
+ elsif ($rcode eq "Uw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Uw, OK (= U + Su)"); &rrUw}}
+ elsif ($rcode eq "Uwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Uwp, OK (= Up + Sup)"); &rrUwp}}
+ elsif ($rcode eq "Us") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Us, OK (= U + Dp)"); &rrUs}}
+ elsif ($rcode eq "Usp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Usp, OK (= Up + D)"); &rrUsp}}
+ elsif ($rcode eq "Ua") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ua, OK (= U + D)"); &rrUa}}
+ elsif ($rcode eq "Uap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Uap, OK (= Up + Dp)"); &rrUap}}
####
- 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}}
+ elsif ($rcode eq "D") {for($j=1;$j<=$m;$j++) {gprint ("...rotation D, OK (= Dp3)"); &rrD}}
+ elsif ($rcode eq "Dp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dp, OK "); &rrDp}}
+ elsif ($rcode eq "Dw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dw, OK (= Dp3 + Sup)"); &rrDw}}
+ elsif ($rcode eq "Dwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dwp, OK (= Dp + Su)"); &rrDwp}}
+ elsif ($rcode eq "Ds") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ds, OK (= D + Up)"); &rrDs}}
+ elsif ($rcode eq "Dsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dsp, OK (= Dp + U)"); &rrDsp}}
+ elsif ($rcode eq "Da") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Da, OK (= D + U)"); &rrDa}}
+ elsif ($rcode eq "Dap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dap, OK (= Dp + Up)"); &rrDap}}
####
- ## 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")}}
+ elsif ($rcode eq "F") {for($j=1;$j<=$m;$j++) {gprint ("...rotation F, OK"); &rrF}}
+ elsif ($rcode eq "Fp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fp, OK (= F3)"); &rrFp}}
+ elsif ($rcode eq "Fw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fw, OK (= F + Sf)"); &rrFw}}
+ elsif ($rcode eq "Fwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fwp, OK (= Fp + Sfp)"); &rrFwp}}
+ elsif ($rcode eq "Fs") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fs, OK (= F + Bp)"); &rrFs}}
+ elsif ($rcode eq "Fsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fsp, OK (= Fp + B)"); &rrFsp}}
+ elsif ($rcode eq "Fa") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fa, OK (= F + B)"); &rrFa}}
+ elsif ($rcode eq "Fap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fap, OK (= Fp + Bp)"); &rrFap}}
####
- ## rotation must be undefined
+ elsif ($rcode eq "B") {for($j=1;$j<=$m;$j++) {gprint ("...rotation B, OK (= Fp3)"); &rrB}}
+ elsif ($rcode eq "Bp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bp, OK"); &rrBp}}
+ elsif ($rcode eq "Bw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bw, OK (= Fp3 + Sfp)"); &rrBw}}
+ elsif ($rcode eq "Bwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bwp, OK (= Fp + Sf)"); &rrBwp}}
+ elsif ($rcode eq "Bs") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bs, OK (= B + Fp)"); &rrBs}}
+ elsif ($rcode eq "Bsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bsp, OK (= Bp + F)"); &rrBsp}}
+ elsif ($rcode eq "Ba") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ba, OK (= B + F)"); &rrBa}}
+ elsif ($rcode eq "Bap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bap, OK (= Bp + Fp)"); &rrBap}}
+
+ #### --------------------------------------
+
+ #### inner-slice (= middle slice)
+ ## need to include MES (middle slice) notation
+ elsif ($rcode eq "M") {for($j=1;$j<=$m;$j++) {gprint ("...rotation M, OK (= Sl) "); &rrSl}}
+ elsif ($rcode eq "Mp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Mp, OK (= Sr) "); &rrSr}}
+ elsif ($rcode eq "E") {for($j=1;$j<=$m;$j++) {gprint ("...rotation E, OK (= Sd) "); &rrSd}}
+ elsif ($rcode eq "Ep") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ep, OK (= Su) "); &rrSu}}
+ elsif ($rcode eq "S") {for($j=1;$j<=$m;$j++) {gprint ("...rotation S, OK (= Sf) "); &rrSf}}
+ elsif ($rcode eq "Sp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sp, OK (= Sb) "); &rrSb}}
+
+ #### middle slice rotations (Singmaster)
+ elsif ($rcode eq "Su") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Su, OK "); &rrSu}}
+ elsif ($rcode eq "Sup") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sup, OK (= Su3)"); &rrSup}}
+ elsif ($rcode eq "Sd") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sd, OK (= Sup)"); &rrSd}}
+ elsif ($rcode eq "Sdp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sdp, OK (= Su)"); &rrSdp}}
+ elsif ($rcode eq "Sl") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sl, OK (= Srp)"); &rrSl}}
+ elsif ($rcode eq "Slp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Slp, OK (= Sr)"); &rrSlp}}
+ elsif ($rcode eq "Sr") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sr, OK"); &rrSr}}
+ elsif ($rcode eq "Srp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Srp, OK (= Sr3)"); &rrSrp}}
+ elsif ($rcode eq "Sf") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sf, OK"); &rrSf}}
+ elsif ($rcode eq "Sfp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sfp, OK (= Sf3)"); &rrSfp}}
+ elsif ($rcode eq "Sb") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sb, OK (= Sfp)"); &rrSb}}
+ elsif ($rcode eq "Sbp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sbp, OK (= Sf)"); &rrSbp}}
+
+ ## need to include Jaap Puzzles website for middle slice notation (Lm, Lmp)
+ ## also include Randelshofer website middle slice notation (ML,MLp..)
+
+ elsif ($rcode eq "ML" or $rcode eq "MRp" or $rcode eq "Lm" or $rcode eq "Rmp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Lm = M = Sl) "); &rrSl}}
+
+ elsif ($rcode eq "MR" or $rcode eq "MLp" or $rcode eq "Rm" or $rcode eq "Lmp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Rm = Mp = Sr) "); &rrSr}}
+
+ elsif ($rcode eq "MU" or $rcode eq "MDp" or $rcode eq "Um" or $rcode eq "Dmp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Um = Ep = Su) "); &rrSu}}
+
+ elsif ($rcode eq "MD" or $rcode eq "MUp" or $rcode eq "Dm" or $rcode eq "Ump")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Dm = E = Sd) "); &rrSd}}
+
+ elsif ($rcode eq "MF" or $rcode eq "MBp" or $rcode eq "Fm" or $rcode eq "Bmp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Fm = S = Sf) "); &rrSf}}
+
+ elsif ($rcode eq "MB" or $rcode eq "MFp" or $rcode eq "Bm" or $rcode eq "Fmp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Bm = Sp = Sb) "); &rrSb}}
+ ##----------------------------------
+
+ #### double outer slice (wide) notation
+ #### need to include Randelshofer TL, TLp double outer slice notation
+ #### (equiv to the w wide notation)
+ elsif ($rcode eq "TL") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TL, OK (= Lw = Lp3 + Srp)"); &rrLw}}
+ elsif ($rcode eq "TLp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TLp, OK (= Lwp = Lp + Sr)"); &rrLwp}}
+ elsif ($rcode eq "TR") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TR, OK (= Rw = R + Sr)"); &rrRw}}
+ elsif ($rcode eq "TRp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TRp, OK (= Rwp = Rp + Srp)"); &rrRwp}}
+ elsif ($rcode eq "TU") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TU, OK (= Uw = U + Su)"); &rrUw}}
+ elsif ($rcode eq "TUp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TUp, OK (= Uwp = Up + Sup)"); &rrUwp}}
+ elsif ($rcode eq "TD") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TD, OK (= Dw = Dp3 + Sup)"); &rrDw}}
+ elsif ($rcode eq "TDp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TDp, OK (= Dwp = Dp + Su)"); &rrDwp}}
+ elsif ($rcode eq "TF") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TF, OK (= Fw = F + Sf)"); &rrFw}}
+ elsif ($rcode eq "TFp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TFp, OK (= Fwp = Fp + Sfp)"); &rrFwp}}
+ elsif ($rcode eq "TB") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TB, OK (= Bw = Fp3 + Sfp)"); &rrBw}}
+ elsif ($rcode eq "TBp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TBp, OK (= Bwp = Fp + Sf)"); &rrBwp}}
+
+
+ ## ---------------------------
+ ## opposite slice notation of Randelshofer (SR, SRp) (= standard Rs, Rsp)
+ ## opposite outer slices rotated in SAME direction as the FACE
+
+ elsif ($rcode eq "SL") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Ls = L + Rp)"); &rrLs}}
+ elsif ($rcode eq "SLp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Lsp = Lp + R)"); &rrLsp}}
+
+ elsif ($rcode eq "SR") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Rs = R + Lp)"); &rrRs}}
+ elsif ($rcode eq "SRp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Rsp = Rp + L)"); &rrRsp}}
+
+ elsif ($rcode eq "SU") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Us = U + Dp)"); &rrUs}}
+ elsif ($rcode eq "SUp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Usp = Up + D)"); &rrUsp}}
+
+ elsif ($rcode eq "SD") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Ds = D + Up)"); &rrDs}}
+ elsif ($rcode eq "SDp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Dsp = Dp + U)"); &rrDsp}}
+
+
+ elsif ($rcode eq "SF") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Fs = F + Bp)"); &rrFs}}
+ elsif ($rcode eq "SFp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Fsp = Fp + B)"); &rrFsp}}
+
+ elsif ($rcode eq "SB") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Bs = B + Fp)"); &rrBs}}
+ elsif ($rcode eq "SBp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Bsp = Bp + F)"); &rrBsp}}
+
+
+ ## -------------------------
+
+ ## whole cube rotations
+ ## need to include x,y,z (upper and lowercase) and also u,d,l,r,f,b (lowercase only) equivalents
+ elsif ($rcode eq "X" or $rcode eq "x" or $rcode eq "r")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= x = R + Sr + Lp)"); &rrR;&rrSr;&rrLp}}
+ elsif ($rcode eq "Xp" or $rcode eq "xp" or $rcode eq "l")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= xp = Rp + Srp + L)");&rrRp;&rrSrp;&rrL}}
+ elsif ($rcode eq "Y" or $rcode eq "y" or $rcode eq "u")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= y = U + Su + Dp)"); &rrU;&rrSu;&rrDp}}
+ elsif ($rcode eq "Yp" or $rcode eq "yp" or $rcode eq "d")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= yp = Up + Sup + D)");&rrUp;&rrSup;&rrD}}
+ elsif ($rcode eq "Z" or $rcode eq "z" or $rcode eq "f")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= z = F + Sf + Bp)"); &rrF;&rrSf;&rrBp}}
+ elsif ($rcode eq "Zp" or $rcode eq "zp" or $rcode eq "b")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= zp = Fp + Sfp + B)");&rrFp;&rrSfp;&rrB}}
+
+ ## more whole cube notation
+ ## need to include Jaap website whole cube Lc notation
+ ## also include Randelshofer C notation (CL, CLp.)
+
+ elsif ($rcode eq "CL" or $rcode eq "CRp" or $rcode eq "Lc" or $rcode eq "Rcp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Lc = xp = Rp + Srp + L)");&rrRp;&rrSrp;&rrL}}
+
+ elsif ( $rcode eq "CR" or $rcode eq "CLp" or $rcode eq "Rc" or $rcode eq "Lcp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Rc = x = R + Sr + Lp)"); &rrR;&rrSr;&rrLp}}
+
+ elsif ($rcode eq "CU" or $rcode eq "CDp" or $rcode eq "Uc" or $rcode eq "Dcp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Uc = y = U + Su + Dp)"); &rrU;&rrSu;&rrDp}}
+
+ elsif ($rcode eq "CD" or $rcode eq "CUp" or $rcode eq "Dc" or $rcode eq "Ucp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Dc = yp = Up + Sup + D)");&rrUp;&rrSup;&rrD}}
+
+ elsif ($rcode eq "CF" or $rcode eq "CBp" or $rcode eq "Fc" or $rcode eq "Bcp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Fc = z = F + Sf + Bp)"); &rrF;&rrSf;&rrBp}}
+
+ elsif ($rcode eq "CB" or $rcode eq "CFp" or $rcode eq "Bc" or $rcode eq "Fcp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Bc = zp = Fp + Sfp + B)");&rrFp;&rrSfp;&rrB}}
+
+ ## -----------------------------
+
+ ## check empty string --> missing rotation
+ elsif ($rcode eq "") {for($j=1;$j<=$m;$j++)
+ {
+ gprint ("..*rotation ,$rcode, ERROR ? typo or missing rotation");
+ ErrorMessage(",$rcode, -- ? typo or missing rotation");
+ }
+ }
+ ## finally ----------------------
else {
- gprint ("...rotation $originalchar NOT KNOWN");
- errormessage("[$originalchar] in RubikRotation\{\}");
- };
- }; # end of foreach
- }; # end of sub
+ ## to fall this far then the rotation (char) must be undefined
+ ## but before we can send these rotation code strings out in ErrorMessages
+ ## we need to check that they are in the original format.
+ ## ie., do not have any {;} chars etc. If they do, then we need to
+ ## translate them back, ie {;} --> (,) etc
+
+ ## we use `originalcode' in the ErrorMessage because the user needs to be
+ ## shown the `bad' code as it was originally input by the RubikRotation{} command.
+
+
+ ## check for code with { ; } and restore to normal syntax
+ if ( $rcode =~ m/(\{|;|\}|\])/ ) {
+ $rcode = restorebrackets($rcode);
+ $originalrcode = restorebrackets($originalrcode);
+ };
+
+
+ if ( $rcode =~ m/(\(|\)|\[|\])/) {
+ gprint ("..*rotation $rcode ERROR -- code not known ? missing comma or nested brackets");
+ ErrorMessage("$originalrcode -- code not known ? missing comma or nested brackets");
+ }
+ else{
+ gprint ("..*rotation $rcode ERROR -- code not known ? typo or missing comma");
+ ErrorMessage("$originalrcode -- code not known ? typo or missing comma");
+ };
-##---------------------------------------------
-## 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)
+ # missing comma after random is a common error
+ if ($originalrcode =~ m/random/i ) {
+ ErrorMessage("$originalrcode -- ? missing comma after random");
+ };
+ #-----------------------------
+ next;
+ }; #end of else
+ next;
+ } # end of sub
-##==========================================================
-# no of arguments passed to the sub = $#_ (black book p 156)
-# parameters passed = $_[0]
-sub random{
+
+#======================================
+
+ sub random {
+
+print " SUB random\n";
+
## 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
+## assign 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 @rrlist= ("U", "Up", "Um", "Ump",
+ "D", "Dp", "Dm", "Dmp",
+ "L", "Lp", "Lm", "Lmp",
+ "R", "Rp", "Rm", "Rmp",
+ "F", "Fp", "Fm", "Fmp",
+ "B", "Bp", "Bm", "Bmp");
my $rrlistnumber=$#rrlist;
print " rrlistnumber = $rrlistnumber\n";
@@ -600,21 +1005,23 @@ print " rrlistnumber = $rrlistnumber\n";
## 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";
+ ## 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 missing: using default value 50");
+ ErrorMessage ("warning: integer n missing or invalid (n=50 was used)")};
-## set the seed for the randomisation (BlackBook p 235)
-srand;
+ 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,
@@ -634,17 +1041,26 @@ for ($j = 1; $j <=$s; $j=$j+1)
## 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==================================
+ my $E;
+
+ foreach $E (@rr) { rotation($E) };
+
+ } ##end of sub
+
+
+#======================================
+
+ sub writestate {
- sub writestate{
-## this just writes the final state to the TeX_OUT_FILE (= rubikstateNEW.dat) will be read by latex.
+print " SUB writestate\n";
-print (TeX_OUT_FILE "\%\% output datafile=$out_file\n");
-print (TeX_OUT_FILE "\%\% PERL prog=rubikrotation version $version\n");
+## this 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 script=rubikrotation.pl 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");
@@ -653,33 +1069,246 @@ print (TeX_OUT_FILE "\\RubikFaceRight\{$Rlt[0]\}\{$Rmt[0]\}\{$Rrt[0]\}\{$Rlm[
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");
+##-----RWDN 2016---create four new holder commands for separate strings----------
+
+## these four names are defined in the rubikrotation.sty file so they can be renewed etc
+## SequenceInfo
+## SequenceName
+## SequenceShort
+## SequenceLong
+
+
+## ----RWDN 25 Sept 2016 ----------------------
+## now remove the first and last chars of [name] to output just NAME without [ and ]
+
+## initialise some variables we shall need
+ $numberofcharsinstring=0;
+ $nmiddlecharsinstring=0;
+
+
+##----------SequenceName----------------------------
+
+## the SequenceName currently includes the [..]
+## need to remove the [] before senting it to LaTeX,
+## so need to detect when NAME string itself is empty, eg []
+## so create a variable:
+ $SequenceNameNew="";
+
+ $numberofcharsinstring = length $SequenceName;
+
+
+## NEED to create error message if [] and empty string etc
+
+if ($numberofcharsinstring <= 2)
+ {$SequenceNameNew = $SequenceName}
+ else {
+
+ $nmiddlecharsinstring = ($numberofcharsinstring - 2);
+ ## reassign the string without first and last chars
+ ### format of substr = (origstring, start possn, no of chars to use)
+ $SequenceNameNew = substr($SequenceName,1,$nmiddlecharsinstring);
+ };
+
+
+print (TeX_OUT_FILE "\\renewcommand\\SequenceName\{$SequenceNameNew\}\%\n");
+
+print (TeX_OUT_FILE "\\typeout{...SequenceName = $SequenceNameNew}\%\n");
+#-----------------
+
+
+
+#----------SequenceInfo----------------
+## we need to preserve any {} structures in the info string,
+## so change { } --> [ ] since
+## otherwise they will disappear or cause error when printed in LaTeX
+
+ $SequenceInfo=~ tr/\{/\[/; ## swap { --> [
+ $SequenceInfo=~ tr/\}/\]/; ## swap } --> ]
+
+print (TeX_OUT_FILE "\\renewcommand\\SequenceInfo\{$SequenceInfo\}\%\n");
+
+print (TeX_OUT_FILE "\\typeout{...SequenceInfo = $SequenceInfo}\%\n");
+#-----------------
+
+
+
+##---------SequenceShort------------------
+## generated in MAIN
+## SequenceShort = original argument of \RubikRotation{} /without/ any infoblocks
+## therefore it may contain square brackets
+
+print (TeX_OUT_FILE "\\renewcommand\\SequenceShort\{$SequenceShort\}\%\n");
+
+print (TeX_OUT_FILE "\\typeout{...SequenceShort = $SequenceShort}\%\n");
+##-----------------------
+
+
+## now prepare the new LONG rotation sequence for output =(LONG sequence + NO NAME)
+## BUT before outputting the string, we need to remove the terminal comma
+
+$numberofcharsinstring = length $SequenceLong;
+$nfrontcharsinstring = $numberofcharsinstring -1;
+## reassign the string except the terminal comma
+$SequenceLong = substr($SequenceLong,0,$nfrontcharsinstring);
+
+
+#----------
+print (TeX_OUT_FILE "\\renewcommand\\SequenceLong\{$SequenceLong\}\%\n");
+
+print (TeX_OUT_FILE "\\typeout{...SequenceLong = $SequenceLong}\%\n");
+
+
+
+##-----------------------
+
## now include any error messages generated
## (these are all in an array waiting to be printed out)
-if ($erroralert eq "YES")
+ 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");
- };
+
+ ## do not attach error to a <checkstate> command, since we really want
+ ## to see the checkstate errors (in the ERROR file) printed AFTER the `rotation' command.
+ if ($rotationcommand eq "checkstate") {}
+ else {print (ERROR_OUT_FILE "*ERR cmd= $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";
-}
-##===========================================
-##================================================
+ ## restore correct brackets etc before outputting to Latex
+ my $errorstring = $error[$k];
+ $errorstring = restorebrackets($errorstring);
+
+ print (TeX_OUT_FILE "\\typeout{$errorstring}\%\n");
+ print (ERROR_OUT_FILE "$errorstring\n");
+
+ }; # end of for
+ }; # end of IF
+ print " Perl output file written OK\n";
+
+ } #end of sub
+
+
+#======================================
+
+ sub ErrorMessage {
+
+ ## writes the argument as a standard error message to out file
+
+ my $errormess = $_[0]; ## parameter passed to sub
+
+ ## restore correct brackets etc before outputting to Latex
+ $errormess = restorebrackets($errormess);
+
+ $erroralert = "YES"; ## set error alert flag (for use in out message)
+ $error[$errornumber] = "*ERR $errormess";
+ $errornumber++; ## increment number
+ };
+
+
+#======================================
+
+ sub gprint {
+
+## 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.
+
+ my $gmess=$_[0];
+ print "$gmess\n";
+ print (TeX_OUT_FILE "\\typeout{$gmess}\%\n");
+ };
+
+
+#======================================
+
+ sub checkstate{
+
+print " SUB checkstate\n";
+
+## only a 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 {
+ gprint ("..*cubie-colour counting ERROR");
+ }
+ };
+
+ 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)");
+
+ # only generate ErrorMessages if n>9 (as may be using a Grey cube)
+ if ($cubiesum != 54) {
+ ErrorMessage ("cubiesum not = 54");
+ gprint ("..*cubiesum not = 54") };
+
+ if ($R >9){
+ ErrorMessage("red cubies > 9 (=$R)");
+ gprint ("..*red cubies > 9 (=$R)") };
+
+ if ($O >9){
+ ErrorMessage("orange cubies > 9 (=$O)");
+ gprint ("..*orange cubies > 9 (=$O)") };
+
+ if ($Y >9){
+ ErrorMessage("yellow cubies > 9 (=$Y)");
+ gprint ("..*yellow cubies > 9 (=$Y)") };
+
+ if ($G >9){
+ ErrorMessage("green cubies > 9 (=$G)");
+ gprint ("..*green cubies > 9 (=$G)") };
+
+ if ($B >9){
+ ErrorMessage("blue cubies > 9 (=$B)");
+ gprint ("..*blue cubies > 9 (=$B)") };
+
+ if ($W >9){
+ ErrorMessage("white cubies > 9 (=$W)");
+ gprint ("..*white cubies > 9 (=$W)") };
+
+ if ($X == 54){
+ ErrorMessage("no colours allocated (X=54)");
+ gprint ("..*no colours allocated (X=54)") };
+
+ print " done\n\n";
+ };
+
+
+#======================================
+
+## Overview of rotation transform subs
+
+#======================================
## 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
@@ -697,13 +1326,18 @@ print " Perl output file written OK\n";
## 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
+## Each of the middle 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{
+## We document only the side and face of the first sub (rrR) in detail, since
+## the other subs are of similar form.
+#======================================
-## the R (slice + face) transform
+
+#======================================
+
+ sub rrR {
+
+## the RIGHT (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
@@ -711,6 +1345,7 @@ print " Perl output file written OK\n";
##-----------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],
@@ -729,6 +1364,7 @@ print " Perl output file written OK\n";
## 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];
@@ -746,12 +1382,13 @@ $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)
+## RIGHT 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]);
@@ -761,6 +1398,7 @@ $Frt[0]=$Rs0[11]; $Frt[1]=$Rs1[11];
## 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];
@@ -774,10 +1412,13 @@ $Rmb[0]=$Rf0[7]; $Rmb[1]=$Rf1[7];
$Rrb[0]=$Rf0[8]; $Rrb[1]=$Rf1[8];
}
-#============================
-sub rrSr {
-## Sr = Right middle SLICE rotation (only 12 side facelets)
+
+#======================================
+
+ 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
@@ -812,12 +1453,15 @@ $Fmt[0]=$SRs0[11]; $Fmt[1]=$SRs1[11];
}
-##===================
-sub rrLp{
-## Left slice (side + face) anticlockwise rotation
+#======================================
+
+ 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],
@@ -847,7 +1491,7 @@ $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)
+## do the LEFT face transform (in rows: 1,2,3//4,5,6//7,8,9)
## f = face; 0=colour, 1= number
## NOTES: not same as for R
@@ -868,15 +1512,16 @@ $Lrb[0]=$LPf0[8]; $Lrb[1]=$LPf1[8];
}
-##==================================
-##==============================
- sub rrU{
+#======================================
-## Up slice (side + face)
+ 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],
@@ -907,6 +1552,7 @@ $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]);
@@ -924,13 +1570,16 @@ $Urb[0]=$Uf0[8]; $Urb[1]=$Uf1[8];
}
-##==============================
- sub rrSu{
+#======================================
+
+ 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],
@@ -961,14 +1610,15 @@ $Llm[0]=$SUs0[11]; $Llm[1]=$SUs1[11];
}
-##==============================
+#======================================
- sub rrDp{
+ sub rrDp {
-## Dpwn Face anticlockwise rotation (side and face)
+## Down 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],
@@ -1015,13 +1665,15 @@ $Drt[0]=$DPf0[8]; $Drt[1]=$DPf1[8];
}
-##==============================
- sub rrF{
+#======================================
+
+ 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],
@@ -1068,13 +1720,15 @@ $Frb[0]=$Lf0[8]; $Frb[1]=$Lf1[8];
}
-##==============================
- sub rrSf{
+#======================================
-## do the Fs transform (side only)
+ sub rrSf {
+
+## do the FRONT middle slice Fm 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],
@@ -1102,14 +1756,16 @@ $Lmm[0]=$SFs0[10]; $Lmm[1]=$SFs1[10];
$Lmt[0]=$SFs0[11]; $Lmt[1]=$SFs1[11];
}
-##==============================
-
- sub rrBp{
+
+#======================================
+
+ 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],
@@ -1139,6 +1795,7 @@ $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]);
@@ -1155,4 +1812,791 @@ $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===================================
+
+
+#======================================
+
+
+#======================================
+
+## Overview of derivative transform subs
+
+#======================================
+
+##---------------------------------------------
+## Note that we have defined (as rotation SUBs above) just 9 primary rotation transforms:
+## (x axis): rrR, rrSr, rrLp
+## (y axis): rrU, rrSu, rrDp
+## (z axis): rrF, rrSf, rrBp
+## and since all remaining possible rotations are simply combinations of these 9
+## we now define all the other rotation subs in terms of these 9 primary rotations.
+## Do NOT use multiples here: write each rotation separately
+## ----------------
+## NB: the Sr, Su, Sf are the middle slice rotations (= Rm, Um, Fm respectively)
+## (the `m' notation is much more intuitive than the S., but too late to change notation now)
+## -------------
+
+## ----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)
+
+
+
+#======================================
+
+ sub rubikmod {
+
+ ## for MODifying (MOD 4)
+print " SUB rubikmod\n";
+ ## passing one RotationElement as a parameter, & return a modified one
+ ## make local variables
+
+
+ my $rot="";
+ my $lencode="";
+ my $char="";
+ my $m4=-1;
+ my $num=-1;
+ my $p=0;
+
+
+ # grab the parameter string
+ # $code = @_[0];
+ $code = $_[0]; ## Perl says this is better
+
+ $lencode=length $code;
+
+ ## we want to split the code string into the front (Rubikcode) and terminal number
+ ## so grab 1 char sequentially starting from the end of the string
+ ## and identify the position of the first non-digit char we get to
+ ## example: $lastchar = substr $code,-1,1 ;
+ for ($p=-1; $p>-$lencode-1; $p=$p-1){
+ $char = substr $code,$p,1 ;
+ if ($char =~ /\d/) {}
+ else{
+ ## this char is the first non-digit from the end"
+ ## its position = $p
+ last;
+ };
+ };
+
+ ## now use the value of $p to split the code string
+ ## into front part (= $rot) and back part (= $num)
+
+ ## get $rot
+ $rot = substr $code, 0, ($lencode + $p + 1);
+
+ ## get $num
+ $num = substr $code, $lencode +$p +1, ($lencode -(length $rot));
+
+ ##--------------
+ ## if no number at all (eg D) then this Rubikcode needs to be implemented just once
+ ## so allocate its num to have value = 1
+
+ ## if ($num == ""){$num=1}; ## BUT this gives an ErrorMessage when num="" etc
+ ## so I have rewritten [if numlength --> 0 then..] then it works OK
+
+ $numlength = ($lencode -(length $rot));
+ if ($numlength == 0) {$num=1};
+ ##---------------------
+
+ ## determine mod 4 of the value num
+ $m4 = $num % 4;
+
+ ## now return the results
+ $rotcode=$rot;
+ $rotnumber=$num; ## we return this so we can use it as a check
+ $modnumber=$m4;
+
+ return $rotcode, $rotnumber, $modnumber;
+
+ } #end of sub
+
+
+#======================================
+
+ sub cleanstring {
+
+ # to clean leading and trailing whitespace from a string
+
+ my $line="";
+
+ $line = $_[0]; # copied from my RubikMOD()
+
+ #clean leading & trailing whitespace
+
+ $line =~ s/^\s+//; ## clean leading whitespace
+ $line =~ s/\s+$//; ## clean trailing whitespace
+
+ return $line;
+ }
+
+
+#======================================
+
+ sub cutinfoblock {
+
+ ## remove each <infoblock> if any exists
+
+ ## pass the whole dataline
+
+ print " SUB cutinfoblock\n";
+
+ my $dataline = $_[0];
+
+ ## we know all brackets are balanced - as this has been checked already.
+
+ print " dataline = $dataline\n";
+ my $Langle=0;
+ my $Rangle=0;
+ my $angleblock="";
+ my $lenangleblock=0;
+
+ ## first see if there is a terminal infoblock
+ $Langle = index $dataline, '<'; ## <
+ $Rangle = index $dataline, '>'; ## <
+ $lenangleblock = $Rangle - $Langle +1;
+
+ ##-----------------
+ ## angleblock is the whole block <...> including both angles
+ ## check both angles exist
+ if ( ($Langle !=-1) and ($Rangle !=-1) )
+ {
+
+ my $angleblock = substr ($dataline, $Langle, $lenangleblock);
+ print " infoblock(s) present: first = $angleblock\n";
+
+ my $lenangleblock = length $angleblock;
+ my $lendataline = length $dataline;
+
+
+ # now need to remove the infoblock from $dataline
+ # need to get front and back strings
+ my $frontstring="";
+ my $newfrontstring="";
+ my $backstring="";
+
+ $lenbackstring= $lendataline - $Rangle -1;
+ $frontstring = substr ($dataline,0, $Langle); # string before Langle
+ $backstring = substr ($dataline,$Rangle +1); # string beyond Rangle
+
+ print " Langle possn = $Langle\n";
+ print " Rangle possn = $Rangle\n";
+ print " lenangleblock (diff + 1) = $lenangleblock\n";
+ print " lendataline = $lendataline\n";
+ print " lenbackstring = $lenbackstring\n";
+ print " frontstring = $frontstring\n";
+
+ #remove the terminal comma from front string
+ $newfrontstring = substr($frontstring, 0, $Langle -1);
+ print " new frontstring = $newfrontstring\n";
+ print " backstring = $backstring\n";
+
+ ##-------
+ # remove angleblock from dataline (join front and back strings)
+ $newdataline =$newfrontstring.$backstring;
+
+ $SequenceInfo = substr ($angleblock, 1, $lenangleblock -2);
+
+ print " new dataline = $newdataline\n";
+ print " SequenceInfo = $SequenceInfo\n";
+ print " newdataline = $newdataline\n";
+ print " done\n\n";
+
+ return $SequenceInfo, $newdataline;
+ }
+
+ else{
+ # no infoblock, so need to make newdataline same as orig dataline
+ $newdataline=$dataline;
+ print " no <infoblock> to remove.\n\n";
+ return $newdataline;
+ };
+ #-----------------
+
+
+ } ## end of sub
+
+
+#======================================
+
+ sub fixrepeatelement {
+
+ print " SUB fixrepeatelement\n";
+
+ print " reformatting any repeat elements...\n";
+
+ ## this sub replaces ,-->; and (--> { and ) --> } for the repeat element
+ ## and inserts it back into the original rotation sequence, where it now
+ ## appears as a separate rotation element.
+
+ my $repeatstring="";
+ my $lenrepeatstring="";
+ my $newrepeatstring="";
+ my $frontstring="";
+ my $backstring="";
+ my $p=0;
+ my $q=0;
+ my $len = 0;
+ my $k1=0;
+ my $k2 = 0;
+
+
+ ## pass the whole dataline without the keyword
+ my $dataline = $_[0]; # copied from my RubikMOD()
+
+
+ $p = index $dataline, '(';
+ $q = index $dataline, ')';
+
+ print " p = $p, q = $q\n";
+
+
+ $lenrepeatstring = $q -$p +1 ;
+ $repeatstring = substr ($dataline, $p, $lenrepeatstring);
+
+ print " first repeat string = $repeatstring\n";
+ print " length of repeat string = $lenrepeatstring\n";
+
+ ## translate the chars
+ $repeatstring =~ tr/,/;/; ## swap , --> ; Black book page 138--139
+ $repeatstring =~ tr/\(/\{/; ## swap ( --> {
+ $repeatstring =~ tr/\)/\}/; ## swap ) --> }
+
+ $newrepeatstring = $repeatstring;
+
+ print "...new repeat string = $newrepeatstring\n";
+
+ #------------
+ $k1=$p; #start of cut
+ $k2= $p + $lenrepeatstring; #end of cut
+ $frontstring = substr ($dataline,0, $k1);
+ $backstring = substr ($dataline,$k2);
+ print " frontstring = $frontstring\n";
+ print " backstring = $backstring\n";
+
+ # add insert
+ $newdataline =$frontstring.$newrepeatstring.$backstring;
+ print " new dataline = $newdataline\n";
+
+
+ print " done\n\n";
+
+ } # end of sub
+
+
+#======================================
+
+ sub repeat {
+
+ # to expand the repeating elements
+
+print " SUB repeat\n";
+
+ ## pass the whole repeatstring = {...}n
+ my $repeatstring = $_[0];
+
+ # the string ={code}n
+ # get the code sequence and the terminal digit
+
+ my $p=0;
+ my $q=0;
+ my $repeatnumber=0;
+ my $repeatcode="";
+ my $lenrepeatcode =0;
+
+ $p = index $repeatstring, '{';
+ $q = index $repeatstring, '}';
+ $lenrepeatcode = $q - $p -1;
+
+
+
+ $repeatcode = substr ($repeatstring,1,$lenrepeatcode);
+ print " repeatcode = $repeatcode\n"; ## correct
+
+
+ $lenrepeatstring= length $repeatstring;
+
+
+ print " lenrepeatstring = $lenrepeatstring\n";
+ print " lenrepeatcode = $lenrepeatcode\n";
+ print " p = $p\n";
+ print " q = $q\n";
+
+
+ if ($lenrepeatcode == ($lenrepeatstring-2)) {
+ print " there is no trailing number --> 1\n";
+ $repeatnumber=1;
+ print " set repeatnumber = $repeatnumber\n";
+ }
+ else{
+ $repeatnumber= substr ($repeatstring, $q + 1); # correct
+ print " repeatnumber = $repeatnumber\n";
+
+ ## need to check that repeatnumber is a valid integer
+ if ($repeatnumber =~ /\D/){
+ # not a valid number
+
+ ## renormalise brackets etc before outputting to LaTeX
+ $repeatnumber= restorebrackets($repeatnumber);
+
+ gprint ("..*repeat-no. ERROR: $repeatnumber not numeric");
+ ErrorMessage ("repeat-no. $repeatnumber not numeric ?missing comma or nested ()");
+ };
+
+ }; #end of else
+
+
+ ## make n copies of repeatcode
+ ## we need commas only between elements (not at end)
+
+ $insert=""; ## $insert = global
+ $insert=$repeatcode;
+ for ($t=1; $t < $repeatnumber; $t=$t+1) {$insert=$insert.",".$repeatcode};
+
+ print " insert = $insert\n";
+ print " done\n\n";
+
+ } # end sub
+
+
+#======================================
+
+ sub quitprogram {
+
+ ## exiting the program cleanly
+ print " closing down: writing state...\n";
+ writestate(); ## write to the output files
+ close; ## close all files
+ exit;
+ }
+
+
+#======================================
+
+ sub showarray {
+
+ # show the array as a string
+
+ my @newarray = @_; # copied from my RubikMOD()
+ my $arraystring= join (",",@newarray);
+ print " the array = *$arraystring*\n\n";
+ }
+
+
+#======================================
+
+ sub cleanarray {
+
+ # cleans array elements of leading and trailing whitespace
+
+ my @cleanset=();
+ my @line = @_;
+ my $E;
+
+ foreach $E (@line) {
+ $E =~ s/^\s+//; ## clean leading whitespace
+ $E =~ s/\s+$//; ## clean trailing whitespace
+ push @cleanset, $E;
+ };
+
+ return @cleanset;
+
+}
+
+
+#======================================
+
+ sub restorebrackets {
+
+ my $line = $_[0];
+
+ ## translate the chars
+ $line =~ tr/;/,/; ## swap , --> ; Black book page 138--139
+ $line =~ tr/\{/\(/; ## swap ( --> {
+ $line =~ tr/\}/\)/; ## swap ) --> }
+
+ return $line;
+
+}
+
+
+#======================================
+
+ sub infoblockcolon {
+
+ print "...SUB InfoblockColon\n";
+
+ ## pass the whole dataline without the keyword
+ my $line = $_[0]; # copied from my RubikMOD()
+
+ if ( (index $line, '<' ) == -1) {
+ # no infoblock, so need to make newdataline same as orig dataline
+ print " no <infoblock> found.\n\n";
+ $newdataline=$dataline;
+ return $newdataline;
+ }
+ else{
+ print " infoblock(s) present\n";
+
+ print " start-string = $line\n";
+
+ # look at each char
+ my $j=0;
+ my $char="";
+
+ my $lenstring = 0;
+ $lenstring= length $line;
+
+ # set initial state of inout-flag
+ my $inoutflag="outside";
+
+ #------------------------
+ for ($j=0; $j<=$lenstring; $j=$j+1) {
+ $char = substr ($line,$j,1);
+
+ if ( ($char eq ',') and ($inoutflag eq 'inside')) {
+ # replace the char with ;
+ substr ($line, $j, 1, ";");
+ print " colon-string = $line\n";
+ };
+
+ ## need these at end of the loop
+ if ($char eq '<'){$inoutflag = "inside"};
+ if ($char eq '>'){$inoutflag = "outside"};
+
+ }; # end of for
+
+ #---------------------------
+
+ # -- repeat for [ ] brackets------
+ $inoutflag="outside";
+
+ for ($j=0; $j<=$lenstring; $j=$j+1) {
+ $char = substr ($line,$j,1);
+
+ if ( ($char eq ',') and ($inoutflag eq 'inside')) {
+ # replace the char with ;
+ substr ($line, $j, 1, ";");
+ print " colon-string = $line\n";
+ };
+
+ ## need these at end of the loop
+ if ($char eq '['){$inoutflag = "inside"};
+ if ($char eq ']'){$inoutflag = "outside"};
+
+ }; # end of for
+
+
+ #----------------------------------
+ ## make an array from the string so we can manipulate the elements
+ our @linedata=();
+ @linedata= split (/,/, $line);
+
+#----------clean the array-------
+ my $E;
+ my @cleandata=();
+
+ foreach $E (@linedata) {
+ $E =~ s/^\s+//; ## clean leading whitespace
+ $E =~ s/\s+$//; ## clean trailing whitespace
+ push @cleandata, $E;
+ };
+
+ print " colon-array = @cleandata\n";
+
+#=================
+
+# Because <infoblocks> can be located inside curved brackets
+# as for example, (\sixspot)2, [\sixspot macro contains an infoblock].
+# Consequently, we need to remove
+# the <..> blocks as parts of a string, not as elements in an array.
+# --otherwise, removing the terminal infoblock associated with \sixspot
+# will result in also removing the right-hand curved bracket --> error.
+# So we return the data as a string, and then send it to sub cutinfoblock later.
+
+ $newdataline = join (",", @cleandata);
+ print "...done\n\n";
+
+ return $newdataline;
+
+ } ## end of else
+ } ## end of sub
+
+
+#======================================
+
+ sub RemoveAllSpaces {
+
+ # remove all spaces in a string
+ # Black book page 143
+
+ my $string=$_[0];
+
+ $string =~ s/\s//g; # OK
+
+ return $string;
+
+}
+
+#======================================
+
+sub CheckSyntax {
+
+ ## checks that all () {} <> are matched (if any exist)
+ ## checks for other syntax problems, eg missing commas
+ ## if any brackets are not balanced, then we SET an errorflag, and terminate the program
+
+ print " SUB CheckSyntax\n";
+
+ my $dataline = $_[0];
+
+ # first clean out all spaces so we can look for specific strings
+ $dataline=RemoveAllSpaces($dataline);
+
+ print " dataline = $dataline\n";
+
+
+
+
+ ## count brackets; Angle, Square, Curved
+ my ($nleftA, $nrightA) = 0;
+ my ($nleftS, $nrightS) = 0;
+ my ($nleftC, $nrightC) = 0;
+ my ($leftsum, $rightsum) =0;
+
+ ## Blackbook p 139 - counting chars in a string
+ $nleftA = ($dataline =~ tr/</</);
+ $nrightA = ($dataline =~ tr/>/>/);
+
+ $nleftS = ($dataline =~ tr/[/[/);
+ $nrightS = ($dataline =~ tr/]/]/);
+
+ $nleftC = ($dataline =~ tr/(/(/);
+ $nrightC = ($dataline =~ tr/)/)/);
+
+ print " left and right <> = $nleftA, $nrightA\n";
+ print " left and right [] = $nleftS, $nrightS\n";
+ print " left and right () = $nleftC, $nrightC\n";
+
+
+ $leftsum = $nleftA + $nleftS + $nleftC;
+ $rightsum =$nrightA + $nrightS + $nrightC;
+
+ print " leftsum, rightsum = $leftsum, $rightsum\n";
+
+ # define the current rotation command before any ErrorMessages are issued
+ # $rotationcommand=$dataline; ## used in writestate sub
+
+ my $errorflag = "";
+
+ if ($leftsum != $rightsum)
+ {
+
+ if ( $nleftS != $nrightS )
+ {
+ gprint ("..*brackets ERROR [ ] Left [$nleftS not equal to Right $nrightS]");
+ ErrorMessage ("brackets [ ]: Left [$nleftS not equal to Right $nrightS]");
+ $errorflag="SET";
+ }
+
+ if ( $nleftC != $nrightC )
+ {
+ gprint ("..*brackets ERROR ( ) Left ($nleftC not equal to Right $nrightC)");
+ ErrorMessage ("brackets ( ): Left ($nleftC not equal to Right $nrightC)");
+ $errorflag="SET";
+ }
+
+ if ( $nleftA != $nrightA )
+ {
+ gprint ("..*brackets ERROR < > Left <$nleftA not equal to Right $nrightA>");
+ ErrorMessage ("brackets < >: Left <$nleftA not equal to Right $nrightA>");
+ $errorflag="SET";
+ }
+
+ };
+
+ #--------------------------
+
+
+
+ # check for other bad syntax
+ # BB p136
+
+ my ($char1, $char2, $charpair) = "";
+ my ($j, $lenstring) = 0;
+ $lenstring= length $dataline;
+ print "lenstring = $lenstring\n";
+
+ # set initial state of inout-flag
+ my $angleflag = "outside";
+ my $squareflag = "outside";
+ my $curvedflag = "outside";
+
+ # look at each char
+ for ($j=0; $j<= $lenstring; $j=$j+1) {
+ $charpair = substr ($dataline,$j,2);
+ $char1 = substr ($dataline,$j,1);
+ $char2 = substr ($dataline,$j+1,1);
+
+ ## at top of for loop
+ if ($char1 eq '<'){$angleflag = "inside"};
+ if ($char1 eq '>'){$angleflag = "outside"};
+ if ($char1 eq '['){$squareflag = "inside"};
+ if ($char1 eq ']'){$squareflag = "outside"};
+ if ($char1 eq '('){$curvedflag = "inside"};
+ if ($char1 eq ')'){$curvedflag = "outside"};
+
+
+ if ($angleflag eq "outside"){
+
+ ## A-Za-z< A-Za-z[ A-Za-z( )A-Za-z >A-Za-z ]A-Za-z
+ ## ]< ][ ]( ]) ]< )< )[ )( >< >[ >( d( d[ d<
+
+ if ( $charpair =~ m/([A-Za-z]\<|[A-Za-z]\[|[A-Za-z]\(|\)[A-Za-z]|\>[A-Za-z]|\][A-Za-z]|\]\<|\]\[|\]\(|\]\)|\]\<|\)\<|\)\[|\)\(|\>\<|\>\[|\>\(|\d\(|\d\[|\d\<|\[\[|\<\<|\(\(|\)\)|\]\]|\>\>)/ )
+ {
+ gprint ("..*syntax error: $charpair -- missing comma");
+ ErrorMessage("$charpair -- syntax error: missing comma");
+ $errorflag="SET";
+ next;
+ };
+
+ # trap nested curved brackets
+ if ( ($char2 eq "(" ) and ($curvedflag eq "inside" ) ) {
+ ## nested curved brackets
+ gprint ("..*syntax error: $charpair -- nested ((..))");
+ ErrorMessage("$charpair -- syntax error: nested ((..)) not allowed");
+ $errorflag="SET";
+ };
+
+ # trap nested square brackets
+ if ( ($char2 eq "[" ) and ($squareflag eq "inside" ) ) {
+ ## nested square brackets
+ gprint ("..*syntax error: $charpair -- nested [[..]]");
+ ErrorMessage("$charpair -- syntax error: nested [[..]] not allowed");
+ $errorflag="SET";
+ };
+
+
+ if ($squareflag eq "inside"){
+ if ($char1 eq ",") {
+ gprint ("..*syntax error: $charpair -- comma not allowed in [ ]");
+ ErrorMessage("$charpair -- syntax error: comma not allowed in [ ]");
+ $errorflag="SET";
+ next;
+ };
+ }; # end of if
+
+
+ ## detect end of string
+ if ($j == $lenstring -1) {last};
+
+
+ }; # end of if
+
+ }; # end of for
+ #---------------------------
+
+
+ if ($errorflag eq "SET") {
+
+ ## closing down
+ gprint ("..*Quiting Perl program -- syntax error");
+ ErrorMessage ("QUITTING PERL PROGRAM -- syntax error");
+
+ print " closing down -- writing state........... OK\n";
+
+ quitprogram();
+
+ }
+ else{
+ print " syntax OK; brackets balanced OK\n";
+ print " done\n\n";
+ };
+
+
+} ## end sub
+
+
+
+#====================
+
+sub inverse {
+
+my $E = $_[0];
+
+ my $lastchar = substr ($E, -1,1);
+ my $frontchars = substr ($E, 0,-1); # correct
+
+ if ($lastchar eq "2") {$newE = $E}
+
+ elsif ($lastchar eq "p") { $newE = $frontchars}
+
+ else { $newE = $E."p"};
+
+return $newE;
+}
+
+##======================
+
diff --git a/Master/texmf-dist/doc/latex/rubik/README.txt b/Master/texmf-dist/doc/latex/rubik/README.txt
index 73e4741a858..1874d1938a3 100644
--- a/Master/texmf-dist/doc/latex/rubik/README.txt
+++ b/Master/texmf-dist/doc/latex/rubik/README.txt
@@ -1,62 +1,65 @@
-September 25, 2015
+ March 3, 2017
--------------------------------------------------------------------------
-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 2017/03/03
+ - rubikcube package v4.0 -> macros and commands for typesetting
+ - rubikrotation package v4.0 -> macros and Perl program for rotations
+ - rubikpatterns package v4.0 -> macros and commands for typesetting
--------------------------------------------------------------------------
-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.
+The RUBIK bundle provides three complementary packages for documenting the
+Rubik cube (3x3x3) notation, configurations and for processing rotation sequences.
+The three packages are (a) the rubikcube package, (b) the rubikrotation package,
+and (c) the rubikpatterns 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.
+ random scrambling of the Rubik cube on-the-fly, using the
+ RubikRotation command. It returns the new Rubik state in a form
+ which can then be typeset using commands from 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.
+ package requires (a) Perl to be installed, and (b) (Pdf/Lua)LaTeX needs
+ to be run using the --shell-escape command-line switch (LuaLaTeX will
+ require access to the recent shellesc package).
(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.
+ rubikcube:
+ --- Improved documentation.
+ --- Additional notation for middle slice rotations (`m' notation).
+ --- Additional notation for whole cube rotations (`c' notation).
+ --- Added Randelshofer notation (the `CMST' rotations).
+ --- Two new \Draw.. commands which replace earlier (now deprecated
+ but still supported) versions.
+ --- Six new commands for showing and annotating rotation sequences.
+ --- A new command for setting up a `solved' colour configuration.
+ --- A new command for setting up a `starter cube' for which the whole
+ cube is allocated the default grey colour.
- (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.
+ rubikrotation:
+ --- better syntax checking
+ --- 4 new macros SequenceInfo, SequenceName, SequenceShort, SequenceLong
+
+ rubikpatterns:
+ --- a new package (a small database of patterns and sequences)
--------------------------------------------------------------------------
RWD Nickalls email: dick@nickalls.org
A Syropoulos email: asyropoulos@yahoo.com
--------------------------------------------------------------------------
-Copyright 2014 RWD Nickalls & A Syropoulos
+Copyright 2017 RWD Nickalls & A Syropoulos
Licence
@@ -68,6 +71,7 @@ The latest version of this license is in
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:
@@ -77,22 +81,30 @@ package files:
- rubikrotation.ins,
- rubikrotation.dtx,
- rubikrotation.sty,
- - rubikrotation.pl (Perl script)
+ - rubikrotation.pl (Perl script)
+ - rubikpatterns.ins
+ - rubikpatterns.dtx
+ - rubikpatterns.sty
documentation and README:
- rubikcube.pdf
- rubikrotation.pdf,
- - rubikrotationPL.pdf, Prel program documentation
+ - rubikrotationPL.pdf (Perl script documentation)
- rubikrotationPL.tex
- - rubikrotation.1, MAN file for perl script
+ - rubikrotation.1 (MAN file for Perl script)
+ - rubikpatterns.pdf
+ - rubikpatternsLIST.pdf
+ - rubikpatternsLIST.tex
- README.txt (this file)
image files:
- pdf -files for the rubikcube documentation (6 pictures)
- pdf -files for the rubikrotation documentation (4 pictures)
+ - pdf -files for the rubikrotation documentation (1 picture)
examples:
- - example-rot.pdf,
- - example-rot.tex
-bash and bat files (for running rotation examples)
+ - rubikexamples.pdf,
+ - rubikexamples.tex
+bash and bat files (for running rubikexamples.tex and rubikpatternsLIST.tex)
--------------------------------------------------------------------------
-If you have any ideas, questions, suggestions or bugs to report, please
+
+If you have any ideas, suggestions, questions, or bugs to report, please
feel free to contact us.
--------------------------------------------------------------------------
diff --git a/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figB.pdf b/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figB.pdf
deleted file mode 100644
index 5bdd92967c5..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figB.pdf
+++ /dev/null
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
deleted file mode 100644
index cc59d3f62b0..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figF.pdf
+++ /dev/null
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
deleted file mode 100644
index a5df718d3bc..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figD.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/examples.pdf b/Master/texmf-dist/doc/latex/rubik/examples.pdf
deleted file mode 100644
index 7aae8f46b65..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/examples.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/examples.sh b/Master/texmf-dist/doc/latex/rubik/examples.sh
deleted file mode 100644
index a891b830979..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/examples.sh
+++ /dev/null
@@ -1,5 +0,0 @@
- 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
deleted file mode 100644
index 9f5a1512175..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/examples.tex
+++ /dev/null
@@ -1,467 +0,0 @@
-%%
-%% 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/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
new file mode 100644
index 00000000000..bb584fe413b
--- /dev/null
+++ 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
index 26fb68fe62c..26fb68fe62c 100644
--- a/Master/texmf-dist/doc/latex/rubik/Rubik-doc-figD.pdf
+++ 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..497cf9722d6
--- /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/rubikcube.pdf b/Master/texmf-dist/doc/latex/rubik/rubikcube.pdf
index 62d8671ee15..769582bad7a 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/rubikexampfig4.tex b/Master/texmf-dist/doc/latex/rubik/rubikexampfig4.tex
new file mode 100644
index 00000000000..d21fedf22c5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/rubikexampfig4.tex
@@ -0,0 +1,7 @@
+%% filename: rubikexampfig4.tex%
+\RubikFaceUp{G}{B}{R}{W}{O}{Y}{Y}{O}{R}%
+\RubikFaceDown{O}{B}{Y}{R}{R}{R}{W}{O}{W}%
+\RubikFaceLeft{Y}{G}{R}{B}{B}{O}{O}{Y}{B}%
+\RubikFaceRight{W}{G}{Y}{W}{G}{G}{O}{W}{R}%
+\RubikFaceFront{G}{G}{B}{Y}{Y}{B}{W}{R}{B}%
+\RubikFaceBack{B}{O}{O}{R}{W}{Y}{G}{W}{G}%
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikexamples.pdf b/Master/texmf-dist/doc/latex/rubik/rubikexamples.pdf
new file mode 100644
index 00000000000..34e91dc761f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/rubikexamples.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikexamples.sh b/Master/texmf-dist/doc/latex/rubik/rubikexamples.sh
new file mode 100644
index 00000000000..52b86832b02
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/rubikexamples.sh
@@ -0,0 +1,9 @@
+
+## rubikexamples.sh
+## run twice to get hyperref links correct
+
+ pdflatex --shell-escape rubikexamples.tex
+ pdflatex --shell-escape rubikexamples.tex
+
+## echo "...checking error file"
+## grep ERROR ./rubikstateERRORS.dat
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikexamples.tex b/Master/texmf-dist/doc/latex/rubik/rubikexamples.tex
new file mode 100644
index 00000000000..053efe2e17e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/rubikexamples.tex
@@ -0,0 +1,1313 @@
+%%
+%% rubikexamples.tex
+%% March 03, 2017
+%% Requires rubik bundle v4.0 and also the tikz package
+%% Part of the Rubik bundle (www.ctan.org/pkg/rubik)
+%% authors: RWD Nickalls & A Syropoulos
+%%--------NOTE-------------------------------------------
+%% USAGE: (pdf)latex --shell-escape rubikexamples.tex
+%% run three times to get all labels and fig nos correct
+%%-------------------------------------------------------
+\documentclass[a4paper]{article}
+%------rubik----------
+\usepackage{tikz} %% load tikz BEFORE rubikcube
+\usepackage{rubikcube}
+\usepackage{rubikrotation}
+\usepackage{rubikpatterns}
+%------LUA-----------
+% LuaTeX is a Unicode engine (as is XeTeX)
+\usepackage{ifluatex}
+\ifluatex
+ \usepackage{fontspec}
+\fi
+%--------------------
+\usepackage{url}
+\usepackage{ifpdf}
+\usepackage{lmodern}
+%---------------------
+\ifpdf
+ \usepackage[verbose]{microtype}
+ \usepackage{cmap}
+ \usepackage[pdfencoding=auto]{hyperref}
+
+ \hypersetup{%
+ pdftitle={rubikexamples.pdf},
+ pdfsubject={Rubik cube, Rubik bundle},
+ pdfkeywords={Rubik cube LaTeX}
+ }
+\fi
+%%-------------------
+
+
+%-------------
+\pagestyle{myheadings}
+\markright{\texttt{rubikexamples.pdf} \ \
+(Rubik bundle v4.0, March 03, 2017) \hspace{0.5cm}\texttt{www.ctan.org/pkg/rubik}}
+%-----------
+%% brace and bracket
+\newcommand{\Rubikbracket}[1]{$\left(\mbox{#1}\right)$}
+\newcommand{\Rubikbrace}[1]{$\left\{\mbox{#1}\right\}$}
+\newcommand{\cubenumber}[1]{\strut\raisebox{1cm}{#1}}
+\newcommand{\leftface}{\textsc{left}\ face}
+\newcommand{\rightface}{\textsc{right}\ face}
+\newcommand{\upface}{\textsc{up}\ face}
+\newcommand{\downface}{\textsc{down}\ face}
+\newcommand{\frontface}{\textsc{front}\ face}
+\newcommand{\backface}{\textsc{back}\ face}
+%---------------------------------
+%% increase text height and width
+\addtolength{\oddsidemargin}{-1.5cm}
+\addtolength{\textwidth}{3cm}
+\addtolength{\textheight}{1cm}
+%----------------------
+\begin{document}
+
+\ifpdf\pdfbookmark[1]{Title}{Title}\fi
+\title{Rubik examples\\
+\smallskip\normalsize\texttt{www.ctan.org/tex-archives/macros/latex/contrib/rubik/rubikexamples.pdf}
+\,\footnote{This file is part of the Rubik bundle. To generate this file,
+use the following command: \newline \texttt{\$ pdflatex --shell-escape rubikexamples.tex}}}
+\author{RWD Nickalls\,\footnote{email: \textsf{dick@nickalls.org}}%
+ \ \ \& A Syropoulos\,\footnote{email: \textsf{asyropoulos@yahoo.com}}}
+\date{03 March 2017 (v4.0)}
+\maketitle
+
+
+%%------------------
+\section{Preliminaries}
+
+
+These examples were generated using the \TeX\
+Rubik bundle\,\footnote{\url{http://www.ctan.org/pkg/rubik}} v4.0. They assume some
+familiarity with the three complementary packages \textsc{rubikcube},
+\textsc{rubikrotation} and \textsc{rubikpatterns}. For~documentation see the files:
+
+\begin{quote}
+\begin{verbatim}
+rubikcube.pdf
+rubikrotation.pdf
+rubikpatterns.pdf
+rubikpatternsLIST.pdf
+\end{verbatim}
+\end{quote}
+
+
+This file requires the following packages: \texttt{tikz, rubikcube, rubikrotation,
+rubikpatterns}; note that the \texttt{tikz} package must be loaded \textit{before}
+the \texttt{rubikcube} package.
+
+This file needs to be run using the \verb!--shell-escape! command-line option;
+for example:
+\begin{quote}
+\begin{verbatim}
+pdflatex --shell-escape rubikexample.tex
+\end{verbatim}
+\end{quote}
+This is because nearly all the examples make use of the \verb!\RubikRotation!
+command, which calls the Perl script \texttt{rubikrotation.pl}.
+If you do forget to use the command-line switch, the file will still run, but
+all the cubes will remain in the initial unprocessed configuration.
+
+
+\subsection{Environments}
+
+When using the Rubik bundle one sometimes needs to be mindful of the various
+\LaTeX\ environments in which Rubik commands are placed (e.g.,~the figure,
+minipage and TikZ picture environments), since these environments restrict
+the actions of commands they contain to the particular environment.
+The \verb!\ShowCube! command is also relevant here, since it is a
+minipage-wrapper for the TikZ picture environment. Only Rubik \verb!\Draw..!
+commands actually need to be inside a TikZ picture environment.
+
+This issue arises because the Rubik bundle allows you to create figures
+showing different stages during a sequence of rotations. Consequently
+the effects of commands executed inside an environment (especially
+commands which determine the colour-state or rotations), may not be
+apparent to subsequent commands outside that particular environment.
+See Example~3 for an illustration of how to handle environments.
+
+\pagebreak
+
+%%------------------
+\section{Examples}
+
+\subsection{Sixspot}
+\typeout{---Example (sixspot)}
+
+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}.
+
+%%--------FIGURE 1 -----------
+\begin{figure}[hbt]
+\centering
+\RubikCubeSolved
+\RubikRotation{\sixspot}
+\ShowCube{7cm}{0.7}{\DrawRubikCubeSF}
+\caption{\label{fig:cubeincube}The `sixspot' configuration.}
+\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! can include \textsc{rubikcube}
+package \verb!\Draw..! commands, and any commands which are valid for use in a
+TikZ \texttt{tikzpicture} environment. The code for the above figure is as follows:
+\begin{quote}
+\begin{verbatim}
+\begin{figure}[hbt]
+ \centering
+ \RubikCubeSolved
+ \RubikRotation{\sixspot}
+ \ShowCube{7cm}{0.7}{\DrawRubikCubeSF}
+\caption{...}
+\end{figure}
+\end{verbatim}
+\end{quote}
+
+Note that the sixspot sequence is a so-called `order~3' sequence, which means that
+running the `sixspot' sequence 3 times returns the cube to its original `solved'
+state. The~command for processing it three times is \verb!\RubikRotation[3]{\sixspot}!.
+
+Note that the semi-flat form of the cube here is generated by the
+ \verb!\DrawRubikCubeSF! command, where the terminal SF denotes the Semi-Flat form.
+
+
+
+\subsubsection{Log-file extract}
+
+Users may find it instructive to inspect the the log-file and follow the dynamic
+interaction between \LaTeX\ and the Perl script.
+This is easy to follow, since output by \texttt{rubikrotation.sty} is prefixed
+by 3 dashes (\verb!---!), while output by the Perl script is prefixed by
+3 dots (\verb!...!). Search for the keyword `Example', as this is written to
+the log-file at the start of each example.
+
+The following is the log-file extract associated with Example~1 (from the
+author's Debian Linux platform).
+
+\begin{quote}
+\begin{verbatim}
+---Example (sixspot)
+LaTeX Font Info: Try loading font information for T1+cmss on input line 134.
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/base/t1cmss.fd
+File: t1cmss.fd 2014/09/29 v2.5h Standard LaTeX font definitions
+)
+---TeX process (rubikrotation.sty)-------
+---NEW rotation command------------------
+---command = RubikRotation[1]{[SixSpot],U,Dp,R,Lp,F,Bp,U,Dp,<(8q*, 8f*)>}
+---writing current Rubik state to file rubikstate.dat
+\openout7 = `rubikstate.dat'.
+
+\ourRRcounter=\count121
+---CALLing Perl script (rubikrotation.pl)
+runsystem(perl rubikrotation.pl -i rubikstate.dat -o rubikstateNEW.dat)...execu
+ted.
+
+---inputting NEW datafile (data written by Perl script)
+(./rubikstateNEW.dat
+
+...PERL process..................................
+...script = rubikrotation.pl v4.0 (03 March 2017)
+...reading the current rubik state (from File: 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
+...
+...command=checkstate
+...checking state of cube
+...cubiesum = 54 (Red=9, Or=9, Ye=9, Gr=9, Bl=9, Wh=9, X=0)
+...
+...command=rotation,[SixSpot],U,Dp,R,Lp,F,Bp,U,Dp,<(8q*, 8f*)>
+...dataline = rotation,[SixSpot],U,Dp,R,Lp,F,Bp,U,Dp,<(8q*; 8f*)>
+...[SixSpot] is a label OK
+...rotation U, OK
+...rotation Dp, OK
+...rotation R, OK
+...rotation Lp, OK
+...rotation F, OK
+...rotation Bp, OK
+...rotation U, OK
+...rotation Dp, OK
+...writing new Rubik state to file rubikstateNEW.dat
+...SequenceName = SixSpot
+...SequenceInfo = (8q*; 8f*)
+...SequenceShort = [SixSpot],U,Dp,R,Lp,F,Bp,U,Dp
+...SequenceLong = U,Dp,R,Lp,F,Bp,U,Dp
+)
+\end{verbatim}
+\end{quote}
+
+
+
+\pagebreak
+%%-------------------------
+
+\subsection{ShowRubikErrors}
+\typeout{---Example (ShowRubikErrors)}
+
+
+ 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.
+ Note that this example is similar to the previous one except that we have
+ introduced several errors---e.g.,~bad minipage width, typos, as well as
+ 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), or even at the end of the document.
+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.5}{\DrawRubikCubeF}
+ \ShowRubikErrors
+\parbox{0.8\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 and some
+animals\,!) in the rotation sequence (it \textit{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.5$cm) in
+the \verb!\ShowCubeF! command---see code below---is too narrow: it should be
+5cm ($10 \times 0.5$) to just include the whole image (i.e.,~$10 \times$ the TikZ
+scale-factor in this case).
+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}{\DrawRubikCubeF}
+ \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 also reveal any errors.
+
+Note that the completely flat form of the cube here is generated by the
+ \verb!\DrawRubikCubeF! command, where the terminal F denotes the Flat form.
+
+
+
+\pagebreak
+%----------------------
+
+\subsection{Environments}
+\typeout{---Example (Environments)}
+
+
+In this example we highlight the fact that Rubik commands used inside a \LaTeX\
+environment remain local to that environment, and how this can sometimes be
+problematic. Commands whose reach is meant to be more global need to be
+executed outside such environments, where they can implement global colour
+settings, which will then be accessible to Rubik \verb!\Draw..! commands inside
+subsequent environments.
+
+Since we are drawing images, this is primarily an issue
+with the the \verb!\minipage!, \verb!\figure!, and TikZ picture environments.
+Consequently, it is generally best when drawing a sequence of cubes to reserve
+the TikZ picture environment only for Rubik \verb!\Draw..! commands and TikZ
+commands. Importantly, this also applies to the commonly used \verb!\ShowCube!
+command, since this is a minipage-wrapper for the TikZ picture environment
+(see the \textsc{rubikcube} package documentation).
+
+In this example the first cube (9a) uses a \verb!\RubikCubeSolved! command
+\textit{inside} a \verb!\ShowCube! environment. However, if we now perform the
+rotation \textRubik{R}\ (using the command \verb!\RubikRotation{R}!) this results
+in a quite unexpected effect on cube (9b) (and obviously not correct). This is because
+ the effect of the initial \verb!\RubikCubeSolved! command
+ (setting a new colour-state) is not visible outside its \verb!\ShowCube!
+ environment, and hence the subsequent \verb!\RubikRotation{R}! command is unaware
+ of this recent attempt to update the global colour-state information.
+ It turns out that this was actually last updated following the action of the \textbackslash\texttt{RubikRotation\{[sixspot],....\}} command used in
+Example~2, being the last colour-state command executed \textit{outside} an
+environment (a \texttt{figure} environment in that example). Consequently,
+the strange form of cube (9b) is not what we expected.
+
+
+\medskip
+\noindent%
+\cubenumber{9a}%
+\ShowCube{2cm}{0.5}{%
+ \RubikCubeSolved%
+ \DrawRubikCubeRU}%
+\quad\Rubik{R}%
+\RubikRotation{R}%
+\cubenumber{9b}%
+\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}%
+%---------------
+\hspace{5mm}
+\begin{minipage}{0.5\textwidth}
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation}
+\newcommand{\cubenumber}[1]{\strut\raisebox{1cm}{#1}}
+...
+\cubenumber{9a}%
+\ShowCube{2cm}{0.5}{%
+ \RubikCubeSolved%
+ \DrawRubikCubeRU%
+ }%
+\quad\Rubik{R}%
+\RubikRotation{R}%
+\cubenumber{9b}%
+\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}%
+\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
+accessible (i.e.,~colour-state gets updated), and therefore gets used by the
+\verb!\RubikRotation{R}! command, and hence cube (9d) is rendered correctly.
+
+\bigskip
+
+\noindent%
+\RubikCubeSolved%
+\cubenumber{9c}%
+\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}%
+\quad\Rubik{R}%
+\RubikRotation{R}%
+\cubenumber{9d}%
+\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}%
+%---------------
+\hspace{5mm}
+\begin{minipage}{0.5\textwidth}
+\begin{verbatim}
+\RubikCubeSolved%
+\cubenumber{9c}%
+\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}%
+\quad\Rubik{R}%
+\RubikRotation{R}%
+\cubenumber{9d}%
+\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}%
+\end{minipage}
+\end{verbatim}
+\end{minipage}
+
+
+
+
+\pagebreak
+%----------------------
+\subsection{Coordinates}
+\typeout{---Example (coordinates)}
+
+
+For all cubes the origin of coordinates is defined as the bottom left corner of
+the \frontface. Consequently, it is easy to determine the coordinates of points
+and hence draw lines, circles, and place lettering or other objects using the
+standard TikZ \verb!\draw..! and \verb!\node..! commands. Note that for
+convenience point $P$ is designed to be $(-1,-1)$ on the 2D view.
+(The~following diagram is Fig~1 from the \textsc{rubikcube} package documentation).
+
+
+\begin{figure}[hbt]
+\centering
+\RubikFaceFrontAll{X} % X = default = grey
+\ShowCube{5.6cm}{0.7}{%
+ \DrawFlatFront
+
+\draw[line join=round,line cap=round,ultra thick] (0,0) -- (0,4); % Y
+\draw[line join=round,line cap=round,ultra thick] (0,0) -- (4,0); % X
+
+%draw labels
+\node (Ylabel) at (-0.35, 3.8) {$Y$};
+\node (Xlabel) at ( 3.8, -0.4) {$X$};
+
+
+%%----------draw the Rubik faces--------
+%% outline Front face
+\draw[line join=round,line cap=round,ultra thick]%
+ (0,3) -- (-1,2) -- (-1,-1) -- (2,-1) -- (3,0);
+%%
+%% outline Down face
+\draw[line join=round,line cap=round,ultra thick]%
+ (-1,-1) -- (0, 0);
+%%
+%%
+%% draw labels
+\node (Y0) at (-0.4, 0) [blue]{$0$};
+\node (Y1) at (-0.4, 1) [blue]{$1$};
+\node (Y2) at (-0.4, 2) [blue]{$2$};
+\node (Y3) at (-0.4, 3) [blue]{$3$};
+%%
+\node (X0) at (0, -0.5) [blue]{$0$};
+\node (X1) at (1, -0.5) [blue]{$1$};
+\node (X2) at (2, -0.5) [blue]{$2$};
+\node (X3) at (3, -0.5) [blue]{$3$};
+%%
+\node (P) at (-2.4, -1) [blue]{$P\,(-1,-1)$};
+}
+\end{figure}
+
+
+
+{\noindent}The code for the figure is given below.
+
+We draw everything in the \verb!\ShowCube! environment; the \frontface\
+in grey (colour code = \texttt{X}) using the Rubik command
+\verb!\DrawFlatFront{X}!, and then draw all the lines and text using standard
+TikZ commands. The correct minipage-width argument (5.6cm) for the
+\verb!\ShowCube! command is determined by trial-and-error, using the `fbox'
+form of the command (\verb!\ShowCubeF!), and then the `F' is removed
+($\rightarrow$ \verb!\ShowCube!). In order to avoid confusion, all Rubik commands
+start with a capital letter (e.g.,~\verb!\Draw..!), while all TikZ commands
+start with a lower-case letter (e.g.,~\verb!\draw..!).
+
+\begin{quote}
+\begin{verbatim}
+\begin{figure}[hbt]
+\centering
+\RubikFaceFrontAll{X}% X = default non-colour (grey)
+\ShowCube{5.6cm}{0.7}{%
+ \DrawFlatFront
+ \draw[line join=round,line cap=round,ultra thick] (0,0) -- (0,4);% Yaxis
+ \draw[line join=round,line cap=round,ultra thick] (0,0) -- (4,0);% Xaxis
+ \node (Ylabel) at (-0.35, 3.8) {$Y$};
+ \node (Xlabel) at ( 3.8, -0.4) {$X$};
+ %% outline Left and Down faces
+ \draw[line join=round,line cap=round,ultra thick]%
+ (0,3) -- (-1,2) -- (-1,-1) -- (2,-1) -- (3,0);
+ \draw[line join=round,line cap=round,ultra thick]%
+ (-1,-1) -- (0, 0);
+ \node (Y0) at (-0.4, 0) [blue]{$0$};
+ \node (Y1) at (-0.4, 1) [blue]{$1$};
+ \node (Y2) at (-0.4, 2) [blue]{$2$};
+ \node (Y3) at (-0.4, 3) [blue]{$3$};
+ \node (X0) at (0, -0.5) [blue]{$0$};
+ \node (X1) at (1, -0.5) [blue]{$1$};
+ \node (X2) at (2, -0.5) [blue]{$2$};
+ \node (X3) at (3, -0.5) [blue]{$3$};
+ \node (P) at (-2.4, -1) [blue]{$P\,(-1,-1)$};
+ }
+\end{figure}
+\end{verbatim}
+\end{quote}
+
+
+
+
+\pagebreak
+%----------------------
+\subsection{Face notation}
+\typeout{---Example (face notation)}
+
+
+%% = my Fig A (rubikcube.dtx)
+
+The following diagram is Fig~2 from the \textsc{rubikcube} package documentation.
+
+\begin{figure}[htb]
+\centering%
+\RubikFaceUpAll{Y}
+\RubikFaceFrontAll{G}
+\RubikFaceRightAll{O}
+\ShowCubeF{5cm}{0.6}{%
+\DrawRubikCubeRU%
+%%-----------------
+
+%% Right
+\draw[line width=2pt,color=blue,->] (3.5,2) -- (5.3, 2);
+\node (R) at (4.6, 2.5) [blue]{\textbf{\textsf{R}}};
+\node (x) at (5.8, 2) [blue]{\textbf{\textsf{x}}};
+
+%%Left
+\draw[line width=2pt,color=blue] (-0.2,2) -- (-1.5, 2);
+\node (L) at (-1.1, 2.5) [blue]{\textbf{\textsf{L}}};
+
+%%Up
+\draw[line width=2pt,color=blue,->] (2, 3.5) -- (2, 5.5);
+\node (U) at (1.4, 4.7) [blue]{\textbf{\textsf{U}}};
+\node (y) at (2, 6.1) [blue]{\textbf{\textsf{y}}};
+
+%%Down
+\draw[line width=2pt,color=blue] (2, -0.2) -- (2, -1.5);
+\node (D) at (2.6, -1.1) [blue]{\textbf{\textsf{D}}};
+
+
+%%Front
+\draw[line width=2pt,color=blue,->] (1.5, 1.5) -- (0, -1);
+\node (F) at (0.7, -0.7) [blue]{\textbf{\textsf{F}}};
+\node (z) at (-0.3, -1.4) [blue]{\textbf{\textsf{z}}};
+
+%%Back
+\draw[line width=2pt,color=blue] (3.2, 4.2) -- (4, 5.5);
+\node (B) at (4.4, 5) [blue]{\textbf{\textsf{B}}};
+%%
+}
+\end{figure}
+
+{\noindent}The code for the figure is as follows
+(the origin $(0,0)$ is at the bottom left corner of the \frontface).
+
+
+\begin{quote}
+\begin{verbatim}
+\begin{figure}[htb]
+\centering%
+\RubikFaceUpAll{Y}
+\RubikFaceFrontAll{G}
+\RubikFaceRightAll{O}
+\ShowCubeF{5cm}{0.6}{%
+ \DrawRubikCubeRU%
+ %% Right
+ \draw[line width=2pt,color=blue,->] (3.5,2) -- (5.3, 2);
+ \node (R) at (4.6, 2.5) [blue]{\textbf{\textsf{R}}};
+ \node (x) at (5.8, 2) [blue]{\textbf{\textsf{x}}};
+ %%Left
+ \draw[line width=2pt,color=blue] (-0.2,2) -- (-1.5, 2);
+ \node (L) at (-1.1, 2.5) [blue]{\textbf{\textsf{L}}};
+ %%Up
+ \draw[line width=2pt,color=blue,->] (2, 3.5) -- (2, 5.5);
+ \node (U) at (1.4, 4.7) [blue]{\textbf{\textsf{U}}};
+ \node (y) at (2, 6.1) [blue]{\textbf{\textsf{y}}};
+ %%Down
+ \draw[line width=2pt,color=blue] (2, -0.2) -- (2, -1.5);
+ \node (D) at (2.6, -1.1) [blue]{\textbf{\textsf{D}}};
+ %%Front
+ \draw[line width=2pt,color=blue,->] (1.5, 1.5) -- (0, -1);
+ \node (F) at (0.7, -0.7) [blue]{\textbf{\textsf{F}}};
+ \node (z) at (-0.3, -1.4) [blue]{\textbf{\textsf{z}}};
+ %%Back
+ \draw[line width=2pt,color=blue] (3.2, 4.2) -- (4, 5.5);
+ \node (B) at (4.4, 5) [blue]{\textbf{\textsf{B}}};
+ }
+\end{figure}
+\end{verbatim}
+\end{quote}
+
+
+
+
+
+\pagebreak
+%----------------------
+\subsection{Grey cube}
+\label{sec:greycube}
+\typeout{---Example (grey cube)}
+
+
+When explaining elementary layer~1 moves, it can be useful to use the `grey cube'
+(\verb!\RubikCubeGrey!), as this sets up only the central cubie on each face;
+we have shown the first cube in Semi-Flat (SF) mode simply to show how the grey
+cube is configured (note that an `all-grey' cube is also available:
+\verb!\RubikCubeAllGrey!). Both of these grey cube commands will also accept
+the word `gray' (to be consistent with TikZ).
+
+In this example, we show how to position a single `flipped' white/orange edge
+cubie in the top layer.
+
+
+\begin{figure}[hbt]
+
+\centering%
+\RubikCubeGrey%
+\RubikFaceUp{X}{X}{X}%
+ {X}{W}{O}%
+ {X}{X}{X}%
+
+\RubikFaceRight{X}{W}{X}
+ {X}{G}{X}
+ {X}{X}{X}
+%
+\cubenumber{1}%
+\ShowCube{5cm}{0.5}{\DrawRubikCubeSF}%
+%------------------
+\quad\Rubik{Rp}\RubikRotation{Rp}
+\cubenumber{2}%
+\ShowCube{2cm}{0.5}{\DrawRubikCube}%
+%-----------------------
+\quad\Rubik{Fp}\RubikRotation{Fp}
+\cubenumber{3}%
+\ShowCube{2cm}{0.5}{\DrawRubikCube}%
+%-----------------------
+\end{figure}
+
+
+
+{\noindent}The code for the figure is given below.
+After setting up the first cube, we then just use the \verb!\RubikRotation!
+command to generate the remaining cubes.
+The colours are coded as follows: R~(red), O~(orange), Y~(yellow),
+G~(green), B~(blue), W~(white), and X~(grey).
+
+\begin{quote}
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation}
+\newcommand{\cubenumber}[1]{\strut\raisebox{1cm}{#1}}
+...
+\begin{figure}[hbt]
+\centering
+% set up the first cube
+\RubikCubeGrey%
+\RubikFaceUp{X}{X}{X}%
+ {X}{W}{O}%
+ {X}{X}{X}%
+
+\RubikFaceRight{X}{W}{X}
+ {X}{G}{X}
+ {X}{X}{X}
+\cubenumber{1}%
+\ShowCube{5cm}{0.5}{\DrawRubikCubeSF}%
+%
+\quad\Rubik{Rp}\RubikRotation{Rp}
+\cubenumber{2}%
+\ShowCube{2cm}{0.5}{\DrawRubikCube}%
+%
+\quad\Rubik{Fp}\RubikRotation{Fp}
+\cubenumber{3}%
+\ShowCube{2cm}{0.5}{\DrawRubikCube}%
+\end{figure}
+\end{verbatim}
+\end{quote}
+
+
+
+
+\pagebreak
+
+%-------------------------------
+\subsection{Scramble a cube}
+\label{sec:scrambleacube}
+\typeout{---Example (scramble a cube)}
+
+
+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}
+On this occasion we draw the cube Flat (F) using the command \verb!\DrawRubikCubeF!.
+In this example, we also make use of the \verb!\SaveRubikState{}! command to save
+the final configuration (state) to a file (\texttt{rubikexampfig4.tex}) using
+\verb!\SaveRubikState{rubikexampfig4.tex}!,
+so we can display the same cube configuration later but in a different format
+(we show it again in the following example (Example~\ref{sec:saverubikstate}).
+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
+here and in Example~\ref{sec:saverubikstate}.
+%%--------FIGURE 3 -----------
+\begin{figure}[hbt]
+ \centering
+ \RubikCubeSolved
+ \RubikRotation{random,120}
+ \SaveRubikState{rubikexampfig4.tex}
+ \ShowCubeF{6cm}{0.5}{\DrawRubikCubeF}
+\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{rubikexampfig4.tex}
+ \ShowCubeF{6cm}{0.5}{\DrawRubikCubeF}
+\caption{....}
+\end{figure}
+\end{verbatim}
+\end{quote}
+
+{\noindent}Q: How do we determine the minipage-width ($7.2$cm) in the
+\verb!\ShowCube! command?
+
+\smallskip
+
+{\noindent}A: The object is 12~cubie squares wide. Since the TikZ scale-factor
+argument of the \verb!\ShowCube! command (cms/unit length; default = 1) in this
+case is set to~$0.5$, then the true width of the image will
+be $12 \times 0.5 = 6$\,cm. Note that here we have used the \verb!\ShowCubeF!
+command and so we can see that this is correct. Changing the scale-factor will
+change the image size and hence a new width argument will be required to just fit
+the image.
+
+Note that in this particular case (where there is only a single image in the
+`figure' environment), since the \verb!\ShowCube! command places the image
+(in a TikZ picture environment) centrally inside a 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 centred 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) as we have done here.
+
+
+
+\pagebreak
+
+%----------------------
+\subsection{SaveRubikState}
+\label{sec:saverubikstate}
+\typeout{---Example (SaveRubikState)}
+
+In this example we display a cube having the same state as that shown in
+the previous example (Example~\ref{sec:scrambleacube}). The configuration state
+was saved from Figure~\ref{fig:randomone} using the command
+\verb!\SaveRubikState{rubikexampfig4.tex}!, and then input here
+using \verb!\input{rubikexampfig4.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{rubikexampfig4.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{rubikexampfig4.tex}
+ \Showcube{4cm}{0.8}{\DrawRubikCubeLD}
+\caption{....}
+\end{figure}
+\end{verbatim}
+\end{quote}
+
+
+
+
+\pagebreak
+%----------------------
+\subsection{Series of cubes}
+\typeout{---Example (series of cubes)}
+
+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}%
+\quad\Rubik{U}\quad%
+\RubikRotation{U}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}%
+\quad\Rubik{R}\quad%
+\RubikRotation{R}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}%
+\quad\Rubik{F}\quad%
+\RubikRotation{F}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}%
+\caption{The rotations \rr{U}, \rr{R}, \rr{F}\ on a solved cube.}
+\end{figure}
+
+{\noindent}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}%
+ \quad\Rubik{U}\quad%
+ \RubikRotation{U}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}%
+ \quad\Rubik{R}\quad%
+ \RubikRotation{R}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}%
+ \quad\Rubik{F}\quad%
+ \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}
+
+{\noindent}Note that we are starting with the default white-opposite-yellow (WY)
+solved cube, using the command \verb!\RubikCubeSolved!, which is functionally
+the same as the more explicit \verb!\RubikCubeSolvedWY! (if you forget the
+terminal two letters then at least you will get a `solved' cube).
+A white-opposite-blue (WB) solved cube is available as \verb!\RubikCubeSolvedWB!.
+
+
+
+
+\pagebreak
+%----------------------
+\subsection{Rotation sequence}
+\typeout{---Example (rotation sequence)}
+
+We now explore using the named Rubik cube rotation sequences and associated
+patterns available in the \textsc{rubikpatterns} package---a small macro database
+(see the \textsc{rubikpatterns} documentation, and also its companion file \texttt{rubikpatternsLIST.pdf}). Having the sequences available as macros is
+very convenient since (a)~it avoids making errors when typing them out,
+and (b)~allows the easy application of software tools.
+
+ A Rubik pattern is the configuration generated by a sequence of rotations
+ (or `moves') from some initial starting configuration (typically a `solved'
+ configuration). For example, FourSpot is a well known pattern which we can
+ generate from a solved Rubik cube using the macro \verb!\FourSpot!; it is
+ defined as follows:
+\begin{quote}
+\begin{verbatim}
+\newcommand{\FourSpot}{[FourSpot],F2,B2,U,Dp,R2,L2,U,Dp,<(12q*, 8f*)>}
+\newcommand{\fourspot}{\FourSpot}
+\end{verbatim}
+\end{quote}
+ Note that for convenience the macros names in the \textsc{rubikpatterns} package
+ are defined in both upper and lower-case (i.e.,~the macros \verb!\FourSpot!
+ and \verb!\fourspot! are identical). The following figure shows the FourSpot
+ sequence and pattern.
+
+\bigskip
+
+\noindent%
+\RubikCubeSolvedWY
+\ShowCube{2cm}{0.5}{\DrawRubikCubeRD}
+\RubikRotation{\FourSpot}
+\quad\SequenceBraceA{FourSpot}{%
+ \ShowSequence{}{\Rubik}{\SequenceLong}%
+ }
+\quad\ShowCube{2cm}{0.5}{\DrawRubikCubeSF}
+
+\bigskip
+
+{\noindent}The code for the above figure is as follows:
+
+
+\begin{quote}
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation,rubikpatterns}
+...
+\noindent%
+\RubikCubeSolvedWY
+\ShowCube{2cm}{0.5}{\DrawRubikCubeRD}
+\RubikRotation{\FourSpot}
+\quad
+\SequenceBraceA{FourSpot}{%
+ \ShowSequence{}{\Rubik}{\SequenceLong}%
+ }
+\quad
+\ShowCube{2cm}{0.5}{\DrawRubikCubeSF}
+\end{verbatim}
+\end{quote}
+Note that we have spread the code slightly here in order to emphasise that
+the \verb!\ShowSequence! command is being used as an argument for the
+\verb!\SequenceBraceA! command (the `A' in the command \verb!\SequenceBraceA!
+denotes that the annotation is placed Above the sequence.)
+We have used a solved cube with the WY (White opposite Yellow)
+configuration (\verb!\RubikCubeSolvedWY!).
+The first cube is drawn from the RD (Right-Down) viewpoint (\verb!\DrawRubikCubeRD!).
+The second cube is drawn from the SF (Semi-Flat) viewpoint (\verb!\DrawRubikCubeSF!)
+so we can see all the faces.
+
+\pagebreak
+
+%----------------------
+\subsection{SixTs}
+\typeout{---Example (SixTs)}
+
+A more interesting cube pattern is the SixTs configuration (from the
+\textsc{rubikpatterns} package), which we now show in a slightly
+different way (adding an extra face), as follows:
+
+\bigskip
+
+\noindent\hfil%
+\RubikCubeSolvedWB%
+\ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU\DrawFlatDown{0}{-3.3}}%
+\RubikRotation{\sixts}
+\quad\SequenceBraceA{SixTs}{\ShowSequence{,\ }{\texttt}{\SequenceLong}}
+\quad\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}%
+\quad\ShowCube{2cm}{0.5}{\DrawFaceFrontSide}%
+\hfil
+
+\bigskip
+
+This time we have started with a solved cube having the WB configuration
+(White opposite Blue), which is generated using the command
+\verb!\RubikCubeSolvedWB!
+(we have added the \downface\ (blue) below to reveal the colour of this
+face---see note below).
+
+The rotation sequence is in `long-format' (expanded into
+separate rotations), comma-separated and space, typewriter font,
+using the command \verb!\ShowSequence{,\ }{\texttt}{\SequenceLong}!.
+
+The final image shows just the \frontface\ together with all the
+side-bars indicating the colours of the adjacent facelets,
+using the \verb!\DrawFaceFrontSide! command. The images are
+separated using \verb!\quad!.
+The code for the above figure is as follows:
+
+\begin{quote}
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation,rubikpatterns}
+...
+\noindent\hfil
+\RubikCubeSolvedWB
+\ShowCube{1.6cm}{0.4}{%
+ \DrawRubikCubeRU%
+ \DrawFlatDown{0}{-3.3}%
+ }
+\RubikRotation{\SixTs}
+\quad\SequenceBraceA{SixTs}{%
+ \ShowSequence{,\ }{\texttt}{\SequenceLong}%
+ }
+\quad\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\quad\ShowCube{2cm}{0.5}{\DrawFaceFrontSide}
+\hfil
+\end{verbatim}
+\end{quote}
+
+
+
+\subsubsection*{Notes}
+
+\begin{enumerate}
+
+ \item We have drawn the \downface\ of the first cube using the command
+\verb!\DrawFlatDown{0}{-3.3}! where the two arguments are the $x$ and
+$y$ coordinates of the \textit{bottom left} corner of the \downface\ (blue).
+Note that the grid origin of all cube images coincides with the
+\textit{bottom left} corner of the \frontface\ (green in this case).
+
+\item The first image is really just 4 units wide. This is because the 2D width
+of the \textit{side} face (red) is designed to measure 1~unit wide in the
+oblique view (similarly, the 2D height of the \textit{top} face also measures
+just 1~unit). Consequently, since the TikZ scale factor used is $0.4$, then
+the (minimum) width argument for its \verb!\ShowCube{}{}{}! command is
+$4\times 0.4 = 1.6$cm., hence we have \verb!\ShowCube{1.6cm}{0.4}{...}!.
+
+\end{enumerate}
+
+
+
+\pagebreak
+%----------------------
+\subsection{Three-edge cycle}
+\typeout{---Example (three-edge cycle)}
+
+
+The following example shows a sequence often used in solving the final layer.
+ The black (no flip) and magenta (flip) arrows indicate the \upface\
+cubie movement associated with the `three-edge cycle sequence
+\ShowSequence{,}{\rr}{F,R,U,Rp,Up,Fp}. The blue arrows indicate so-called
+collateral damage (two pairs of corner cubies swap positions) which can be fixed
+at a later stage. (This diagram is from Section~13 in the
+\textsc{rubikcube} package documentation).
+
+ \bigskip%
+ \noindent\hfil%
+ \RubikCubeSolved%
+ \ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}%
+ \quad\ShowCube{1.6cm}{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);
+ }%
+ \RubikRotation{F,R,U,Rp,Up,Fp}%
+ \quad\ShowSequence{}{\Rubik}{\SequenceLong}\quad$\longrightarrow$\quad%
+ \ShowCube{1.6cm}{0.4}{\DrawFlatUpSide}%
+ \hfil%
+
+ \bigskip%
+
+
+{\noindent}The code for the figure is as follows
+
+
+\begin{verbatim}
+ \bigskip%
+ \noindent\hfil%
+ \RubikCubeSolved%
+ \ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}%
+ \quad\ShowCube{1.6cm}{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);
+ }%
+ \RubikRotation{F,R,U,Rp,Up,Fp}%
+ \quad\ShowSequence{}{\Rubik}{\SequenceLong}\quad$\longrightarrow$\quad%
+ \ShowCube{1.6cm}{0.4}{\DrawFlatUpSide}%
+ \hfil%
+
+ \bigskip
+\end{verbatim}
+
+
+
+
+
+\pagebreak
+%----------------------
+\subsection{Superflip}
+\typeout{---Example (subperflip)}
+
+
+Once you can solve 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\,\footnote{See the `superflip' entry in \textit{Wikipedia}, and also
+the Kociemba website (\url{www.kociemba.org/cube.htm}); particularly the page
+\url{http://kociemba.org/math/oh.htm}}.
+
+%--------draw the images-------------
+\begin{figure}[hbt]
+ \centering
+ \RubikCubeSolved
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+ \quad$\longrightarrow$\quad%
+ \RubikRotation{\superflip}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeLD}
+ \quad\quad%
+ \ShowCube{5cm}{0.5}{\DrawRubikCubeSF}
+\caption{Two representations of the superflip configuration.}
+\end{figure}
+%----------------------
+
+{\noindent}A superflip sequence converts the solved cube on the left
+into the form on the right, using the command \verb!\RubikRotation{\superflip}!.
+The full code for the above figure is as follows:
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation,rubikpatterns}
+...
+\begin{figure}[hbt]
+ \centering
+ \RubikCubeSolved
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+ \quad$\longrightarrow$\quad%
+ \RubikRotation{\superflip}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeLD}
+ \quad\quad%
+ \ShowCube{5cm}{0.5}{\DrawRubikCubeSF}
+\caption{...}
+\end{figure}
+\end{verbatim}
+
+
+The following superflip sequence\,\footnote{This particular superflip sequence
+(in the \textsc{rubikpatterns} package) is due to Reid (1995);
+for details see the \textsc{rubikpatterns} package
+documentation, and also \url{http://kociemba.org/math/oh.htm}.
+Another 20-move superflip sequence (due to H Kociemba), is designated as K32466
+ in \url{www.nickalls.org/dick/papers/tex/RUBIK20moves.zip}.}
+has just 20 HTM rotations (Half Turn Metric: counting 180~degree turns as just
+one `rotation'). Note that the \textsc{rubikpatterns} package contains this particular
+superflip sequence as the macro \verb!\superflip!
+(see \texttt{rubikpatterns.pdf}). Consequently the code
+\verb!\ShowSequence{,}{\large\texttt}{\superflip}!, will typeset the sequence
+as follows:
+
+\begin{center}
+%% show the Short code
+\ShowSequence{,}{\texttt}{\superflip}
+\end{center}
+Note that for convenience, the \textsc{rubikpatterns} package includes the sequence
+name (in square brackets) as the first element of the associated macro.
+This is possible since the contents of a comma-separated square bracket is not
+actioned as a rotation when it appears as part of the argument of
+the \verb!\RubikRotation! command.
+
+\pagebreak
+
+Next we present the sequence without commas in the form of hieroglyphs using
+the \verb!\Rubik! font, for which we require the `expanded' \verb!\SequenceLong!
+form (since the `short form' includes trailing digits---see \S\,9 in
+\texttt{rubikcube.pdf}), using the code
+
+\begin{quote}
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation,rubikpatterns}
+...
+\RubikCubeSolved
+\RubikRotation{\superflip}
+\noindent\strut\hspace{-8mm}\ShowSequence{}{\Rubik}{\SequenceLong}
+\end{verbatim}
+\end{quote}
+which gives
+
+
+\bigskip
+
+\RubikCubeSolved
+\RubikRotation{\superflip}
+\noindent\strut\hspace{-8mm}\ShowSequence{}{\Rubik}{\SequenceLong}
+
+
+%%---------------------------------
+\bigskip
+
+\subsubsection*{Equivalent sequence}
+
+
+Interestingly, the superflip sequence is actually equivalent to
+\Rubikbrace{\Rubikbracket{\Rubik{Rmp}\Rubik{Up}}4, \Rubik{yp}, \Rubik{x}}3.
+Furthermore we can readily demonstrate this, as we can process this novel form
+of the sequence using some useful features of the \verb!\RubikRotation!
+command, as follows:
+
+\begin{quote}
+\begin{verbatim}
+\RubikCubeSolved%
+\RubikRotation[3]{[superflip],(Rmp,Up)4,yp,x}%
+\ShowCube{4cm}{0.4}{\DrawRubikCubeSF}%
+\end{verbatim}
+\end{quote}
+which generates the following
+
+%-------------------
+\begin{figure}[hbt]
+ \centering
+ \RubikCubeSolved%
+ \RubikRotation[3]{[shortsuper],(Rmp,Up)4,yp,x}%
+ \ShowCube{5cm}{0.5}{\DrawRubikCubeSF}
+\end{figure}
+%----------------------
+{\noindent}which is exactly the same configuration as before.
+Note that to do this we had to make use of the `repeat' option \verb![3]!
+as well as the \verb!(Rmp,Up)4! `repeat-block' in
+the argument of the \verb!\RubikRotation! command above.
+
+
+
+
+\pagebreak
+%----------------------
+\subsection{Inverse sequence}
+\typeout{---Example (inverse sequence)}
+
+
+Generating the inverse of a Rubik sequence involves (a)~reversing the order of
+the sequence, and (b)~inverting each rotation in the sequence
+(see Sections~5.1 and 5.11 in the \textsc{rubikrotation} package documentation).
+
+
+From the grey-cube example~(\ref{sec:greycube}) we saw that the sixspot sequence is: \verb!U,Dp,R,Lp,F,Bp,U,Dp!;
+its inverse is therefore readily determined as \verb!D,Up,B,Fp,L,Rp,D,Up!.
+Note that this is easy to check since the sequence generated by the
+\verb!\RubikRotation! command is held by the macro \verb!\SequenceLong!.
+For~example, the output of the following commands
+\begin{quote}
+\begin{verbatim}
+\fbox{\strut\ %
+The inverse of the sixspot sequence is:
+\RubikRotation{\sixspot,<inverse>}
+\ShowSequence{,}{\texttt}{\SequenceLong}.
+}
+\end{verbatim}
+\end{quote}
+is \quad\fbox{\strut\ %
+The inverse of the sixspot sequence is:
+\RubikRotation{\sixspot,<inverse>}
+\ShowSequence{,}{\texttt}{\SequenceLong}.
+}
+
+\bigskip
+
+A sequence and its inverse will annihilate each other when applied consecutively.
+For example, in the following figure we start with a solved cube and
+apply the sixspot sequence. Applying the inverse of the sixspot sequence then
+results in the solved cube configuration again.
+
+\newcommand{\sixspotINV}{[sixspotINV],D,Up,B,Fp,L,Rp,D,Up}
+\newcommand{\sixspotarrow}{$\quad\overrightarrow{\strut\textsc{sixspot}}\quad$}
+\newcommand{\sixspotINVarrow}{$\quad\overrightarrow{\strut\textsc{sixspotINV}}\quad$}
+
+\begin{figure}[hbt]
+\centering
+\RubikCubeSolved%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}\sixspotarrow%
+\RubikRotation{\sixspot}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}\sixspotINVarrow%
+\RubikRotation{\sixspotINV}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\end{figure}
+
+{\noindent}The code for the above figure is as follows:
+
+\begin{quote}
+\begin{verbatim}
+\usepackage{tikz,rubikcube,rubikrotation,rubikpatterns}
+...
+\newcommand{\sixspotINV}{[sixspotINV],D,Up,B,Fp,L,Rp,D,Up}
+\newcommand{\sixspotarrow}{$\quad\overrightarrow{\strut\textsc{sixspot}}\quad$}
+\newcommand{\sixspotINVarrow}{$\quad\overrightarrow{\strut\textsc{sixspotINV}}\quad$}
+
+\begin{figure}[hbt]
+\centering
+\RubikCubeSolved%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}\sixspotarrow%
+\RubikRotation{\sixspot}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}\sixspotINVarrow%
+\RubikRotation{\sixspotINV}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\end{figure}
+\end{verbatim}
+\end{quote}
+
+\pagebreak
+
+A significant property of the superflip configuration is that it is its own inverse.
+Consequently we can achieve a similar result simply by applying the
+superflip sequence \textit{twice in succession}, as follows:
+
+\newcommand{\superfliparrow}{$\quad\overrightarrow{\strut\textsc{superflip}}\quad$}
+
+
+\begin{figure}[hbt]
+\centering
+\RubikCubeSolved%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}\superfliparrow%
+\RubikRotation{\superflip}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}\superfliparrow%
+\RubikRotation{\superflip}%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
+\end{figure}
+
+
+
+
+\begin{center}
+------ END ------
+\end{center}
+
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikpatterns-doc-figA.pdf b/Master/texmf-dist/doc/latex/rubik/rubikpatterns-doc-figA.pdf
new file mode 100644
index 00000000000..bcf34e0cdde
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/rubikpatterns-doc-figA.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikpatterns.pdf b/Master/texmf-dist/doc/latex/rubik/rubikpatterns.pdf
new file mode 100644
index 00000000000..053ffaa6822
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/rubikpatterns.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.pdf b/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.pdf
new file mode 100644
index 00000000000..f80c1f7344a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.sh b/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.sh
new file mode 100644
index 00000000000..8e101ad176d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.sh
@@ -0,0 +1,9 @@
+
+## rubikpatternsLIST.sh
+## run twice to get hyperref-links correct
+
+ pdflatex --shell-escape rubikpatternsLIST.tex
+ pdflatex --shell-escape rubikpatternsLIST.tex
+
+## echo "...checking error file"
+## grep ERROR ./rubikstateERRORS.dat
diff --git a/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.tex b/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.tex
new file mode 100644
index 00000000000..fc7a677b51d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.tex
@@ -0,0 +1,305 @@
+%% rubikpatternsLIST.tex
+%% part of the rubikpatterns package v 4.0
+%% authors: RWD Nickalls & A Syropoulos
+%% 03 March 2017
+%%------------------------
+%% this file uses the rubikrotation package
+%% run this file as : $ pdflatex --shell-escape rubikpatternsLIST.tex
+%%------------------------
+
+\documentclass[a4paper]{article}
+
+%------LUA-----------
+\usepackage{ifluatex}
+
+\ifluatex
+ \usepackage{shellesc} %% for use with LUAlatex
+ \usepackage{fontspec}
+\else
+\fi
+%--------------------
+
+
+\usepackage{tikz}
+\usepackage{rubikcube}
+\usepackage{rubikrotation}
+\usepackage{rubikpatterns}
+%--------------------------
+\usepackage{url,ifpdf}
+%---------------------
+\ifpdf
+ \usepackage[verbose]{microtype}
+ \usepackage{cmap}
+ \usepackage[pdfencoding=auto]{hyperref}
+
+ \hypersetup{%
+ pdftitle={rubikpatternsLIST.pdf},
+ pdfsubject={Rubik cube, Rubik bundle},
+ pdfkeywords={Rubik cube LaTeX}
+ }
+\fi
+%%-------------------
+%-------------
+\pagestyle{myheadings}
+\markright{\texttt{rubikpatternsLIST.pdf} \ \
+(Rubik bundle v4.0, March 03, 2017) }
+%-------------------------------------
+\newcommand{\ShowPattern}[1]{%
+\noindent%
+ \RubikCubeSolvedWB
+ \RubikRotation{#1}
+ \ShowCube{2.4cm}{0.6}{\DrawRubikCubeRU}
+ \hspace{0.5cm}% was 1cm
+\begin{minipage}{9cm}
+\noindent\ShowSequence{,\ }{\texttt}{\SequenceShort},
+\newline\noindent\texttt{\SequenceInfo}.
+\end{minipage}
+}
+%-------------------------
+
+
+
+%======================
+\begin{document}
+
+
+\ifpdf\pdfbookmark[1]{Title}{Title}\fi
+\title{List of Rubik patterns\\%
+\smallskip\normalsize\texttt{www.ctan.org/tex-archives/macros/latex/contrib/rubik/rubikpatternsLIST.pdf}%
+\footnote{This file is part of the Rubik bundle. To generate this file,
+use the following command:
+\newline \texttt{\$ pdflatex --shell-escape rubikpatternsLIST.tex}}}
+\author{RWD Nickalls\,\footnote{email: \textsf{dick@nickalls.org}}%
+ \ \ \& A Syropoulos\,\footnote{email: \textsf{asyropoulos@yahoo.com}}}
+\date{March 03, 2017 (v4.0)}
+\maketitle
+
+
+%==========================================
+\section{Rubik patterns}
+
+
+
+A Rubik pattern is the configuration generated by a sequence of rotations
+(or `moves') from some initial starting configuration (typically a `solved'
+configuration). For example, `sixspot' is a well known pattern generated from
+a solved Rubik cube by the rotation sequence \texttt{U,Dp,R,Lp,F,Bp,U,Dp}, as follows:
+
+
+\bigskip
+
+\noindent\hfil%
+\RubikCubeSolvedWB
+\ShowCube{2.4cm}{0.6}{\DrawRubikCubeRU}%
+\RubikRotation{\sixspot}%
+\quad\SequenceBraceA{sixspot}{\ShowSequence{}{\Rubik}{\SequenceLong}}\quad%
+\ShowCube{2.4cm}{0.6}{\DrawRubikCubeRU}%
+\hfil%
+
+\bigskip
+
+
+\medskip
+{\noindent}The code for this image is as follows:
+
+\begin{quote}
+\begin{verbatim}
+\usepackage{tikz}
+\usepackage{rubikcube,rubikrotation,rubikpatterns}
+...
+\noindent\hfil%
+\RubikCubeSolvedWB%
+\ShowCube{2.4cm}{0.6}{\DrawRubikCubeRU}%
+\RubikRotation{\sixspot}%
+\quad\SequenceBraceA{sixspot}{%
+ \ShowSequence{}{\Rubik}{\SequenceLong}%
+ }%
+\quad\ShowCube{2.4cm}{0.6}{\DrawRubikCubeRU}%
+\hfil%
+\end{verbatim}
+\end{quote}
+
+
+Note that the appearance of a pattern generated by a given rotation sequence is,
+of course, sensitive to (a)~the particular colour configuration of the solved
+cube used, and (b)~the initial orientation of the cube.
+
+
+The initial condition associated with all the pattern images shown in this
+document is the solved form of the `WB' colour configuration
+(White opposite Blue), since this is the solved cube colour configuration used
+by the Reid website, from which nearly all these patterns are drawn.
+
+
+The following image shows the WB cube form (set up using the command
+\verb!\RubikCubeSolvedWB!) displayed in a semi-flat (SF) mode
+(\verb!\DrawRubikCubeSF!) so we can see all the faces
+---see the \textsc{rubikcube} documentation for details.
+
+\bigskip
+
+ \RubikCubeSolvedWB%
+ \ShowCube{2cm}{0.5}{\DrawRubikCubeSF}%
+
+\medskip
+{\noindent}The code for this image is as follows:
+
+\begin{quote}
+\begin{verbatim}
+\usepackage{tikz}
+\usepackage{rubikcube,rubikrotation}
+...
+\RubikCubeSolvedWB%
+\ShowCube{2cm}{0.5}{\DrawRubikCubeSF}%
+\end{verbatim}
+\end{quote}
+
+
+
+
+
+\section{Typesetting}
+
+The remainder of this document just displays the various patterns made available
+ with the \textsc{rubikpatterns} package.
+We display the patterns using the following \verb!\ShowPattern! command, which
+uses the \verb!\RubikRotation! command (from the \textsc{rubikrotation} package),
+and takes the pattern macro-name as the argument:
+This command draws the cube from the right-upper (RU) viewpoint, and shows the
+rotation sequence and metadata.
+
+\begin{verbatim}
+%----------------------------------------
+\usepackage{tikz}
+\usepackage{rubikcube,rubikrotation,rubikpatterns}
+...
+\newcommand{\ShowPattern}[1]{%
+\noindent%
+ \RubikCubeSolvedWB
+ \RubikRotation{#1}
+ \ShowCube{2.4cm}{0.6}{\DrawRubikCubeRU}
+ \hspace{0.5cm}%
+\begin{minipage}{9cm}
+\noindent\ShowSequence{,\ }{\texttt}{\SequenceShort},
+\newline\noindent\texttt{\SequenceInfo}.
+\end{minipage}
+}
+%------------------------------------------
+\end{verbatim}
+
+\pagebreak
+
+For example, the first pattern below (Pons Asinorum) is typeset using the following
+command:
+
+\begin{verbatim}
+\bigskip\ShowPattern{\ponsasinorum}
+\end{verbatim}
+
+
+%-----------------------------
+\section{List of Patterns}
+
+\bigskip\ShowPattern{\PonsAsinorum}
+
+\bigskip\ShowPattern{\CheckerboardsThree}
+
+\bigskip\ShowPattern{\CheckerboardsSix}
+
+\bigskip\ShowPattern{\Stripes}
+
+\bigskip\ShowPattern{\CubeInCube}
+
+\bigskip\ShowPattern{\CubeInCubeInCube}
+
+\bigskip\ShowPattern{\ChristmasCross}
+
+\bigskip\ShowPattern{\PlummersCross}
+
+\bigskip\ShowPattern{\Anaconda}
+
+\bigskip\ShowPattern{\Python}
+
+\bigskip\ShowPattern{\BlackMamba}
+
+\bigskip\ShowPattern{\GreenMamba}
+
+\bigskip\ShowPattern{\FemaleRattlesnake}
+
+\bigskip\ShowPattern{\MaleRattlesnake}
+
+\bigskip\ShowPattern{\FemaleBoa}
+
+\bigskip\ShowPattern{\MaleBoa}
+
+\bigskip\ShowPattern{\FourSpot}
+
+\bigskip\ShowPattern{\sixspot}
+
+\bigskip\ShowPattern{\OrthogonalBars}
+
+\bigskip\ShowPattern{\SixTs}
+
+\bigskip\ShowPattern{\SixTwoOne}
+
+\bigskip\ShowPattern{\ExchangedPeaks}
+
+\bigskip\ShowPattern{\TwoTwistedPeaks}
+
+\bigskip\ShowPattern{\FourTwistedPeaks}
+
+\bigskip\ShowPattern{\ExchangedChickenFeet}
+
+\bigskip\ShowPattern{\TwistedChickenFeet}
+
+\bigskip\ShowPattern{\ExchangedRings}
+
+\bigskip\ShowPattern{\TwistedRings}
+
+\bigskip\ShowPattern{\EdgeHexagonTwo}
+
+\bigskip\ShowPattern{\EdgeHexagonThree}
+
+\bigskip\ShowPattern{\TomParksPattern}
+
+\bigskip\ShowPattern{\RonsCubeInCube}
+
+\bigskip\ShowPattern{\TwistedDuckFeet}
+
+\bigskip\ShowPattern{\ExchangedDuckFeet}
+
+\bigskip\ShowPattern{\Superflip}
+
+\bigskip
+
+
+%------------------------
+\section{References}
+
+\begin{itemize}
+\item Fridrich website (Fridrich J). \ \ \url{http://www.ws.binghamton.edu/fridrich/}
+See the `Pretty patterns' webpage
+\url{http://www.ws.binghamton.edu/fridrich/ptrns.html}
+
+
+
+\item Kociemba website (Kociemba H). \url{http://www.kociemba.org/cube.htm}
+ {\newline}---for superflip see: \url{http://www.kociemba.org/math/oh.htm}
+
+
+
+\item Randelshofer website (Randelshofer W). Pretty patterns. \url{http://www.randelshofer.ch/rubik/patterns/U080.01.html}
+
+
+
+\item Reid patterns web page (Reid M).
+\url{http://www.cflmath.com/~reid/Rubik/patterns.html}
+
+\end{itemize}
+
+
+\begin{center}
+------ END ------
+\end{center}
+
+\end{document} \ No newline at end of file
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 b3992299158..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
index 7ca1fe2db2d..7ca1fe2db2d 100644
--- a/Master/texmf-dist/doc/latex/rubik/Rubikrot-doc-figC.pdf
+++ 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..8cda23314e5
--- /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/rubikrotation.1 b/Master/texmf-dist/doc/latex/rubik/rubikrotation.1
index bfcec061deb..c3c8c655b02 100644
--- a/Master/texmf-dist/doc/latex/rubik/rubikrotation.1
+++ b/Master/texmf-dist/doc/latex/rubik/rubikrotation.1
@@ -1,40 +1,41 @@
-.\" copyright (c) 2015 A Syropoulos and RWD Nickalls
+.\" copyright (c) 2014--2017 A Syropoulos and RWD Nickalls
.\" rubikrotation.1
.\" place this file in: /usr/share/man/man1/
..
.TH rubikrotation.1
.SH NAME
-.B rubikrotation (v3.0)
+.B rubikrotation (v4.0)
.SH AUTHORS
-A. Syropoulos and R.W.D. Nickalls (September 25, 2015)
+A. Syropoulos and R.W.D. Nickalls (3rd March 2017)
- asyropoulos[at]<yahoo><com>
dick[at]<nickalls><org>
+ asyropoulos[at]<yahoo><com>
+
.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/
+CTAN: mirror.ctan.org/macros/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>
+rubikrotation [-h|--help|-v|--version] [-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.
+The default input filename set by the rubikrotation package is rubikstate.dat, and this is generated by the LaTeX RubikRotation{} command (see the rubikrotation LaTeX package manual rubikrotation.pdf). Note that the rubikrotation perl script expects the input file to have a certain structure, as described in rubikrotation.pdf and rubikrotationPL.pdf).
.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)
+The rubikrotation Perl script manual (rubikrotationPL.pdf), the rubikrotation LaTeX package manual (rubikrotation.pdf), examples (rubikexamples.pdf), the rubikcube LaTeX package manual (rubikcube.pdf), and the rubikpatterns LaTeX package manuals (rubikpatterns.pdf and rubikpatternsLIST.pdf).
To view rubikrotation.pdf, type: texdoc rubikrotation
@@ -42,6 +43,11 @@ To view rubikrotationPL.pdf, type: texdoc rubikrotationPL
To view rubikcube.pdf, type: texdoc rubikcube
+To view rubikexamples.pdf, type: texdoc rubikexamples
+
+To view rubikpatterns.pdf, type: texdoc rubikpatterns
+
+To view rubikpatternsLIST.pdf, type: texdoc rubikpatternsLIST
.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 d38932f4d62..13274cb9571 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
index 0dc64ac5426..0065929b066 100644
--- a/Master/texmf-dist/doc/latex/rubik/rubikrotationPL.pdf
+++ 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
deleted file mode 100644
index 8377aa25a07..00000000000
--- a/Master/texmf-dist/doc/latex/rubik/rubikrotationPL.tex
+++ /dev/null
@@ -1,1333 +0,0 @@
-%% 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 77c3dadbab3..05e69ef0049 100755
--- a/Master/texmf-dist/scripts/rubik/rubikrotation.pl
+++ b/Master/texmf-dist/scripts/rubik/rubikrotation.pl
@@ -1,84 +1,128 @@
#!/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.
-##--------------------------------------------------
-
-##=============main===================================================
-
-## 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
+ use Carp;
+ use Fatal;
+ use warnings;
+ ##
+ our $version = "v4.0 (03 March 2017)";
+ ##
+ ## rubikrotation.pl
+ ## VERSION 4.0
+ ##
+ ## Copyright 03 March 2017,
+ ## RWD Nickalls (dick@nickalls.org)
+ ## A Syropoulos (asyropoulos@yahoo.com)
+ ##
+ ##-------------------------------
+ ## changes in v3.6 (January 2017)
+ ## (1) included Jaap Rm and Rc notation
+ ## (2) new sub for improved expansion of mod-4 multiples of rotations (Oct 2016)
+ ## (3) restructured to facilitate processing arrays through the rotation sub
+ ## (4) included option for an <info> block
+ ## (5) included Randelshofer superset ENG 3x3 notation
+ ## (6) implemented an `inverse' mode
+ ## (7) improved syntax checking
+ ## (8) used perltidy to polish the program layout
+ ## (but only when making the pdf documentation-- see file rubikrotationPL.pdf)
+ ## (9) included a lot of new subroutines
+ ##--------------------------------
+ ## changes in v3.2:
+ ## 1) changed program, prog --> script
+ ## 2) added leading ... to the comments written by the <writestate> sub
+ ## (the ... code indicates that comments are written by the Perl script)
+ ##
+ ## 3) v3.2a added a \RubikSeqNEW{...} output line in the output file
+ ## to facilitate typesetting the rotation sequence (works OK just now)
+ ##
+ ## 4) v3.2c: added new commands:
+ ## \RotationSequenceName{}
+ ## \RotationSequenceClean{}
+ ##
+ ## 5) v3.2d: changed the returned command names (removed the Rotation part to keep it simple)
+ ## \Sequence{} = orig seq + NO NAME
+ ## \SequenceName{} = NAME only
+ ## \SequenceClean{} = clean seq + NO NAME
+ ##
+ ## 6) v3.2e:(25 Sept 2016)
+ ## changed some command names: use short & long for the Rubik R2 --> R,R code
+ ## (more intuitive than Clean)
+ ## \Sequence{} --> SecquenceShort{}
+ ## \SequenceClean{} --> SecquenceLong{}
+ ## removed the [ and ] around [name] variable
+ ##
+ ## 7) v3.2h: (2 Oct 2016)
+ ## improved the mod 4 routine using SUB rubikmod()
+ ## improved comments to log file re: rotation processing
+ ##
+ ##--------------------------------
+ ## 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.
+ ##----------------------------------------------------------------------
+
+ ##------------------ MAIN --------------------------
+
+ ## 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'')
+ ##---------------
+ ## set autoflush for outputs
+ ## $|=1;
+ ##--------------
+ 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;
@@ -86,8 +130,8 @@ if ($argc == 0||$argc > 4 ){ # croak if 0 or more than 4 arguments
else {
SWITCHES:
while($_ = $ARGV[0]) {
- shift;
- if (/^-h$/ || /^--help$/ ) {
+ shift;
+ if (/^-h$/ || /^--help$/ ) {
die $rubikversion,$usage,
"\twhere,\n" .
"\t[-h|--help]\tgives this help listing\n" .
@@ -96,10 +140,10 @@ if ($argc == 0||$argc > 4 ){ # croak if 0 or more than 4 arguments
"\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){
+ }
+ elsif (/^-v$/ || /^--version$/ ) {die $rubikversion;}
+ elsif (/^-i$/) {
+ if (!@ARGV){
croak $showargs,
"\tNo input file specified!\n",
$usage;
@@ -108,8 +152,8 @@ if ($argc == 0||$argc > 4 ){ # croak if 0 or more than 4 arguments
$source_file = $ARGV[0],
shift;
}
- }
- elsif (/^-o$/) {
+ }
+ elsif (/^-o$/) {
if (!@ARGV) {
croak $showargs,
"\tNo output file specified!\n",
@@ -119,114 +163,184 @@ if ($argc == 0||$argc > 4 ){ # croak if 0 or more than 4 arguments
$out_file = $ARGV[0],
shift;
}
- }
- elsif (/^-\w+/) {
+ }
+ elsif (/^-\w+/) {
croak $showargs,
"\t$_: Illegal command line switch!\n",
$usage;
- }
- else {
+ }
+ else {
croak $showargs,
"\tmissing filenames or ? missing -i or -o switch!\n",
$usage;
- }
- } # end of while
-}; # end of else
+ }
+ } # 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, "<$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 (""); # newline
gprint ("...PERL process..................................");
- gprint ("...program = rubikrotation.pl v$version");
+ gprint ("...script = rubikrotation.pl $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
+ ## setup global error parameters, so we can write all the errors to a file as an array
+ our %error = (); # setup an array for error messages (was %)
+ our $erroralert = ""; # error flag
+ our $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;
+ our $dataline = "";
+ our $newdataline ="";
+ our $rubikkeyword = "";
+ our $rotationcommand = "";
+ our @data=();
+
+ our $Sequence=""; ## will hold the original (SHORT) sequence
+ our $rotationseqNEW = ""; ## will hold the LONG sequence
+ our $RotationSequenceName="";
+
+ our $SequenceName="";
+ our $SequenceShort="";
+ our $SequenceLong="";
+ our $SequenceInfo="";
+
+ #---------inverse mode------------
+ # a keyword INVERSE or inverse in an infoblock <..>
+ # FLAG is set (line 400) in response to detecting an infloblock.
+ # A set FLAG triggers (a) reversing rotation sequence (line 484),
+ # and (b) inverting each rotation (to generate the inverse sequence).
+ # Here we define direction FLAG for the INVERSE sequence of rotations.
+ # The conditional test is in the SUB rotation
+ our $inverse="INV";
+ our $directionflag="";
+ #-------------------------
+
LINE: while (<IN_FILE>){
next LINE if /^#/; #skip comments
next LINE if /^%/; #skip comments
- next LINE if /^$/; #skip blank lines
+ next LINE if /^$/; #skip blank lines
+
+
+ print " \n TOP --------- (new line)\n\n";
+
$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') {
+ chomp $dataline; # remove the line-ending character
+
+ ## now we can clean whitespace
+ $dataline = cleanstring($dataline);
+
+ #check syntax of the string
+ $rotationcommand=$dataline; ## needed for error messages
+ CheckSyntax($dataline);
+
+ ## form an array so we can process the (rubik)keywords.
+ @data=split (/,/, $dataline); # create an array called data
+
+ print " dataline array = @data\n";
+ #-------------------------
+
+ ## we have 10 fields (0--9)
+ ## check for rubikkeyword= up,down,left,right,front,back,checkstate,rotation:
+ $rubikkeyword=$data[0];
+
+ if ($rubikkeyword eq 'up') { gprint ("...$dataline");
$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]
- }
+ $Ulb[0]=$data[7], $Umb[0]=$data[8],$Urb[0]=$data[9];
+ next LINE;
+ };
- if ($rubikkeyword eq 'down') {
+ if ($rubikkeyword eq 'down') { gprint ("...$dataline");
$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') {
+ $Dlb[0]=$data[7], $Dmb[0]=$data[8],$Drb[0]=$data[9];
+ next LINE;
+ };
+
+ if ($rubikkeyword eq 'left') { gprint ("...$dataline");
$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') {
+ $Llb[0]=$data[7], $Lmb[0]=$data[8],$Lrb[0]=$data[9];
+ next LINE;
+ };
+
+ if ($rubikkeyword eq 'right') { gprint ("...$dataline");
$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') {
+ $Rlb[0]=$data[7], $Rmb[0]=$data[8],$Rrb[0]=$data[9];
+ next LINE;
+ };
+
+ if ($rubikkeyword eq 'front') { gprint ("...$dataline");
$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') {
+ $Flb[0]=$data[7], $Fmb[0]=$data[8],$Frb[0]=$data[9];
+ next LINE;
+ };
+
+ if ($rubikkeyword eq 'back') { gprint ("...$dataline");
$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.
+ $Blb[0]=$data[7], $Bmb[0]=$data[8],$Brb[0]=$data[9];
+ next LINE;
+ };
+
+ ## 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 ("...");
+ next LINE ;
+ };
+
+ ## 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 it is an integer n --> random => random(n)
+ ## ELSE it must be a rotation sequence --> send elements to rotation sub.
+
+
+ #------------------------
+ if ($rubikkeyword eq 'rotation')
+ {
+ gprint ("...");
+
+ # we now grab a copy of the dataline, and we shall use this
+ # in the ErrorMessage SUB to indicate which command
+ # an error is in.
$rotationcommand=$dataline; ## used in output message
gprint ("...command=$rotationcommand");
+ # need to check that a second argument exists (else --> ErrorMessage).
+ # ---should be either `random',
+ # ---or a macroname for a rotation sequence,
+ # ---or the first element of a rotation sequence.
+
+ if ($data[1] eq "")
+ { # no second argument
+ gprint ("..*missing second argument");
+ ErrorMessage ("QUITTING PERL PROGRAM --- missing second argument:");
+ ErrorMessage ("--- ? bad rotation macro-name");
+ quitprogram();
+ };
+
+
+
##-----random-----------------
## if second argument = random,
## THEN we also need to check if third argument is an integer;
@@ -235,363 +349,654 @@ my @data;
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
+ ## if true then cannot be a number (D matches for word elements)
+ ErrorMessage("[$data[2]] is not an integer");
+ ## we reject the command (as bad syntax) and get next line
+ next LINE;
}
else{
- ## data[2] must be an integer (n), so we just do n random rotations
- random($data[2])
+ ## the next argument is an integer (n), so we do n random rotations
+ random($data[2]);
+ next LINE;
};
- }
+ } ## end of IF
+ #---------------
+
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
+ # -----rotation sequence---------
+ # the line must be a rotation sequence line, so send the sequence
+ # to the rotation sub;
+
+ # Note that a copy of the rotation command is already held in the
+ # variable rotationcommand (see above). It is used in the
+ # ErrorMessage SUB.
+
+
+ #-------------------------------
+
+ # Process and remove any infoblocks if they exist
+ # infoblocks are text delimited by <...>
+ # The SUB cutinfoblock returns the name of the new revised string = newdataline,
+ # and also the contents of the infoblock = $SequenceInfo
+ # RubikRotation command uses infoblocks to cary keywords, eg INVERSE or inverse
+ # If several infoblocks exist, then we collect the contents into
+ # variable SequenceInfo, and separate them with a colon;
+
+ infoblockcolon($dataline);
+ $dataline=$newdataline;
+ $newdataline=""; ## reset the variable
+
+
+ gprint ("...dataline = $dataline");
+
+
+ ## now pass the string to cutinfoblock
+ local @seq=();
+
+ while ( (index $dataline, '<') !=-1 ){
+
+ cutinfoblock($dataline);
+ # best to use the whole word <inverse> to avoid errors
+ if ($SequenceInfo =~ m/(inverse|INVERSE)/) {$directionflag=$inverse;
+ print " FLAG set to = $inverse\n";
+ };
+ # append each infoblock to an array
+ push @seq, $SequenceInfo;
+ $dataline = $newdataline;
+ };
+
+ # finally, we join the seqInfo array into a string so we can print it
+ $SequenceInfo = join ("; ", @seq);
+
+
+ #----------------------------------
+ ## there are now no more infoblocks, so we now look for repeat-blocks.
+
+ ## reformulate any repeat blocks (,) --> {;} if they exist
+ ## this is to allow us to process any repeat blocks as separate elements
+ # this sub returns the name of the new revised string.
+ while ( (index $dataline, '(') !=-1 ){
+ fixrepeatelement ($dataline);
+ $dataline=$newdataline;
+ $newdataline=""; ## reset the variable
+ };
+
+ ## rename remaining dataline string as SequenceShortBrace
+ ## since if there are any repeat blocks, they are now reformulated with braces
+ $SequenceShortBrace=$dataline;
- ## 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
+
+ ## clean leading and trailing whitespace
+ $SequenceShortBrace = cleanstring($SequenceShortBrace);
+
+ ##----------------
+ ## form a new array from $SequenceShortBrace (since we have changed the format
+ ## slightly; ie some commands may have been reformulated as semicolons).
+ @data=split (/,/, $SequenceShortBrace);
+
+
+ ## need to remove keyword <rotation> (= first element in the array)
+ ## removing it late like this is convenient for error checking purposes,
+ ## as then the keyword `rotation' is on the string
+ shift (@data);
+
+
+
+ ## now need to recreate the string from the array @data for use later
+ ## (as rotation keyword has been removed)
+
+ $SequenceShortBrace = join (",", @data);
+
+
+ #-----create SequenceShort, so we can output it later----
+
+ # since the `rotating' keyword has been removed, we can
+ # replace any braces around repeat strings (if exist) and
+ # rename it as SequenceShort which we will output at the end.
+ if ( (index $SequenceShortBrace, '{') !=-1 )
+ {
+ print " repairing braces--> ()\n";
+ ## swap: BBook p 138--139
+ $SequenceShortBrace =~ tr/\{/(/; # swap , --> ;
+ $SequenceShortBrace =~ tr/\}/)/; # swap ( --> {
+ $SequenceShortBrace =~ tr/;/,/; # swap ) --> }
+ };
+
+ #rename to SequenceShort
+ $SequenceShort = $SequenceShortBrace;
+
+ print " SequenceShort = $SequenceShort\n";
+ ##----------------------------
+
+
+ ## now we continue processing the array "data"
+
+ my $n = 0; ##total no of array elements in "data"
+ $n = ($#data +1);
+ print " processing rotation arguments: = @data (n= $n)\n";
+
+
+ # setup a loop counter (for use in the rotation sub)
+ # this is used to identify the first element (rcode)
+ # and used to grab [name] --> SequenceName.
+ our $jrcode=0;
+
+ ## --------check for state of direction flag----------------------
+ ## FLAG defined in line 224.
+ ## FLAG is set in line 400 on detecting <..> delimeters = infoblock
+ ## if flag set (by inverse keyword) then reverse the sequence array
+ if ( $directionflag eq $inverse){
+ # FLAG is set, so we need to inverse the array
+ gprint ("...directionFLAG set; reversing array...");
+ # but before reversing, look at the first array element
+ # to see if it is a square bracket element = NAME element
+ # so check the first char to see if it is [
+ if (substr ($data[0], 0,1) eq '[') {
+ $SequenceName=$data[0];
+ print " SequenceName (inv) = $SequenceName \n";
+ };
+
+ @data = reverse @data;
+ print " processing rotation arguments: = @data (n= $n)\n";
+ };
+
+ # send each rotation element to the sub rotation()
+ print " CALLing SUB rotation\n";
+
+ foreach $element (@data) {
+ ## clean leading and trailing white space
+ $element = cleanstring($element);
+ ## send element to rotation SUB
+ rotation($element);
+ };
+
+ } # end of else
+ }; # end of IF (rotation keyword)
+
+ #----------------------------------------------
+ ## place any new keywords for processing here
+ ##---------------------------------------------
+
+ }; ## end of while
+
+ ## we have now finished reading in all the lines from the source file,
+ ## and processing 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;
+ ## plus any ErrorMessages
+ ## -- all these are handled by the quitprogram sub
+
+ quitprogram();
+
##==============end of main==========================
-##=============================subs====================
-
-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
-};
-
-##======================================
-## 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");
- };
-##========================================
+ sub rotation {
-sub checkstate{
-### simple check to see if wrong no of colours being used etc
-### uses the cubie colours as used by rubikcube package= ROYGBWX
+print " SUB rotation\n";
- gprint ("...checking state of cube");
+ ## here we process the array @data (from main) consisting of all
+ ## the rotation commands associated with
+ ## a single RubikRotation command -- the `rotation' key word has already been removed
+ ## so we start here with [name] if it exists.
- 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]);
+ ##---------------------------
+ ## variables used in SUBs rotation() and rubikmod()
+ ## need to be defined outside the SUBs
-my $R=0,my $O=0,my $Y=0,my $G=0,my $B=0,my $W=0,my $X=0;
+ $modnumber=-1; #multiple associated with the char, eg D2 etc
+ $rotcode="";
+ $rotnumber=0;
+ #------------------
+ my @repeatcode = ();
-my $cubiecolour = "";
+ my $m=-1;
+ my $originalrcode="";
+ my $j; ## used with m below
+ my $numberofchars; ## length of a string
+ my $nfrontchars;
-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)")};
-};
+ ## grab the rotation code passed to this sub from MAIN
+ my $rcode = $_[0];
-##====================================================
-# no of arguments passed to the sub = $#_ (black book p 156)
+ ## now we start a big loop processing each cs-element (= rcode),
+ ## and collecting these elements into two cs-strings
+ ## ($Sequence --> original string output as SHORT string (has codes like R2,L3 etc),
+ ## and $rotationseqNEW --> output as LONG string -- all short codes expanded)
- 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;(MOD 4) (NOT IMPLEMENTED)");
- errormessage ("[$originalchar] in RubikRotation (4 MOD 4 = 0)");
- next;
- };
+
+ ## first, clean leading and trailing white space (eg between, R ,)
+ $rcode = cleanstring($rcode);
+
+
+ ## grab a copy of the element (char) for use if m Mod4=0
+ $originalrcode=$rcode;
+
+ ## increment the loop counter (initialised in MAIN)
+ $jrcode=$jrcode+1; ## increment rotation element (char) counter
+
+
+ ## ----------------------------------
+ ## We look at the first character of each element in the sequence
+ ## if an element has a leading [ then it is a label (not a rotation)
+ ## should really be matched, but this is not checked for at present.
+ ## If this is the case, then jump to next element in the array
+
+ ## BUT if trailing comma is missing, then next rotation is included as part of the label
+ ## so need to trap this and test: is first AND last char a sq bracket?
+
+ if ( (substr ($rcode,0,1) =~ /\[/) and (substr ($rcode,-1) ) =~ /\]/) {
+
+ gprint ("...$rcode is a label OK");
+
+ if ($directionflag eq $inverse) {
+ # do nothing
+ }
+
+ else{
+ ## if this `label' is also the FIRST element, then label = name
+ if ($jrcode ==1) {$SequenceName=$rcode};
+ }; # end of IF
+
+ ## now get next rotation element
+ next;
+ }; ## end of if
+
+ ##--------------
+
+ ## the rcode must therefore be either a rotation code or a repeat-block.
+
+ ##----------------------------------------
+ ## we have already replaced any repeat (,) with {;}
+ ## so we now check for elements with leading { and then expand them.
+
+ ## Note that if there is NO comma before the {} of a {repeat block}, then
+ ## the true repeat block will not be recognised by the
+ ## usual test -- since the test is looking for a leading { etc.
+ ## However, in this event, the string being handled (not a true element)
+ ## will be processed as if it were a rotation, and an
+ ## error will be thrown, so it will get picked up OK.
+
+ if (substr ($rcode,0,1) =~ /\{/ )
+ {
+ print " repeat block found = $rcode \n";
+
+ ## since we now want to send each rotation element in the repeat block to
+ ## the rotation sub, we need to replace any ; with commas
+ ## therefore translate ; --> , but retain the {}
+ $rcode =~ tr/;/,/;
+
+ print " repeat block reformulated = $rcode \n";
+
+
+ #-------log file message--------
+ ## log file: we want to show the repeat string in the users original form
+ ## so we translate it back to the user's orig form {,} --> (,)
+ $origrcode=$rcode;
+ $origrcode =~ tr/\{/(/;
+ $origrcode =~ tr/\}/)/;
+ gprint ("...Expanding: $origrcode ...");
+ #-------------
+
+
+ #-----------
+ ## expand the code in the repeat block
+ print " CALLing SUB: repeat($rcode)\n";
+
+ repeat($rcode); # this expands the repeated elements in the block
+
+ ## this sub returns the expanded form as $insert
+ $expanded_repeatcode=$insert;
+
+ print " expanded_repeatcode = $expanded_repeatcode\n\n";
+ #------------
+
+ #----------------
+ # process each new element in the expanded_repeatcode --> rotation
+ # make expanded_repeatcode into an array, and send each element on
+
+ @repeatcode = split (/,/, $expanded_repeatcode) ;
+
+
+ ## -----------check for direction flag-----------------
+ ## if flag set then reverse the array
+ if ( $directionflag eq $inverse){@repeatcode = reverse @repeatcode};
+
+
+ # send each element to rotation SUB for processing
+ print " CALLing SUB rotation\n";
+ foreach $E (@repeatcode) {
+ print " sending repeat element $E to rotation SUB\n";
+ rotation($E)
+ };
+
+ # when this foreach is finished, then get next rotation element from
+ # the original @data array (see foreach.. near end of MAIN)
+ next;
+
+ }; ## end of if
+
+ ##================================
+
+ ## if an element has got this far, it must be a single rotation code
+ ## (maybe with a trailing digit), so it needs processing as a rotation
+ ## and appending the code to what will become the SequenceLONG string.
+
+ ##------------------------
+
+ ## CALL the sub rubikmod to process the rotation element,
+ ## and to return the front code (= $rotcode), orig no = $rotnumber,
+ ## and mod4 value (= $modnumber).
+
+ rubikmod($rcode);
+
+ ## update rcode <--- rotcode (returned by the SUB rubikmod() )
+ ## collect $m <--- modnumber (returned by the SUB rubikmod() )
+ $rcode = $rotcode;
+ $m = $modnumber;
+
+ ## we collect all the new versions of rcode into a cs-string = $SequenceLong
+ ## which will finally be output as the LONG string
+
+#-----------------------
+# check with directionflag
+ if ($directionflag eq $inverse) {$rcode = inverse ($rcode)};
+#-------------------------
+
+ ##--------------------
+ if ( $m == 0 )
+ {
+ ## do NOT implement the rotation code, and do NOT append to SequenceLong
+ ## print the /original/ rcode (eg R4, or D0 etc)
+ gprint ("..*rotation ,$originalrcode, ERROR ($rotnumber = 0 mod 4) not implemented");
+ ErrorMessage(",$originalrcode, -- ($rotnumber = 0 mod 4) not implemented");
+ next;
};
- ## if single trailing digit present, then we implement the rotation command m times.
+
+ if ( $m == 1 )
+ {
+ if($rotnumber >=5)
+ {gprint ("...Expanding $originalrcode ($rotnumber = $m mod 4) ...")};
+ $SequenceLong=$SequenceLong.$rcode.",";
+ }
+ else {
+ # m = 2 or 3
+ if($rotnumber >=5)
+ {gprint ("...Expanding $originalrcode ($rotnumber = $m mod 4) ...")}
+ else {gprint ("...Expanding $originalrcode ...")};
+
+ for($j=1; $j<=$m; $j++)
+ {## append rcode m times to sequenceLONG
+ $SequenceLong=$SequenceLong.$rcode.","
+ };
+ }; ## end of else
+
+ ##-------------------
+
+ ## 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}}
+
+
+ if ($rcode eq "L") {for($j=1;$j<=$m;$j++) {gprint ("...rotation L, OK (= Lp3)"); &rrL}}
+ elsif ($rcode eq "Lp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lp, OK"); &rrLp}}
+ elsif ($rcode eq "Lw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lw, OK (= Lp3 + Srp)"); &rrLw}}
+ elsif ($rcode eq "Lwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lwp, OK (= Lp + Sr)"); &rrLwp}}
+ elsif ($rcode eq "Ls") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ls, OK (= L + Rp)"); &rrLs}}
+ elsif ($rcode eq "Lsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lsp, OK (= Lp + R)"); &rrLsp}}
+ elsif ($rcode eq "La") {for($j=1;$j<=$m;$j++) {gprint ("...rotation La, OK (= L + R)"); &rrLa}}
+ elsif ($rcode eq "Lap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Lap, OK (= Lp + Rp)"); &rrLap}}
+ ####
+ elsif ($rcode eq "R") {for($j=1;$j<=$m;$j++) {gprint ("...rotation R, OK"); &rrR}}
+ elsif ($rcode eq "Rp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Rp, OK (= R3)"); &rrRp}}
+ elsif ($rcode eq "Rw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Rw, OK (= R + Sr)"); &rrRw}}
+ elsif ($rcode eq "Rwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Rwp, OK (= Rp + Srp)"); &rrRwp}}
+ elsif ($rcode eq "Rs") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Rs, OK (= R + Lp)"); &rrRs}}
+ elsif ($rcode eq "Rsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Rsp, OK (= Rp + L)"); &rrRsp}}
+ elsif ($rcode eq "Ra") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ra, OK (= R + L)"); &rrRa}}
+ elsif ($rcode eq "Rap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Rap, OK (= Rp + Lp)"); &rrRap}}
####
- 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 ($rcode eq "U") {for($j=1;$j<=$m;$j++) {gprint ("...rotation U, OK"); &rrU}}
+ elsif ($rcode eq "Up") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Up, OK (= U3)"); &rrUp}}
+ elsif ($rcode eq "Uw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Uw, OK (= U + Su)"); &rrUw}}
+ elsif ($rcode eq "Uwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Uwp, OK (= Up + Sup)"); &rrUwp}}
+ elsif ($rcode eq "Us") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Us, OK (= U + Dp)"); &rrUs}}
+ elsif ($rcode eq "Usp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Usp, OK (= Up + D)"); &rrUsp}}
+ elsif ($rcode eq "Ua") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ua, OK (= U + D)"); &rrUa}}
+ elsif ($rcode eq "Uap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Uap, OK (= Up + Dp)"); &rrUap}}
####
- 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}}
+ elsif ($rcode eq "D") {for($j=1;$j<=$m;$j++) {gprint ("...rotation D, OK (= Dp3)"); &rrD}}
+ elsif ($rcode eq "Dp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dp, OK "); &rrDp}}
+ elsif ($rcode eq "Dw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dw, OK (= Dp3 + Sup)"); &rrDw}}
+ elsif ($rcode eq "Dwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dwp, OK (= Dp + Su)"); &rrDwp}}
+ elsif ($rcode eq "Ds") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ds, OK (= D + Up)"); &rrDs}}
+ elsif ($rcode eq "Dsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dsp, OK (= Dp + U)"); &rrDsp}}
+ elsif ($rcode eq "Da") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Da, OK (= D + U)"); &rrDa}}
+ elsif ($rcode eq "Dap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Dap, OK (= Dp + Up)"); &rrDap}}
####
- ## 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")}}
+ elsif ($rcode eq "F") {for($j=1;$j<=$m;$j++) {gprint ("...rotation F, OK"); &rrF}}
+ elsif ($rcode eq "Fp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fp, OK (= F3)"); &rrFp}}
+ elsif ($rcode eq "Fw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fw, OK (= F + Sf)"); &rrFw}}
+ elsif ($rcode eq "Fwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fwp, OK (= Fp + Sfp)"); &rrFwp}}
+ elsif ($rcode eq "Fs") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fs, OK (= F + Bp)"); &rrFs}}
+ elsif ($rcode eq "Fsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fsp, OK (= Fp + B)"); &rrFsp}}
+ elsif ($rcode eq "Fa") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fa, OK (= F + B)"); &rrFa}}
+ elsif ($rcode eq "Fap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Fap, OK (= Fp + Bp)"); &rrFap}}
####
- ## rotation must be undefined
+ elsif ($rcode eq "B") {for($j=1;$j<=$m;$j++) {gprint ("...rotation B, OK (= Fp3)"); &rrB}}
+ elsif ($rcode eq "Bp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bp, OK"); &rrBp}}
+ elsif ($rcode eq "Bw") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bw, OK (= Fp3 + Sfp)"); &rrBw}}
+ elsif ($rcode eq "Bwp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bwp, OK (= Fp + Sf)"); &rrBwp}}
+ elsif ($rcode eq "Bs") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bs, OK (= B + Fp)"); &rrBs}}
+ elsif ($rcode eq "Bsp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bsp, OK (= Bp + F)"); &rrBsp}}
+ elsif ($rcode eq "Ba") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ba, OK (= B + F)"); &rrBa}}
+ elsif ($rcode eq "Bap") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Bap, OK (= Bp + Fp)"); &rrBap}}
+
+ #### --------------------------------------
+
+ #### inner-slice (= middle slice)
+ ## need to include MES (middle slice) notation
+ elsif ($rcode eq "M") {for($j=1;$j<=$m;$j++) {gprint ("...rotation M, OK (= Sl) "); &rrSl}}
+ elsif ($rcode eq "Mp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Mp, OK (= Sr) "); &rrSr}}
+ elsif ($rcode eq "E") {for($j=1;$j<=$m;$j++) {gprint ("...rotation E, OK (= Sd) "); &rrSd}}
+ elsif ($rcode eq "Ep") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Ep, OK (= Su) "); &rrSu}}
+ elsif ($rcode eq "S") {for($j=1;$j<=$m;$j++) {gprint ("...rotation S, OK (= Sf) "); &rrSf}}
+ elsif ($rcode eq "Sp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sp, OK (= Sb) "); &rrSb}}
+
+ #### middle slice rotations (Singmaster)
+ elsif ($rcode eq "Su") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Su, OK "); &rrSu}}
+ elsif ($rcode eq "Sup") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sup, OK (= Su3)"); &rrSup}}
+ elsif ($rcode eq "Sd") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sd, OK (= Sup)"); &rrSd}}
+ elsif ($rcode eq "Sdp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sdp, OK (= Su)"); &rrSdp}}
+ elsif ($rcode eq "Sl") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sl, OK (= Srp)"); &rrSl}}
+ elsif ($rcode eq "Slp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Slp, OK (= Sr)"); &rrSlp}}
+ elsif ($rcode eq "Sr") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sr, OK"); &rrSr}}
+ elsif ($rcode eq "Srp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Srp, OK (= Sr3)"); &rrSrp}}
+ elsif ($rcode eq "Sf") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sf, OK"); &rrSf}}
+ elsif ($rcode eq "Sfp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sfp, OK (= Sf3)"); &rrSfp}}
+ elsif ($rcode eq "Sb") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sb, OK (= Sfp)"); &rrSb}}
+ elsif ($rcode eq "Sbp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation Sbp, OK (= Sf)"); &rrSbp}}
+
+ ## need to include Jaap Puzzles website for middle slice notation (Lm, Lmp)
+ ## also include Randelshofer website middle slice notation (ML,MLp..)
+
+ elsif ($rcode eq "ML" or $rcode eq "MRp" or $rcode eq "Lm" or $rcode eq "Rmp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Lm = M = Sl) "); &rrSl}}
+
+ elsif ($rcode eq "MR" or $rcode eq "MLp" or $rcode eq "Rm" or $rcode eq "Lmp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Rm = Mp = Sr) "); &rrSr}}
+
+ elsif ($rcode eq "MU" or $rcode eq "MDp" or $rcode eq "Um" or $rcode eq "Dmp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Um = Ep = Su) "); &rrSu}}
+
+ elsif ($rcode eq "MD" or $rcode eq "MUp" or $rcode eq "Dm" or $rcode eq "Ump")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Dm = E = Sd) "); &rrSd}}
+
+ elsif ($rcode eq "MF" or $rcode eq "MBp" or $rcode eq "Fm" or $rcode eq "Bmp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Fm = S = Sf) "); &rrSf}}
+
+ elsif ($rcode eq "MB" or $rcode eq "MFp" or $rcode eq "Bm" or $rcode eq "Fmp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Bm = Sp = Sb) "); &rrSb}}
+ ##----------------------------------
+
+ #### double outer slice (wide) notation
+ #### need to include Randelshofer TL, TLp double outer slice notation
+ #### (equiv to the w wide notation)
+ elsif ($rcode eq "TL") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TL, OK (= Lw = Lp3 + Srp)"); &rrLw}}
+ elsif ($rcode eq "TLp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TLp, OK (= Lwp = Lp + Sr)"); &rrLwp}}
+ elsif ($rcode eq "TR") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TR, OK (= Rw = R + Sr)"); &rrRw}}
+ elsif ($rcode eq "TRp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TRp, OK (= Rwp = Rp + Srp)"); &rrRwp}}
+ elsif ($rcode eq "TU") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TU, OK (= Uw = U + Su)"); &rrUw}}
+ elsif ($rcode eq "TUp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TUp, OK (= Uwp = Up + Sup)"); &rrUwp}}
+ elsif ($rcode eq "TD") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TD, OK (= Dw = Dp3 + Sup)"); &rrDw}}
+ elsif ($rcode eq "TDp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TDp, OK (= Dwp = Dp + Su)"); &rrDwp}}
+ elsif ($rcode eq "TF") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TF, OK (= Fw = F + Sf)"); &rrFw}}
+ elsif ($rcode eq "TFp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TFp, OK (= Fwp = Fp + Sfp)"); &rrFwp}}
+ elsif ($rcode eq "TB") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TB, OK (= Bw = Fp3 + Sfp)"); &rrBw}}
+ elsif ($rcode eq "TBp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation TBp, OK (= Bwp = Fp + Sf)"); &rrBwp}}
+
+
+ ## ---------------------------
+ ## opposite slice notation of Randelshofer (SR, SRp) (= standard Rs, Rsp)
+ ## opposite outer slices rotated in SAME direction as the FACE
+
+ elsif ($rcode eq "SL") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Ls = L + Rp)"); &rrLs}}
+ elsif ($rcode eq "SLp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Lsp = Lp + R)"); &rrLsp}}
+
+ elsif ($rcode eq "SR") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Rs = R + Lp)"); &rrRs}}
+ elsif ($rcode eq "SRp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Rsp = Rp + L)"); &rrRsp}}
+
+ elsif ($rcode eq "SU") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Us = U + Dp)"); &rrUs}}
+ elsif ($rcode eq "SUp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Usp = Up + D)"); &rrUsp}}
+
+ elsif ($rcode eq "SD") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Ds = D + Up)"); &rrDs}}
+ elsif ($rcode eq "SDp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Dsp = Dp + U)"); &rrDsp}}
+
+
+ elsif ($rcode eq "SF") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Fs = F + Bp)"); &rrFs}}
+ elsif ($rcode eq "SFp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Fsp = Fp + B)"); &rrFsp}}
+
+ elsif ($rcode eq "SB") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Bs = B + Fp)"); &rrBs}}
+ elsif ($rcode eq "SBp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= Bsp = Bp + F)"); &rrBsp}}
+
+
+ ## -------------------------
+
+ ## whole cube rotations
+ ## need to include x,y,z (upper and lowercase) and also u,d,l,r,f,b (lowercase only) equivalents
+ elsif ($rcode eq "X" or $rcode eq "x" or $rcode eq "r")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= x = R + Sr + Lp)"); &rrR;&rrSr;&rrLp}}
+ elsif ($rcode eq "Xp" or $rcode eq "xp" or $rcode eq "l")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= xp = Rp + Srp + L)");&rrRp;&rrSrp;&rrL}}
+ elsif ($rcode eq "Y" or $rcode eq "y" or $rcode eq "u")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= y = U + Su + Dp)"); &rrU;&rrSu;&rrDp}}
+ elsif ($rcode eq "Yp" or $rcode eq "yp" or $rcode eq "d")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= yp = Up + Sup + D)");&rrUp;&rrSup;&rrD}}
+ elsif ($rcode eq "Z" or $rcode eq "z" or $rcode eq "f")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= z = F + Sf + Bp)"); &rrF;&rrSf;&rrBp}}
+ elsif ($rcode eq "Zp" or $rcode eq "zp" or $rcode eq "b")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= zp = Fp + Sfp + B)");&rrFp;&rrSfp;&rrB}}
+
+ ## more whole cube notation
+ ## need to include Jaap website whole cube Lc notation
+ ## also include Randelshofer C notation (CL, CLp.)
+
+ elsif ($rcode eq "CL" or $rcode eq "CRp" or $rcode eq "Lc" or $rcode eq "Rcp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Lc = xp = Rp + Srp + L)");&rrRp;&rrSrp;&rrL}}
+
+ elsif ( $rcode eq "CR" or $rcode eq "CLp" or $rcode eq "Rc" or $rcode eq "Lcp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Rc = x = R + Sr + Lp)"); &rrR;&rrSr;&rrLp}}
+
+ elsif ($rcode eq "CU" or $rcode eq "CDp" or $rcode eq "Uc" or $rcode eq "Dcp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Uc = y = U + Su + Dp)"); &rrU;&rrSu;&rrDp}}
+
+ elsif ($rcode eq "CD" or $rcode eq "CUp" or $rcode eq "Dc" or $rcode eq "Ucp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Dc = yp = Up + Sup + D)");&rrUp;&rrSup;&rrD}}
+
+ elsif ($rcode eq "CF" or $rcode eq "CBp" or $rcode eq "Fc" or $rcode eq "Bcp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Fc = z = F + Sf + Bp)"); &rrF;&rrSf;&rrBp}}
+
+ elsif ($rcode eq "CB" or $rcode eq "CFp" or $rcode eq "Bc" or $rcode eq "Fcp")
+ {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode OK (= Bc = zp = Fp + Sfp + B)");&rrFp;&rrSfp;&rrB}}
+
+ ## -----------------------------
+
+ ## check empty string --> missing rotation
+ elsif ($rcode eq "") {for($j=1;$j<=$m;$j++)
+ {
+ gprint ("..*rotation ,$rcode, ERROR ? typo or missing rotation");
+ ErrorMessage(",$rcode, -- ? typo or missing rotation");
+ }
+ }
+ ## finally ----------------------
else {
- gprint ("...rotation $originalchar NOT KNOWN");
- errormessage("[$originalchar] in RubikRotation\{\}");
- };
- }; # end of foreach
- }; # end of sub
+ ## to fall this far then the rotation (char) must be undefined
+ ## but before we can send these rotation code strings out in ErrorMessages
+ ## we need to check that they are in the original format.
+ ## ie., do not have any {;} chars etc. If they do, then we need to
+ ## translate them back, ie {;} --> (,) etc
+
+ ## we use `originalcode' in the ErrorMessage because the user needs to be
+ ## shown the `bad' code as it was originally input by the RubikRotation{} command.
+
+
+ ## check for code with { ; } and restore to normal syntax
+ if ( $rcode =~ m/(\{|;|\}|\])/ ) {
+ $rcode = restorebrackets($rcode);
+ $originalrcode = restorebrackets($originalrcode);
+ };
+
+
+ if ( $rcode =~ m/(\(|\)|\[|\])/) {
+ gprint ("..*rotation $rcode ERROR -- code not known ? missing comma or nested brackets");
+ ErrorMessage("$originalrcode -- code not known ? missing comma or nested brackets");
+ }
+ else{
+ gprint ("..*rotation $rcode ERROR -- code not known ? typo or missing comma");
+ ErrorMessage("$originalrcode -- code not known ? typo or missing comma");
+ };
-##---------------------------------------------
-## 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)
+ # missing comma after random is a common error
+ if ($originalrcode =~ m/random/i ) {
+ ErrorMessage("$originalrcode -- ? missing comma after random");
+ };
+ #-----------------------------
+ next;
+ }; #end of else
+ next;
+ } # end of sub
-##==========================================================
-# no of arguments passed to the sub = $#_ (black book p 156)
-# parameters passed = $_[0]
-sub random{
+
+#======================================
+
+ sub random {
+
+print " SUB random\n";
+
## 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
+## assign 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 @rrlist= ("U", "Up", "Um", "Ump",
+ "D", "Dp", "Dm", "Dmp",
+ "L", "Lp", "Lm", "Lmp",
+ "R", "Rp", "Rm", "Rmp",
+ "F", "Fp", "Fm", "Fmp",
+ "B", "Bp", "Bm", "Bmp");
my $rrlistnumber=$#rrlist;
print " rrlistnumber = $rrlistnumber\n";
@@ -600,21 +1005,23 @@ print " rrlistnumber = $rrlistnumber\n";
## 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";
+ ## 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 missing: using default value 50");
+ ErrorMessage ("warning: integer n missing or invalid (n=50 was used)")};
-## set the seed for the randomisation (BlackBook p 235)
-srand;
+ 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,
@@ -634,17 +1041,26 @@ for ($j = 1; $j <=$s; $j=$j+1)
## 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==================================
+ my $E;
+
+ foreach $E (@rr) { rotation($E) };
+
+ } ##end of sub
+
+
+#======================================
+
+ sub writestate {
- sub writestate{
-## this just writes the final state to the TeX_OUT_FILE (= rubikstateNEW.dat) will be read by latex.
+print " SUB writestate\n";
-print (TeX_OUT_FILE "\%\% output datafile=$out_file\n");
-print (TeX_OUT_FILE "\%\% PERL prog=rubikrotation version $version\n");
+## this 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 script=rubikrotation.pl 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");
@@ -653,33 +1069,246 @@ print (TeX_OUT_FILE "\\RubikFaceRight\{$Rlt[0]\}\{$Rmt[0]\}\{$Rrt[0]\}\{$Rlm[
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");
+##-----RWDN 2016---create four new holder commands for separate strings----------
+
+## these four names are defined in the rubikrotation.sty file so they can be renewed etc
+## SequenceInfo
+## SequenceName
+## SequenceShort
+## SequenceLong
+
+
+## ----RWDN 25 Sept 2016 ----------------------
+## now remove the first and last chars of [name] to output just NAME without [ and ]
+
+## initialise some variables we shall need
+ $numberofcharsinstring=0;
+ $nmiddlecharsinstring=0;
+
+
+##----------SequenceName----------------------------
+
+## the SequenceName currently includes the [..]
+## need to remove the [] before senting it to LaTeX,
+## so need to detect when NAME string itself is empty, eg []
+## so create a variable:
+ $SequenceNameNew="";
+
+ $numberofcharsinstring = length $SequenceName;
+
+
+## NEED to create error message if [] and empty string etc
+
+if ($numberofcharsinstring <= 2)
+ {$SequenceNameNew = $SequenceName}
+ else {
+
+ $nmiddlecharsinstring = ($numberofcharsinstring - 2);
+ ## reassign the string without first and last chars
+ ### format of substr = (origstring, start possn, no of chars to use)
+ $SequenceNameNew = substr($SequenceName,1,$nmiddlecharsinstring);
+ };
+
+
+print (TeX_OUT_FILE "\\renewcommand\\SequenceName\{$SequenceNameNew\}\%\n");
+
+print (TeX_OUT_FILE "\\typeout{...SequenceName = $SequenceNameNew}\%\n");
+#-----------------
+
+
+
+#----------SequenceInfo----------------
+## we need to preserve any {} structures in the info string,
+## so change { } --> [ ] since
+## otherwise they will disappear or cause error when printed in LaTeX
+
+ $SequenceInfo=~ tr/\{/\[/; ## swap { --> [
+ $SequenceInfo=~ tr/\}/\]/; ## swap } --> ]
+
+print (TeX_OUT_FILE "\\renewcommand\\SequenceInfo\{$SequenceInfo\}\%\n");
+
+print (TeX_OUT_FILE "\\typeout{...SequenceInfo = $SequenceInfo}\%\n");
+#-----------------
+
+
+
+##---------SequenceShort------------------
+## generated in MAIN
+## SequenceShort = original argument of \RubikRotation{} /without/ any infoblocks
+## therefore it may contain square brackets
+
+print (TeX_OUT_FILE "\\renewcommand\\SequenceShort\{$SequenceShort\}\%\n");
+
+print (TeX_OUT_FILE "\\typeout{...SequenceShort = $SequenceShort}\%\n");
+##-----------------------
+
+
+## now prepare the new LONG rotation sequence for output =(LONG sequence + NO NAME)
+## BUT before outputting the string, we need to remove the terminal comma
+
+$numberofcharsinstring = length $SequenceLong;
+$nfrontcharsinstring = $numberofcharsinstring -1;
+## reassign the string except the terminal comma
+$SequenceLong = substr($SequenceLong,0,$nfrontcharsinstring);
+
+
+#----------
+print (TeX_OUT_FILE "\\renewcommand\\SequenceLong\{$SequenceLong\}\%\n");
+
+print (TeX_OUT_FILE "\\typeout{...SequenceLong = $SequenceLong}\%\n");
+
+
+
+##-----------------------
+
## now include any error messages generated
## (these are all in an array waiting to be printed out)
-if ($erroralert eq "YES")
+ 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");
- };
+
+ ## do not attach error to a <checkstate> command, since we really want
+ ## to see the checkstate errors (in the ERROR file) printed AFTER the `rotation' command.
+ if ($rotationcommand eq "checkstate") {}
+ else {print (ERROR_OUT_FILE "*ERR cmd= $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";
-}
-##===========================================
-##================================================
+ ## restore correct brackets etc before outputting to Latex
+ my $errorstring = $error[$k];
+ $errorstring = restorebrackets($errorstring);
+
+ print (TeX_OUT_FILE "\\typeout{$errorstring}\%\n");
+ print (ERROR_OUT_FILE "$errorstring\n");
+
+ }; # end of for
+ }; # end of IF
+ print " Perl output file written OK\n";
+
+ } #end of sub
+
+
+#======================================
+
+ sub ErrorMessage {
+
+ ## writes the argument as a standard error message to out file
+
+ my $errormess = $_[0]; ## parameter passed to sub
+
+ ## restore correct brackets etc before outputting to Latex
+ $errormess = restorebrackets($errormess);
+
+ $erroralert = "YES"; ## set error alert flag (for use in out message)
+ $error[$errornumber] = "*ERR $errormess";
+ $errornumber++; ## increment number
+ };
+
+
+#======================================
+
+ sub gprint {
+
+## 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.
+
+ my $gmess=$_[0];
+ print "$gmess\n";
+ print (TeX_OUT_FILE "\\typeout{$gmess}\%\n");
+ };
+
+
+#======================================
+
+ sub checkstate{
+
+print " SUB checkstate\n";
+
+## only a 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 {
+ gprint ("..*cubie-colour counting ERROR");
+ }
+ };
+
+ 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)");
+
+ # only generate ErrorMessages if n>9 (as may be using a Grey cube)
+ if ($cubiesum != 54) {
+ ErrorMessage ("cubiesum not = 54");
+ gprint ("..*cubiesum not = 54") };
+
+ if ($R >9){
+ ErrorMessage("red cubies > 9 (=$R)");
+ gprint ("..*red cubies > 9 (=$R)") };
+
+ if ($O >9){
+ ErrorMessage("orange cubies > 9 (=$O)");
+ gprint ("..*orange cubies > 9 (=$O)") };
+
+ if ($Y >9){
+ ErrorMessage("yellow cubies > 9 (=$Y)");
+ gprint ("..*yellow cubies > 9 (=$Y)") };
+
+ if ($G >9){
+ ErrorMessage("green cubies > 9 (=$G)");
+ gprint ("..*green cubies > 9 (=$G)") };
+
+ if ($B >9){
+ ErrorMessage("blue cubies > 9 (=$B)");
+ gprint ("..*blue cubies > 9 (=$B)") };
+
+ if ($W >9){
+ ErrorMessage("white cubies > 9 (=$W)");
+ gprint ("..*white cubies > 9 (=$W)") };
+
+ if ($X == 54){
+ ErrorMessage("no colours allocated (X=54)");
+ gprint ("..*no colours allocated (X=54)") };
+
+ print " done\n\n";
+ };
+
+
+#======================================
+
+## Overview of rotation transform subs
+
+#======================================
## 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
@@ -697,13 +1326,18 @@ print " Perl output file written OK\n";
## 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
+## Each of the middle 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{
+## We document only the side and face of the first sub (rrR) in detail, since
+## the other subs are of similar form.
+#======================================
-## the R (slice + face) transform
+
+#======================================
+
+ sub rrR {
+
+## the RIGHT (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
@@ -711,6 +1345,7 @@ print " Perl output file written OK\n";
##-----------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],
@@ -729,6 +1364,7 @@ print " Perl output file written OK\n";
## 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];
@@ -746,12 +1382,13 @@ $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)
+## RIGHT 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]);
@@ -761,6 +1398,7 @@ $Frt[0]=$Rs0[11]; $Frt[1]=$Rs1[11];
## 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];
@@ -774,10 +1412,13 @@ $Rmb[0]=$Rf0[7]; $Rmb[1]=$Rf1[7];
$Rrb[0]=$Rf0[8]; $Rrb[1]=$Rf1[8];
}
-#============================
-sub rrSr {
-## Sr = Right middle SLICE rotation (only 12 side facelets)
+
+#======================================
+
+ 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
@@ -812,12 +1453,15 @@ $Fmt[0]=$SRs0[11]; $Fmt[1]=$SRs1[11];
}
-##===================
-sub rrLp{
-## Left slice (side + face) anticlockwise rotation
+#======================================
+
+ 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],
@@ -847,7 +1491,7 @@ $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)
+## do the LEFT face transform (in rows: 1,2,3//4,5,6//7,8,9)
## f = face; 0=colour, 1= number
## NOTES: not same as for R
@@ -868,15 +1512,16 @@ $Lrb[0]=$LPf0[8]; $Lrb[1]=$LPf1[8];
}
-##==================================
-##==============================
- sub rrU{
+#======================================
-## Up slice (side + face)
+ 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],
@@ -907,6 +1552,7 @@ $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]);
@@ -924,13 +1570,16 @@ $Urb[0]=$Uf0[8]; $Urb[1]=$Uf1[8];
}
-##==============================
- sub rrSu{
+#======================================
+
+ 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],
@@ -961,14 +1610,15 @@ $Llm[0]=$SUs0[11]; $Llm[1]=$SUs1[11];
}
-##==============================
+#======================================
- sub rrDp{
+ sub rrDp {
-## Dpwn Face anticlockwise rotation (side and face)
+## Down 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],
@@ -1015,13 +1665,15 @@ $Drt[0]=$DPf0[8]; $Drt[1]=$DPf1[8];
}
-##==============================
- sub rrF{
+#======================================
+
+ 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],
@@ -1068,13 +1720,15 @@ $Frb[0]=$Lf0[8]; $Frb[1]=$Lf1[8];
}
-##==============================
- sub rrSf{
+#======================================
-## do the Fs transform (side only)
+ sub rrSf {
+
+## do the FRONT middle slice Fm 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],
@@ -1102,14 +1756,16 @@ $Lmm[0]=$SFs0[10]; $Lmm[1]=$SFs1[10];
$Lmt[0]=$SFs0[11]; $Lmt[1]=$SFs1[11];
}
-##==============================
-
- sub rrBp{
+
+#======================================
+
+ 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],
@@ -1139,6 +1795,7 @@ $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]);
@@ -1155,4 +1812,791 @@ $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===================================
+
+
+#======================================
+
+
+#======================================
+
+## Overview of derivative transform subs
+
+#======================================
+
+##---------------------------------------------
+## Note that we have defined (as rotation SUBs above) just 9 primary rotation transforms:
+## (x axis): rrR, rrSr, rrLp
+## (y axis): rrU, rrSu, rrDp
+## (z axis): rrF, rrSf, rrBp
+## and since all remaining possible rotations are simply combinations of these 9
+## we now define all the other rotation subs in terms of these 9 primary rotations.
+## Do NOT use multiples here: write each rotation separately
+## ----------------
+## NB: the Sr, Su, Sf are the middle slice rotations (= Rm, Um, Fm respectively)
+## (the `m' notation is much more intuitive than the S., but too late to change notation now)
+## -------------
+
+## ----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)
+
+
+
+#======================================
+
+ sub rubikmod {
+
+ ## for MODifying (MOD 4)
+print " SUB rubikmod\n";
+ ## passing one RotationElement as a parameter, & return a modified one
+ ## make local variables
+
+
+ my $rot="";
+ my $lencode="";
+ my $char="";
+ my $m4=-1;
+ my $num=-1;
+ my $p=0;
+
+
+ # grab the parameter string
+ # $code = @_[0];
+ $code = $_[0]; ## Perl says this is better
+
+ $lencode=length $code;
+
+ ## we want to split the code string into the front (Rubikcode) and terminal number
+ ## so grab 1 char sequentially starting from the end of the string
+ ## and identify the position of the first non-digit char we get to
+ ## example: $lastchar = substr $code,-1,1 ;
+ for ($p=-1; $p>-$lencode-1; $p=$p-1){
+ $char = substr $code,$p,1 ;
+ if ($char =~ /\d/) {}
+ else{
+ ## this char is the first non-digit from the end"
+ ## its position = $p
+ last;
+ };
+ };
+
+ ## now use the value of $p to split the code string
+ ## into front part (= $rot) and back part (= $num)
+
+ ## get $rot
+ $rot = substr $code, 0, ($lencode + $p + 1);
+
+ ## get $num
+ $num = substr $code, $lencode +$p +1, ($lencode -(length $rot));
+
+ ##--------------
+ ## if no number at all (eg D) then this Rubikcode needs to be implemented just once
+ ## so allocate its num to have value = 1
+
+ ## if ($num == ""){$num=1}; ## BUT this gives an ErrorMessage when num="" etc
+ ## so I have rewritten [if numlength --> 0 then..] then it works OK
+
+ $numlength = ($lencode -(length $rot));
+ if ($numlength == 0) {$num=1};
+ ##---------------------
+
+ ## determine mod 4 of the value num
+ $m4 = $num % 4;
+
+ ## now return the results
+ $rotcode=$rot;
+ $rotnumber=$num; ## we return this so we can use it as a check
+ $modnumber=$m4;
+
+ return $rotcode, $rotnumber, $modnumber;
+
+ } #end of sub
+
+
+#======================================
+
+ sub cleanstring {
+
+ # to clean leading and trailing whitespace from a string
+
+ my $line="";
+
+ $line = $_[0]; # copied from my RubikMOD()
+
+ #clean leading & trailing whitespace
+
+ $line =~ s/^\s+//; ## clean leading whitespace
+ $line =~ s/\s+$//; ## clean trailing whitespace
+
+ return $line;
+ }
+
+
+#======================================
+
+ sub cutinfoblock {
+
+ ## remove each <infoblock> if any exists
+
+ ## pass the whole dataline
+
+ print " SUB cutinfoblock\n";
+
+ my $dataline = $_[0];
+
+ ## we know all brackets are balanced - as this has been checked already.
+
+ print " dataline = $dataline\n";
+ my $Langle=0;
+ my $Rangle=0;
+ my $angleblock="";
+ my $lenangleblock=0;
+
+ ## first see if there is a terminal infoblock
+ $Langle = index $dataline, '<'; ## <
+ $Rangle = index $dataline, '>'; ## <
+ $lenangleblock = $Rangle - $Langle +1;
+
+ ##-----------------
+ ## angleblock is the whole block <...> including both angles
+ ## check both angles exist
+ if ( ($Langle !=-1) and ($Rangle !=-1) )
+ {
+
+ my $angleblock = substr ($dataline, $Langle, $lenangleblock);
+ print " infoblock(s) present: first = $angleblock\n";
+
+ my $lenangleblock = length $angleblock;
+ my $lendataline = length $dataline;
+
+
+ # now need to remove the infoblock from $dataline
+ # need to get front and back strings
+ my $frontstring="";
+ my $newfrontstring="";
+ my $backstring="";
+
+ $lenbackstring= $lendataline - $Rangle -1;
+ $frontstring = substr ($dataline,0, $Langle); # string before Langle
+ $backstring = substr ($dataline,$Rangle +1); # string beyond Rangle
+
+ print " Langle possn = $Langle\n";
+ print " Rangle possn = $Rangle\n";
+ print " lenangleblock (diff + 1) = $lenangleblock\n";
+ print " lendataline = $lendataline\n";
+ print " lenbackstring = $lenbackstring\n";
+ print " frontstring = $frontstring\n";
+
+ #remove the terminal comma from front string
+ $newfrontstring = substr($frontstring, 0, $Langle -1);
+ print " new frontstring = $newfrontstring\n";
+ print " backstring = $backstring\n";
+
+ ##-------
+ # remove angleblock from dataline (join front and back strings)
+ $newdataline =$newfrontstring.$backstring;
+
+ $SequenceInfo = substr ($angleblock, 1, $lenangleblock -2);
+
+ print " new dataline = $newdataline\n";
+ print " SequenceInfo = $SequenceInfo\n";
+ print " newdataline = $newdataline\n";
+ print " done\n\n";
+
+ return $SequenceInfo, $newdataline;
+ }
+
+ else{
+ # no infoblock, so need to make newdataline same as orig dataline
+ $newdataline=$dataline;
+ print " no <infoblock> to remove.\n\n";
+ return $newdataline;
+ };
+ #-----------------
+
+
+ } ## end of sub
+
+
+#======================================
+
+ sub fixrepeatelement {
+
+ print " SUB fixrepeatelement\n";
+
+ print " reformatting any repeat elements...\n";
+
+ ## this sub replaces ,-->; and (--> { and ) --> } for the repeat element
+ ## and inserts it back into the original rotation sequence, where it now
+ ## appears as a separate rotation element.
+
+ my $repeatstring="";
+ my $lenrepeatstring="";
+ my $newrepeatstring="";
+ my $frontstring="";
+ my $backstring="";
+ my $p=0;
+ my $q=0;
+ my $len = 0;
+ my $k1=0;
+ my $k2 = 0;
+
+
+ ## pass the whole dataline without the keyword
+ my $dataline = $_[0]; # copied from my RubikMOD()
+
+
+ $p = index $dataline, '(';
+ $q = index $dataline, ')';
+
+ print " p = $p, q = $q\n";
+
+
+ $lenrepeatstring = $q -$p +1 ;
+ $repeatstring = substr ($dataline, $p, $lenrepeatstring);
+
+ print " first repeat string = $repeatstring\n";
+ print " length of repeat string = $lenrepeatstring\n";
+
+ ## translate the chars
+ $repeatstring =~ tr/,/;/; ## swap , --> ; Black book page 138--139
+ $repeatstring =~ tr/\(/\{/; ## swap ( --> {
+ $repeatstring =~ tr/\)/\}/; ## swap ) --> }
+
+ $newrepeatstring = $repeatstring;
+
+ print "...new repeat string = $newrepeatstring\n";
+
+ #------------
+ $k1=$p; #start of cut
+ $k2= $p + $lenrepeatstring; #end of cut
+ $frontstring = substr ($dataline,0, $k1);
+ $backstring = substr ($dataline,$k2);
+ print " frontstring = $frontstring\n";
+ print " backstring = $backstring\n";
+
+ # add insert
+ $newdataline =$frontstring.$newrepeatstring.$backstring;
+ print " new dataline = $newdataline\n";
+
+
+ print " done\n\n";
+
+ } # end of sub
+
+
+#======================================
+
+ sub repeat {
+
+ # to expand the repeating elements
+
+print " SUB repeat\n";
+
+ ## pass the whole repeatstring = {...}n
+ my $repeatstring = $_[0];
+
+ # the string ={code}n
+ # get the code sequence and the terminal digit
+
+ my $p=0;
+ my $q=0;
+ my $repeatnumber=0;
+ my $repeatcode="";
+ my $lenrepeatcode =0;
+
+ $p = index $repeatstring, '{';
+ $q = index $repeatstring, '}';
+ $lenrepeatcode = $q - $p -1;
+
+
+
+ $repeatcode = substr ($repeatstring,1,$lenrepeatcode);
+ print " repeatcode = $repeatcode\n"; ## correct
+
+
+ $lenrepeatstring= length $repeatstring;
+
+
+ print " lenrepeatstring = $lenrepeatstring\n";
+ print " lenrepeatcode = $lenrepeatcode\n";
+ print " p = $p\n";
+ print " q = $q\n";
+
+
+ if ($lenrepeatcode == ($lenrepeatstring-2)) {
+ print " there is no trailing number --> 1\n";
+ $repeatnumber=1;
+ print " set repeatnumber = $repeatnumber\n";
+ }
+ else{
+ $repeatnumber= substr ($repeatstring, $q + 1); # correct
+ print " repeatnumber = $repeatnumber\n";
+
+ ## need to check that repeatnumber is a valid integer
+ if ($repeatnumber =~ /\D/){
+ # not a valid number
+
+ ## renormalise brackets etc before outputting to LaTeX
+ $repeatnumber= restorebrackets($repeatnumber);
+
+ gprint ("..*repeat-no. ERROR: $repeatnumber not numeric");
+ ErrorMessage ("repeat-no. $repeatnumber not numeric ?missing comma or nested ()");
+ };
+
+ }; #end of else
+
+
+ ## make n copies of repeatcode
+ ## we need commas only between elements (not at end)
+
+ $insert=""; ## $insert = global
+ $insert=$repeatcode;
+ for ($t=1; $t < $repeatnumber; $t=$t+1) {$insert=$insert.",".$repeatcode};
+
+ print " insert = $insert\n";
+ print " done\n\n";
+
+ } # end sub
+
+
+#======================================
+
+ sub quitprogram {
+
+ ## exiting the program cleanly
+ print " closing down: writing state...\n";
+ writestate(); ## write to the output files
+ close; ## close all files
+ exit;
+ }
+
+
+#======================================
+
+ sub showarray {
+
+ # show the array as a string
+
+ my @newarray = @_; # copied from my RubikMOD()
+ my $arraystring= join (",",@newarray);
+ print " the array = *$arraystring*\n\n";
+ }
+
+
+#======================================
+
+ sub cleanarray {
+
+ # cleans array elements of leading and trailing whitespace
+
+ my @cleanset=();
+ my @line = @_;
+ my $E;
+
+ foreach $E (@line) {
+ $E =~ s/^\s+//; ## clean leading whitespace
+ $E =~ s/\s+$//; ## clean trailing whitespace
+ push @cleanset, $E;
+ };
+
+ return @cleanset;
+
+}
+
+
+#======================================
+
+ sub restorebrackets {
+
+ my $line = $_[0];
+
+ ## translate the chars
+ $line =~ tr/;/,/; ## swap , --> ; Black book page 138--139
+ $line =~ tr/\{/\(/; ## swap ( --> {
+ $line =~ tr/\}/\)/; ## swap ) --> }
+
+ return $line;
+
+}
+
+
+#======================================
+
+ sub infoblockcolon {
+
+ print "...SUB InfoblockColon\n";
+
+ ## pass the whole dataline without the keyword
+ my $line = $_[0]; # copied from my RubikMOD()
+
+ if ( (index $line, '<' ) == -1) {
+ # no infoblock, so need to make newdataline same as orig dataline
+ print " no <infoblock> found.\n\n";
+ $newdataline=$dataline;
+ return $newdataline;
+ }
+ else{
+ print " infoblock(s) present\n";
+
+ print " start-string = $line\n";
+
+ # look at each char
+ my $j=0;
+ my $char="";
+
+ my $lenstring = 0;
+ $lenstring= length $line;
+
+ # set initial state of inout-flag
+ my $inoutflag="outside";
+
+ #------------------------
+ for ($j=0; $j<=$lenstring; $j=$j+1) {
+ $char = substr ($line,$j,1);
+
+ if ( ($char eq ',') and ($inoutflag eq 'inside')) {
+ # replace the char with ;
+ substr ($line, $j, 1, ";");
+ print " colon-string = $line\n";
+ };
+
+ ## need these at end of the loop
+ if ($char eq '<'){$inoutflag = "inside"};
+ if ($char eq '>'){$inoutflag = "outside"};
+
+ }; # end of for
+
+ #---------------------------
+
+ # -- repeat for [ ] brackets------
+ $inoutflag="outside";
+
+ for ($j=0; $j<=$lenstring; $j=$j+1) {
+ $char = substr ($line,$j,1);
+
+ if ( ($char eq ',') and ($inoutflag eq 'inside')) {
+ # replace the char with ;
+ substr ($line, $j, 1, ";");
+ print " colon-string = $line\n";
+ };
+
+ ## need these at end of the loop
+ if ($char eq '['){$inoutflag = "inside"};
+ if ($char eq ']'){$inoutflag = "outside"};
+
+ }; # end of for
+
+
+ #----------------------------------
+ ## make an array from the string so we can manipulate the elements
+ our @linedata=();
+ @linedata= split (/,/, $line);
+
+#----------clean the array-------
+ my $E;
+ my @cleandata=();
+
+ foreach $E (@linedata) {
+ $E =~ s/^\s+//; ## clean leading whitespace
+ $E =~ s/\s+$//; ## clean trailing whitespace
+ push @cleandata, $E;
+ };
+
+ print " colon-array = @cleandata\n";
+
+#=================
+
+# Because <infoblocks> can be located inside curved brackets
+# as for example, (\sixspot)2, [\sixspot macro contains an infoblock].
+# Consequently, we need to remove
+# the <..> blocks as parts of a string, not as elements in an array.
+# --otherwise, removing the terminal infoblock associated with \sixspot
+# will result in also removing the right-hand curved bracket --> error.
+# So we return the data as a string, and then send it to sub cutinfoblock later.
+
+ $newdataline = join (",", @cleandata);
+ print "...done\n\n";
+
+ return $newdataline;
+
+ } ## end of else
+ } ## end of sub
+
+
+#======================================
+
+ sub RemoveAllSpaces {
+
+ # remove all spaces in a string
+ # Black book page 143
+
+ my $string=$_[0];
+
+ $string =~ s/\s//g; # OK
+
+ return $string;
+
+}
+
+#======================================
+
+sub CheckSyntax {
+
+ ## checks that all () {} <> are matched (if any exist)
+ ## checks for other syntax problems, eg missing commas
+ ## if any brackets are not balanced, then we SET an errorflag, and terminate the program
+
+ print " SUB CheckSyntax\n";
+
+ my $dataline = $_[0];
+
+ # first clean out all spaces so we can look for specific strings
+ $dataline=RemoveAllSpaces($dataline);
+
+ print " dataline = $dataline\n";
+
+
+
+
+ ## count brackets; Angle, Square, Curved
+ my ($nleftA, $nrightA) = 0;
+ my ($nleftS, $nrightS) = 0;
+ my ($nleftC, $nrightC) = 0;
+ my ($leftsum, $rightsum) =0;
+
+ ## Blackbook p 139 - counting chars in a string
+ $nleftA = ($dataline =~ tr/</</);
+ $nrightA = ($dataline =~ tr/>/>/);
+
+ $nleftS = ($dataline =~ tr/[/[/);
+ $nrightS = ($dataline =~ tr/]/]/);
+
+ $nleftC = ($dataline =~ tr/(/(/);
+ $nrightC = ($dataline =~ tr/)/)/);
+
+ print " left and right <> = $nleftA, $nrightA\n";
+ print " left and right [] = $nleftS, $nrightS\n";
+ print " left and right () = $nleftC, $nrightC\n";
+
+
+ $leftsum = $nleftA + $nleftS + $nleftC;
+ $rightsum =$nrightA + $nrightS + $nrightC;
+
+ print " leftsum, rightsum = $leftsum, $rightsum\n";
+
+ # define the current rotation command before any ErrorMessages are issued
+ # $rotationcommand=$dataline; ## used in writestate sub
+
+ my $errorflag = "";
+
+ if ($leftsum != $rightsum)
+ {
+
+ if ( $nleftS != $nrightS )
+ {
+ gprint ("..*brackets ERROR [ ] Left [$nleftS not equal to Right $nrightS]");
+ ErrorMessage ("brackets [ ]: Left [$nleftS not equal to Right $nrightS]");
+ $errorflag="SET";
+ }
+
+ if ( $nleftC != $nrightC )
+ {
+ gprint ("..*brackets ERROR ( ) Left ($nleftC not equal to Right $nrightC)");
+ ErrorMessage ("brackets ( ): Left ($nleftC not equal to Right $nrightC)");
+ $errorflag="SET";
+ }
+
+ if ( $nleftA != $nrightA )
+ {
+ gprint ("..*brackets ERROR < > Left <$nleftA not equal to Right $nrightA>");
+ ErrorMessage ("brackets < >: Left <$nleftA not equal to Right $nrightA>");
+ $errorflag="SET";
+ }
+
+ };
+
+ #--------------------------
+
+
+
+ # check for other bad syntax
+ # BB p136
+
+ my ($char1, $char2, $charpair) = "";
+ my ($j, $lenstring) = 0;
+ $lenstring= length $dataline;
+ print "lenstring = $lenstring\n";
+
+ # set initial state of inout-flag
+ my $angleflag = "outside";
+ my $squareflag = "outside";
+ my $curvedflag = "outside";
+
+ # look at each char
+ for ($j=0; $j<= $lenstring; $j=$j+1) {
+ $charpair = substr ($dataline,$j,2);
+ $char1 = substr ($dataline,$j,1);
+ $char2 = substr ($dataline,$j+1,1);
+
+ ## at top of for loop
+ if ($char1 eq '<'){$angleflag = "inside"};
+ if ($char1 eq '>'){$angleflag = "outside"};
+ if ($char1 eq '['){$squareflag = "inside"};
+ if ($char1 eq ']'){$squareflag = "outside"};
+ if ($char1 eq '('){$curvedflag = "inside"};
+ if ($char1 eq ')'){$curvedflag = "outside"};
+
+
+ if ($angleflag eq "outside"){
+
+ ## A-Za-z< A-Za-z[ A-Za-z( )A-Za-z >A-Za-z ]A-Za-z
+ ## ]< ][ ]( ]) ]< )< )[ )( >< >[ >( d( d[ d<
+
+ if ( $charpair =~ m/([A-Za-z]\<|[A-Za-z]\[|[A-Za-z]\(|\)[A-Za-z]|\>[A-Za-z]|\][A-Za-z]|\]\<|\]\[|\]\(|\]\)|\]\<|\)\<|\)\[|\)\(|\>\<|\>\[|\>\(|\d\(|\d\[|\d\<|\[\[|\<\<|\(\(|\)\)|\]\]|\>\>)/ )
+ {
+ gprint ("..*syntax error: $charpair -- missing comma");
+ ErrorMessage("$charpair -- syntax error: missing comma");
+ $errorflag="SET";
+ next;
+ };
+
+ # trap nested curved brackets
+ if ( ($char2 eq "(" ) and ($curvedflag eq "inside" ) ) {
+ ## nested curved brackets
+ gprint ("..*syntax error: $charpair -- nested ((..))");
+ ErrorMessage("$charpair -- syntax error: nested ((..)) not allowed");
+ $errorflag="SET";
+ };
+
+ # trap nested square brackets
+ if ( ($char2 eq "[" ) and ($squareflag eq "inside" ) ) {
+ ## nested square brackets
+ gprint ("..*syntax error: $charpair -- nested [[..]]");
+ ErrorMessage("$charpair -- syntax error: nested [[..]] not allowed");
+ $errorflag="SET";
+ };
+
+
+ if ($squareflag eq "inside"){
+ if ($char1 eq ",") {
+ gprint ("..*syntax error: $charpair -- comma not allowed in [ ]");
+ ErrorMessage("$charpair -- syntax error: comma not allowed in [ ]");
+ $errorflag="SET";
+ next;
+ };
+ }; # end of if
+
+
+ ## detect end of string
+ if ($j == $lenstring -1) {last};
+
+
+ }; # end of if
+
+ }; # end of for
+ #---------------------------
+
+
+ if ($errorflag eq "SET") {
+
+ ## closing down
+ gprint ("..*Quiting Perl program -- syntax error");
+ ErrorMessage ("QUITTING PERL PROGRAM -- syntax error");
+
+ print " closing down -- writing state........... OK\n";
+
+ quitprogram();
+
+ }
+ else{
+ print " syntax OK; brackets balanced OK\n";
+ print " done\n\n";
+ };
+
+
+} ## end sub
+
+
+
+#====================
+
+sub inverse {
+
+my $E = $_[0];
+
+ my $lastchar = substr ($E, -1,1);
+ my $frontchars = substr ($E, 0,-1); # correct
+
+ if ($lastchar eq "2") {$newE = $E}
+
+ elsif ($lastchar eq "p") { $newE = $frontchars}
+
+ else { $newE = $E."p"};
+
+return $newE;
+}
+
+##======================
+
diff --git a/Master/texmf-dist/source/latex/rubik/examples.bat b/Master/texmf-dist/source/latex/rubik/examples.bat
deleted file mode 100755
index 1a67e63e77e..00000000000
--- a/Master/texmf-dist/source/latex/rubik/examples.bat
+++ /dev/null
@@ -1,4 +0,0 @@
- 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 c2f2411d015..4f57d98a0ee 100644
--- a/Master/texmf-dist/source/latex/rubik/rubikcube.dtx
+++ b/Master/texmf-dist/source/latex/rubik/rubikcube.dtx
@@ -1,10 +1,9 @@
% \iffalse meta-comment
-%
% rubikcube.dtx
%
-% version 3.0 25 September 2015
+% version v4.0 (03 March 2017)
%
-% Copyright 2015
+% Copyright 2017
% RWD Nickalls (dick@nickalls.org) and
% A Syropoulos (asyropoulos@yahoo.com)
%
@@ -63,7 +62,7 @@
%
%
%
-% \CheckSum{4105}
+%%% \CheckSum{5683}
%
%%% \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
@@ -82,7 +81,9 @@
%% Right brace \} Tilde \~}
%
%
-% \title{The \textsc{rubikcube} package}
+% \title{%
+% \ifpdf\pdfbookmark[1]{Title}{Title}\else\fi%
+% The \textsc{rubikcube} package}
%
% \author{
% RWD Nickalls (dick@nickalls.org) \\
@@ -96,7 +97,7 @@
% The \rubikcube\ package provides LaTeX commands and macros
% for typesetting Rubik cube (3x3x3) notation, configurations, and
% rotation sequences using the TikZ graphic language. It is part of the
-% rubik `bundle'.
+% Rubik `bundle'.
% \end{abstract}
%
% \medskip
@@ -104,7 +105,7 @@
% \begin{minipage}{11cm}
% \centering
% \ifpdf
-% \includegraphics[width=10cm]{Rubik-doc-figF.pdf}
+% \includegraphics[width=10cm]{rubik-doc-figF.pdf}
% \else
% \fi
% \end{minipage}
@@ -118,58 +119,109 @@
% 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
+% PGF/TikZ graphic languages, and relates only to the
% familiar 3x3x3 Rubik cube.
-% We have extended the layer-rotation hieroglyphic notation, originally
+% We have extended the rotation hieroglyph notation, originally
% developed by Garfath-Cox (1981), and improved by Duvoid (2010, 2011).
%
% 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.
+% with both the \textsc{rubikrotation} package and the \textsc{rubikpatterns} package.
+% The \rubikcube\ package deals primarily with typesetting, while the \textsc{rubikrotation}
+% package processes rotation sequences and keeps track of the cube's configuration.
+% The \textsc{rubikpatterns} package is a small database of Rubik cube rotation sequences
+% which generate well-known named cube configurations (patterns).
+% For full functionality it is recommended that all three Rubik packages are used
+% together; for~example,
+%\begin{verbatim}
+% \usepackage{tikz,rubikcube,rubikrotation,rubikpatterns}
+%\end{verbatim}
+% Note that the \verb!TikZ! package must be loaded \textit{before} the \textsc{rubikcube}
+% package.
%
% 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).
+% platform (with \textsf{MiK}\TeX), a GNU-Linux platform (Debian 8.2.0
+% and {\TeX}Live 2016), 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).
+% Davis (2006), Golomb~(1981, 1982), Hofstadter (1981), Hutchings~(2011),
+% Heise website, Joyner~(2008), Kociemba website,
+% Rokicki~\textit{et al.} (2013), Scherphius website, Tran~(2005).
+% Other useful websites are the Speedsolving website, and those
+% maintained by Duvoid, by Fridrich, by Jelinek, by Reid, and by Vandenburgh.
+% A useful online solver utility (based on an algorithm by Kociemba) is
+% available at the RuWix website. Websites with good pages on patterns and symmetries are
+% those by Fridrich, Kociemba, Longridge, Reid, Randelshofer, Scherphius
+% (see References for details).
%
%
% \subsection{Requirements}
%
-% The \rubikcube\ package requires the TikZ package.
-% In particular, we make use the \cmd{\pgfmathsetmacro} command and
-% the TikZ picture environment.
+% The \rubikcube\ package requires the TikZ package, since it makes
+% use of the TikZ picture environment and the \cmd{\pgfmathsetmacro} command.
+% Consequently, the \verb!TikZ! package must be loaded \textit{before}
+% the \textsc{rubikcube} package.
+%
+% Both the \textsc{rubikrotation} and \textsc{rubikpatterns} packages (see below)
+% require Perl to be installed.
%
%
% \subsection[rubikrotation package]{Supporting tool---the
% \textsc{rubikrotation} package}
-% \label{sec:addons}
+% \label{sec:rubikrotation}
%
-% The \textsc{rubikrotation} package, is a dynamic extension to
-% the \rubikcube\ package, and is part of the `Rubk bundle'. It consists of the
+% The \textsc{rubikrotation} package (also part of the \textsc{rubik} `bundle'),
+% is a dynamic extension to the \rubikcube\ package. 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
+% The \textsc{rubikrotation} package implements rotation sequences 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.
+% new state in a form which can then be used by the \rubikcube\ package.
+% It also returns some useful strings associated with the rotation sequence
+% which can be used by the \rubikcube\
+% package---see also Section~\ref{sec:showsequence}.
%
% Since the \cmd{\RubikRotation} command works by \textsc{call}ing the
% \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 \textsc{rubikrotation} documentation for details.
+% and (b)~the \LaTeX\ engine needs to be run using the \texttt{--shell-escape}
+% command-line option. Those wishing to use Lua\LaTeX\ will also need to have access
+% to the recent \texttt{shellesc} package (in {\TeX}Live 2016).
+% The \texttt{shellesc} package can always be downloaded from CTAN directly.
+% See the \textsc{rubikrotation} documentation for further details.
+%
+%
+%
+% \subsection[rubikpatterns]{Supporting database---\textsc{rubikpatterns.sty} }
+% \label{sec:patterns}
+%
+%
+% The \textsc{rubikpatterns.sty} file (also part of the \textsc{rubik} `bundle')
+% is a small database of some well-known Rubik cube rotation sequences, stored as
+% named macros. For~example, the `fourspot' and `sixspot' sequences are encoded in
+% this package as follows:
+%\begin{verbatim}
+% \newcommand{\fourspot}{[fourspot],F2,B2,U,Dp,R2,L2,U,Dp,<(12q*, 8f*)>}
+% \newcommand{\sixspot}{[sixspot],U,Dp,R,Lp,F,Bp,U,Dp,<(8q*, 8f*)>}
+%\end{verbatim}
+% These sequences can be processed by name (using the \cmd{\RubikRotation} command
+% which also requires Perl to be installed---see Section~\ref{sec:rubikrotation}), and
+% then displayed (using the \cmd{\ShowCube} command in conjunction with various
+% \cmd{\DrawRubikCube...} commands). So, for~example, one could typeset the so-called
+% `fourspot' configuration using the following code:
+%\begin{verbatim}
+% \usepackage{tikz,rubikcube,rubikrotation,rubikpatterns}
+% ...
+% \RubikCubeSolved
+% \RubikRotation{\fourspot}
+% \ShowCube{2.4cm}{0.6}{\DrawRubikCubeRU}
+%\end{verbatim}
+% See also the \textsc{rubikrotation} documentation---especially
+% Section~5.1.1 \textit{Sequences as macros}.
%
%
% \subsection{Copyright}
-% Copyright 2014--2015 RWD Nickalls and A Syropoulos.
+% Copyright 2014--2017 RWD Nickalls and A Syropoulos.
%
% \medskip
% {\noindent}This work may be distributed and/or modified under the
@@ -181,31 +233,39 @@
%
% \section{Installation}
%
+% The Rubik bundle consists of the three package \rubikcube, \textsc{rubikrotation}
+% and \textsc{rubikpatterns}, each of which needs to be installed separately.
+% Here we describe the installation of the \rubikcube\ package.
%
-% \subsection{Generating the files}
+% \subsection{Generating the \rubikcube\ files}
%
% Place the file \texttt{rubikcube.zip} into a temporary directory, and unzip it.
% This will generate the following files:
%\begin{verbatim}
% rubikcube.ins
% rubikcube.dtx
-% rubikcube.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
+% rubikcube.pdf --documentation of the rubikcube package
+% rubik-doc-figA.pdf
+% rubik-doc-figB.pdf
+% rubik-doc-figC.pdf
+% rubik-doc-figD.pdf
+% rubik-doc-figE.pdf
+% rubik-doc-figF.pdf
+% rubikexamples.tex
+% rubikexamples.pdf
+% rubikexamples.sh
+% rubikexamples.bat
%\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}
% 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
+% steps\,\footnote{Several pdflatex runs are required, since the documentation includes
+% an index as well as hyperef links (the package \texttt{hypdoc}
+% is used). 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
@@ -216,6 +276,14 @@
% pdflatex rubikcube.dtx
%\end{verbatim}
%
+% Note that the package includes a `rubikexamples' file (\texttt{rubikexamples.tex})
+% as well as associated \texttt{.sh} (Linux) and \texttt{.bat} (Microsoft) batch
+% files which can be used to facilitate processing the file.
+% Note that many of the examples in this file use the \cmd{\RubikRotation} command
+% (associated with the \textsc{rubikrotation} package),
+% and hence this file needs to be run using the \verb!--shell-escape! command-line
+% option (see Section~\ref{sec:rubikrotation} for details).
+
%
% \subsection{Placing the files}
%
@@ -229,7 +297,7 @@
%
% \medskip
% {\noindent}Finally, (depending on your system) update the \TeX\ file database.
-% For example, on a Linux system one uses the \texttt{texhash} command.
+% For~example, on a Linux system one uses the \texttt{texhash} command.
%
%
% \subsection{Usage}
@@ -240,212 +308,123 @@
% \begin{quote}
%\begin{verbatim}
% \usepackage{tikz}
-% \usepackage{rubikcube,rubikrotation}
+% \usepackage{rubikcube,rubikrotation,rubikpatterns}
%\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 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 the \rubikcube\ package
-% is as follows:
-% \begin{quote}
-%\begin{verbatim}
-% \begin{tikzpicture}[scale=0.5]
-% ....
-% \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. 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}).
-%
-%
-% \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 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|).
-%
-% \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}
-% \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
-%\end{verbatim}
-% 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
-% `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:
-%
-% \medskip
-%
-% \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}.
+% \textsc{rubikrotation} and \textsc{rubikpatterns} packages.
%
%
+% \DescribeMacro{\rubikcube}
+% This command generates the logo \rubikcube.
%
-% \subsection[Draw.. error message]{\cmd{\Draw} error message}
-% \label{sec:drawerrormessage}
%
-% 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 use the \rubikcube\ command
-% \cmd{\DrawRubikFlat} without a surrounding TikZ picture environment
-% then something similar to the following error message will be generated.
-%\begin{verbatim}
-%! Undefined control sequence.
-%\DrawFlatUp ... }{#1}\pgfmathsetmacro {\uy }{#2}\draw
-% [line join=round,...
-%l.56 \DrawRubikFlat
-%\end{verbatim}
+% \section{Command conventions}
+% \label{sec:conventions}
%
%
+% All \rubikcube\ package 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).
%
-% \section{Command conventions}
-% \label{sec:conventions}
%
-% \subsection{Commands and environments}
+% \subsection{Environments}
%
% Although the \rubikcube\ package has been designed with TikZ in mind,
-% it is important to appreciate that of all the various \rubikcube\
+% it is important to appreciate that of all the various \rubikcube\ package
% 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
+% Indeed, using \rubikcube\ package 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
+% Rubik colour state brought about by such commands is not accessible
% 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.
+% drawing sequences of rotations across several figures; for~example, keeping commands like
+% \cmd{\RubikRotation}, \cmd{\RubikFace..}, \cmd{\RubikSide..}, \cmd{\RubikCubeSolved},
+% 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, 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.
+% Virtually all Rubik bundle commands start with a capital letter, primarily to
+% avoid any confusion with TikZ commands (these generally start with lower-case letters). However,
+% each `word' in a Rubik bundle command (except the word `text') also starts
+% with a capital letter, primarily to facilitate readability.
+% For~example, \cmd{\DrawRubikCubeRU}, \cmd{\DrawCubieRU}.
+% However, as with \LaTeX, `text..' commands start with a lower-case `t';
+% for~example \cmd{\textCubieRU}. Letter arguments for colours (R, O, Y, G, B, W, X) are
+% always written in upper-case letters.
+%
%
%
% \subsection{XYZ argument ordering}
+% \label{sec:xyzarguments}
+%
+% Many commands have an appended two, three, or even six ordered arguments or letters
+% which form some feature of the structure of a command; perhaps
+% either face or colour code or a viewpoint direction.
%
-% Many commands have an appended two (XY) or three (XYZ) ordered letter code
-% which is used to for specifying some feature of the command; perhaps
-% either face or cubie colours or a viewpoint direction.
+% We adopt the convention that where ordering of arguments is critical, then the
+% arguments are ordered in the XYZ, $+$, $-$ order. An XYZ code implies that
+% the first letter in the code relates to an X-related parameter,
+% for~example, L (Left) or R (Right); the second letter 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)
+% ---see Figure~\ref{fig:notation}.
%
-% The convention is that the letter codes are ordered in the XYZ order;
-% 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).
+% Some commands have six arguments which adopt an (XYZ;$+$$-$) format. In this case,
+% for~example, the \cmd{\SolvedConfig} command, for which the six colour arguments
+% are ordered as X$+$, X$-$, Y$+$, Y$-$, Z$+$, Z$-$. Here the colour argument
+% associated with a face positioned on the $+$ve axis is ordered before
+% its $-$ve complement on the same axis.
%
+% Another example is the |\DrawCubieRU{G}{Y}{O}| command, which draws a cubie. Here
+% the RU letters are XY ordered; i.e.,~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.
%
-% \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 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, and
-% also on the end of each \cmd{\end\{tikzpicture\}} environment command.
-% This is to prevent unwanted `space' characters appearing in
-% the graphics. In \TeX\ every newline character is automatically converted
+% Since the all the output of this package is drawn using graphic elements
+% using TikZ, it is important to include a trailing \% on the end
+% of \rubikcube\ package commands when used \textit{outside} a TikZ picture environment, and
+% also on the end of the \cmd{\end\{tikzpicture\}} environment command itself.
+% In particular it is important to use a trailing \% on
+% the end of lines which break before the terminal curly bracket of a \cmd{\newcommand}.
+%
+% This is to prevent accumulating spurious spaces which may otherwise appear in
+% figures and diagrams as a strange or unexpected horizontal shift or white-space.
+% That this can occur is because 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).
+% (Feuers\"{a}nger 2016).
+%
+% The \LaTeX\ fbox is a useful aid for visualising unwanted white space
+% which may have accumulated, and for identifying the cause.
+% See Section~\ref{sec:showcube} on the \cmd{\ShowCubeF} command for
+% more regarding this approach.
%
+% Although this effect is mostly small, and is generally only observed in situations
+% when centering a graphic is critical, it is, however, cumulative and can be surprisingly large.
+% In these situations, the cure is the addition of terminal \% characters to preceding
+% code guided by careful detective use of the fbox technique mentioned above.
%
%
% \subsection{Cubies, cubicles, faces and facelets}
@@ -457,38 +436,283 @@
%
% 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
+% (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
+% 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}
+% \section{Rubik cube coordinates}
+% \label{sec:coordinates}
+%
+% The coordinate origin of all 2D Rubik cube images 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
+% extent of this particular 2D rendering of the cube is actually at $(-1,-1)$,
+% and hence the default height and width of all oblique-view cubes is 4~units
+% (i.e.,~equivalent to 4cm if the TikZ scale-factor = 1).
+%
+% \begin{figure}[hbt]
+% \centering
+% \ifpdf
+% \includegraphics[height=4cm]{rubik-doc-figB.pdf}
+% \else
+% \includegraphics[height=4cm]{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.
+% Since $P$ is at $(-1,-1)$ then the default height and width of the
+% 2D~cube image is 4~units.}}
+% \end{figure}
+%
+% Arranging for $P$ to be at $(-1,-1)$, as well as using the bottom-left corner
+% of the \textsc{front} face as the origin, are useful design
+% features which make it easy to know the coordinates of any point, and hence
+% facilitate the 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}).
+
+%
+% \subsection[Size of cube minipage]{Size of cube \cmd{\minipage}}
+% \label{sec:sizeofminipage}
+%
+% Since the the default height and width of the oblique 2D~cube image is
+% 4~units (see Section~\ref{sec:coordinates} 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}$.
+%
+% Note that the width of the semi-flat (SF) cube representation is therefore
+% 10~units ($=3+3+1+3$), and that of the flat (F) cube is 12~units ($=3+3+3+3$)
+% --- see Section~\ref{sec:flatcommands} for images of these forms.
+% If in doubt check the horizontal extent of an image using the \cmd{\ShowCubeF} command,
+% which places an fbox around the image.
+%
+%
+%
+% \section{TikZ picture environment}
+% \label{sec:tikz}
+%
+% All the Rubik bundle \cmd{\Draw..} commands are designed to be used
+% with the TikZ picture environment, and are compatible with standard 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{https://en.wikipedia.org/wiki/PGF/TikZ}
+% \item \texttt{pgfmanual.pdf}, version 3.0.1a (?\,2013) (1161 pages)
+% \item \texttt{pgfplot.pdf}, version 1.13 (2016) (544 pages)
+% \item \texttt{tkz-base-screen.pdf}, version 1.16c (2011) (91 pages)
+% \end{itemize}
+% An example of the TikZ picture environment for use with the Rubik bundle
+% is as follows:
+% \begin{quote}
+%\begin{verbatim}
+% \begin{tikzpicture}[scale=0.5]
+% ...
+% \end{tikzpicture}%
+%\end{verbatim}
+% \end{quote}
+% If no scale-factor is used (default scale-factor = 1), then each of the small
+% cubie sides will have a length of 1~cm.
+%
+% \textsc{useful commands}:\ Probably the most
+% useful TikZ commands for use with regard
+% to the Rubik bundle are the \cmd{\draw} command (for drawing lines, arrows, circles),
+% and the \cmd{\node} command (for writing text at specific coordinate locations).
+% The basic structure of these commands is as~follows, where
+% (x,y) represent grid coordinates of start or end points of lines or arrows,
+% or of a circle centre, or of text position (see Sections~\ref{sec:flatcommands}
+% and \ref{sec:arrows} for examples).
+% \begin{quote}
+% \begin{verbatim}
+% \draw[->,thick,color=blue] (4.5, 2.5) -- (3.5,2.5);
+% \draw[->,ultra thick,color=red] (4.5, 2.5) -- (3.5,2.5);
+% \draw [color=blue, thick] (0.3, 0.3) circle (1.3);
+% \node (B) at (7.5, 1.5) [black]{\small\textsf{B}};
+%\end{verbatim}
+%\end{quote}
+% Remember that all TikZ commands which are valid inside a \texttt{tikzpicture}
+% environment require a terminal semicolon (see Section~\ref{sec:arrows}
+% for examples).
+%
+% \textsc{colours}: \
+% The following colors are predefined by TikZ: red, green, blue, cyan, magenta,
+% yellow, black, gray, darkgray, lightgray, brown, lime, olive, orange, pink,
+% purple, teal, violet and white (see \texttt{https://en.wikipedia.org/wiki/PGF/TikZ}).
+%
+% \textsc{line width}: \
+% TikZ allows line width to be specified directly
+% (e.g.,~\texttt{[line width=<dimension>]}), or by using the following abbreviations:
+% `ultra thin' for 0.1pt, `very thin' for 0.2pt, `thin' for 0.4pt (the default width),
+% `semi thick' for 0.6pt, `thick' for 0.8pt, `very thick' for 1.2pt,
+% `ultra thick' for 1.6pt (see \texttt{https://en.wikipedia.org/wiki/PGF/TikZ}).
+%
+%% \textsc{white space}: \
+% A particularly useful feature of TikZ is that it automatically
+% minimises any horizontal white-space. However, it is good practice to place
+% a \% symbol after the \verb!\end{tikzpicture}! command *see above)
+% to avoid additional white space inadvertently being added by \LaTeX\
+% (see Section~\ref{sec:trailingpercent}).
+%
+% When making images it can be helpful to place them inside a minipage
+% (e.g.,~using the \cmd{\ShowCube} command / environment below).
+% A~convenient approach is to first adjust the value of the tikzpicture scale-factor
+% (to obtain the appropriate size), and then adjust the minipage-width as necessary, using
+% the fbox associated with the \cmd{\ShowCubeF} command
+% (see Section~\ref{sec:sizeofminipage} for a useful guide on this).
+%
+% The main `display' tool for drawing cubes is the \cmd{\ShowCube} command
+% (see below), and this incorporates a
+% TikZ picture environment inside a minipage. The equivalent tool for
+% displaying rotation sequences is the \cmd{\ShowSequence} command.
+%
+%
+%
+%
+%
+% \section[ShowCube command]{\cmd{\ShowCube} command}
+% \label{sec:showcube}
+%
+%
+% \DescribeMacro{\ShowCube}
+% This command \cmd{\ShowCube}\marg{width}\marg{scale-factor}\marg{commands}
+% is a convenient tool which places one or more commands inside a
+% tikzpicture environment and places all of these inside a minipage
+% (see Section~\ref{sec:showcubecode} for the code).
+% This command takes three arguments: the first (\verb!#1!) is the minipage width,
+% the second (\verb!#2!) is the tikzpicture scale factor, and the third (\verb!#3!)
+% is a series of any \rubikcube\ package \cmd{\Draw..} and other commands, as well as
+% any TikZ commands which are valid in a \texttt{tikzpicture} environment
+% (e.g.,~\cmd{\draw} or \cmd{\node} etc.).
+%
+% \medskip
+%
+% \noindent\textsc{usage}:
+% The following \cmd{\ShowCube} command displays a Rubik cube
+% (the `SixT's configuration\footnote{The \cmd{\sixts} macro is from the \textsc{rubikpatterns}
+% package.}) and a blue arrow in a minipage of width~3cm, using a tikzpicture scale
+% factor of~0.5.
+% Note that the TikZ \cmd{\draw} command requires a terminal
+% semicolon---see Section~\ref{sec:tikz}.
+%
+% \medskip
+%
+% {\noindent}%
+% \begin{minipage}{6.6cm}
+%\begin{verbatim}
+% \RubikCubeSolved
+% \RubikRotation{\sixts}
+% \ShowCube{3cm}{0.5}{%
+% \DrawRubikCubeLU
+% \draw[->,thick,color=blue] (4.5, 2.5) -- (3.5,2.5);
+% }
+%\end{verbatim}
+% \end{minipage}
+% \hspace{2.5cm}%
+%\RubikFaceUp{Y}{Y}{W}{W}{W}{W}{Y}{Y}{W}%
+%\RubikFaceDown{Y}{W}{W}{Y}{Y}{Y}{Y}{W}{W}%
+%\RubikFaceLeft{B}{G}{G}{B}{B}{B}{B}{G}{G}%
+%\RubikFaceRight{G}{B}{B}{G}{G}{G}{G}{B}{B}%
+%\RubikFaceFront{O}{O}{O}{R}{O}{R}{R}{O}{R}%
+%\RubikFaceBack{O}{R}{O}{O}{R}{O}{R}{R}{R}%
+% \ShowCube{3cm}{0.5}{%
+% \DrawRubikCubeLU
+% \draw[->,thick,color=blue] (4.5, 2.5) -- (3.5,2.5);
+% }
+%
+% \medskip
+%
+% {\noindent}The convenience of the \cmd{\ShowCube} command is illustrated below; the
+% \cmd{\ShowCube} command on the left is equivalent to the bunch of commands
+% on the right (see Section~\ref{sec:showcubecode} for the complete code).
+% $$
+% \left.
+% \begin{array}{l}
+% {\ }\\
+% {\ }\\
+% \verb!\ShowCube{3cm}{0.5}{...}!\\
+% {\ }\\
+% {\ }\\
+% \end{array}
+% \right\{
+% \begin{array}{l}
+% \verb!\begin{minipage}{3cm}%!\\
+% \verb!\centering%!\\
+% \verb!\begin{tikzpicture}[scale=0.5]!\\
+% ...\\
+% \verb!\end{tikzpicture}%!\\
+% \verb!\end{minipage}%!\\
+% \end{array}
+% $$
+%
+% \DescribeMacro{\ShowCubeF}
+% 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. For~example, unexpected spacing between two adjacent images,
+% or between an 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 white-space). Use the \cmd{\ShowCubeF} command for this.
+
+% For~example, the following use of the \cmd{\ShowCubeF} command reveals a significant
+% white-space problem:
+%
+% \medskip
+%{\noindent}%
+%\begin{minipage}{6.6cm}
+%\begin{verbatim}
+% \ShowCubeF{4cm}{0.3}{\DrawRubikCubeRU}
+%\end{verbatim}
+%\end{minipage}
+% \RubikCubeSolved
+% \ShowCubeF{4cm}{0.3}{\DrawRubikCubeRU}
+%
+% \medskip
+% {\noindent}In this example, 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 centres 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}.
+%
+%
+%
+% \section{Colour commands}
+% \label{sec: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.}
+% R~(red), O~(orange), Y~(yellow), G~(green), B~(blue), W~(white),
+% and X~(grey). Now according to the following webpage\,\footnote{We thank Peter Bartal
+% for bringing this webpage to our attention.}
%
% \medskip
% \noindent\texttt{http://The-Rubiks-Cube.deviantart.com/journal/Using-Official-Rubik}
-% \newline\texttt{-s-Cube-Colors-268760351}
+% \newline\texttt{-s-Cube-Colors-268760351} (Nov 2011)
%
% \medskip
% {\noindent}the official Rubik cube colours are defined as
% \begin{quote}
%\begin{verbatim}
-% .... colours which are red (PMS 200C*), green (PMS 347C*),
+% ... 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
@@ -512,10 +736,13 @@
%\end{verbatim}
% \end{quote}
% However, we have optimised these prescribed colours very slightly
-% for screen \& print use (for example, the yellow was made very
+% 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}):
+% the \rubikcube\ package are as follows:\,\footnote{Although the Pantone
+% colours cannot be converted to RGB, there is a subset of of Pantone colours
+% which can be be converted using CMYK
+% (see \texttt{https://en.wikipedia.org/wiki/Pantone})}.
+% (see Section~\ref{sec:codecolours}):
%
% \begin{quote}
%\begin{verbatim}
@@ -529,8 +756,8 @@
%\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
+% standard \LaTeX\ \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}
@@ -543,140 +770,495 @@
% \subsection{Colour state of the cube}
% \label{sec:colourstate}
%
+%
+% \DescribeMacro{\RubikFace..}
+% \DescribeMacro{\RubikSlice..}
+% \DescribeMacro{\RubikSide..}
+% \DescribeMacro{\RubikCubeSolved}
+% \DescribeMacro{\RubikCubeGrey}
+% \DescribeMacro{\RubikCubeGreyAll}
% 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}).
+% are allocated the colour-code X, which can be regarded as a zero-colour state.
+% Until a facelet is allocated one of the six Rubik colours (using a suitable command)
+% it will be rendered as grey by a Rubik \cmd{\Draw...} command, since these commands
+% simply implement the current colour state of the cube (e.g.,~\cmd{\DrawRubikCubeRU}).
%
% 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...},
+% \cmd{\RubikSlice...} and \cmd{\RubikSide...} commands (see Sections~\ref{sec:facecommands},
+% \ref{sec:slicecommands} and \ref{sec:rubikside}).
+% In addition. the command \cmd{\RubikCubeSolved}, allocates a prescribed colour state
+% for the whole `solved' cube, and is a very useful starting
+% point (configuration) for subsequent rotations.
+% The commands \cmd{\RubikCubeGrey} and \cmd{\RubikCubeGreyAll} allocate different colour
+% states for the whole cube, and are designed to be useful starting points when illustrating
+% aspects of how to solve the cube. These two commands accept both `grey' and `gray'
+% (to be consistent with TikZ).
+% Cubies retain their colour allocation even if the cubies are moved using
+% the \cmd{\RubikRotation} command (\textsc{rubikrotation} package), unless they are
+% overwritten by a subsequent colour allocation command.
+%
+% To visualise the current state of the cube one has to use a Rubik \cmd{\Draw...} command.
+% Although some \cmd{\Draw...} commands (e.g.,~\cmd{\DrawRubikLayerFace...}) allow
+% you to specify colours as arguments, \cmd{\Draw...} commands really only
+% `paint' colours onto cubie positions (on the page, so to speak).
+% \cmd{\Draw..} commands never influence the internal Rubik colour state.
+%
+% The current colour state / configuration of the Rubik cube can be saved and
+% written to a named file (using the \cmd{\SaveRubikState} command) in a form
+% which can then be easily \cmd{\input} and processed when required.
+
+%
+% \subsection{RubikFace commands}
+% \label{sec:facecommands}
+%
+% \DescribeMacro{\RubikFaceUp}
+% \DescribeMacro{\RubikFaceDown}
+% \DescribeMacro{\RubikFaceLeft}
+% \DescribeMacro{\RubikFaceRight}
+% \DescribeMacro{\RubikFaceFront}
+% \DescribeMacro{\RubikFaceBack}
+% These commands take nine colour arguments and allocate colours to the
+% individual cubies of a Rubik cube face.
+% The ordering is isomorphic to the sequence 1--9, i.e.,~numbering the small
+% squares 1-3~(top row, left to right), 4-6~(middle row, left to right),
+% 7-9~(bottom row, left to right), as follows:
+% \begin{quote}
+% \fbox{
+% \begin{minipage}{1.6cm}
+% \#1 \#2 \#3
+%
+% \#4 \#5 \#6
+%
+% \#7 \#8 \#9
+% \end{minipage}
+% }
+% \end{quote}
+% Conveniently, \LaTeX\ allows the colour arguments to be separated by spaces
+% (e.g.,~separated in groups of three), or even spread across several
+% lines (e.g.,~in a square block to resemble a 9-face). This is fortunate, as it
+% allows the command to be formulated in a visually intuitive way, as in the
+% following examples.
+%
+% \begin{quote}
+% \begin{minipage}{8cm}
+%\begin{verbatim}
+% \RubikFaceUp{G}{B}{G} {G}{W}{O} {G}{O}{G}
+%
+% \RubikFaceFront{O}{W}{R}
+% {W}{W}{W}
+% {G}{W}{G}
%
-% 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.
+%\end{verbatim}
+% \end{minipage}
+% \end{quote}
%
+% \DescribeMacro{\RubikFaceUpAll}
+% \DescribeMacro{\RubikFaceDownAll}
+% \DescribeMacro{\RubikFaceLeftAll}
+% \DescribeMacro{\RubikFaceRightAll}
+% \DescribeMacro{\RubikFaceFrontAll}
+% \DescribeMacro{\RubikFaceBackAll}
+% Each of the above commands has an associated
+% `\texttt{All}' version which allocates the same colour to all the cubies
+% on a 9-face (i.e.,~only a single colour argument is required).
%
-% \section{Rubik cube coordinates}
-% \label{sec:coordinates}
+% If you want a particular face to be all grey, then
+% use the colour-code~X; for~example, \cmd{\RubikFaceUpAll\{X\}}.
+% Failure to include a valid colour argument 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.
%
-% 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.
+% \bigskip
+%
+% \begin{minipage}{2.8cm}
+% \RubikFaceUpAll{X}
+% \RubikFaceRightAll{R}
+% \RubikFaceFront{W}{Y}{G}
+% {W}{Y}{G}
+% {W}{Y}{G}
+% \begin{tikzpicture}[scale=0.7]
+% \DrawRubikCubeRU
+% \end{tikzpicture}%
+% \end{minipage}
+% \hspace{5mm}
+% \begin{minipage}{0.6\textwidth}
+%\begin{verbatim}
+% \RubikFaceUpAll{X}
+% \RubikFaceRightAll{R}
+% \RubikFaceFront{W}{Y}{G}
+% {W}{Y}{G}
+% {W}{Y}{G}
+% \ShowCube{3cm}{0.7}{\DrawRubikCubeRU}
+% \end{verbatim}
+% \end{minipage}
+%
%
-% 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}).
+% \subsection{Solved Configuration}
+% \label{sec:solvedconfig}
%
-% \begin{figure}[hbt]
+% \DescribeMacro{\SolvedConfig}
+% This command allocates the six face colours according to the following ordered
+% XYZ$+-$ argument rule, namely X$+$, X$-$, Y$+$, Y$-$, Z$+$, Z$-$; i.e.,~the order
+% of the six colour arguments follows the face order
+% \textsc{right, left, up, down, front, back} (for notation see
+% Section~\ref{sec:xyzarguments} and Figure~\ref{fig:notation}).
+% {\newline}\textsc{usage}:\ \verb!\SolvedConfig{G}{B}{W}{Y}{O}{R}!
+% {\newline}Examples of its use are shown in the next section.
+%
+%
+% \subsection{RubikCubeSolved command}
+% \label{sec:rubikcubesolved}
+%
+% \DescribeMacro{\RubikCubeSolved}
+% \DescribeMacro{\RubikCubeSolvedWY}
+% The action of both of these commands is identical:
+% they both set all the face colours to the following standard `solved' cube
+% configuration, namely Up=white, Down=yellow, Right=green, Left=blue, Front=orange, Back=red,
+% by invoking the above \cmd{\SolvedConfig} command, as follows:
+%\begin{verbatim}
+%\newcommand{\RubikCubeSolved}{\SolvedConfig{G}{B}{W}{Y}{O}{R}}
+%\end{verbatim}
+% Note that this is in fact just a convenient short-hand for the following:
+%\begin{verbatim}
+%\newcommand{\RubikCubeSolved}{%
+% \RubikFaceRightAll{G}%
+% \RubikFaceLeftAll{B}%
+% \RubikFaceUpAll{W}%
+% \RubikFaceDownAll{Y}%
+% \RubikFaceFrontAll{O}%
+% \RubikFaceBackAll{R}%
+%}
+%\end{verbatim}
+% Note that for convenience, this configuration is also available using the command
+% \verb!\RubikCubeSolvedWY! (WY denoting White opposite Yellow).
+% This solved configuration is shown in the following
+% semi-flat (SF) image.
+%
+%
+% \bigskip
+%
+% \begin{minipage}{5cm}
% \centering
-% \ifpdf
-% \includegraphics[height=3cm]{Rubik-doc-figB.pdf}
-% \else
-% \includegraphics[height=3cm]{Rubik-doc-figB.eps}
-% \fi
+% \begin{tikzpicture}[scale=0.5]
+% \RubikCubeSolvedWY
+% \DrawRubikCubeSF
+% \end{tikzpicture}%
+% \end{minipage}
+% \begin{minipage}{0.5\textwidth}
+%\begin{verbatim}
+% \RubikCubeSolvedWY
+% \ShowCube{5cm}{0.5}{\DrawRubikCubeSF}
+%\end{verbatim}
+% \end{minipage}
%
-% \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}
+% \bigskip
%
+% Note that the width of the minipage used in \cmd{\ShowCube} command above
+% is set to 5cm. This value is derived from the fact
+% that the \textit{unscaled} width of the semi-flat image is 10cm (9 + 1 squares), and hence if
+% the TikZ scale factor is set to 0.5 then the minimum minipage width = $10 \times 0.5 = 5$cm
+% (see Section~\ref{sec:coordinates} for details).
%
%
-% \subsection[Size of cube minipage]{Size of cube \cmd{\minipage}}
-% \label{sec:sizeofminipage}
+% \textbf{Other orientations:} If other orientations of the solved cube are required,
+% this can be easily achieved using the \cmd{\RubikRotation} command
+% (from the \texttt{RubikRotation} package) to rotate the cube as required.
+% For~example, we could make a command to show the above solved cube upsidedown
+% and rotated slightly, as follows:
+%\begin{verbatim}
+%\newcommand{\CubeUpSideDown}{\RubikCubeSolved\RubikRotation{x2,y}}
+%\end{verbatim}
+% ---this uses the rotations \rrx, \rrx, to invert, and then \rry\ to turn
+% the cube 90~$\deg$:
%
-% 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}$.
+% \bigskip
+%
+% \begin{minipage}{2.6cm}
+% \centering
+% \begin{tikzpicture}[scale=0.5]
+% \DrawNCubeAll{3}{O}{Y}{G}
+% \end{tikzpicture}%
+% \end{minipage}
+% \hspace{5mm}
+% \begin{minipage}{0.6\textwidth}
+%\begin{verbatim}
+% \CubeUpSideDown
+% \ShowCube{2cm}{0.5}\DrawRubikCubeRU}
+%\end{verbatim}
+% \end{minipage}
+%
+% \bigskip
+%
+%% \DescribeMacro{\RubikCubeSolvedWB}
+% \textbf{Other configurations:} While the `solved' WY colour configuration
+% described above (White face opposite Yellow)
+% is that of the most commonly occurring Rubik cube, another `solved' colour configuration
+% which is also commercially available has the White opposite Blue configuration, which
+% is available using the command \verb!\RubikCubeSolvedWB!.
+% Its colour configuration is as follows:
+%
+%\begin{center}
+% \RubikCubeSolvedWB
+% \ShowCube{4cm}{0.4}{\DrawRubikCubeSF}%
+%\end{center}
+%
+% \bigskip
+%
+% Note that users can easily create their own alternative `solved'
+% face/colour versions.
+% For~example, the above mentioned white opposite
+% blue~(WB) solved configuration command \verb!\RubikCubeSolvedWB!
+% (white opposite blue, red opposite orange,
+% and green opposite yellow), was created using \verb!\SolvedConfig{R}{O}{W}{B}{G}{Y}!
+% (for the code see \ref{sec:codesolvedconfig}).
+%
+%
+% \subsection{RubikCubeGrey command}
+% \label{sec:rubikcubegrey}
+%
+% \DescribeMacro{\RubikCubeGrey}
+% \DescribeMacro{\RubikCubeGreyAll}
+% The command \cmd{\RubikCubeGrey} generates a 3x3x3 cube with no colours allocated
+% \textit{except} for the central cubie of each face, which takes the same colour
+% configuration as defined for the \cmd{\RubikCubeSolved} command.
+% The command \cmd{\RubikCubeGreyAll} generates a cube with \textit{all} the faces
+% completely grey.
+% Both these commands will accept either `grey' or `gray' (to be consistent with TikZ).
+%
+% These two commands, are designed to be useful starting points when wanting to
+% describe the movement of particular cubies. We can see the effect of
+% the \cmd{\RubikCubeGrey} command by viewing the cube in a semi-flat (SF) format,
+% as follows:
+%
+% \bigskip
+%
+% \RubikCubeGrey
+% \ShowCube{4.5cm}{0.45}{\DrawRubikCubeSF}
+% \hspace{3mm}
+% \begin{minipage}{0.6\textwidth}
+%\begin{verbatim}
+% \RubikCubeGrey
+% \ShowCube{4.5cm}{0.45}{\DrawRubikCubeSF}
+%\end{verbatim}
+% \end{minipage}
+%
+% \bigskip
+% Users can easily set their own alternative face/colour configuration either by `renewing'
+% the \cmd{\RubikCubeGrey} command along the lines shown above (the code is
+% in Section~\ref{sec:codegrey}), or simply creating a new `variant' command
+% altogether.
+%
+%
+%
+% \subsection{RubikSlice commands}
+% \label{sec:slicecommands}
+%
+% \DescribeMacro{\RubikSliceTopX}
+% \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, Middle, Bottom.
+% The six colour arguments associated with a given slice run in sequence
+% from left to right irrespective of the viewpoint, e.g.,~\#1 \#2 \#3 \#4 \#5 \#6.
%
-% 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.
+% 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) 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
+% and consequently each of the `slice' commands in this
+% 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
+% \RubikFaceDownAll{Y}
+% \RubikSliceTopL {G}{G}{G} {R}{R}{R}
+% \RubikSliceMiddleL {R}{R}{R} {B}{B}{B}
+% \RubikSliceBottomL {O}{O}{O} {G}{G}{G}
+% \begin{tikzpicture}[scale=0.7]
+% \DrawRubikCubeLD
+% \end{tikzpicture}%
+% \end{minipage}
+% \hspace{5mm}
+% \begin{minipage}{0.6\textwidth}
+%\begin{verbatim}
+% \RubikFaceDownAll{Y}
+% \RubikSliceTopL {G}{G}{G} {R}{R}{R}
+% \RubikSliceMiddleL {R}{R}{R} {B}{B}{B}
+% \RubikSliceBottomL {O}{O}{O} {G}{G}{G}
+% \ShowCube{3cm}{0.7}{\DrawRubikCubeLD}
+%\end{verbatim}
+% \end{minipage}
+%
+%
+%
+% \subsection{RubikSide commands}
+% \label{sec:rubikside}
+%
+% \DescribeMacro{\RubikSideLeft}
+% \DescribeMacro{\RubikSideRight}
+% \DescribeMacro{\RubikSideFront}
+% \DescribeMacro{\RubikSideBack}
+% These RubikSide commands allocate colours to the side facelets of
+% the UP~face, and each takes three ordered colour arguments, running from
+% top-left to top-right when looking directly at the side faces---see Section~\ref{sec:rubiksidecode}.
+% These facelets are the top three facelets of each side Front, Back, Left, Right.
+%
+% {\noindent}\textsc{usage}: \verb!\RubikSideBack{B}{G}{G}!
+%
+% \medskip
+%
+% \DescribeMacro{\RubikSideLeftAll}
+% \DescribeMacro{\RubikSideRightAll}
+% \DescribeMacro{\RubikSideFrontAll}
+% \DescribeMacro{\RubikSideBackAll}
+% These commands allocate the same colour to all three side cubies, and hence
+% take only a single colour argument.
+%
+% {\noindent}\textsc{usage}: \verb!\RubikSideBackAll{R}!
+%
+% \medskip
+%
+% The \cmd{\RubikSide..} and \cmd{\RubikFace..} commands are useful for setting up the colours
+% for just part of the cube. For~example, the following commands set-up the UP-face and sides,
+% and then draws the face and sidebars using \verb!\DrawFlatUpSide!.
+%
+% \bigskip
+%
+% \begin{minipage}{4cm}
+% \centering
+%\RubikFaceUp {R}{Y}{R}%
+% {Y}{Y}{Y}%
+% {G}{Y}{B}%
+%\RubikSideBack{B}{G}{G}%
+%\RubikSideFront{Y}{R}{Y}%
+%\RubikSideRight{O}{B}{Y}%
+%\RubikSideLeft{Y}{O}{O}%
+%\ShowCube{2cm}{0.5}{\DrawFlatUpSide}
+% \end{minipage}
+% \hspace{1cm}
+% \begin{minipage}{0.6\textwidth}
+%\begin{verbatim}
+%%set up the UP face
+%\RubikFaceUp {R}{Y}{R}%
+% {Y}{Y}{Y}%
+% {G}{Y}{B}%
+%\RubikSideBack{B}{G}{G}%
+%\RubikSideFront{Y}{R}{Y}%
+%\RubikSideRight{O}{B}{Y}%
+%\RubikSideLeft{Y}{O}{O}%
+%%draw the UP face and sides
+%\ShowCube{2cm}{0.5}{\DrawFlatUpSide}
+%\end{verbatim}
+% \end{minipage}
+%
+% \bigskip
+%
+% Note that we could instead have drawn the above image using \cmd{\DrawRubikLayer..}
+% commands. However, using the \cmd{\RubikSide..} and \cmd{\RubikFace..} commands
+% makes for a much more flexible and dynamic system, since the colours allocated using
+% these commands (provided they are external to an environment) will be global,
+% and hence will follow subsequent \cmd{\RubikRotation} commands.
+%
+%
+%
+% \pagebreak
%
%
% \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 (see References).
-%
-% 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 remove any ambiguity:
-% \rr{U},\rr{Lw}2,\rr{Usp},\rr{Da} \ \ (|\rr{U},\rr{Lw}2,\rr{Usp},\rr{Da}|).
+% The Rubik bundle implements not only the standard Rubik cube notation of the
+% World Cube Association (see WCA website), but also the main variant notations
+% used by the Rubik interest groups and websites.
+%
+% \begin{figure}[hbt]
+% \centering
+% \ifpdf
+% \includegraphics[height=5cm]{rubik-doc-figA.pdf}
+% \fi
+% \caption{\label{fig:notation}Face rotations}
+% \end{figure}
+%
+% To avoid confusion the Rubik bundle uses a trailing `p' (lower-case) in rotation-codes to denote
+% a `prime' (reversed direction); we also recommend that commas are used to separate
+% sequential Rubik rotations (moves).
+% While these are mainly to avoid ambiguity, they also greatly facilitate computer
+% searching and copy-and-pasting of rotation sequences.
+%
+% Unfortunately, obtaining a good balance between an intuitive notation for defining
+% rotations and the need for flexibility is difficult,
+% and consequently some notation is more intuitive than others. A good compromise
+% seems to be the World Cube Association's FADN structure; i.e.,~Face (L,R,U,D,F,B),
+% Action (m,w,s,a,c), Direction (p),
+% N (n); for example, codes like \texttt{R, R2, Rc, Rm, Rwp, Rwp2} etc.
+%
+%
+% The \rubikcube\ package includes commands for typesetting a wide range of
+% rotation-codes (e.g.,~\rr{R}, \rr{y}, \rr{Bw}) and
+% equivalent hieroglyphs (e.g.,~\rrh{R}, \rrh{y}, \rrh{Bw}), as well as commands
+% for typesetting 3x3x3 cubes and single cubies. All the rotation-codes and
+% hieroglyphs are typeset using one particular font \& size which we call the `rubikfont'
+% for convenience (see Section~\ref{sec:rubikfont} for details).
+% All of the rotation-codes described
+% here are recognised by the \textsc{rubikrotation} package
+% (see Section~\ref{sec:rubikrotation}).
+%
+% Note that there are some rotation codes which are not represented by arrow
+% hieroglyphs, since 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 rotation-code in a square; for~example, \rrhBw, \rrhFm.
%
-%
+%
+% \pagebreak
%
% \subsection{Overview}
% \label{sec:overview}
%
-% The \rubikcube\ notation comprises a range of
-% 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 rotation-code in a square; for example \rrhBw, \rrhSb.
+% We now describe the four commands used for typesetting the various rotation-codes.
%
% \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 command \cmd{\rrh\marg{rotation-code}}. Thus the command \cmd{\rrh\{R\}} generates
-% \rrh{R}\ which is the hieroglyph associated with \rr{R}.
+% The text version of a rotation-code is typeset using the rubik-rotation
+% command \cmd{\rr\marg{rotation-code}}, i.e.,~\rr{R}\ is typeset using the command \cmd{\rr\{R\}}.
+% The hieroglyph of a rotation is generated (in text) by \DescribeMacro{\rrh}
+% using instead the command \cmd{\rrh\marg{rotation-code}}. For~example, the command
+% \cmd{\rrh\{R\}} generates \rrh{R}\ which is the hieroglyph associated with
+% the rotation \rr{R}.
%
% \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\}},
+% \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 (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
+% For some hieroglyphs (e.g.,~\rrh{x}, \rrh{y}, \rrh{z}\ denoting 90~degree cube-axis rotations)
+% the only difference between the \cmd{\rrh\{\}} and \cmd{\Rubik\{\}} form 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
+% For~example, \cmd{\rrh\{yp\}} generates \rrh{yp}, while
% \cmd{\Rubik\{yp\}} generates \Rubik{yp}.
%
% \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
+% is generated using the command \cmd{\textRubik\marg{rotation-code}}.
+% For~example, \textRubik{R}\ is typeset using the command \cmd{\textRubik\{R\}}.
+% A list of all rotation-code commands and their associated hieroglyphs is given in
% Section~\ref{sec:listofcommands}.
%
-% \pagebreak
+%
%
% \subsection{Face rotations}
%
@@ -688,10 +1270,10 @@
% \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 (\rr{F}, \rr{B}, \rr{L}, \rr{R}, \rr{U}, \rr{D})
+% The upper-case 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, \rr{D}\ is generated by the `rubik rotation' command \cmd{\rr\{D\}}.
+% For~example, \rr{D}\ is generated by the `rubik rotation' command \cmd{\rr\{D\}}.
%
% \DescribeMacro{Up}
% \DescribeMacro{Dp}
@@ -701,57 +1283,69 @@
% \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\}}.
+% achieved by appending a lower-case `p' to the face rotation command. For~example, \rr{Rp}\
+% is generated by \cmd{\rr\{Rp\}}. More formally, \rr{Rp} is the `inverse' of \rr{R}.
%
-% \vspace{-0.2cm}
-% \begin{figure}[hbt]
-% \centering
-% \ifpdf
-% \includegraphics[height=5cm]{Rubik-doc-figA.pdf}
-% \fi
-% \caption{\label{fig:notation}}
-% \end{figure}
+% The superscript~$^2$, or sometimes just an ordinary~2, indicates that the rotation
+% 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;
+% \rr{R}\textbf{$^3$} is equivalent to \rr{Rp} etc.
%
%
-% \subsection{Slice rotations}
+% \subsection{Inner-slice rotations}
% \label{sec:slicerotations}
%
-% \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
+% The Rubik cube (3x3x3) has three orthogonal so-called
+% `inner' slices (middle layers, middle 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 \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.
-%
-% \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 \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 \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}
+% direction follows the rotation \rr{R}\ (i.e.,~its rotation is isomorphic to \rr{R}).
+% The inner-slice rotations form a group (the Slice group), originally
+% described by John Conway (Frey and Singmaster, 1982, p~105).
+%
+%
+% \subsubsection*{The `m' notation}
+% \label{sec:mnotation}
+%
+% \DescribeMacro{Um}
+% \DescribeMacro{Dm}
+% \DescribeMacro{Lm}
+% \DescribeMacro{Rm}
+% \DescribeMacro{Fm}
+% \DescribeMacro{Bm}
+% Here `m' stands for the `middle' slice, namely that parallel to the designated
+% \textsc{face}; its rotation mirrors that of the
+% \textsc{face}. The \texttt{m} must be in lower-case.
+% Each of these rotation-codes has a complementary `prime' version, formed
+% by appending a `p'; for~example, \rr{Rm} (\verb!\rr{Rm}!) is a middle layer rotation
+% \rrh{Rm} between the \textsc{right} and \textsc{left} faces, and is in the same
+% direction as \rr{R}. The code \rr{Rmp} (\verb!\rr{Rmp}!) refers to the same
+% middle slice, but rotated in the opposite direction \rrh{Rmp}.
+%
+% This notation, which was probably invented by Singmaster, was originally used on the
+% Cube Lovers usenet group (1981--1997). It is now much used on the
+% Jaap Puzzles website (see Scherphius J) ---see also Section~\ref{sec:codeJaap}.
+%
+%
+% \subsubsection*{The `M' notation}
+% \label{sec:Mnotation}
+%
+% \DescribeMacro{MU}
+% \DescribeMacro{MD}
+% \DescribeMacro{ML}
+% \DescribeMacro{MR}
+% \DescribeMacro{MF}
+% \DescribeMacro{MB}
+% This variant of the above `middle' slice notation (e.g.,~\texttt{MR} $\equiv$ \texttt{Rm})
+% is part of the `superset' notation of Randelshofer. As before, the rotation
+% direction follows that of the designated \textsc{face}.
+% Each has a complementary `prime' version
+% formed by appending a `p'. The \texttt{M} must be in upper-case.
+%
+%
+% \bigskip\bigskip
+%
+% \subsubsection*{The MES notation}
%
% \DescribeMacro{M}
% \DescribeMacro{E}
@@ -759,8 +1353,8 @@
% \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
+% An alternative but very confusing
+% inner-slice notation (e.g.,~\texttt{Ep} $\equiv$ \texttt{Um}) which is occasionally used is the
% so-called MES notation, as used in the Waterman algorithm
% (Treep and Waterman 1987).
% \begin{itemize}
@@ -771,16 +1365,28 @@
% \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, 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}.
+% Each of these also has an inverse (prime) version.
+%
+%
+% \subsubsection*{The `S' notation}
+%
+% \DescribeMacro{Su}
+% \DescribeMacro{Sd}
+% \DescribeMacro{Sl}
+% \DescribeMacro{Sr}
+% \DescribeMacro{Sf}
+% \DescribeMacro{Sb}
+% In this equally confusing inner-slice notation, `S' stands for `inner-slice';
+% the face letter must be in lower-case (e.g.,~\texttt{Sr} $\equiv$ \texttt{Rm}). For~example, the inner-slice
+% rotation between the \textsc{right} and \textsc{left} faces whose rotation
+% direction follows the rotation \rr{R}\ is denoted
+% as \rr{Sr}, which is typeset using the command \cmd{\rr\{Sr\}}.
+% Each has an inverse (prime) p-form.
%
-%
%
-% \subsubsection*{Singmaster slice notation}
+% \subsection{Outer-slice rotations}
+%
+% \subsubsection*{Slice notation}
%
% \DescribeMacro{Us}
% \DescribeMacro{Ds}
@@ -788,20 +1394,38 @@
% \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
-% Singmaster (Frey and Singmaster, 1982).
-% See the link to `notation' on the `Pretty patterns' page of the
-% Fridrich website.
+% This is a `paired' form of
+% notation (two rotations at once), which can be thought of as complementing the
+% inner-slice (middle layer) rotations.
+% Each of these `slice' commands denotes a rotation of two opposite faces
+% in the \textit{same} direction.
+% {\linebreak}For~example, \textRubik{Us}\ $\equiv$ \textRubik{U}\ + \textRubik{Dp};
+% i.e.,~both face-rotations are in the \textit{same} direction
+% as \rr{U}. Each of these rotation-codes has a complementary `anti-slice' version (see below).
%
-% Each of these commands denotes a rotation of two opposite faces
-% in the same direction. For example, \textRubik{Us}\ $\equiv$ \textRubik{U}\ + \textRubik{Dp},
-% which is typeset as:
-% \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}.
+% This notation was originally described by
+% Singmaster (Frey and Singmaster, 1982), and is much used
+% on the `Pretty patterns' page of the Fridrich website (this
+% page also has a useful link to `notation').
+%
+%
+% \bigskip
%
+% \DescribeMacro{SU}
+% \DescribeMacro{SD}
+% \DescribeMacro{SL}
+% \DescribeMacro{SR}
+% \DescribeMacro{SF}
+% \DescribeMacro{SB}
+% This variant of the above `slice' notation (e.g.,~\texttt{SU} $\equiv$ \texttt{Us})
+% is part of the `superset' notation of Randelshofer. As before, the rotation
+% direction follows that of the designated
+% \textsc{face}. Each has a complementary `prime' version formed by appending a `p'.
+%
+%
+% \bigskip\bigskip
+%
+
%
% \subsubsection*{Anti-slice notation}
%
@@ -813,11 +1437,9 @@
% \DescribeMacro{Ba}
% Each of these commands denotes a rotation of two opposite faces
% in \textit{opposite} directions.
-% For example, \textRubik{Ua}\ $\equiv$ \textRubik{U}\ + \textRubik{D},
-% which is typeset as:
-% \newline |\textRubik{Ua}\ $\equiv$ \textRubik{U}\ + \textRubik{D}|.
-% See the link to `notation' on the `Pretty patterns' page of the
-% Fridrich website.
+% For~example, \textRubik{Ua}\ $\equiv$ \textRubik{U}\ + \textRubik{D}.
+% This notation is much used on the `Pretty patterns' page of the
+% Fridrich website (see the note above re: `slice notation').
%
% \bigskip\bigskip
%
@@ -829,19 +1451,32 @@
% \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 \rr{Rw}.
-% Similarly, the prime $^\prime$ version \rr{Lwp}\ is generated by \cmd{\rr\{Lwp\}}.
+% The clockwise \textit{combined} rotation of an outer face AND its inner-slice
+% (officially known as a `double outer slice' rotation, or a `double block' move)
+% is denoted by appending a lower-case \textbf{\textsf{\footnotesize{w}}}
+% (denoting `wide') to a rotation-code (endorsed by the WCA).
+% For~example, a \textsc{right} double outer slice rotation \rrh{Rw} (\verb!\rrh{Rw}!)
+% is denoted as \rr{Rw} (\verb!\rr{Rw}!). The `prime' version is formed by
+% appending a `p' to the rotation-code. For~example, \rr{Rwp}\ is generated by \verb!\rr{Rwp}!.
%
-% The superscript~$^2$, or sometimes just an ordinary 2, indicates that the rotation
-% 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.
%
+% \bigskip
%
+% \subsubsection*{The `T' notation}
+% \label{sec:Tnotation}
%
+% \DescribeMacro{TU}
+% \DescribeMacro{TD}
+% \DescribeMacro{TL}
+% \DescribeMacro{TR}
+% \DescribeMacro{TF}
+% \DescribeMacro{TB}
+% This confusing variant of the above `w' notation (e.g.,~\texttt{TR} $\equiv$ \texttt{Rw}) is part of
+% the `superset' notation of Randelshofer. As before, the rotation direction
+% follows that of the designated \textsc{face}. Each has a complementary `prime' version
+% formed by appending a `p'.
+%
+% \bigskip\bigskip
%
% \subsection{Axis rotations}
%
@@ -854,17 +1489,17 @@
% 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 since \rr{x}, \rr{y}, \rr{z}\ rotations are always expressed in lowercase,
-% this practice is extended also to the commands.
+% Note that since \rr{x}, \rr{y}, \rr{z}\ rotations are always expressed in lower-case;
+% this practice is also extended to the commands.
%
-% An \rr{x}\textbf{2} rotation (two \rr{x}\ rotations one after
+% For example, 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, \rr{xp}\ (which is generated by appending a `p' to the end of
-% the command, i.e.,~\cmd{\rr\{xp\}}).
+% for~example, \rr{xp}\ (which is generated by appending a `p' to the
+% rotation-code, 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
@@ -886,7 +1521,7 @@
% \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
+% lower-case face letter to denote a 90~degree whole-cube rotation in the same
% directional sense as that of the standard face rotations.
%
% {\noindent}Thus
@@ -894,24 +1529,62 @@
% \rr{l}\ $\equiv$ \rr{xp}, \ \rr{r}\ $\equiv$ \rr{x}, \
% \rr{f}\ $\equiv$ \rr{z}, \ \rr{b}\ $\equiv$ \rr{zp},
%
-% {\noindent}For example, \rr{d}\ is generated by the command \cmd{\rr\{d\}}.
+% {\noindent}For~example, \rr{d}\ is generated by the command \cmd{\rr\{d\}}.
%
% {\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,
+% As with the \rrh{x}, \rrh{y}, \rrh{z}\ forms (described above) there are also
+% equivalent \cmd{\rrh\{\}} and \cmd{\Rubik\{\}} forms. For~example,
% \rrh{d}\ is generated by the command \cmd{\rrh\{d\}}.
%
%
+% \subsubsection*{The `c' notation}
+% \label{sec:cnotation}
+%
+% \DescribeMacro{Uc}
+% \DescribeMacro{Dc}
+% \DescribeMacro{Lc}
+% \DescribeMacro{Rc}
+% \DescribeMacro{Fc}
+% \DescribeMacro{Bc}
+% This slightly more intuitive notation (the `c' stands for `cube') also associates the rotation
+% direction with that of the designated \textsc{face} (e.g.,~\texttt{Rc} $\equiv$ \texttt{x}).
+% Each has a complementary `prime' version formed by appending a `p'.
+% For~example, \rr{Rc} (\verb!\rr{Rc}!) is equivalent to \rr{x};
+% \rr{Rcp} (\verb!\rr{Rcp}!) is equivalent to \rr{xp}.
+%
+% This notation, which was probably invented by Singmaster, was originally used on the
+% Cube Lovers usenet group (1981--1997). It is now much used on the
+% Jaap Puzzles website (see Scherphius J) ---see also Section~\ref{sec:codeJaap}.
+%
+% \bigskip\bigskip
+%
+% \subsubsection*{The `C' notation}
+% \label{sec:Cnotation}
+%
+% \DescribeMacro{CU}
+% \DescribeMacro{CD}
+% \DescribeMacro{CL}
+% \DescribeMacro{CR}
+% \DescribeMacro{CF}
+% \DescribeMacro{CB}
+% This variant of the whole cube rotation notation
+% (e.g.,~\texttt{CR} $\equiv$ \texttt{Rc} $\equiv$ \texttt{x})
+% is part of the `superset' notation of Randelshofer. As before, the rotation
+% direction follows that of the designated \textsc{face}. Each has a complementary
+% `prime' version formed by appending a `p'.
+%
+%
+% \bigskip% \bigskip
%
% \subsection{Examples}
% \label{sec:examples}
%
-% {\noindent}\rr{R}\ is generated by the `rubik rotation' command \cmd{\rr\{R\}}
+% {\noindent}\rr{R}\ is generated by the command \cmd{\rr\{R\}}
%
-% {\noindent}\rr{Fw}\ is generated by the `rubik rotation' command \cmd{\rr\{Fw\}}
+% {\noindent}\rr{Fw}\ is generated by the command \cmd{\rr\{Fw\}}
%
% {\noindent}\rr{L}$^2$ is generated by \cmd{\rr\{L\}}\verb!$^2$!
%
@@ -924,7 +1597,7 @@
% {\noindent}\rr{x}\ and \rrh{y}\ and \Rubik{zp}\ are generated by
% \cmd{\rr\{x\}} and \cmd{\rrh\{y\}} and \cmd{\Rubik\{zp\}}
%
-% {\noindent}\rr{f}\ and \rrh{b}\ are generated by \cmd{\rr\{f\}} and \cmd{\rrh\{b\}}
+% {\noindent}\rr{Fc}\ and \rrh{Bc}\ are generated by \cmd{\rr\{Fc\}} and \cmd{\rrh\{Bc\}}
%
% {\noindent}\rr{U}\rr{U}\rr{R}\rr{R}\ is generated by
% \cmd{\rr\{U\}}\cmd{\rr\{U\}}\cmd{\rr\{R\}}\cmd{\rr\{R\}}
@@ -941,7 +1614,7 @@
%
% \bigskip
%
-% {\noindent}Commas can be important in avoiding ambiguity; for example
+% {\noindent}Commas can be important in avoiding ambiguity; for~example,
%
% \bigskip
%
@@ -956,35 +1629,48 @@
% {\noindent}\rrh{F}\rrh{U}\rrh{y}\rrh{Rp}\rrh{Lwp} \ \ \ \
% \verb!\rrh{F}\rrh{U}\rrh{y}\rrh{Rp}\rrh{Lwp}!
%
+% \bigskip
+%
+% Note that if each rotation element uses the \textit{same} font or encoding, then
+% typesetting a rotation sequence can be achieved more easily using the
+% \verb!\ShowSequence! command (see Section~\ref{sec:showsequence}). For example, we can
+% typeset the last sequence much more conveniently, as follows:
+%
+% \medskip
+%
+% \verb!\ShowSequence{}{\rrh}{F,U,y,Rp,Lwp}! \ \ $\rightarrow$ \ \ \ShowSequence{}{\rrh}{F,U,y,Rp,Lwp}
%
%
-% \bigskip
%
% \subsection{Backwards compatibility}
% \label{sec:backwardscompat}
%
% 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
+% can still be written without the usual curly braces \verb!{}!.
+% For~example, the hieroglyph \rrhD\ (\cmd{\rrh\{D\}}) can also be generated using the command
% \cmd{\rrhD}.
%
% \bigskip
%
+% \pagebreak
+%
% \subsection{Listing of all rotation commands}
% \label{sec:listofcommands}
%
%
% 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 `Examples' section above. These have been ommitted here
+% as shown in the `Examples' section above. These have been omitted here
% owing to the difficulty of including this form easily in the following table.
%
-% Note also that some \cmd{\rrh\{\}} commands (eg~the \cmd{\rrh\{B\}} command)
+%
+% Note also that some \cmd{\rrh\{\}} commands (e.g.,~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,
% and hence can be somewhat ambiguous unless typeset with their associated
% lettercode.
%
+%
% \newcommand{\dnstrut}{\rule{0pt}{17pt}}
% \newcommand{\dns}{\hspace{2mm}}
% \newcommand{\dnsp}{\hspace{2mm}}
@@ -1016,6 +1702,18 @@
% \dnstrut\rr{Uap}\dns\cmd{\rr\{Uap\}}
% & \rrh{Uap}\dns\cmd{\rrh\{Uap\}}
% & \textRubik{Uap}\dns\cmd{\textRubik\{Uap\}} \nonumber\\
+% \dnstrut\rr{Um}\dns\cmd{\rr\{Um\}}
+% & \rrh{Um}\dns\cmd{\rrh\{Um\}}
+% & \textRubik{Um}\dns\cmd{\textRubik\{Um\}} \nonumber\\
+% \dnstrut\rr{Ump}\dns\cmd{\rr\{Ump\}}
+% & \rrh{Ump}\dns\cmd{\rrh\{Ump\}}
+% & \textRubik{Ump}\dns\cmd{\textRubik\{Ump\}} \nonumber\\
+% \dnstrut\rr{Uc}\dns\cmd{\rr\{Uc\}}
+% & \rrh{Uc}\dns\cmd{\rrh\{Uc\}}
+% & \Rubik{Uc}\dns\cmd{\Rubik\{Uc\}} \nonumber\\
+% \dnstrut\rr{Ucp}\dns\cmd{\rr\{Ucp\}}
+% & \rrh{Ucp}\dns\cmd{\rrh\{Ucp\}}
+% & \Rubik{Ucp}\dns\cmd{\Rubik\{Ucp\}} \nonumber\\
% \end{supertabular}
%
%
@@ -1044,6 +1742,18 @@
% \dnstrut\rr{Dap}\dns\cmd{\rr\{Dap\}}
% & \rrh{Dap}\dns\cmd{\rrh\{Dap\}}
% & \textRubik{Dap}\dns\cmd{\textRubik\{Dap\}} \nonumber\\
+% \dnstrut\rr{Dm}\dns\cmd{\rr\{Dm\}}
+% & \rrh{Dm}\dns\cmd{\rrh\{Dm\}}
+% & \textRubik{Dm}\dns\cmd{\textRubik\{Dm\}} \nonumber\\
+% \dnstrut\rr{Dmp}\dns\cmd{\rr\{Dmp\}}
+% & \rrh{Dmp}\dns\cmd{\rrh\{Dmp\}}
+% & \textRubik{Dmp}\dns\cmd{\textRubik\{Dmp\}} \nonumber\\
+% \dnstrut\rr{Dc}\dns\cmd{\rr\{Dc\}}
+% & \rrh{Dc}\dns\cmd{\rrh\{Dc\}}
+% & \Rubik{Dc}\dns\cmd{\Rubik\{Dc\}} \nonumber\\
+% \dnstrut\rr{Dcp}\dns\cmd{\rr\{Dcp\}}
+% & \rrh{Dcp}\dns\cmd{\rrh\{Dcp\}}
+% & \Rubik{Dcp}\dns\cmd{\Rubik\{Dcp\}} \nonumber\\
% \end{supertabular}
%
%
@@ -1072,9 +1782,20 @@
% \dnstrut\rr{Lap}\dns\cmd{\rr\{Lap\}}
% & \rrh{Lap}\dns\cmd{\rrh\{Lap\}}
% & \textRubik{Lap}\dns\cmd{\textRubik\{Lap\}} \nonumber\\
+% \dnstrut\rr{Lm}\dns\cmd{\rr\{Lm\}}
+% & \rrh{Lm}\dns\cmd{\rrh\{Lm\}}
+% & \textRubik{Lm}\dns\cmd{\textRubik\{Lm\}} \nonumber\\
+% \dnstrut\rr{Lmp}\dns\cmd{\rr\{Lmp\}}
+% & \rrh{Lmp}\dns\cmd{\rrh\{Lmp\}}
+% & \textRubik{Lmp}\dns\cmd{\textRubik\{Lmp\}} \nonumber\\
+% \dnstrut\rr{Lc}\dns\cmd{\rr\{Lc\}}
+% & \rrh{Lc}\dns\cmd{\rrh\{Lc\}}
+% & \Rubik{Lc}\dns\cmd{\Rubik\{Lc\}} \nonumber\\
+% \dnstrut\rr{Lcp}\dns\cmd{\rr\{Lcp\}}
+% & \rrh{Lcp}\dns\cmd{\rrh\{Lcp\}}
+% & \Rubik{Lcp}\dns\cmd{\Rubik\{Lcp\}} \nonumber\\
% \end{supertabular}
%
-%
% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
% \dnstrut\rr{R}\dns\cmd{\rr\{R\}}
% & \rrh{R}\dns\cmd{\rrh\{R\}}
@@ -1100,6 +1821,18 @@
% \dnstrut\rr{Rap}\dns\cmd{\rr\{Rap\}}
% & \rrh{Rap}\dns\cmd{\rrh\{Rap\}}
% & \textRubik{Rap}\dns\cmd{\textRubik\{Rap\}} \nonumber\\
+% \dnstrut\rr{Rm}\dns\cmd{\rr\{Rm\}}
+% & \rrh{Rm}\dns\cmd{\rrh\{Rm\}}
+% & \textRubik{Rm}\dns\cmd{\textRubik\{Rm\}} \nonumber\\
+% \dnstrut\rr{Rmp}\dns\cmd{\rr\{Rmp\}}
+% & \rrh{Rmp}\dns\cmd{\rrh\{Rmp\}}
+% & \textRubik{Rmp}\dns\cmd{\textRubik\{Rmp\}} \nonumber\\
+% \dnstrut\rr{Rc}\dns\cmd{\rr\{Rc\}}
+% & \rrh{Rc}\dns\cmd{\rrh\{Rc\}}
+% & \Rubik{Rc}\dns\cmd{\Rubik\{Rc\}} \nonumber\\
+% \dnstrut\rr{Rcp}\dns\cmd{\rr\{Rcp\}}
+% & \rrh{Rcp}\dns\cmd{\rrh\{Rcp\}}
+% & \Rubik{Rcp}\dns\cmd{\Rubik\{Rcp\}} \nonumber\\
% \end{supertabular}
%
%
@@ -1128,6 +1861,18 @@
% \dnstrut\rr{Fap}\dns\cmd{\rr\{Fap\}}
% & \rrh{Fap}\dns\cmd{\rrh\{Fap\}}
% & \textRubik{Fap}\dns\cmd{\textRubik\{Fap\}} \nonumber\\
+% \dnstrut\rr{Fm}\dns\cmd{\rr\{Fm\}}
+% & \rrh{Fm}\dns\cmd{\rrh\{Fm\}}
+% & \textRubik{Fm}\dns\cmd{\textRubik\{Fm\}} \nonumber\\
+% \dnstrut\rr{Fmp}\dns\cmd{\rr\{Fmp\}}
+% & \rrh{Fmp}\dns\cmd{\rrh\{Fmp\}}
+% & \textRubik{Fmp}\dns\cmd{\textRubik\{Fmp\}} \nonumber\\
+% \dnstrut\rr{Fc}\dns\cmd{\rr\{Fc\}}
+% & \rrh{Fc}\dns\cmd{\rrh\{Fc\}}
+% & \Rubik{Fc}\dns\cmd{\Rubik\{Fc\}} \nonumber\\
+% \dnstrut\rr{Fcp}\dns\cmd{\rr\{Fcp\}}
+% & \rrh{Fcp}\dns\cmd{\rrh\{Fcp\}}
+% & \Rubik{Fcp}\dns\cmd{\Rubik\{Fcp\}} \nonumber\\
% \end{supertabular}
%
%
@@ -1156,6 +1901,18 @@
% \dnstrut\rr{Bap}\dns\cmd{\rr\{Bap\}}
% & \rrh{Bap}\dns\cmd{\rrh\{Bap\}}
% & \textRubik{Bap}\dns\cmd{\textRubik\{Bap\}} \nonumber\\
+% \dnstrut\rr{Bm}\dns\cmd{\rr\{Bm\}}
+% & \rrh{Bm}\dns\cmd{\rrh\{Bm\}}
+% & \textRubik{Bm}\dns\cmd{\textRubik\{Bm\}} \nonumber\\
+% \dnstrut\rr{Bmp}\dns\cmd{\rr\{Bmp\}}
+% & \rrh{Bmp}\dns\cmd{\rrh\{Bmp\}}
+% & \textRubik{Bmp}\dns\cmd{\textRubik\{Bmp\}} \nonumber\\
+% \dnstrut\rr{Bc}\dns\cmd{\rr\{Bc\}}
+% & \rrh{Bc}\dns\cmd{\rrh\{Bc\}}
+% & \Rubik{Bc}\dns\cmd{\Rubik\{Bc\}} \nonumber\\
+% \dnstrut\rr{Bcp}\dns\cmd{\rr\{Bcp\}}
+% & \rrh{Bcp}\dns\cmd{\rrh\{Bcp\}}
+% & \Rubik{Bcp}\dns\cmd{\Rubik\{Bcp\}} \nonumber\\
% \end{supertabular}
%
%
@@ -1265,43 +2022,171 @@
% \end{supertabular}
%
%
-% \pagebreak
+% \subsubsection{Randelshofer notation}
+% \label{sec:listofRandelshofercommands}
%
-% \section{Other commands}
+% \newcommand{\dnRubik}[1]{%
+% \dnstrut\rr{#1}\dns\cmd{\rr\{#1\}}%
+% & \rrh{#1}\dns\cmd{\rrh\{#1\}}%
+% & \Rubik{#1}\dns\cmd{\Rubik\{#1\}} \nonumber\\%
+% }%
%
+% \newcommand{\dntextRubik}[1]{%
+% \dnstrut\rr{#1}\dns\cmd{\rr\{#1\}}%
+% & \rrh{#1}\dns\cmd{\rrh\{#1\}}%
+% & \textRubik{#1}\dns\cmd{\textRubik\{#1\}} \nonumber\\%
+% }%
%
-% \DescribeMacro{\rubikcube}
-% This command generates the logo \rubikcube.
%
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dnRubik{CR}
+% \dnRubik{CRp}
+% \dnRubik{CL}
+% \dnRubik{CLp}
+% \dnRubik{CU}
+% \dnRubik{CUp}
+% \dnRubik{CD}
+% \dnRubik{CDp}
+% \dnRubik{CF}
+% \dnRubik{CFp}
+% \dnRubik{CB}
+% \dnRubik{CBp}
+% \end{supertabular}
%
-% 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).
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dntextRubik{MR}
+% \dntextRubik{MRp}
+% \dntextRubik{ML}
+% \dntextRubik{MLp}
+% \dntextRubik{MU}
+% \dntextRubik{MUp}
+% \dntextRubik{MD}
+% \dntextRubik{MDp}
+% \dntextRubik{MF}
+% \dntextRubik{MFp}
+% \dntextRubik{MB}
+% \dntextRubik{MBp}
+% \end{supertabular}
%
-% 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.
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dntextRubik{SR}
+% \dntextRubik{SRp}
+% \dntextRubik{SL}
+% \dntextRubik{SLp}
+% \dntextRubik{SU}
+% \dntextRubik{SUp}
+% \dntextRubik{SD}
+% \dntextRubik{SDp}
+% \dntextRubik{SF}
+% \dntextRubik{SFp}
+% \dntextRubik{SB}
+% \dntextRubik{SBp}
+% \end{supertabular}
+%
+% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
+% \dntextRubik{TR}
+% \dntextRubik{TRp}
+% \dntextRubik{TL}
+% \dntextRubik{TLp}
+% \dntextRubik{TU}
+% \dntextRubik{TUp}
+% \dntextRubik{TD}
+% \dntextRubik{TDp}
+% \dntextRubik{TF}
+% \dntextRubik{TFp}
+% \dntextRubik{TB}
+% \dntextRubik{TBp}
+% \end{supertabular}
%
%
+% \subsection{The rubikfont}
+% \label{sec:rubikfont}
+%
+% For hieroglyph-related text we use the standard Computer Modern Sans (cmss)
+% bold extended (bx) 10pt font for upper-case letters, and the 8pt footnote size for lower-case
+% (see Section~\ref{sec:coderubikfont} for details). This font (rubikfont)
+% and the `prime' symbol (rubikprime) can be easily changed by `renewing' the three commands there.
+%
+% For example, to change to the somewhat `lighter' semi-bold extended (sbx) CM Sans (cmss) form
+% one can simply include the following in the preamble (the FNS suffix stands for `footnotesize'):
+%\begin{verbatim}
+% \makeatletter
+% \renewcommand{\@rubikfont}{\fontsize{10}{12pt}\usefont{T1}{cmss}{sbx}{n}}
+% \renewcommand{\@rubikfontFNS}{\fontsize{8}{12pt}\usefont{T1}{cmss}{sbx}{n}}
+% \makeatother
+%\end{verbatim}
+%
+%
+% \subsubsection*{The `rubikprime' symbol}
+% \label{sec:rubikprime}
+%
+% We currently use the apostrophe for the prime symbol (see Section~\ref{sec:coderubikfont}),
+% since the maths \cmd{\prime} seems to be a bit too faint (especially since we need to use
+% the `scriptstyle' size in this setting). However, users can
+% easily make the Rubik bundle use the maths prime instead, by loading the following
+% in the preamble.
+%\begin{verbatim}
+% \makeatletter
+% \renewcommand{\@rubikprime}{\raisebox{1.2pt}{\ensuremath{\scriptstyle{^\prime}}}}
+% \makeatother
+%\end{verbatim}
+%
+%
+%
+% \section{Draw commands}
+%
+% A \cmd{\Draw..} command typesets either a Rubik cube, cubie or a face
+% or layer using parameters set or defined via
+% previous parameter-allocation commands (e.g.,~face colours, dimensions etc).
+% Note that those \cmd{\Draw..} commands which do take colours as arguments do not
+% update the cube's internal `colour state', but simply `paint' these colours.
+%
+% It is important to distinguish between the \rubikcube\ package \cmd{\Draw..} commands
+% and TikZ \cmd{\draw..} commands. \cmd{\Draw..} commands are implemented by the
+% TikZ \cmd{\draw..} commands, and consequently \cmd{\Draw..} commands can only be
+% used \textit{inside} a TikZ picture environment---and hence they can also be used safely in
+% conjunction with the \cmd{\ShowCube} command, which itself uses a TikZ picture environment.
+% See also Section~\ref{sec:drawerrormessage} below..
+%
+%
+%
+% \subsection[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 an
+% ``Undefined control sequence'' error message, indicating
+% that it is trying to draw something using an undefined
+% TikZ \cmd{\draw} command\,\footnote{Note that the TikZ \cmd{\draw} command
+% uses a lower-case `d', while all \rubikcube\ commands start with an upper-case letter.}.
+%
+% This is because all Rubik \cmd{\Draw..} commands achieve their effects by
+% implementing a series of TikZ \cmd{\draw..} and other commands, all of which
+% need to be inside a \texttt{tikzpicture} environment.
+%
+% For~example, if the command \cmd{\DrawRubikCubeF} is used
+% without a surrounding TikZ picture environment,
+% then something similar to the following error message will be generated.
+%\begin{verbatim}
+%! Undefined control sequence.
+%\DrawFlatUp ... }{#1}\pgfmathsetmacro {\uy }{#2}\draw
+% [line join=round,...
+%l.56 \DrawRubikCubeF
+%\end{verbatim}
+%
%
-% \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{DrawRubikCube commands}
%
% \DescribeMacro{\DrawRubikCubeXY}
-% 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
+% \DescribeMacro{\DrawRubikCubeF}
+% \DescribeMacro{\DrawRubikCubeSF}
+% This command draws Rubik cubes in one of four oblique
+% orientations or configurations as denoted by the following terminal
+% XY viewing-direction codes: RU~(RightUp), RD~(RightDown), LU~(LeftUp),
+% LD~(LeftDown); two additional terminal codes are F~(Flat) and SF~(Semi-Flat).
+% For~example, the command
% \begin{quote}
% \cmd{\DrawRubikCubeRU}
% \end{quote}
@@ -1323,7 +2208,7 @@
% \DrawRubikCubeRU
% \end{tikzpicture}%
%\end{verbatim}
-% Note that these commands are equivalent to:
+% Note that the above commands are equivalent to:
%\begin{verbatim}
% \RubikCubeSolved
% \ShowCube{3cm}{0.7}{\DrawRubikCubeRU}
@@ -1347,42 +2232,32 @@
% 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
+% 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.
%
% \medskip
%
-% \begin{minipage}{1.35cm}
-% \begin{tikzpicture}[scale=1]
-% \DrawCubieRU{O}{Y}{G}
-% \end{tikzpicture}%
-% \end{minipage}
+% \ShowCube{1.33cm}{1}{\DrawCubieRU{O}{Y}{G}}
% \hspace{1cm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
-% \begin{tikzpicture}[scale=1]
-% \DrawCubieRU{O}{Y}{G}
-% \end{tikzpicture}%
+% \ShowCube{1.33cm}{1}{\DrawCubieRU{O}{Y}{G}}
%\end{verbatim}
% \end{minipage}
%
% \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}
-%
+% {\noindent}Since the front face is 1~unit wide and the 2D width of the side approx 1/3~unit,
+% and the scale-factor =~1, then the minipage width required for the cubie image
+% $=(1.33 \times 1) = 1.33$cm.
%
% \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}
@@ -1396,25 +2271,23 @@
% \cmd{\Cubiedy\{\}} \\
% \cmd{\Cubiedx\{\}}
% \end{quote}
-% as shown in the folowing example.
+% as shown in the following example.
%
% \bigskip
%
-% \begin{minipage}{1.7cm}
-% \begin{tikzpicture}[scale=1]
-% \Cubiedy{0.4}
-% \Cubiedx{0.8}
-% \DrawCubieRU{O}{Y}{G}
-% \end{tikzpicture}%
-% \end{minipage}
+% \ShowCube{1.7cm}{1}{%
+% \Cubiedy{0.4}%
+% \Cubiedx{0.8}%
+% \DrawCubieRU{O}{Y}{G}%
+% }
% \hspace{2cm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
-% \begin{tikzpicture}[scale=1]
+% \ShowCube{1.7cm}{1}{%
% \Cubiedy{0.4}
% \Cubiedx{0.8}
% \DrawCubieRU{O}{Y}{G}
-% \end{tikzpicture}%
+% }
%\end{verbatim}
% \end{minipage}
%
@@ -1449,288 +2322,267 @@
% \textCubieLD{O}{Y}{G} \ \ |\textCubieLD{O}{Y}{G}|
% \end{quote}
% Note that these \cmd{\textCubieXY} commands are not influenced by the
-% \cmd{\Cubiedy}, \cmd{\Cubiedx} commands as their size is preset for text use.
-%
-%
-% \subsubsection[Draw.. error message]{\cmd{\draw} error message}
-%
-% See also section~\ref{sec:drawerrormessage} regarding the error message associated with
-% using a \cmd{\Draw...} command \textit{outside} a TikZ picture environment.
-%
+% \cmd{\Cubiedy}, \cmd{\Cubiedx} commands as their size is pre-set for text use.
%
-% \subsection{Face commands}
-% \label{sec:facecommands}
-%
-% \DescribeMacro{\RubikFaceUp}
-% \DescribeMacro{\RubikFaceDown}
-% \DescribeMacro{\RubikFaceLeft}
-% \DescribeMacro{\RubikFaceRight}
-% \DescribeMacro{\RubikFaceFront}
-% \DescribeMacro{\RubikFaceBack}
-% These commands take nine colour arguments and allocate colours to the
-% individual cubies of a Rubik cube face.
-% The ordering is isomorphic to the sequence 1--9, i.e.,~numbering the small
-% squares 1-3~(top row, left to right), 4-6~(middle row, left to right),
-% 7-9~(bottom row, left to right), as follows:
-% \begin{quote}
-% \fbox{
-% \begin{minipage}{1.6cm}
-% \#1 \#2 \#3
%
-% \#4 \#5 \#6
-%
-% \#7 \#8 \#9
-% \end{minipage}
-% }
-% \end{quote}
-% Conveniently, \LaTeX\ allows the colour arguments to be separated by spaces
-% (e.g.,~separated in groups of three), or even spread across several
-% lines (e.g.,~in a square block to resemble a 9-face) in order to
-% make the command more visually intuitive, as in the following examples.
-% \begin{quote}
-%\begin{verbatim}
-% \RubikFaceUp{G}{B}{G} {G}{W}{O} {G}{O}{G}
-%
-% \RubikFaceFront{O}{W}{R}
-% {W}{W}{W}
-% {G}{W}{G}
%
-%\end{verbatim}
-% \end{quote}
-%
-% \DescribeMacro{\RubikFaceUpAll}
-% \DescribeMacro{\RubikFaceDownAll}
-% \DescribeMacro{\RubikFaceLeftAll}
-% \DescribeMacro{\RubikFaceRightAll}
-% \DescribeMacro{\RubikFaceFrontAll}
-% \DescribeMacro{\RubikFaceBackAll}
-% For convenience, each of these commands has an associated
-% `\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 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 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.
+% \subsection{Flat commands}
+% \label{sec:flatcommands}
%
-% \bigskip
-%
-% \begin{minipage}{2.8cm}
-% \RubikFaceUpAll{X}
-% \RubikFaceRightAll{R}
-% \RubikFaceFront{W}{Y}{G}
-% {W}{Y}{G}
-% {W}{Y}{G}
-% \begin{tikzpicture}[scale=0.7]
-% \DrawRubikCubeRU
-% \end{tikzpicture}%
-% \end{minipage}
-% \hspace{5mm}
-% \begin{minipage}{0.6\textwidth}
-%\begin{verbatim}
-% \RubikFaceUpAll{X}
-% \RubikFaceRightAll{R}
-% \RubikFaceFront{W}{Y}{G}
-% {W}{Y}{G}
-% {W}{Y}{G}
-% \ShowCube{3cm}{0.7}{\DrawRubikCubeRU}
-% \end{verbatim}
-% \end{minipage}
-%
+% \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 the current state 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.
%
-% \subsection{RubikCubeSolved command}
-% \label{sec:rubikcubesolved}
+% Note that the Y-argument set for the \cmd{\DrawFlatLeft}
+% and \cmd{\DrawFlatRight} commands is not currently actioned
+% (see Section~\ref{sec:drawflatxcommands}).
+% This is because both the \textsc{left} and \textsc{right} faces, as used by the
+% \cmd{\DrawRubikCubeSF} (Semi-Flat) command which incorporates the RU
+% view, require only Y=0. It is anticipated that 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 \textit{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.
+%
+% \textsc{usage}:\ 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:
%
-% \DescribeMacro{\RubikCubeSolved}
-% This command sets all the face colours to that of a standard `solved' cube
-% and is equivalent to the following set of face commands
+% \bigskip
+%
+% \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}
-% \RubikFaceUpAll{W}%
-% \RubikFaceDownAll{Y}%
-% \RubikFaceLeftAll{B}%
-% \RubikFaceRightAll{G}%
-% \RubikFaceFrontAll{O}%
-% \RubikFaceBackAll{R}%
+% \RubikCubeSolved
+% \ShowCube{3cm}{0.4}{%
+% \DrawRubikCubeRU
+% \DrawFlatBack{4}{1}
+% }
%\end{verbatim}
-% as shown in the following semi-flat image.
-%
-% \bigskip
+% \end{minipage}
+%
+% \bigskip
%
-% \begin{minipage}{5cm}
-% \centering
-% \begin{tikzpicture}[scale=0.5]
-% \RubikCubeSolved
-% \DrawRubikCubeFlat
-% \end{tikzpicture}%
-% \end{minipage}
-% \begin{minipage}{0.5\textwidth}
+% \DescribeMacro{\DrawRubikCubeF}
+% This command draws the completely flat (F) format of the cube, as shown in the following example.
+%
+% \bigskip
+%
+% \begin{minipage}{0.4\textwidth}
+% \centering
+% \begin{tikzpicture}[scale=0.4]
+% \RubikCubeSolved
+% \DrawRubikCubeF
+% \node (U) at (1.5, 4.5) [black]{\small\textsf{U}};
+% \node (D) at (1.5, -1.5) [black]{\small\textsf{D}};
+% \node (L) at (-1.5, 1.5) [black]{\small\textsf{L}};
+% \node (R) at (4.5, 1.5) [black]{\small\textsf{R}};
+% \node (F) at (1.5, 1.5) [black]{\small\textsf{F}};
+% \node (B) at (7.5, 1.5) [black]{\small\textsf{B}};
+% \end{tikzpicture}%
+% \end{minipage}
+% \begin{minipage}{5cm}
%\begin{verbatim}
% \RubikCubeSolved
-% \showcube{5cm}{0.5}{\DrawRubikCubeFlat}
+% \ShowCube{5cm}{0.4}{\DrawRubikCubeF}
%\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):
+% \end{minipage}
+%
+% \bigskip
+%
+% The addition of text (numbers or letters) in the faces is
+% straightforward---the origin of the 1-unit grid is located at the
+% bottom left corner of the \textsc{front} face (orange here).
+% The letters were placed using the following TikZ code inside the
+% TikZ picture environment.
+%
%\begin{verbatim}
-%\newcommand{\CubeUpSideDown}{\RubikCubeSolved\RubikRotation{x2,y}}
+% \RubikCubeSolved
+% \ShowCube{5cm}{0.4}{%
+% \DrawRubikCubeF
+% \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}
-% This command would then generate the following:
-%
-% \bigskip
+%
+% \DescribeMacro{\DrawRubikCubeSF}
+% {\noindent}A useful `semi-flat' (SF) alternative format, which uses
+% the standard RU view of the cube and appends the three hidden
+% sides (cf.,~Rokicki \textit{et~al.}, 2013), is generated by the
+% command \cmd{\DrawRubikCubeSF} as follows.
+%
+% \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{minipage}{5cm}
+% \begin{tikzpicture}[scale=0.5]
+% \RubikCubeSolved
+% \DrawRubikCubeSF
+% \node (B) at (5.5, 2.5) [white]{\small\textsf{B}};
+% \end{tikzpicture}%
+% \end{minipage}
+% \begin{minipage}{5cm}
%\begin{verbatim}
-% \CubeUpSideDown
-% \ShowCube{2.4cm}{0.6}\DrawRubikCubeRU}
+% \RubikCubeSolved
+% \ShowCube{5cm}{0.5}{%
+% \DrawRubikCubeSF
+% \node (B) at (5.5, 2.5)
+% [white]{\small\textsf{B}};
+% }
%\end{verbatim}
-% \end{minipage}
-%
+% \end{minipage}
+%
% \bigskip
%
-% Users can easily set their own alternative `solved' face/colour configuration by `renewing'
-% 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{..}%
-% \RubikFaceDownAll{..}%
-% \RubikFaceLeftAll{..}%
-% \RubikFaceRightAll{..}%
-% \RubikFaceFrontAll{..}%
-% \RubikFaceBackAll{..}%
-% }
-%\end{verbatim}
-%
-%
-%
-% \subsection{RubikCubeGrey command}
-% \label{sec:rubikcubegrey}
+% Note that even in this configuration it is straight-forward to
+% write text on the graphic, since the 2D 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 coordinate-grid is at the bottom left
+% corner of the \textsc{front} face (the orange face here), the coordinates
+% of the centre of the red \textsc{back} face are easily determined to be (5.5, 2.5).
+%
%
-% \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:
+% \subsection{Face commands}
+% \label{sec:facecommands}
+%
+%
+% \DescribeMacro{\DrawFaceUp}
+% \DescribeMacro{\DrawFaceDown}
+% \DescribeMacro{\DrawFaceLeft}
+% \DescribeMacro{\DrawFaceRight}
+% \DescribeMacro{\DrawFaceFront}
+% \DescribeMacro{\DrawFaceBack}
+% \DescribeMacro{\DrawFaceUpSide}
+% \DescribeMacro{\DrawFaceDownSide}
+% \DescribeMacro{\DrawFaceLeftSide}
+% \DescribeMacro{\DrawFaceRightSide}
+% \DescribeMacro{\DrawFaceFrontSide}
+% \DescribeMacro{\DrawFaceBackSide}
+% These commands draw the current state of a specified face
+% (e.g.,~\cmd{\DrawFaceUp}), or the face and all the associated side-bars
+% (e.g.,~\cmd{\DrawFaceUpSide}).
+% \textsc{Note}: these commands do \textsc{not} take any
+% arguments---for code see Section~\ref{sec:drawfacecode}.
%
-% \bigskip
+% 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.
%
-% \RubikCubeGrey
-% \ShowCube{3cm}{0.5}{\DrawRubikCubeRU}
-% \hspace{5mm}
-% \begin{minipage}{0.6\textwidth}
+% \bigskip
+%
+% \begin{minipage}{0.4\textwidth}
+% \centering
+% \RubikCubeSolved
+% \begin{tikzpicture}[scale=0.4]
+% \DrawFaceUpSide
+% \end{tikzpicture}%
+% \end{minipage}
+% \begin{minipage}{5cm}
%\begin{verbatim}
-% \RubikCubeGrey
-% \ShowCube{3cm}{0.5}{\DrawRubikCubeRU}
+% \RubikCubeSolved
+% \ShowCube{1.6cm}{0.4}{%
+% \DrawFaceUpSide
+% }
%\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}).
+% \end{minipage}
%
+% \vspace{1cm}
%
%
-% \subsection{Slice commands}
-% \label{sec:slicecommands}
-%
-% \DescribeMacro{\RubikSliceTopX}
-% \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, Middle, Bottom.
-% The six colour arguments associated with a given slice run in sequence
-% 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) specified in the command name.
+% \subsection[NCube]{NCube (NxNxN)}
+% \label{sec:NCube}
+%
+% \DescribeMacro{\DrawNCubeAll}
+% An `NCube' is a solved NxNxN cube drawn from the RU direction;
+% (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\}}.
+% \end{quote}
+% This command takes four ordered parameters (N, X, Y, Z)---the number
+% (integer; $N>0$) of cubies along an edge, followed by three face
+% colours in XYZ order.
+% Since the viewpoint is only from the RU direction, the three colour
+% parameters are: X(Right), Y(Up), Z(Front).
+%
+% \bigskip
+%
+% \begin{minipage}{0.3\textwidth}
+% \begin{tikzpicture}[scale=0.5]
+% \DrawNCubeAll{5}{O}{Y}{G}
+% \end{tikzpicture}%
+% \end{minipage}
+% \begin{minipage}{0.5\textwidth}
+%\begin{verbatim}
+% \ShowCube{3.5cm}{0.5}{\DrawNCubeAll{5}{O}{Y}{G}}
+%\end{verbatim}
+% \end{minipage}
%
-% The format of the `slice' command is shown in the following example.
-% The Rubik cube is shown from the LeftDown (LD) view
-% and consequently each of the `slice' commands in this
-% particular example ends in L, consistent with
-% the final \cmd{\DrawRubikCubeLD} command.
%
-% Note that the two legacy `Equator' versions (now replaced by `Middle')
-% are retained to allow backward compatibility.
%
-% \bigskip
%
-% \begin{minipage}{2.8cm}
-% \centering
-% \RubikFaceDownAll{Y}
-% \RubikSliceTopL {G}{G}{G} {R}{R}{R}
-% \RubikSliceMiddleL {R}{R}{R} {B}{B}{B}
-% \RubikSliceBottomL {O}{O}{O} {G}{G}{G}
-% \begin{tikzpicture}[scale=0.7]
-% \DrawRubikCubeLD
-% \end{tikzpicture}%
-% \end{minipage}
-% \hspace{5mm}
-% \begin{minipage}{0.6\textwidth}
-%\begin{verbatim}
-% \RubikFaceDownAll{Y}
-% \RubikSliceTopL {G}{G}{G} {R}{R}{R}
-% \RubikSliceMiddleL {R}{R}{R} {B}{B}{B}
-% \RubikSliceBottomL {O}{O}{O} {G}{G}{G}
-% \ShowCube{3cm}{0.7}{\DrawRubikCubeLD}
-%\end{verbatim}
-% \end{minipage}
%
+% \subsection{LayerFace}
+% \label{sec:layerface}
%
-% \subsection{LayerFace \& LayerSide commands}
-% \label{sec:layerface}
+% While a cube has faces and layers, a layer has a face (the face you are looking
+% at or drawing) and four sides (consisting of the nine side facelets of the
+% associated cubies).
+% The two `Layer' commands described here are intended for drawing final layer
+% configurations from `scratch' without any prior configuration information.
%
-% 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})
+% Typically, we might wish to show the yellow face in
+% the \textsc{up} position, with or without the associated side faces of the
+% cubies of this layer.
+% Of course, if we already know the rotation history from some initial configuration,
+% it would be much simpler just to invoke the \cmd{\RubikRotation} command and then use the
+% \cmd{\DrawFlatUpSide} command (see 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.
-% The command takes nine ordered colour arguments.
-% Their use is illustrated in the following example, which shows a yellow cross configuration.
+% \DescribeMacro{\DrawRubikLayerFaceAll}
+% These two LayerFace commands draw a simple 3x3 face and allocate colours
+% to the 9~facelets.
+% The \cmd{\DrawRubikLayerFace} command takes nine ordered colour arguments.
+% The command is illustrated in the following example, which shows a yellow cross configuration.
%
% \bigskip
%
-% \begin{minipage}{2.5cm}
-% \centering
-% \begin{tikzpicture}[scale=0.7]
-% \DrawRubikLayerFace{X}{Y}{X}
-% {Y}{Y}{Y}
-% {X}{Y}{X}
-% \end{tikzpicture}%
-% \end{minipage}
+% \ShowCube{2.1cm}{0.7}{%
+% \DrawRubikLayerFace{X}{Y}{X}
+% {Y}{Y}{Y}
+% {X}{Y}{X}
+% }%
% \hspace{1cm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
@@ -1738,35 +2590,34 @@
% \DrawRubikLayerFace{X}{Y}{X}
% {Y}{Y}{Y}
% {X}{Y}{X}
-% }
+% }
%\end{verbatim}
% \end{minipage}
%
-% \medskip
-%
-% \subsubsection[Draw.. error message]{\cmd{\draw} error message}
+% \bigskip
%
-% See also section~\ref{sec:drawerrormessage} regarding the error message associated with
-% using a \cmd{\Draw...} command \textit{outside} a TikZ picture environment.
+% {\noindent}The \cmd{\DrawRubikLayerFaceAll} command takes a single colour argument, and paints
+% the whole face the same colour.
%
% \medskip
%
-% \subsubsection{LayerSide}
-% \label{sec:layerside}
+% \subsection{LayerSide (sidebars)}
+% \label{sec:layerside} \label{sec:sidebars}
%
% \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
+% the layer as small rectangular sidebars.
+% The LayerSide command adopts a three-letter XYp \textbf{position} notation
% where the XY pair define the location (X:[Left \verb!|! Middle \verb!|! Right];
-% Y:[Top \verb!|! Middle \verb!|! Bottom]) of a particular cubie in the layer face.
+% Y:[Top \verb!|! Middle \verb!|! Bottom]) of a particular cubie in the layer face,
+% as depicted in Figure~\ref{fig:facenotation}.
%
% \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 rotation-codes }
% \end{figure}
@@ -1782,7 +2633,7 @@
% Various different LayerSide commands are available: those for
% drawing a single colour side bar, and others for facilitating
% drawing all 12 side bars.
-% For example, \textit{either} of the following commands
+% For~example, \textit{either} of the following commands
%
% \begin{quote}
%\begin{verbatim}
@@ -1805,9 +2656,9 @@
%\end{verbatim}
% \end{quote}
% where the T and B forms require the colour parameters to be in left-right
-% horizontal order (eg, left, middle, right),
+% horizontal order (e.g.,~left, middle, right),
% while the L and R forms require the colour parameters to be in top-down
-% vertical order (eg, top, middle, bottom).
+% vertical order (e.g.,~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}
@@ -1864,11 +2715,9 @@
% \DrawRubikLayerSideR{O}{B}{R}
% \DrawRubikLayerSideB{R}{G}{O}
%
-% \node (LT) at (0.5, 2.5)
-% [red]{\small\textsf{LT}};
-% \node (LM) at (0.5, 1.5)
-% [red]{\small\textsf{LM}};
-% }
+% \node (LT) at (0.5, 2.5) [red]{\small\textsf{LT}};
+% \node (LM) at (0.5, 1.5) [red]{\small\textsf{LM}};
+% }
%\end{verbatim}
% \end{minipage}
%
@@ -1903,21 +2752,19 @@
% {R} {O}
% {Y} {O}
% \DrawRubikLayerSideB {O}{G}{G}
-% }
+% }
%\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
+% \DescribeMacro{\DrawFaceUpSide}
+% \textsc{important note}: If the colour configuration of the layer shown above
+% 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.
+% drawn much more simply using just the single \cmd{\DrawFaceUpSide} command,
+% as described in Section~\ref{sec:facecommands}.
%
% \bigskip
%
@@ -1930,14 +2777,15 @@
% These sidebar values (decimal values $\geq 0$; no units) can be
% changed from their default values using the three commands.
% \begin{quote}
-% \cmd{\RubikSideBarWidth\{\}}\\
-% \cmd{\RubikSideBarLength\{\}}\\
-% \cmd{\RubikSideBarSep\{\}}
+% \cmd{\RubikSideBarWidth\{\}}\hspace{35.751pt}(default = 0.3)\\
+% \cmd{\RubikSideBarLength\{\}}\hspace{30pt}(default = 1.0)\\
+% \cmd{\RubikSideBarSep\{\}}\hspace{46.251pt}(default = 0.3)
% \end{quote}
% Values set in the document preamble will apply globally, while values
% set within a TikZ picture environment will apply only locally to that
% particular environment, as shown in the following example where we have
-% set both the sidebar width and length to 0.7.
+% set both the sidebar width and length to 0.7 in position MTy using the command
+% \verb!\DrawRubikLayerSideMTy{G}! (for the MTy code see Figure~\ref{fig:facenotation}).
%
% \bigskip
%
@@ -1965,7 +2813,7 @@
% \RubikSideBarWidth{0.7}
% \RubikSideBarLength{0.7}
% \DrawRubikLayerSideMTy{G}
-% }
+% }
%\end{verbatim}
% \end{minipage}
%
@@ -1979,12 +2827,11 @@
% Since the \textsc{front} face drawn using the \cmd{\DrawRubikCube} command is
% identical with that drawn using the \cmd{\DrawLayerFace} command it
% follows that LayerSide commands can also be used in conjunction with
-% the \textsc{front} face drawn using \cmd{\DrawRubikCube} command, as
-% shown in the following example. 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.
+% the \textsc{front} face drawn using \cmd{\DrawRubikCube} command. This
+% shown in the following example, where 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 the minipage width of
+% 3.5cm ($=5 \times 0.7$).
%
% \bigskip
%
@@ -2025,233 +2872,219 @@
% \DrawRubikCubeRU
% \DrawRubikLayerSideL{G}{B}{R}
% \DrawRubikLayerSideB{R}{G}{O}
-% }
+% }
%\end{verbatim}
% \end{minipage}
%
% \bigskip
%
-% {\noindent}Note that since using a left or a right \cmd{\DrawRubikLayerSide}
-% command in conjunction with a \cmd{\DrawRubikCube} command will necessarily
-% increase the width of the image, one may also have to adjust the width of
-% the associated minipage.
-%
-% \pagebreak
+% Since using left and/or right sidebars (e.g.,~\cmd{\DrawRubikLayerSide})
+% in conjunction with a \cmd{\DrawRubikCube} command, will increase
+% the width of the image, one may also have to adjust the width of
+% the associated minipage. Note that the width of a 2D oblique view of the cube
+% is 4~units (= width of 4~cubies). With the default sidebar width and sep settings
+% (see above) one sidebar increases the 2D cube image width by 0.6\,units (= 0.3 + 0.3).
+% Sidebars on both sides increase the width by 1.2\,units. Note also that setting
+% both the sidebar width and separation to 0.25\,units has the convenience that
+% the 2D width of a cube face $+$ left and right sidebars (e.g.,~using \cmd{\DrawFaceUpSide})
+% is then exactly 5\,units.
+%
+%
+%
+%
+% \section[ShowSequence command]{\cmd{\ShowSequence} command}
+% \label{sec:showsequence}
+%
+% \DescribeMacro{\ShowSequence}
+% \DescribeMacro{\ShowSequenceF}
+% \DescribeMacro{\ShowSequencef}
+% The \cmd{\ShowSequence}\marg{separator}\marg{font-code}\marg{sequence} command
+% typesets a comma-separated sequence of rotation
+% codes---for code see Section~\ref{sec:codeshowsequence}.
+% Appending an `F' to the command-name (\cmd{\ShowSequenceF}) results in an fbox about
+% the whole output (cf.~the \cmd{\ShowCubeF} command).
+% Appending an `f' to the command-name (\cmd{\ShowSequencef}) results in an fbox about
+% each element in the output (these two forms can be helpful when checking white space).
+%
+% The \cmd{\ShowSequence} command takes three mandatory arguments:
+% the first is the separator (\verb!#1!),
+% the second is the font or style code (\verb!#2!),
+% and third is a comma-separated sequence of Rubik rotation codes (|#3|).
+%
+% The separator (e.g.,~comma) used for typesetting the sequence can be specified
+% (or just omitted---i.e.,~an empty bracket);
+% the sequence can be either a named sequence (i.e.,~encoded as a macro) or just a
+% comma separated sequence of rotation codes.
%
-% \subsection{Flat commands}
-% \label{sec:flatcommands}
+% \noindent\textsc{usage}:
+% The following command displays the rotation sequence F, R, U, Rp, Up, using
+% the \verb!\rr! encoding and comma \& space separated.
%
-% \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.
+% \medskip
%
-% 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.
+% \verb!\ShowSequence{,\ }{\rr}{F,R,U,Rp,Up}! \ \ $\rightarrow$ \ \ \ShowSequence{,\ }{\rr}{F,R,U,Rp,Up}
%
-% 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:
+% \medskip
%
-% \bigskip
-%
-% \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
+% Remember that if you want a very long sequence to break automatically
+% at the line-ends, then you need to include at least one space between
+% the sequence elements, either with or without a comma; for this the
+% separator argument needs to include a space, i.e.,~something like
+% \verb!{,\ }! or \verb!{\ }! or just \verb!{ }! perhaps.
%
%
-% \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.
+% For~example, the following commands typeset the comma-separated
+% rotation sequence U,D,Lp,R using different separators and fonts.
+% For convenience, we start by encoding the sequence as the macro \verb!\myseq!.
%
%
-% \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
+% \newcommand{\myseq}{U,D,Lp,R}
%
-% \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}};
-% \node (L) at (-1.5, 1.5) [black]{\small\textsf{L}};
-% \node (R) at (4.5, 1.5) [black]{\small\textsf{R}};
-% \node (F) at (1.5, 1.5) [black]{\small\textsf{F}};
-% \node (B) at (7.5, 1.5) [black]{\small\textsf{B}};
-% \end{tikzpicture}%
-% \noindent\strut\hspace{5mm}\texttt{$\backslash$DrawRubikFlat}
-% \end{minipage}
-% \begin{minipage}{5cm}
-%\begin{verbatim}
-% \RubikCubeSolved
-% \ShowCube{5cm}{0.4}{\DrawRubikFlat}
-%\end{verbatim}
-% \end{minipage}
-%
-% \bigskip
-%
-% The addition of text (numbers or letters) in the faces is
-% straightforward---the origin of the 1-unit grid is located at the
-% bottom left corner of the front face (orange here).
-% The letters were placed using the following TikZ code inside the
-% TikZ picture environment.
-%
-%\begin{verbatim}
-% \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}
-%
-% \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
+% \medskip\noindent\verb!\newcommand{\myseq}{U,D,Lp,R}!
%
-% \begin{minipage}{5cm}
-% \begin{tikzpicture}[scale=0.5]
-% \RubikCubeSolved
-% \DrawRubikCubeFlat
-% \node (B) at (5.5, 2.5) [white]{\small\textsf{B}};
-% \end{tikzpicture}%
-% \end{minipage}
-% \begin{minipage}{5cm}
-%\begin{verbatim}
-% \RubikCubeSolved
-% \ShowCube{5cm}{0.5}{%
-% \DrawRubikCubeFlat
-% \node (B) at (5.5, 2.5)
-% [white]{\small\textsf{B}};
-% }
-%\end{verbatim}
-% \end{minipage}
-%
-% \bigskip
+% \medskip\noindent\verb!\ShowSequence{,}{\texttt}{\myseq}! \ $\longrightarrow$ \ \ShowSequence{,}{\texttt}{\myseq}
%
-% 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}
+% \medskip\noindent\verb!\ShowSequence{,}{\rr}{\myseq}! \ $\longrightarrow$ \ \rr{U},\rr{D},\rr{Lp},\rr{R}
+%
+% \medskip\noindent\verb!\ShowSequence{}{\rrh}{\myseq}! \ $\longrightarrow$ \ \rrh{U}\rrh{D}\rrh{Lp}\rrh{R}
+%
+% \medskip\noindent\verb!\ShowSequence{\ }{\rrh}{\myseq}! \ $\longrightarrow$ \ \rrh{U}\ \rrh{D}\ \rrh{Lp}\ \rrh{R}
%
-% \DescribeMacro{\DrawNCubeAll}
-% An `NCube' is a solved NxNxN cube drawn from the RU direction;
-% (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\}}.
-% \end{quote}
-% This command takes four ordered parameters (N, X, Y, Z)---the number
-% (integer; $N>0$) of cubies along an edge, followed by three face
-% colours in XYZ order.
-% Since the viewpoint is only from the RU direction, the three colour
-% parameters are: X(Right), Y(Up), Z(Front).
-%
-% \bigskip
-%
-% \begin{minipage}{0.3\textwidth}
-% \begin{tikzpicture}[scale=0.5]
-% \DrawNCubeAll{5}{O}{Y}{G}
-% \end{tikzpicture}%
-% \end{minipage}
-% \begin{minipage}{0.5\textwidth}
+% \medskip\noindent\verb!\ShowSequence{,\ }{\textRubik}{\myseq}! \ $\longrightarrow$ \ \textRubik{U},\ \textRubik{D},\
+% \textRubik{Lp},\ \textRubik{R}
+%
+%
+% \subsection*{Trailing digits}
+%
+% Note that the fonts denoted by \verb!\rr!, \verb!\rrh!, \verb!\Rubik!
+% and \verb!\textRubik! will fail for rotation codes which
+% have a trailing digit, e.g.,~R2, Dp3 (so-called `short' codes), since the
+% \verb!\ShowSequence! macro currently only reads the whole string between pairs of
+% commas (i.e.,~it does not interpret each string). However, the typewriter font \verb!\texttt!
+% does work correctly in this case, as you would expect.
+%
+% An effective `work-around' for this limitation is provided by the \verb!\RubikRotation{}!
+% command\,\footnote{Using the \texttt{--shell-escape} command-line option
+% with the \LaTeX\ engine---see Section~\ref{sec:rubikrotation}.}
+% (part of the \textsc{rubikrotation} package), since this returns (via the Perl program
+% \texttt{rubikrotation.pl}) an extended (`long') form of a given sequence in which
+% any `short' rotation codes are converted into their separate (atomic) long-form rotation codes;
+% the associated string is \verb!\SequenceLong!.
+% In fact three different forms of the sequence are returned, as shown below.
+%
+% For~example, consider the following short-form sequence L,R,D2,L3, and denote
+% it as `seqA' as follows: \verb!\newcommand{\seqA}{[seqA],L,R,D2,L3,<test>}!.
+% In this case D2,L3, and the name `seqA' fail to be typeset when using
+% the \verb!\rr! font with the \verb!\ShowSequence! command as follows:
+%
+% \newcommand{\seqA}{[seqA],L,R,D2,L3,<test>}
+%
+% \medskip\noindent\verb!\newcommand{\seqA}{[seqA],L,R,D2,L3,<test>}!
+%
+% \medskip\noindent\verb!\ShowSequence{,}{\texttt}{\seqA}! \ $\longrightarrow$ \ \ShowSequence{,}{\texttt}{\seqA}
+%
+% \medskip\noindent\verb!\ShowSequence{,}{\rr}{\seqA}! \ $\longrightarrow$ \ \ShowSequence{,}{\rr}{\seqA}
+%
+% \medskip
+%
+% However, if we now run the command \verb!\RubikRotation{\seqA}! we shall then have
+% at our disposal the following four strings:
+%
+% \medskip
+%
+% \verb!\SequenceInfo = ! test
+%
+% \verb!\SequenceName = ! seqA
+%
+% \verb!\SequenceShort = ! L,R,D2,L3
+%
+% \verb!\SequenceLong = ! L,R,D,D,L,L,L
+%
+% \medskip
+%
+% {\noindent}and therefore have full control over typesetting rotation sequences.
+% This approach therefore offers sufficient flexibility for most purposes.
+% For~example, if we now write the command \verb!\ShowSequence{,}{\rr}{\SequenceLong}!
+% we obtain
+%
+% \medskip\noindent\verb!\ShowSequence{,}{\rr}{\SequenceLong}! \ $\longrightarrow$ \
+% \ShowSequence{,}{\rr}{L,R,D,D,L,L,L}
+%
+% \medskip
+%
+% In practice, any trailing digit is converted (modulo~4) and expanded accordingly, the details being
+% copied to the log-file. For~example, if one writes the command
+% \cmd{\RubikRotation\{[test],R,D28978\}}, then since $28978 \equiv 2$\,(modulo~4) then \cmd{\SequenceLong}
+% will be returned containing the string |R,D,D|. The associated entries in the log-file are
+% as follows:
%\begin{verbatim}
-% \ShowCube{3.5cm}{0.5}{\DrawNCubeAll{5}{O}{Y}{G}}
+%...rotation R OK
+%...Expanding D28978 (28978 = 2 mod 4) ...
+%...rotation D OK (= Dp3)
+%...rotation D OK (= Dp3)
+%...writing new Rubik state to file rubikstateNEW.dat
+%...SequenceName = test
+%...SequenceShort = R,D28978
+%...SequenceLong = R,D,D
%\end{verbatim}
-% \end{minipage}
%
-% \medskip
%
-% \subsubsection[Draw.. error message]{\cmd{\draw} error message}
%
-% See also section~\ref{sec:drawerrormessage} regarding the error message associated with
-% using a \cmd{\Draw...} command \textit{outside} a TikZ picture environment.
-%
+% \section{SequenceBrace commands}
+% \label{sec:sequencebrace}
+%
+% \DescribeMacro{\SequenceBraceA}
+% \DescribeMacro{\SequenceBraceB}
+% \DescribeMacro{\SequenceBraceAF}
+% \DescribeMacro{\SequenceBraceBF}
+% The \cmd{\SequenceBraceX}\marg{name}\marg{sequence} command
+% is a tool for displaying a named sequence using a brace. The trailing~A
+% denotes that the brace is placed Above the sequence; the trailing~B denotes
+% the brace is Below the sequence.
+% Appending an `F' to the command-name (e.g.,~\cmd{\SequenceBraceAF}) results
+% in a surrounding fbox (cf.~the \cmd{\ShowCubeF} command).
+% For the code see Section~\ref{sec:sequencebracecode}.
+%
+% {\noindent}Thus \verb!\SequenceBraceB{myseq}{U,D,L,R}! generates
+% \ \SequenceBraceB{myseq}{U,D,L,R}.
+%
+% {\noindent}A typical example of its use might be:
+%
+% \bigskip
+%
+%\noindent%
+%\RubikCubeSolved%
+%\ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}%
+%\quad\SequenceBraceA{fourspot}{\ShowSequence{}{\Rubik}{F,F,B,B,U,Dp,R,R,L,L,U,Dp}}%
+%\quad$\longrightarrow$\quad%
+%\RubikFaceFront{R}{R}{R}%
+% {R}{O}{R}%
+% {R}{R}{R}%
+%\RubikFaceRight{B}{B}{B}%
+% {B}{G}{B}%
+% {B}{B}{B}%
+%\ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}%
+%
+%
+% \bigskip
+%
+% {\noindent}which was generated by the following code, showing that the \cmd{\ShowSequence}
+% command can be used as an argument for the \cmd{\SequenceBraceA} command:
+%\begin{verbatim}
+%\newcommand{\fourspot}{[fourspot],F2,B2,U,Dp,R2,L2,U,Dp}%
+%\noindent%
+%\RubikCubeSolved%
+%\ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}%
+%\RubikRotation{\fourspot}%
+%\quad\SequenceBraceA{\SequenceName}{%
+% \ShowSequence{}{\Rubik}{\SequenceLong}}%
+%\quad$\longrightarrow$\quad%
+%\ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}%
+%\end{verbatim}
+% Note (1)~that the `fourspot' listing is included in the \textsc{rubikpatterns} package, and
+% (2)~the \cmd{\RubikRotation} command requires using the \texttt{--shell-escape} command-line
+% option with the \LaTeX\ engine---see Section~\ref{sec:rubikrotation} for details.
+%
%
%
% \section{Arrows}
@@ -2259,31 +3092,40 @@
%
% The \rubikcube\ package does not offer any special commands for drawing
% arrows since it is straightforward just to include the appropriate TikZ
-% `draw' commands in the \texttt{tikzpicture} environment.
+% `draw' commands in the \texttt{tikzpicture} environment (i.e.,~in our
+% own \cmd{\ShowCube} environment).
%
-% In order to facilitate using the standard TikZ `draw' commands both
-% the RubikCubeFaceFront and LayerFace commands have the coordinate origin
-% at the bottom left corner, and draw `faces' consisting of 9~unit-squares
-% in a 3x3 grid, as shown in Figure~\ref{fig:facegraph}.
+% In order to facilitate using the standard TikZ `draw' commands
+% the graphic grid origin of Rubik cube images is located at the bottom left corner
+% of the \textsc{front} face (see also Section~\ref{sec:coordinates} for details of the
+% cube's coordinate system). Similarly, single face images (e.g.,~drawn using the
+% \cmd{\DrawFlatUp} or \cmd{\DrawFlatUpSide} and LayerFace commands etc.) have
+% their grid origin at the bottom left corner of the face.
% Consequently the start and finish coordinates for any arrow or line are
-% easy to determine.
+% easy to determine.
%
% \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}
+%
+% \parbox{9cm}{%
+% \caption{\label{fig:facegraph}Grid showing the positive coordinates
+% associated with \textsc{front} face of a cube image, or of a face-only image.}
+% }%
% \end{figure}
%
-% 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
+% \medskip
+%
+% For~example, Figure~\ref{fig:facegraph} shows a green
+% arrow drawn 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.
+% To do this we just include the following TikZ command, remembering that TikZ
+% commands require a terminal semicolon.
% \begin{quote}
%\begin{verbatim}
% \draw[->,color=green] (0.5,0.5) -- (1.5, 1.5);
@@ -2316,7 +3158,7 @@
% \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}
%
@@ -2357,7 +3199,7 @@
% {Y} {O}
% \DrawRubikLayerSideB {O}{G}{G}
% \draw[->,ultra thick,color=green] (0.5,5) -- (0.5, 4);
-% }
+% }
%\end{verbatim}
% \end{minipage}
%
@@ -2408,39 +3250,77 @@
% \DrawRubikCubeRD
% \draw[ultra thick,->,color=blue]
% (1.5,0.5) -- (2.5, 1.5);
-% }
+% }
%\end{verbatim}
% \end{minipage}
-%
+%
+% \bigskip
+%
+% In the following example we use a blue circle to highlight the cubie
+% to be rotated into the top layer.
+%
+% \bigskip
+%
+% \noindent%
+% \RubikCubeGrey
+% \RubikFaceUp{X}{W}{X}%
+% {W}{W}{W}%
+% {W}{W}{X}%
+% \RubikSliceBottomR{X}{X}{W}{G}{X}{X}%
+% \ShowCube{2.5cm}{0.5}{%
+% \DrawRubikCubeRU
+% \DrawRubikLayerSideRBy{O}
+% \draw[ultra thick,->,color=blue] (2.5,0.5) -- (2.5, 2.5);
+% \draw [color=blue, thick] (2.7, 0.3) circle (1.3);
+% }%
+% \hspace{3mm}
+% \begin{minipage}{0.6\textwidth}
+%\begin{verbatim}
+% \noindent%
+% \RubikCubeGrey
+% \RubikFaceUp{X}{W}{X}
+% {W}{W}{W}
+% {W}{W}{X}
+% \RubikSliceBottomR{X}{X}{W}{G}{X}{X}
+% \ShowCube{2.5cm}{0.5}{%
+% \DrawRubikCubeRU
+% \DrawRubikLayerSideRBy{O}
+% \draw[ultra thick,->,color=blue]
+% (2.5,0.5) -- (2.5, 2.5);
+% \draw [color=blue, thick] (2.7, 0.3) circle (1.3);
+% }%
+%\end{verbatim}
+% \end{minipage}
%
%
% \section{Final example}
%
% 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.
-%
+% figure\,\footnote{This is a well-known sequence of order 6 used to cycle three
+% edge cubies; it is used to generate the `cross' configuration in the final layer
+% when solving the cube. Here we are performing the sequence on a `solved' cube,
+% since this allows you to see how the three edge cubies move, and either
+% flip (magenta arrows) or do not flip (black arrow).}.
+% This code uses the \cmd{\RubikRotation} command (from the \textsc{rubikrotation}
+% package), and therefore the \LaTeX\ engine needs to be run using the
+% \verb!--shell-escape! command-line switch (see Section~\ref{sec:rubikrotation} for details).
%
% \bigskip
-% \hfil
-% \RubikCubeSolved
-% \ShowCube{2cm}{0.4}{\DrawRubikCubeRU}
-% \ShowCube{2cm}{0.4}{%
+%
+% \noindent\hfil%
+% \RubikCubeSolved%
+% \ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}%
+% \quad\ShowCube{1.6cm}{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}{%
+% }%
+% \quad\Rubik{F}\Rubik{R}\Rubik{U}\Rubik{Rp}\Rubik{Up}\Rubik{Fp}%
+% \quad$\longrightarrow$%
+% \quad\ShowCube{1.6cm}{0.4}{%
% \DrawRubikLayerFace{W}{W}{B}
% {W}{W}{O}
% {W}{R}{B}
@@ -2451,31 +3331,30 @@
% \DrawRubikLayerSideB {G}{W}{O}
% }
% \hfil
-% \bigskip
%
+% \bigskip
%
%\begin{verbatim}
-% \hfil
-% \RubikCubeSolved
-% \ShowCube{2cm}{0.4}{\DrawRubikCubeRU}
-% \ShowCube{2cm}{0.4}{%
-% \DrawFlatUpSide
+% \noindent\hfil%
+% \RubikCubeSolved%
+% \ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}%
+% \quad\ShowCube{1.6cm}{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}
+% }%
+% \RubikRotation{F,R,U,Rp,Up,Fp}%
+% \quad\ShowSequence{}{\Rubik}{\SequenceLong}\quad$\longrightarrow$%
+% \ShowCube{1.6cm}{0.4}{\DrawFlatUpSide}%
% \hfil
%\end{verbatim}
%
%
%
-% \subsection[Without using {\textbackslash}RubikRotation]{Without using \cmd{\RubikRotation..}}
+% \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
@@ -2483,11 +3362,14 @@
% commands
%\begin{verbatim}
% \RubikRotation{F,R,U,Rp,Up,Fp}
-% \ShowCubeF{2cm}{0.4}{\DrawFlatUpSide}
+% \ShowSequence{,}{\Rubik}{\SequenceLong} \ \ \ $\longrightarrow$
+% \ShowCube{2cm}{0.4}{\DrawFlatUpSide}
%\end{verbatim}
-% with the following set of \cmd{\DrawRubikLayer...} commands.
+% with the following commands:
%
%\begin{verbatim}
+% \Rubik{F}\Rubik{R}\Rubik{U}\Rubik{Rp}\Rubik{Up}\Rubik{Fp}
+% \ \ \ $\longrightarrow$
% \ShowCube{2cm}{0.4}{%
% \DrawRubikLayerFace{W}{W}{B}
% {W}{W}{O}
@@ -2497,71 +3379,129 @@
% {B} {W}
% {O} {W}
% \DrawRubikLayerSideB {G}{W}{O}
-% }
+% }
%\end{verbatim}
%
%
%
%
%
-% \section{Known issues \& shortcomings}
+% \section{Known limitations}
%
-% Please contact the authors regarding any ideas, errors or shortcomings etc.
+% Please contact the authors regarding any ideas for improvement, errors,
+% problems or shortcomings etc.
%
% \begin{itemize}
%
-% \item The rotation hieroglyphs are optimised for a 10pt font, and do
-% 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.
+% \item Note that the rotation hieroglyphs are optimised for a 10pt font
+% and do not scale with document font size. However, they do work well in
+% conjunction with the standard 11pt and 12pt document fonts sizes. Nevertheless,
+% the font size can of course be changed by renewing the font command
+% (see Section~\ref{sec:rubikfont} for details).
+%
+% \item The sidebars cannot be arbitrarily positioned (note: hidden
+% faces can be arbitrarily positioned).
%
% \end{itemize}
%
%
-% \section{Acknowledgements}
-%
-% We would like to thank Peter Bartal and Peter Grill for useful ideas and
-% suggestions. We have built on some of their ideas and have acknowledged
-% these instances in the documentation.
-% We would also like to thank Christian Tellechea for the \cmd{\@join\{\}\{\}} command.
-%
-%
-%
-% \section{Future supporting packages}
+% \section{Future packages}
%
% Since Rubik-type cubes currently exist in a variety of sizes (from 2x2x2 to 11x11x11)
-% it is possible that similar packages dealing with cubes of other sizes may be made in
-% the future. Supporting tools may also be made
+% other authors may well create similar packages dealing with
+% cubes of other sizes the future. Supporting tools may also be made
% 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.
%
-% In the event of new packages being made, we suggest that a CTAN directory structure
+% In the event of new packages being made, may we suggest that a CTAN directory structure
% along the following lines might be appropriate.
%
% $$
-% \textsc{rubik} \left\{
-% \begin{array}{l}
-% \mbox{rubiktools}\\
-% \mbox{rubik2x}\\
-% \mbox{rubik3x}\\
-% \ldots\\
-% \mbox{rubik11x}\\
-% \end{array}
-% \right.\\
+% \textsc{rubik}
+% \left\{
+% \begin{array}{l}
+% \mbox{rubiktools}\\
+% \mbox{rubik2x}\\
+% \mbox{rubik3x}\\
+% \ldots\\
+% \mbox{rubik11x}\\
+% \end{array}
+% \right.\\
% $$
%
%
%
-% \section{History}
+% \section{Change history}
%
% \begin{itemize}
-
+%
+% \item Version 4.0 (March 2017)
+%
+% ---Improved documentation.
+%
+% ---Improved inter-hieroglyph spacing and vertical position. The Computer Moderm sans bold font
+% (10/12pt) is used for the hieroglyphs and rotation codes (see Section~\ref{sec:coderubikfont}
+% for details).
+%
+% ---Improved the \cmd{\ShowCube} and \cmd{\ShowCubeF} macros (see Sections~\ref{sec:showcube}
+% and \ref{sec:showcubecode}).
+%
+% ---Additional notation for middle slice rotations (`m' notation), e.g.,~\rr{Rm}, \rr{Rmp} etc
+% (see Sections~\ref{sec:mnotation} and \ref{sec:codeJaap}).
+%
+% ---Additional notation for whole cube rotations (`c' notation), e.g.,~\rr{Rc}, \rr{Rcp} etc
+% (see Sections~\ref{sec:cnotation} and \ref{sec:codeJaap}).
+%
+% ---Added Randelshofer notation (the `CMST' rotations), e.g.,~\rr{CR}, \rr{MR} etc
+% (see Sections~\ref{sec:listofRandelshofercommands} and \ref{sec:codeRandelshofer}).
+%
+%
+% ---Two new (more-intuitive) \cmd{\Draw..} commands replace earlier (now deprecated)
+% ambiguous versions; these new versions are now consistent with
+% the other \cmd{\DrawRubikCubeXX} commands (see Section~\ref{sec:flatcommands}).
+% \begin{quote}
+% \cmd{\DrawRubikCubeF} (F = flat) ---replaces \cmd{\DrawRubikFlat}.
+% \newline\cmd{\DrawRubikCubeSF} (SF = semi-flat) ---replaces \cmd{\DrawRubikCubeFlat}.
+% \end{quote}
+%
+%
+% ---Six new commands for showing and annotating rotation sequences; the versions with a
+% terminal `F' also surround the object with an fbox to allow users to see the extent
+% of any associated white space
+% (see Sections~\ref{sec:showsequence} \& \ref{sec:sequencebrace}):
+% \begin{quote}
+% \cmd{\ShowSequence}
+% \newline\cmd{\ShowSequenceF}
+% \newline\cmd{\ShowSequencef}
+% \newline\cmd{\SequenceBraceA}
+% \newline\cmd{\SequenceBraceAF}
+% \newline\cmd{\SequenceBraceB}
+% \newline\cmd{\SequenceBraceBF}
+%
+% \end{quote}
+%
+% ---A new command for setting up or allocating a `solved' colour configuration.
+% (see Section~\ref{sec:solvedconfig}):
+% \begin{quote}
+% \cmd{\SolvedConfig}
+% \end{quote}
+%
+% ---A new command for setting up a `starter cube' for which the \textit{whole} cube
+% is allocated the default `grey' colour (see Section~\ref{sec:rubikcubegrey}):
+% \begin{quote}
+% \cmd{\RubikCubeGreyAll}
+% \end{quote}
+%
+% ---A new supporting \textsc{rubikpatterns} package has been added to
+% the Rubik bundle. It is a small macro database of well-known named Rubik patterns
+% and associated sequences (see Section~\ref{sec:patterns}).
+%
+%
+%
% \item Version 3.0 (September 2015)
%
-% ---All rotation commands can now use the rotation-code as an argument; for example,
+% ---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:
@@ -2605,13 +3545,13 @@
%
% ---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
+% commands and Slice commands. Note that although the 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};
+% 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}.
%
%
@@ -2623,13 +3563,25 @@
%
%
%
+% \section{Acknowledgements}
+%
+% We would like to thank Peter Bartal and Peter Grill for useful ideas and
+% suggestions. We have built on some of their ideas and have acknowledged
+% these instances in the documentation.
+% Finally, we would like to thank Christian Tellechea for the \cmd{\@join\{\}\{\}}
+% command (see Section~\ref{sec:usefulinternalcommands}),
+% Christian Schr\"{o}ppel for help regarding the \textsf{forarray} package
+% (see Section~\ref{sec:codeshowsequence}), and Herbert Kociemba for helpful comments.
+%
+%
+%
+%
% \section{References}
%
% \begin{itemize}
%
%
-% \item Bartal P (2011)
-%
+% \item Bartal P (2011). \
% \url{http://tex.stackexchange.com/questions/34482/}
%
% \item Chen JJ (2004). Group theory and the Rubik's cube.
@@ -2638,7 +3590,7 @@
%
% \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/}
@@ -2658,14 +3610,16 @@
% \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 Feuers\"{a}nger (2016). Manual for package \textsc{pgfplots}.
+% v\,1.13 (2016/01/06), \S\,3.2.3, page~21. (\texttt{pgfplots.pdf})
+% \url{http://www.ctan.org/pkg/pgfplots}. [re: preventing extra white space]
%
-% \item Fridrich J. \ \ \url{http://www.ws.binghamton.edu/fridrich/}.
+% \item Fridrich website (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 Frey AH and Singmaster D (1982). \textit{Handbook of cubik math},
+% (Enslow Publishers, Inc.) (republished: 2010, Lutterworth Press, UK)
%
% \item Golomb SW (1981). Rubik's cube and a model of quark confinement.
% \textit{Am.\ J.\ Phys.}; vol~49, pp~1030--1031.
@@ -2678,12 +3632,13 @@
% \item Gymrek M (2009). The mathematics of the Rubik's cube.
% \newline\url{http://web.mit.edu/sp.268/www/rubik.pdf}
%
+% \item Heise website (Heise R). Rubik's cube theory. \url{http://www.ryanheise.com/cube/theory.html}
+%
% \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/rubik.pdf}
%
-%
% \item Jelinek website (Jelinek J). Rubik's cube solution methods.
% \url{http://www.rubikscube.info/}
%
@@ -2691,18 +3646,29 @@
% Rubik's cube, Merlin's machine and other mathematical toys}; pp~322.
% \url{http://www.mike.verdone.ca/media/rubiks.pdf}
%
-% \item Kociemba website (Kociemba H). \url{http://www.kociemba.org/cube.htm}
-%
+%
+% \item Kociemba website (Kociemba H). \url{http://www.kociemba.org/cube.htm}
+% {\newline}---for superflip see: \url{http://www.kociemba.org/math/oh.htm}
+%
+%
% \item Kriz I and Siegel P (2008). Rubik's cube-inspired puzzles demonstrate math's
% simple groups. \textit{Scientific American}; July 2008
%
+% \item Longridge website (Longridge M). The cube pattern archive. \url{http://www.cubeman.org}
%
% \item Randelshofer website (Randelshofer W). Pretty patterns.
% \url{http://www.randelshofer.ch/rubik/patterns/}
%
-% \item Reid website (Reid M) \ \ \url{http://www.cflmath.com/Rubik/},
+% \item Reid website (Reid M) \ \ \url{http://www.cflmath.com/Rubik},
% for patterns see \url{http://www.cflmath.com/Rubik/patterns.html}
%
+% \item Reid M. (1995). Superflip requires 20 face turns. (January 1995)
+% \url{http://www.math.ucf.edu/~reid/Rubik/CubeLovers/}
+% {\newline}[cited from Rokicki \textit{et~al.}, 2013].
+% {\newline}(Note: easier to use is the following html indexed version of the
+% archive of the Cube-Lovers usenet group (1982--1997)
+% \url{http://www.math.rwth-aachen.de/~Martin.Schoenert/Cube-Lovers/})
+%
%
% \item Rokicki T, Kociemba H, Davidson M and Dethridge J (2013). The diameter of the
% Rubik's cube is twenty. \textit{SIAM.\ J.\ Discrete Math.}, \underline{27}, 1082--1105.
@@ -2711,7 +3677,15 @@
% \item Rubik's cube. See Section on notation.
% \newline\url{http://en.wikipedia.org/wiki/Rubik's_Cube}
%
-% \item Speedsolving website. \url{www.speedsolving.com/}
+% \item RuWix website (Ferenec D) \ \ \url{http://www.ruwix.com}.
+% See the online Rubik's cube solver \url{http://www.ruwix.com/online-rubiks-cube-solver-program}.
+%
+% \item Scherphius website (Scherphius J). Jaap Puzzles website
+% \url{http://www.jaapsch.net/puzzles/symmetr1.htm}
+%
+% \item Singmaster D (1981). \textit{Notes on Rubik's magic cube} (Harmondsworth, Eng., Penguin Books)
+%
+% \item Speedsolving website. \url{http://www.speedsolving.com/}
%
% \item Tran R (2005). A mathematical approach to solving Rubik's cube.
% \url{http://www.math.ubc.ca/~cass/courses/m308/projects/rtran/rtran.pdf}
@@ -2722,9 +3696,9 @@
% [cited from \textit{Wikipedia} (Rubik's cube)]
%
%
-% \item Vandenbergh L. \ \ \textsc{cubezone} \url{http://www.cubezone.be}
+% \item Vandenbergh website (Vandenbergh L.) \ \ \textsc{cubezone} \url{http://www.cubezone.be}
%
-% \item WCA (2015). World Cube Association Regulations. See Section~12 for notation.
+% \item WCA (2016). World Cube Association Regulations. See \S\,12 for notation.
% \url{http://www.worldcubeassociation.org/regulations.htm}
%
%
@@ -2742,17 +3716,17 @@
% 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.
+% Note that it is important when using a graphics package to use a trailing \% on
+% the end of lines which break before the terminal curly bracket of a \cmd{\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.
+% figures and diagrams as a strange or unexpected horizontal shift or white-space.
%
% \subsection{\hspace{3mm}Package heading}
%
% \begin{macrocode}
%<*rubikcube>
-\def\RCfileversion{3.0}%
-\def\RCfiledate{2015/09/25}%
+\def\RCfileversion{4.0}%
+\def\RCfiledate{2017/03/03}%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rubikcube}[\RCfiledate\space (v\RCfileversion)]
% \end{macrocode}
@@ -2763,100 +3737,38 @@
\RequirePackage{tikz}}%
% \end{macrocode}
%
-% \begin{macro}{\rubikcube}
-% First we create a suitable logo
+% The package requires the Forarray package (see Section~\ref{sec:codeshowsequence})---so
+% we load it if not already loaded.
% \begin{macrocode}
-\newcommand{\rubikcube}{\textsc{rubikcube}}%
-\newcommand{\Rubikcube}{\textsc{Rubikcube}}%
+\@ifpackageloaded{forarray}{}{%
+ \typeout{---rubikcube requires the Forarray package.}%
+ \RequirePackage{forarray}}%
% \end{macrocode}
-% \end{macro}
-%
-%
-% \subsection{\hspace{3mm}Some useful internal commands}
-% \label{sec:usefulinternalcommands}
-%
-% \begin{macro}{\@rr}
-% \begin{macro}{\@rrp}
-% \begin{macro}{\@rrw}
-% \begin{macro}{\@rrwp}
-% \begin{macro}{\@rrs}
-% \begin{macro}{\@rrsp}
-% \begin{macro}{\@rra}
-% \begin{macro}{\@rrap}
-% \begin{macro}{\@xyzh}
-% \begin{macro}{\@xyzhp}
-% \begin{macro}{\@xyzRubik}
-% \begin{macro}{\@xyzRubikp}
-% \begin{macro}{\@SquareLetter}
-% \begin{macro}{\@hRubik}
-% Internal commands. These are used to generate the
-% prime, w, w-prime, s, s-prime, a, a-prime
-% rotation commands. The \cmd{\@xyz..} commands are used to generate the
-% x,y,z,u,d,l,r,f,b, and their prime rotation commands.
-% The \cmd{\@SquareLetter} command is used to form the separate square hieroglyph form
-% used for rotations with no 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
-% 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
-% of all the various glyphs. However, these internal tools are currently
-% only partially implemented (= work in progress).
-% \begin{macrocode}
-\newcommand{\@rr}[1]{\textbf{\textsf{#1}}}
-\newcommand{\@rrp}[1]{\textbf{\textsf{#1}$^\prime$}}
-\newcommand{\@rrw}[1]{\textbf{\textsf{#1\footnotesize{w}}}}
-\newcommand{\@rrwp}[1]{\textbf{\textsf{#1\footnotesize{w}}$^\prime$}}
-\newcommand{\@rrs}[1]{\textbf{\textsf{#1\footnotesize{s}}}}
-\newcommand{\@rrsp}[1]{\textbf{\textsf{#1\footnotesize{s}}$^\prime$}}
-\newcommand{\@rra}[1]{\textbf{\textsf{#1\footnotesize{a}}}}
-\newcommand{\@rrap}[1]{\textbf{\textsf{#1\footnotesize{a}}$^\prime$}}
-\newcommand{\@xyzh}[1]{\textbf{[\textsf{#1}]}\,}
-\newcommand{\@xyzhp}[1]{\textbf{[\textsf{#1}$^\prime$]}\,}
-\newcommand{\@xyzRubik}[1]{\raisebox{3.45pt}{\textbf{[\textsf{#1}]}}}
-\newcommand{\@xyzRubikp}[1]{\raisebox{3.45pt}{\textbf{[\textsf{#1}$^\prime$]}}}
-\newcommand{\@SquareLetter}[1]{\setlength\fboxsep{2.5pt}\fboxrule=0.8pt%
- \fbox{\rule[-1pt]{0pt}{8.5pt}\raisebox{-0.5pt}{#1}}}
-\newlength\@hRubik%
-\setlength{\@hRubik}{0.185cm}%
+% The package requires the IfThen package (see Section~\ref{sec:codeshowsequence})---so
+% we load it if not already loaded.
+% \begin{macrocode}
+\@ifpackageloaded{ifthen}{}{%
+ \typeout{---rubikcube requires the IfThen package.}%
+ \RequirePackage{ifthen}}%
% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
%
%
-% \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}
+%
+% \begin{macro}{\rubikcube}
+% First we create a suitable logo
+% \begin{macrocode}
+\newcommand{\rubikcube}{\textsc{rubikcube}}%
+\newcommand{\Rubikcube}{\textsc{Rubikcube}}%
% \end{macrocode}
-% \end{macro}
+% \end{macro}
%
%
% \subsection{\hspace{3mm}Colours}
% \label{sec:codecolours}
%
-% These colour allocations were initially defined by Peter Bartal (2011).
+% We have adopted the following colour allocations; these were initially
+% defined by Peter Bartal (2011) ---see Section~\ref{sec:colours}.
% We have modified only the colour grey, which is now defined as {black!30}.
%
% \begin{macrocode}
@@ -2871,6 +3783,37 @@
%
%
%
+% \subsection{\hspace{3mm}The rubikfont}
+% \label{sec:coderubikfont}
+%
+% \begin{macro}{\@rubikfont}
+% \begin{macro}{\@rubikfontFNS}
+% \begin{macro}{\@rubikprime}
+% We define two fonts for text associated with the Rubik glyphs
+% (both the `arrow' glyphs and the `letter' glyphs),
+% namely, (1)~Computer Modern Sans (cmss), bold extended (bx), normal shape (n)
+% at 10/12pt, and (2)~a footnotesize (FNS) version (8pt) for the lower-case letters
+% [for cmss see Latex Companion (2004), p.\,417 \& p.\,354\,\footnote{Note the typo in Table~7.5 (p.\,354):
+% the font-series code for the Sans semi-bold condensed form is `sbx' (not sbc).}].
+% This has the effect of keeping the size
+% of Rubik glyphs constant in the face of any changes in the document fonts.
+% We make the baseline-skip values the same, since the `arrow' glyphs generated by
+% the \cmd{\Rubik} commands involve a single baseline-skip (for example, as with
+% \verb!\Rubik{D}!; see Section~\ref{sec:coderotationD}).
+% We use the cmss font apostrophe as the `prime' symbol (the user has
+% the opportunity to use the maths \cmd{\prime}
+% instead---see Section~\ref{sec:rubikprime}).
+%\begin{macrocode}
+\newcommand{\@rubikfont}{\fontsize{10}{12pt}\usefont{T1}{cmss}{bx}{n}}
+\newcommand{\@rubikfontFNS}{\fontsize{8}{12pt}\usefont{T1}{cmss}{bx}{n}}
+\newcommand{\@rubikprime}{'}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
% \subsection{\hspace{3mm}ShowCube command}
% \label{sec:showcubecode}
%
@@ -2880,42 +3823,181 @@
% 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}|
+% {\newline}\textsc{usage}: |\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}|
+%
+% February 2017 (RWDN): \ We first require a new length variable (which will become the minipage-width),
+% so we can add the length 1.6pt to it (this is the width of the TikZ ultra-thick line
+% which is used to draw the Rubik cubes).
+% In order for a width of an image made up of $x$~units to be equal
+% to $x \times (\mbox{scale-factor})$ we need to add an extra line-width
+% (i.e.,~to include the right-hand edge).
+% \begin{macrocode}
+\newlength{\@showcubewidth}%
+% \end{macrocode}
+% We can now build the two macros. We set the \cmd{\fboxsep} value to zero.
% \begin{macrocode}
\newcommand{\ShowCube}[3]{%
- \begin{minipage}{#1}%
+ \setlength{\fboxsep}{0cm}%
+ \setlength{\@showcubewidth}{#1}%
+ \advance\@showcubewidth by 1.6pt\relax%
+ \begin{minipage}{\the\@showcubewidth}%
\centering%
\begin{tikzpicture}[scale=#2]%
#3%
\end{tikzpicture}%
\end{minipage}%
-}
+}%
\newcommand{\ShowCubeF}[3]{%
- \fbox{%
- \begin{minipage}{#1}%
+ \setlength{\fboxsep}{0cm}%
+ \setlength{\fboxrule}{0.4pt}%
+ \setlength{\@showcubewidth}{#1}%
+ \advance\@showcubewidth by 1.6pt\relax%
+ \framebox{%
+ \begin{minipage}{\the\@showcubewidth}%
\centering%
\begin{tikzpicture}[scale=#2]%
#3%
\end{tikzpicture}%
\end{minipage}%
-}}
+}}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+%
+% \subsection{\hspace{3mm}ShowSequence command}
+% \label{sec:codeshowsequence}
+%
+% \begin{macro}{\ShowSequence}
+% \begin{macro}{\ShowSequenceF}
+% \begin{macro}{\ShowSequencef}
+% The \cmd{\ShowSequence}\marg{separator}\marg{font-code}\marg{sequence} command
+% typesets a comma separated sequence of rotation commands.
+% (See Section~\ref{sec:showsequence}).
+% This command takes three mandatory arguments: the first is the separator (\verb!#1!),
+% the second is the font or style code (\verb!#2!), and third is a comma-separated
+% sequence of Rubik rotation commands (|#3|).
+%
+% This command requires the \texttt{forarray}
+% package---by Christian Schr\"{o}ppel---(for the \cmd{\ForEachX} command)
+% and the \texttt{ifthen} package---by David Carlisle---(for the \cmd{\ifthenelse} command).
+% These two packages are loaded at startup if not already loaded.
+% We first need to define two variables for use by the command; these are
+% derived from the \texttt{forarray} package.
+%
+% \begin{macrocode}
+\newcommand{\x}{\thislevelitem}
+\newcommand{\xcount}{\thislevelcount}
+% \end{macrocode}
+%
+% The \cmd{\ShowSequence} command typesets a sequence of elements, and places
+% an optional separator (|#1|) between them.
+% For each element of |#3| this command forms the construction |#2{element of #3}|.
+% For~example, if |#2 = \rr|, and an element of |#3| is D, then it forms |\rr{D}| etc.
+%
+% Note that in order to avoid placing a trailing comma after the final element,
+% we identify the first element (using |\xcount|) and then place a comma in front
+% all the remaining elements. This is because it is easy to identify the first element
+% of a sequence, but very difficult to identify the final element.
+%
+% We also create two fbox forms: the `F' form places an fbox about the whole output;
+% the `f' form places an fbox about each element in the output (these forms can be
+% helpful when checking white space.
+%
+% \noindent\textsc{usage}: |\ShowSequence{,}{\rr}{R,L,Up,Dp.....}|
+%
+% \begin{macrocode}
+\newcommand{\ShowSequence}[3]{%
+ \ForEachX{,}{%
+ \ifthenelse{\xcount=1}{#2{\x}}{#1#2{\x}}%
+ }{#3}%
+}%
+\newcommand{\ShowSequenceF}[3]{%
+\fbox{%
+ \ForEachX{,}{%
+ \ifthenelse{\xcount=1}{#2{\x}}{#1#2{\x}}%
+ }{#3}%
+}}%
+\newcommand{\ShowSequencef}[3]{%
+ \ForEachX{,}{%
+ \ifthenelse{\xcount=1}{\fbox{#2{\x}}}{#1{\fbox{#2{\x}}}}%
+ }{#3}%
+}%
% \end{macrocode}
+% \begin{macro}{\SequenceInfo}
+% \begin{macro}{\SequenceName}
+% \begin{macro}{\SequenceShort}
+% \begin{macro}{\SequenceLong}
+% \noindent\textsc{Sequence holders}: providing none of the Rubik rotation-codes has a trailing
+% integer (e.g.,~R3) then the Rubik macros (|\rr|, |\rrh|, |\Rubik|, |\textRubik|) will work
+% as expected when used as the second argument in the \cmd{\ShowSequence} command
+% (described above). However, a problem arises when trying to process in this way any Rubik
+% rotation-codes having a terminal integer (for example, short-codes e.g.,~R2, D3,...), since the
+% \cmd{\ShowSequence} macro cannot expand short-codes into their long-code
+% elements (e.g.,~~R,R,D,D,D,...).
+%
+% Accommodating such codes when using the \cmd{\ShowSequence} command is currently
+% solved by using separate `holders' for four derived strings, namely: \cmd{\SequenceInfo},
+% \cmd{\SequenceName},\cmd{\SequenceShort} and \cmd{\SequenceLong}
+% (for details see Section~\ref{sec:showsequence}).
+% These are generated automatically by the Perl \textsc{rubikrotation} program, which returns
+% a so-called `long' version of the `short' string (the argument of the \cmd{\RubikRotation}
+% command). For~example, the Perl program converts
+% any short codes (e.g.,~R2, D3,... ) $\rightarrow$ long form, e.g.,~R,R,D,D,D,...
+% (see the \textsc{rubikrotation} documentation for details).
+% In order for the four `holders' of these derived strings generated by the Perl program
+% (written to the file \texttt{rubikstateNEW.dat}) to be accessible to the user they need to
+% defined here so that they can then be `redefined' (by the Perl program) in the file
+% \texttt{rubikstateNEW.dat}:
+% \begin{macrocode}
+\newcommand{\SequenceInfo}{{}}% %% INFO only
+\newcommand{\SequenceName}{{}}% %% NAME only
+\newcommand{\SequenceShort}{{}}% %% original SHORT seq but with NO NAME
+\newcommand{\SequenceLong}{{}}% %% just the LONG string \& no name
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsection{\hspace{3mm}SequenceBrace commands}
+% \label{sec:sequencebracecode}
%
+% \begin{macro}{\SequenceBraceA}
+% \begin{macro}{\SequenceBraceB}
+% The \cmd{\SequenceBraceX}\marg{name}\marg{sequence} command
+% is a tool for displaying a named sequence using a brace. The trailing~A
+% denotes that the brace is placed Above the sequence; B~denotes the brace is Below the sequence.
+% For usage see Section~\ref{sec:sequencebrace}.
+%
+% \begin{macrocode}
+\newcommand{\SequenceBraceA}[2]{$\overbrace{\mbox{#2}}^{\mbox{#1}}$}%
+\newcommand{\SequenceBraceB}[2]{$\underbrace{\mbox{#2}}_{\mbox{#1}}$}%
+\newcommand{\SequenceBraceAF}[2]{\fbox{$\overbrace{\mbox{#2}}^{\mbox{#1}}$}}%
+\newcommand{\SequenceBraceBF}[2]{\fbox{$\underbrace{\mbox{#2}}_{\mbox{#1}}$}}%
+% \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,
+% 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 use the t, b notation 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}middle row\, (4,5,6) = ml, mm, mr
% {\newline}\strut\hspace{1cm}bottom row (7,8,9) = bl, bm, br
%
% \begin{macro}{\RubikFaceUp}
@@ -2936,12 +4018,12 @@
% 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'' 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
+% of the two lower-case letters (in this case \texttt{rt}) are always written
+% in the $x,y$ order; i.e.,~the first of the two lower-case letters relates to the $x$
+% direction (either left, middle, or right), while the second lower-case letter
% relates to the $y$ direction (either top, middle, or bottom)---this rule makes it
% easy to remember the order.
% \end{macro}
@@ -2989,9 +4071,11 @@
% \begin{macro}{\RubikFaceRightAll}
% \begin{macro}{\RubikFaceFrontAll}
% \begin{macro}{\RubikFaceBackAll}
-% These 5 commands allocate the same colour to all 9 cubiesquares in the specified face (Up, Down, Left, Right, Front). Each command therefore takes only 1 argument (one of the colour codes).
+% These 5 commands allocate the same colour to all 9 cubie-squares
+% in the specified face (Up, Down, Left, Right, Front).
+% Each command therefore takes only 1~argument (one of the colour codes).
%
-% {\noindent}For example, \cmd{\RubikFaceUpAll\{R\}}
+% {\noindent}For~example, \cmd{\RubikFaceUpAll\{R\}}
% \end{macro}
% \end{macro}
% \end{macro}
@@ -3031,7 +4115,8 @@
}
% \end{macrocode}
%
-% {\noindent}We now use these commands to initialise all visible faces to default colour grey (X)
+% {\noindent}Finally, we now use these commands to initialise all
+% visible faces to the default colour grey~(X)
%
% \begin{macrocode}
\RubikFaceUpAll{X}%
@@ -3051,7 +4136,9 @@
% \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.
+% The colour configuration of the central cubies matches those defined for
+% the RubikCubeSolved command (i.e.,~white opposite yellow etc).
+% We also implement an equivalent `gray' version (to be consistent with TikZ).
% \begin{macrocode}
\newcommand{\RubikCubeGrey}{%
\RubikFaceUp {X}{X}{X}{X}{W}{X}{X}{X}{X}%
@@ -3061,29 +4148,73 @@
\RubikFaceFront{X}{X}{X}{X}{O}{X}{X}{X}{X}%
\RubikFaceBack {X}{X}{X}{X}{R}{X}{X}{X}{X}%
}
+\newcommand{\RubikCubeGray}{\RubikCubeGrey}
% \end{macrocode}
% \end{macro}
%
%
-% \subsection{\hspace{3mm}RubikCubeSolved command}
%
-% \begin{macro}{\RubikCubeSolved}
+%
+% \subsection{\hspace{3mm}SolvedConfig command}
+%
+% \begin{macro}{\SolvedConfig}
% This command sets the face/colour configuration (state) of a typical
-% solved Rubik cube.
+% solved Rubik cube. Note that the order is Right, Left, Up, Down, Front, Back
+% (i.e.,~X$+$, X$-$, Y$+$, Y$-$, Z$+$, Z$-$, order).
+% We shall use this command to define solved cube configurations.
% \begin{macrocode}
-\newcommand{\RubikCubeSolved}{%
- \RubikFaceUpAll{W}%
- \RubikFaceDownAll{Y}%
- \RubikFaceLeftAll{B}%
- \RubikFaceRightAll{G}%
- \RubikFaceFrontAll{O}%
- \RubikFaceBackAll{R}%
+\newcommand{\SolvedConfig}[6]{%
+ \RubikFaceRightAll{#1}%
+ \RubikFaceLeftAll{#2}%
+ \RubikFaceUpAll{#3}%
+ \RubikFaceDownAll{#4}%
+ \RubikFaceFrontAll{#5}%
+ \RubikFaceBackAll{#6}%
}
% \end{macrocode}
% \end{macro}
%
%
%
+%
+% \subsection{\hspace{3mm}RubikCubeGreyAll command}
+% \label{sec:codegreyall}
+%
+% \begin{macro}{\RubikCubeGreyAll}
+% This command sets the face/colour configuration (state) of a 3x3x3
+% Rubik cube with no colours allocated.
+% This colour configuration is the same as the startup default state---all cubies will
+% appear grey. We implement it using the \cmd{\SolvedConfig} command (above).
+% We also implement an equivalent `gray' version (to be consistent with TikZ).
+% \begin{macrocode}
+\newcommand{\RubikCubeGreyAll}{\SolvedConfig{X}{X}{X}{X}{X}{X}}%
+\newcommand{\RubikCubeGrayAll}{\RubikCubeGreyAll}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{\hspace{3mm}RubikCubeSolved command}
+% \label{sec:codesolvedconfig}
+%
+% \begin{macro}{\RubikCubeSolved}
+% \begin{macro}{\RubikCubeSolvedWY}
+% \begin{macro}{\RubikCubeSolvedWB}
+% The first (default) command sets the face/colour configuration (state) one of the standard
+% commercially available solved Rubik cube (white opposite yellow). The argument order
+% follows the XYZ notation. For convenience we make a copy named \cmd{\RubikCubeSolvedWY}
+% (denoting the White opposite Yellow configuration), and also a different version named
+% \cmd{\RubikCubeSolvedWB} (denoting the White opposite Blue configuration).
+% These represent the two standard versions of the Rubik Cube.
+% \begin{macrocode}
+\newcommand{\RubikCubeSolved}{\SolvedConfig{G}{B}{W}{Y}{O}{R}}%
+\newcommand{\RubikCubeSolvedWY}{\RubikCubeSolved}%
+\newcommand{\RubikCubeSolvedWB}{\SolvedConfig{R}{O}{W}{B}{G}{Y}}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
% \subsection{\hspace{3mm}Slice commands}
%
% \begin{macro}{\RubikSliceTopR}
@@ -3148,7 +4279,7 @@
% 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).
+% defines the viewing direction (X = either R or L; Y = either U or D).
% The order of the XY code is important: X~first, Y~second (so it is easy to remember).
%
% On each face the facelets are drawn in the following order: Top row
@@ -3158,7 +4289,7 @@
% 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
+% (only need four coords); the (x,y) grid origin is at the bottom-left corner of the
% \textsc{front} face.
%
% \begin{macro}{\DrawRubikCubeFrontFace}
@@ -3197,7 +4328,7 @@
% \subsubsection{\hspace{3mm}Viewing direction}
%
% The command `DrawRubikCubeXY' command uses the trailing XY code
-% to specify the view direction (X = either R, L; Y = either U, D).
+% to specify the view direction (X = either R or L; Y = either U or D).
% The order of the XY code is important: X~first, Y~second (so it is easy
% to remember).
%
@@ -3209,7 +4340,8 @@
% 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 (x,y) grid origin is at the bottom-left corner of the \textsc{front} face
+% (see Section~\ref{sec:coordinates}).
% 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
@@ -3450,9 +4582,10 @@
% 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 facelet etc.)
-% The second takes only one colour parameter (since \texttt{All} the
+% is the place-holder for the colour of the TopLeft facelet etc.)
+% The second command takes only one colour parameter (since \texttt{All} the
% colours are the same).
+%
% 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
@@ -3517,8 +4650,12 @@
%
% [\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].
+% reformulated as a set of \cmd{\Draw...} commands so as to make this
+% notation consistent with the other \cmd{\Draw..} commands.
+% Note also that, for user convenience, all of these commands have
+% been copied (in version~4.0) to equivalent \cmd{\DrawFace..}
+% versions associated with their two coordinate arguments
+% set to $x=0$, $y=0$---see Section~\ref{sec:drawfacecode}]
%
% \begin{macro}{\DrawFlatUp}
% \begin{macro}{\DrawFlatDown}
@@ -3526,11 +4663,13 @@
% \begin{macro}{\DrawFlatRight}
% \begin{macro}{\DrawFlatFront}
% \begin{macro}{\DrawFlatBack}
-% Each of these commands draws a separate (flat) face (9~facelets).
+% Each of these commands draws a separate (flat) face (9~facelets)
+% (see Section~\ref{sec:flatcommands}).
% 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
+% the user to position the face in relation to the cube itself.
+% 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
@@ -3553,9 +4692,9 @@
% 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}).
+% `u' stands for Up etc. However, since we are unable to use a `dx, dy' notation
+% with the \cmd{\DrawFlatDown} command (since dx and dy are already used by the
+% \cmd{\cube@dxdydz...} command), we encode these instead as (\cmd{\ddx}, \cmd{\ddy}).
%
% \end{macro}
% \end{macro}
@@ -3689,7 +4828,7 @@
}
%%-----------------------
\newcommand{\DrawFlatFront}{%
-%% This command is used /only/ by the \cmd{\DrawRubikFlat} command.
+%% This command is used /only/ by the \cmd{\DrawRubikCubeF} command.
%% NOTE: x, y variables not implemented as not required here
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Flt]%
@@ -3756,12 +4895,12 @@
}
% \end{macrocode}
%
-% \begin{macro}{\DrawRubikFlat}
-% Draws a standard flat representation of the Rubik
-% cube (colours only). Note that \cmd{\DrawFlatFront} does not
-% take any arguments (x,y) arguments.
+% \begin{macro}{\DrawRubikCubeF}
+% Draws a standard flat (F) representation of the Rubik
+% cube (colours only). Note that \cmd{\DrawFlatFront} (below)
+% does not take any arguments (x,y).
% \begin{macrocode}
-\newcommand{\DrawRubikFlat}{%
+\newcommand{\DrawRubikCubeF}{%
\DrawFlatUp{0}{3}%
\DrawFlatDown{0}{-3}%
\DrawFlatLeft{-3}{0}%
@@ -3772,12 +4911,13 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\DrawRubikCubeFlat}
+%
+% \begin{macro}{\DrawRubikCubeSF}
% 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.
+% (colours only) in a semi-flat (SF) representation. The (x,y)
+% arguments (below) are for the bottom-left corner of the face.
% \begin{macrocode}
-\newcommand{\DrawRubikCubeFlat}{%
+\newcommand{\DrawRubikCubeSF}{%
\DrawRubikCube%
\DrawFlatDown{0}{-3}%
\DrawFlatLeft{-3}{0}%
@@ -3789,6 +4929,7 @@
%
%
% \subsubsection{DrawFlatXSide commands}
+% \label{sec:drawflatxsidecode}
%
% These six commands draw a face together with all four sidebars
% (colours only). We use the \cmd{\DrawFlatX} commands to draw the face.
@@ -3798,7 +4939,10 @@
% 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).
-%
+%
+% Note that for user convenience, we we have copied many of these commands
+% to a \cmd{\DrawFace..} version (see Section~\ref{sec:drawfacecode}).
+%
%
% \begin{macro}{\DrawFlatUpSide}
% Draws the \textsc{up} face together with all four sidebars
@@ -3891,6 +5035,31 @@
%
%
%
+% \subsection{\hspace{3mm}DrawFace commands}
+% \label{sec:drawfacecode}
+%
+% We now copy the above \cmd{\DrawFlat..} commands
+% as \cmd{\DrawFace..} commands for the purpose of user
+% convenience, since most of the time the user wants just to
+% draw a particular face with or without the associated side bars.
+% In a future version we may well, therefore, deprecate some of the above
+% `Flat' command names.
+% \begin{macrocode}
+\newcommand{\DrawFaceUp}{\DrawFlatUp{0}{0}}
+\newcommand{\DrawFaceDown}{\DrawFlatDown{0}{0}}
+\newcommand{\DrawFaceLeft}{\DrawFlatLeft{0}{0}}
+\newcommand{\DrawFaceRight}{\DrawFlatRight{0}{0}}
+\newcommand{\DrawFaceFront}{\DrawFlatFront{0}{0}}
+\newcommand{\DrawFaceBack}{\DrawFlatBack{0}{0}}
+\newcommand{\DrawFaceUpSide}{\DrawFlatUpSide}
+\newcommand{\DrawFaceDownSide}{\DrawFlatDownSide}
+\newcommand{\DrawFaceLeftSide}{\DrawFlatLeftSide}
+\newcommand{\DrawFaceRightSide}{\DrawFlatRightSide}
+\newcommand{\DrawFaceFrontSide}{\DrawFlatFrontSide}
+\newcommand{\DrawFaceBackSide}{\DrawFlatBackSide}
+% \end{macrocode}
+%
+%
% \subsection{\hspace{3mm}SideBar commands}
%
% SideBar commands draw narrow bars of colour indicating the
@@ -3949,7 +5118,7 @@
% 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 the TikZ \cmd{\draw} command for each bar rectangle
-% is botton Left corner of the bar =(\cmd{\dx},\cmd{\dy})
+% is bottom Left corner of the bar =(\cmd{\dx},\cmd{\dy})
% \end{macro}
% \end{macro}
% \end{macro}
@@ -3999,15 +5168,15 @@
% 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 M \mid B\rangle$
+% {\newline}X$_2$ is a \, $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
% right $\langle x \rangle$ of the associated cubie.
% An $X_3$ parameter is not required for the sidebar of an edge cubie, since
-% only one location is posible in these cases.
+% only one location is possible in these cases.
% \end{quote}
-% For example, the following command
+% For~example, the following command
% \begin{quote}
% \cmd{\DrawRubikLayerSideLTy\{G\}}
% \end{quote}
@@ -4038,7 +5207,7 @@
% \end{macrocode}
%
%
-% \subsubsection{\hspace{3mm}Drawing multiple cubie sidebars}
+% \subsubsection{\hspace{3mm}Drawing multiple cubie sidebars}
%
% \begin{macro}{\DrawRubikLayerSideT}
% \begin{macro}{\DrawRubikLayerSideB}
@@ -4107,6 +5276,65 @@
% \end{macro}
%
%
+% \subsection{\hspace{3mm}RubikSide commands}
+% \label{sec:rubiksidecode}
+%
+% \begin{macro}{\RubikSideLeft}
+% \begin{macro}{\RubikSideRight}
+% \begin{macro}{\RubikSideFront}
+% \begin{macro}{\RubikSideBack}
+% RubikSide commands allocate colours to the side facelets of the
+% UP~face---see Section~\ref{sec:rubikside}.
+% These facelets are the top three facelets of each side Front, Back, Left, Right.
+% \begin{macrocode}
+\newcommand{\RubikSideFront}[3]{%
+\def\Flt{#1}\def\Fmt{#2}\def\Frt{#3}%
+}
+\newcommand{\RubikSideRight}[3]{%
+\def\Rlt{#1}\def\Rmt{#2}\def\Rrt{#3}%
+}
+\newcommand{\RubikSideLeft}[3]{%
+\def\Llt{#1}\def\Lmt{#2}\def\Lrt{#3}%
+}
+\newcommand{\RubikSideBack}[3]{%
+\def\Blt{#1}\def\Bmt{#2}\def\Brt{#3}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\RubikSideLeftAll}
+% \begin{macro}{\RubikSideRightAll}
+% \begin{macro}{\RubikSideFrontAll}
+% \begin{macro}{\RubikSideBackAll}
+% These 4 commands allocate the same colour to all 3 cubiesquares in the specified face
+% (Left, Right, Front, Back). Each command therefore takes only 1 argument
+% (one of the colour codes).
+%
+% {\noindent}For~example, \cmd{\RubikSideUpAll\{R\}}
+% \begin{macrocode}
+\newcommand{\RubikSideFrontAll}[1]{%
+\def\Flt{#1}\def\Fmt{#1}\def\Frt{#1}%
+}
+\newcommand{\RubikSideRightAll}[1]{%
+\def\Rlt{#1}\def\Rmt{#1}\def\Rrt{#1}%
+}
+\newcommand{\RubikSideLeftAll}[1]{%
+\def\Llt{#1}\def\Lmt{#1}\def\Lrt{#1}%
+}
+\newcommand{\RubikSideBackAll}[1]{%
+\def\Blt{#1}\def\Bmt{#1}\def\Brt{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
%
% \subsection{\hspace{3mm}NCube command}
%
@@ -4123,7 +5351,7 @@
% The command takes four ordered arguments, as follows:
% \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);
+% {\newline}\#2, \#3, \#4 = colours 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}
@@ -4144,10 +5372,11 @@
% \end{macro}
%
% \begin{macro}{\cube@dxdydz}
-% This internal command is used only by the \cmd{\DrawNCubeAll} command.
-% The original version of this command was developed by Peter Bartal (see Bartal, 2011).
-% It was modified (2012) by RWD Nickalls (to implement a more
-% intuitive X, Y, Z ordering of parameters).
+% This internal command is used only by the \cmd{\DrawNCubeAll} command
+% (see above). The original version of this command was developed
+% by Peter Bartal (see Bartal, 2011).
+% It was later modified (2012) by RWD Nickalls (to implement a more
+% intuitive X, Y, Z ordering of the face colour parameters).
%
% The cube need not be in the origin, the distances of
% the \textsc{down}-behind [L] corner from
@@ -4175,7 +5404,7 @@
% 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).
+% (by reassigning \#2, \#3, \#4 to the X, Y, Z face colours, as shown above).
%
% \begin{macrocode}
\newcommand{\cube@dxdydz}[7]{%
@@ -4192,7 +5421,7 @@
\draw[line join=round,line cap=round,ultra thick,fill=#4]%
(#5,#6,\dz) -- (\dx,#6,\dz) -- (\dx,\dy,\dz) -- (#5,\dy,\dz) -- cycle;
%% The 'rectangle' command does not work with 3D coordinates,
-%% so this is the way to draw the squres with space coordinates
+%% so this is the way to draw the squares with space coordinates
%% Draw UP face (using the Y colour = #3)
\draw[line join=round,line cap=round,ultra thick,fill=#3]%
(#5,\dy,\dz) -- (\dx,\dy,\dz) -- (\dx,\dy,#7) -- (#5,\dy,#7) -- cycle;
@@ -4214,10 +5443,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} 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.
+% Note that we cannot use the names \texttt{dx}, \texttt{dy} for the
+% variables here since these names have been allocated already
+% (see above). However, we can 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}}
@@ -4307,8 +5536,8 @@
%
% 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).
+% These commands take three arguments (since just three faces are visible with this
+% cube format), namely three different XYZ ordered colour codes (R,O,Y,G,B,W,X).
% \newline\textsc{format}: \cmd{\textCubieRU}\marg{Xcolour}\marg{Ycolour}\marg{Zcolour}
% \newline\textsc{usage}: |\textCubieRU{G}{B}{W}|
% \end{macro}
@@ -4361,27 +5590,50 @@
%
% \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
+% We use a special prefix notation to denote each of four different representations
+% of the various Rubik cube rotations as follows: the name of the Rubik 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
+% 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}).
+%
+% In version~3.0, however, all the rotation commands were also made available to the user
+% in the much more intuitive form stem\{argument\} form, for~example,
+% |\rrh{D}|. In practice, this `argument' form actually generates the original non-argument
+% form by the use of the internal macro |\@join|.
+% For example, \verb!\rrh{D}! $\rightarrow$ join(\verb!\rrh! + \verb!D!) $\rightarrow$ \verb!\rrhD!
+% (see Sections~\ref{sec:cmdsusingjoin} for details).
%
-% 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 pgfmanual (2012) page~146 (\S 14.8)).
+% The hieroglyphs are of two types: `arrow' glyphs (all exactly square),
+% and `letter' glyphs (mostly square, but many are rectangular); however both
+% types are made to have the same height so they sit nicely when arranged side-by-side.
+% A lot of special macros for handling and generating these glyphs are described below
+% in Section~\ref{sec:usefulinternalcommands} (and also in Section~\ref{sec:codedrawnotationbox}).
+%
+% The `arrow' hieroglyphs are built up in stages using TikZ. We first create a
+% command for drawing the square (\cmd{\DrawNotationBox};
+% see Section~\ref{sec:codedrawnotationbox}) and then draw the
+% contents (lines, arrows, arcs of circles). For an example,
+% see the D~form \rrh{D}\ constructed in Section~\ref{sec:coderotationD}.
+%
+% The `letter' hieroglyphs (glyphs for which the rotations cannot be seen from the front,
+% and hence cannot have arrows) just give a letter representation of the rotation
+% (say, Bw for `back wide'). These glyphs are therefore made using an fbox (for convenience),
+% and therefore these are sometimes not square. Some vertical fine-tuning using
+% the \verb!\raisebox! command is often required to force these `letter' glyphs to
+% have the same vertical position as their `arrow' cousins. For an example,
+% see the form \rrh{Bw}\ constructed Section~\ref{sec:coderotationBw}).
%
% 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 TikZ scale=0.5.
+%
+%
+% \subsubsection{\hspace{3mm}DrawNotationBox}
+% \label{sec:codedrawnotationbox}
%
%
% \begin{macro}{\DrawNotationBox}
@@ -4389,7 +5641,7 @@
% 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
+% todo: ? make this a proper internal command
% using \verb!@! sometime.
%
% \begin{macrocode}
@@ -4403,10 +5655,11 @@
% (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 centre and a start point.
% Note that the final argument does not use any units.
+% For the TikZ ARC command see TikZ pgfmanual (2012) page~146 (\S 14.8).
%
-% TODO: make a small diagram to illustrate the position of these
+% todo: make a small diagram to illustrate the position of these
% parameters and make things a bit clearer sometime.
%
%\begin{macrocode}
@@ -4422,23 +5675,148 @@
\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}}
+% \subsubsection{\hspace{3mm}Some useful internal commands}
+% \label{sec:usefulinternalcommands}
+%
+% \begin{macro}{\@rr}
+% \begin{macro}{\@rrp}
+% \begin{macro}{\@rrw}
+% \begin{macro}{\@rrwp}
+% \begin{macro}{\@rrs}
+% \begin{macro}{\@rrsp}
+% \begin{macro}{\@rra}
+% \begin{macro}{\@rrap}
+% \begin{macro}{\@xyzh}
+% \begin{macro}{\@xyzhp}
+% \begin{macro}{\@xyzRubik}
+% \begin{macro}{\@xyzRubikp}
+% \begin{macro}{\@SquareLetter}
+% \begin{macro}{\@hRubik}
+% These internal commands are used to generate the
+% prime, w, w-prime, s, s-prime, a, a-prime
+% rotation commands. The \cmd{\@xyz..} commands are used to generate the
+% x, y, z, u, d, l, r, f, b commands and their associated prime rotation commands.
+% The \cmd{\@SquareLetter} command is used to form the separate square hieroglyph form
+% used for rotations with no visible representation from the front
+% (e.g.,~B.., Fs, Fsp, Fa, Fap, S, Sp, Sf, Sfp, Sb, Sbp).
+% The \cmd{\@hRubik} is the vertical shift used to raise the box carrying the rotation
+% rotation-code in \cmd{\Rubik..} commands not visible from the front.
+%
+% The commands \verb!\@xyzhbdfl! and \verb!\@xyzbdflRubik! relate to the
+% axis rotations denoted as b, d, f, l; since these four letters have long upstrokes
+% they require special fine-tuning for vertical position.
+%
+% The idea is that by using these internal
+% tools taking parameters we are able to more easily standardise the size
+% and position of all the various glyphs. For details of the
+% rubikfont and rubikprime see Section~\ref{sec:coderubikfont}).
+%
+% Note that the TikZ `thick' line code = 0.8pt (used in \cmd{\@SquareLetter}).
+%
+% \begin{macrocode}
+\newcommand{\@rr}[1]{{\@rubikfont #1}}
+\newcommand{\@rrp}[1]{{\@rubikfont #1\@rubikprime}}
+\newcommand{\@rrw}[1]{{\@rubikfont #1{\@rubikfontFNS w}}}
+\newcommand{\@rrwp}[1]{{\@rubikfont #1{\@rubikfontFNS w}\@rubikprime}}
+\newcommand{\@rrs}[1]{{\@rubikfont #1{\@rubikfontFNS s}}}
+\newcommand{\@rrsp}[1]{{\@rubikfont #1{\@rubikfontFNS s}\@rubikprime}}
+\newcommand{\@rra}[1]{{\@rubikfont #1{\@rubikfontFNS a}}}
+\newcommand{\@rrap}[1]{{\@rubikfont #1{\@rubikfontFNS a}\@rubikprime}}
+\newcommand{\@rru}[1]{{\@rubikfont #1{\@rubikfontFNS u}}}
+\newcommand{\@rrup}[1]{{\@rubikfont #1{\@rubikfontFNS u}\@rubikprime}}
+\newcommand{\@rrd}[1]{{\@rubikfont #1{\@rubikfontFNS d}}}
+\newcommand{\@rrdp}[1]{{\@rubikfont #1{\@rubikfontFNS d}\@rubikprime}}
+\newcommand{\@rrl}[1]{{\@rubikfont #1{\@rubikfontFNS l}}}
+\newcommand{\@rrlp}[1]{{\@rubikfont #1{\@rubikfontFNS l}\@rubikprime}}
+\newcommand{\@rrr}[1]{{\@rubikfont #1{\@rubikfontFNS r}}}
+\newcommand{\@rrrp}[1]{{\@rubikfont #1{\@rubikfontFNS r}\@rubikprime}}
+\newcommand{\@rrf}[1]{{\@rubikfont #1{\@rubikfontFNS f}}}
+\newcommand{\@rrfp}[1]{{\@rubikfont #1{\@rubikfontFNS f}\@rubikprime}}
+\newcommand{\@rrb}[1]{{\@rubikfont #1{\@rubikfontFNS b}}}
+\newcommand{\@rrbp}[1]{{\@rubikfont #1{\@rubikfontFNS b}\@rubikprime}}
+\newcommand{\@rrc}[1]{{\@rubikfont #1{\@rubikfontFNS c}}}
+\newcommand{\@rrcp}[1]{{\@rubikfont #1{\@rubikfontFNS c}\@rubikprime}}
+\newcommand{\@rrm}[1]{{\@rubikfont #1{\@rubikfontFNS m}}}
+\newcommand{\@rrmp}[1]{{\@rubikfont #1{\@rubikfontFNS m}\@rubikprime}}
+\newcommand{\@xyzh}[1]{[{\@rubikfont #1}]}
+\newcommand{\@xyzhp}[1]{[{\@rubikfont #1\@rubikprime}]}
+\newcommand{\@xyzRubik}[1]{\raisebox{3.45pt}{[{\@rubikfont #1}]}}
+\newcommand{\@xyzRubikp}[1]{\raisebox{3.45pt}{[{\@rubikfont #1\@rubikprime}]}}
+\newcommand{\@xyzhbdfl}[1]{[\raisebox{-0.6pt}{{\@rubikfont #1}}]}
+\newcommand{\@xyzbdflRubik}[1]{\raisebox{3.45pt}{[\raisebox{-0.6pt}{{\@rubikfont #1}}]}}
+\newcommand{\@SquareLetter}[1]{\setlength{\fboxsep}{2.5pt}%
+ \setlength{\fboxrule}{0.8pt}%
+ \fbox{\rule[-1pt]{0pt}{8.5pt}\raisebox{-0.5pt}{#1}}}
+\newlength\@hRubik%
+\setlength{\@hRubik}{0.185cm}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\@tlen}
+% Feb 2017 (RWDN): \ We also need to define a small length for fine-tuning the default
+% horizontal space between a pair of `letter' hieroglyphs, eg~B (i.e.,~when no
+% additional space has been added by the user), so that this matches that between a pair of
+% `arrow' hieroglyphs. This length is inserted on both sides of the square frame.
+% This length is used in two settings: (a)~in `letter' hieroglyphs (for an example,
+% see the definition of the macro \cmd{\SquareB} in Section~\ref{sec:coderotationB}),
+% and in (b)~in `arrow' hieroglyphs (for an example,
+% see the definition of the macro \cmd{\rrhD} in Section~\ref{sec:coderotationD}).
+%
+%\begin{macrocode}
+\newcommand{\@tlen}{\hspace{1pt}}%
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \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 (many thanks\,!).
+% {\newline}\textsc{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}
+%
+%
+%
+%
+% \subsubsection{\hspace{3mm}Using {\textbackslash}\texttt{@join}}
% \label{sec:cmdsusingjoin}
%
% \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 following four commands typeset a single rotation, where the rotation-code (e.g.,~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
+% 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.
%
@@ -4461,6 +5839,7 @@
%
%
% \subsubsection{\hspace{3mm}Rotation B}
+% \label{sec:coderotationB}
%
% \begin{macro}{\rrB}
% \begin{macro}{\SquareB}
@@ -4469,12 +5848,20 @@
% \begin{macro}{\textRubikB}
% These commands all draw forms which denote the B (\textsc{back}-face) rotation.
% Not visible from the front.
+%
+% Feb 2017 (RWDN): added the \cmd{\@tlen} length (= 1pt; defined above) to the
+% \cmd{\SquareB} command, and removed the terminal \cmd{\,} space
+% from the rrhB, RubikB, textRubikB commands, and copied
+% this action with all the subsequent Letter hieroglyphs (e.g.,~B, Bw,..).
+% These minor changes were to improve the spacing between two Letter hieroglyphs,
+% and make it match that between two square `arrow' hieroglyphs.
+% The same changes were made to all the `letter' hieroglyphs.
% \begin{macrocode}
\newcommand{\rrB}{\@rr{B}}
-\newcommand{\SquareB}{\@SquareLetter{\rrB}}
-\newcommand{\rrhB}{\raisebox{-0.25mm}{\SquareB}\,}
-\newcommand{\RubikB}{\raisebox{\@hRubik}{\SquareB}\,}
-\newcommand{\textRubikB}{\rrhB\,}
+\newcommand{\SquareB}{\@tlen\@SquareLetter{\rrB}\@tlen}
+\newcommand{\rrhB}{\raisebox{-0.25mm}{\SquareB}}
+\newcommand{\RubikB}{\raisebox{\@hRubik}{\SquareB}}
+\newcommand{\textRubikB}{\rrhB}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -4494,10 +5881,10 @@
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrBp}{\@rrp{B}}
-\newcommand{\SquareBp}{\@SquareLetter{\rrBp}}
-\newcommand{\rrhBp}{\raisebox{-0.25mm}{\SquareBp}\,}
-\newcommand{\RubikBp}{\raisebox{\@hRubik}{\SquareBp}\,}
-\newcommand{\textRubikBp}{\rrhBp\,}
+\newcommand{\SquareBp}{\@tlen\@SquareLetter{\rrBp}\@tlen}
+\newcommand{\rrhBp}{\raisebox{-0.25mm}{\SquareBp}}
+\newcommand{\RubikBp}{\raisebox{\@hRubik}{\SquareBp}}
+\newcommand{\textRubikBp}{\rrhBp}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -4507,6 +5894,7 @@
%
%
% \subsubsection{\hspace{3mm}Rotation Bw}
+% \label{sec:coderotationBw}
%
% \begin{macro}{\rrBw}
% \begin{macro}{\SquareBw}
@@ -4516,12 +5904,11 @@
% These commands all draw forms which denote the Bw rotation.
% Not visible from the front.
% \begin{macrocode}
-%\newcommand{\rrBw}{\textbf{\textsf{Bw}}}
\newcommand{\rrBw}{\@rrw{B}}
-\newcommand{\SquareBw}{\@SquareLetter{\rrBw}}
-\newcommand{\rrhBw}{\raisebox{-0.25mm}{\SquareBw}\,}
-\newcommand{\RubikBw}{\raisebox{\@hRubik}{\SquareBw}\,}
-\newcommand{\textRubikBw}{\rrhBw\,}
+\newcommand{\SquareBw}{\@tlen\@SquareLetter{\rrBw}\@tlen}
+\newcommand{\rrhBw}{\raisebox{-0.25mm}{\SquareBw}}
+\newcommand{\RubikBw}{\raisebox{\@hRubik}{\SquareBw}}
+\newcommand{\textRubikBw}{\rrhBw}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -4540,12 +5927,11 @@
% These commands all draw forms which denote the Bwp rotation.
% Not visible from the front.
% \begin{macrocode}
-%\newcommand{\rrBwp}{\textbf{\textsf{Bwp}}}
\newcommand{\rrBwp}{\@rrwp{B}}
-\newcommand{\SquareBwp}{\@SquareLetter{\rrBwp}}
-\newcommand{\rrhBwp}{\raisebox{-0.25mm}{\SquareBwp}\,}
-\newcommand{\RubikBwp}{\raisebox{\@hRubik}{\SquareBwp}\,}
-\newcommand{\textRubikBwp}{\rrhBwp\,}
+\newcommand{\SquareBwp}{\@tlen\@SquareLetter{\rrBwp}\@tlen}
+\newcommand{\rrhBwp}{\raisebox{-0.25mm}{\SquareBwp}}
+\newcommand{\RubikBwp}{\raisebox{\@hRubik}{\SquareBwp}}
+\newcommand{\textRubikBwp}{\rrhBwp}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -4564,12 +5950,11 @@
% These commands all draw forms which denote the Bs rotation.
% Not visible from the front.
% \begin{macrocode}
-%\newcommand{\rrBs}{\textbf{\textsf{Bs}}}
\newcommand{\rrBs}{\@rrs{B}}
-\newcommand{\SquareBs}{\@SquareLetter{\rrBs}}
-\newcommand{\rrhBs}{\raisebox{-0.25mm}{\SquareBs}\,}
-\newcommand{\RubikBs}{\raisebox{\@hRubik}{\SquareBs}\,}
-\newcommand{\textRubikBs}{\rrhBs\,}
+\newcommand{\SquareBs}{\@tlen\@SquareLetter{\rrBs}\@tlen}
+\newcommand{\rrhBs}{\raisebox{-0.25mm}{\SquareBs}}
+\newcommand{\RubikBs}{\raisebox{\@hRubik}{\SquareBs}}
+\newcommand{\textRubikBs}{\rrhBs}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -4588,12 +5973,11 @@
% These commands all draw forms which denote the Bsp rotation.
% Not visible from the front.
% \begin{macrocode}
-%\newcommand{\rrBsp}{\textbf{\textsf{Bsp}}}
\newcommand{\rrBsp}{\@rrsp{B}}
-\newcommand{\SquareBsp}{\@SquareLetter{\rrBsp}}
-\newcommand{\rrhBsp}{\raisebox{-0.25mm}{\SquareBsp}\,}
-\newcommand{\RubikBsp}{\raisebox{\@hRubik}{\SquareBsp}\,}
-\newcommand{\textRubikBsp}{\rrhBsp\,}
+\newcommand{\SquareBsp}{\@tlen\@SquareLetter{\rrBsp}\@tlen}
+\newcommand{\rrhBsp}{\raisebox{-0.25mm}{\SquareBsp}}
+\newcommand{\RubikBsp}{\raisebox{\@hRubik}{\SquareBsp}}
+\newcommand{\textRubikBsp}{\rrhBsp}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -4612,12 +5996,11 @@
% These commands all draw forms which denote the Ba rotation.
% Not visible from the front.
% \begin{macrocode}
-%\newcommand{\rrBa}{\textbf{\textsf{Ba}}}
\newcommand{\rrBa}{\@rra{B}}
-\newcommand{\SquareBa}{\@SquareLetter{\rrBa}}
-\newcommand{\rrhBa}{\raisebox{-0.25mm}{\SquareBa}\,}
-\newcommand{\RubikBa}{\raisebox{\@hRubik}{\SquareBa}\,}
-\newcommand{\textRubikBa}{\rrhBa\,}
+\newcommand{\SquareBa}{\@tlen\@SquareLetter{\rrBa}\@tlen}
+\newcommand{\rrhBa}{\raisebox{-0.25mm}{\SquareBa}}
+\newcommand{\RubikBa}{\raisebox{\@hRubik}{\SquareBa}}
+\newcommand{\textRubikBa}{\rrhBa}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -4636,12 +6019,11 @@
% These commands all draw forms which denote the Bap rotation.
% Not visible from the front.
% \begin{macrocode}
-%\newcommand{\rrBap}{\textbf{\textsf{Bap}}}
\newcommand{\rrBap}{\@rrap{B}}
-\newcommand{\SquareBap}{\@SquareLetter{\rrBap}}
-\newcommand{\rrhBap}{\raisebox{-0.25mm}{\SquareBap}\,}
-\newcommand{\RubikBap}{\raisebox{\@hRubik}{\SquareBap}\,}
-\newcommand{\textRubikBap}{\rrhBap\,}
+\newcommand{\SquareBap}{\@tlen\@SquareLetter{\rrBap}\@tlen}
+\newcommand{\rrhBap}{\raisebox{-0.25mm}{\SquareBap}}
+\newcommand{\RubikBap}{\raisebox{\@hRubik}{\SquareBap}}
+\newcommand{\textRubikBap}{\rrhBap}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -4651,6 +6033,7 @@
%
%
% \subsubsection{\hspace{3mm}Rotation D}
+% \label{sec:coderotationD}
%
% \begin{macro}{\rrD}
% \begin{macro}{\SquareD}
@@ -4658,8 +6041,12 @@
% \begin{macro}{\RubikD}
% \begin{macro}{\textRubikD}
% These commands all draw forms which denote the D rotation.
+%
+% Feb 2017 (RWDN): \ added the \cmd{\@tlen} length to the \cmd{\rrhD} command to improve the
+% spacing between two `arrow' square hieroglyphs; and also removed the terminal \cmd{\,}
+% space. The same changes were made to all the `arrow' hieroglyphs.
% \begin{macrocode}
-\newcommand{\rrD}{\textbf{\textsf{D}}}
+\newcommand{\rrD}{\@rr{D}}
%%
\newcommand{\SquareD}{%
\begin{tikzpicture}[scale=0.5]
@@ -4669,15 +6056,16 @@
\draw [thick, ->] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhD}{\raisebox{-0.333\height}{\SquareD}\,}
+\newcommand{\rrhD}{\raisebox{-0.333\height}{\@tlen\SquareD\@tlen}}
%%
\newcommand{\RubikD}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareD\\
-\rrD
+\rrD%
\end{minipage}%
-}
+}}
\newcommand{\textRubikD}{\rrD\,\rrhD}
% \end{macrocode}
% \end{macro}
@@ -4696,7 +6084,7 @@
% \begin{macro}{\textRubikDp}
% These commands all draw forms which denote the Dp rotation.
% \begin{macrocode}
-\newcommand{\rrDp}{\textbf{\textsf{D}$^\prime$}}
+\newcommand{\rrDp}{\@rrp{D}}
%%
\newcommand{\SquareDp}{%
\begin{tikzpicture}[scale=0.5]
@@ -4706,15 +6094,16 @@
\draw [thick, <-] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDp}{\raisebox{-0.333\height}{\SquareDp}\,}
+\newcommand{\rrhDp}{\raisebox{-0.333\height}{\@tlen\SquareDp\@tlen}}
%%
\newcommand{\RubikDp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDp\\
-\rrDp
+\rrDp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDp}{\rrDp\,\rrhDp}
% \end{macrocode}
% \end{macro}
@@ -4733,7 +6122,7 @@
% \begin{macro}{\textRubikDw}
% These commands all draw forms which denote the Dw rotation.
% \begin{macrocode}
-\newcommand{\rrDw}{\textbf{\textsf{D\footnotesize{w}}}}
+\newcommand{\rrDw}{\@rrw{D}}
%%
\newcommand{\SquareDw}{%
\begin{tikzpicture}[scale=0.5]
@@ -4743,15 +6132,16 @@
\draw [thick, ->] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDw}{\raisebox{-0.333\height}{\SquareDw}\,}
+\newcommand{\rrhDw}{\raisebox{-0.333\height}{\@tlen\SquareDw\@tlen}}
%%
\newcommand{\RubikDw}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDw\\
-\rrDw
+\rrDw%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDw}{\rrDw\,\rrhDw}
% \end{macrocode}
% \end{macro}
@@ -4770,7 +6160,7 @@
% \begin{macro}{\textRubikDwp}
% These commands all draw forms which denote the Dwp rotation.
% \begin{macrocode}
-\newcommand{\rrDwp}{\textbf{\textsf{D\footnotesize{w}}$^\prime$}}
+\newcommand{\rrDwp}{\@rrwp{D}}
%%
\newcommand{\SquareDwp}{%
\begin{tikzpicture}[scale=0.5]
@@ -4780,15 +6170,16 @@
\draw [thick, <-] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDwp}{\raisebox{-0.333\height}{\SquareDwp}\,}
+\newcommand{\rrhDwp}{\raisebox{-0.333\height}{\@tlen\SquareDwp\@tlen}}
%%
\newcommand{\RubikDwp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDwp\\
-\rrDwp
+\rrDwp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDwp}{\rrDwp\,\rrhDwp}
% \end{macrocode}
% \end{macro}
@@ -4817,15 +6208,16 @@
\draw [thick, ->] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDs}{\raisebox{-0.333\height}{\SquareDs}\,}
+\newcommand{\rrhDs}{\raisebox{-0.333\height}{\@tlen\SquareDs\@tlen}}
%%
\newcommand{\RubikDs}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDs\\
-\rrDs
+\rrDs%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDs}{\rrDs\,\rrhDs}
% \end{macrocode}
% \end{macro}
@@ -4854,15 +6246,16 @@
\draw [thick, <-] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDsp}{\raisebox{-0.333\height}{\SquareDsp}\,}
+\newcommand{\rrhDsp}{\raisebox{-0.333\height}{\@tlen\SquareDsp\@tlen}}
%%
\newcommand{\RubikDsp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDsp\\
-\rrDsp
+\rrDsp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDsp}{\rrDsp\,\rrhDsp}
% \end{macrocode}
% \end{macro}
@@ -4891,15 +6284,16 @@
\draw [thick, ->] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDa}{\raisebox{-0.333\height}{\SquareDa}\,}
+\newcommand{\rrhDa}{\raisebox{-0.333\height}{\@tlen\SquareDa\@tlen}}
%%
\newcommand{\RubikDa}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDa\\
-\rrDa
+\rrDa%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDa}{\rrDa\,\rrhDa}
% \end{macrocode}
% \end{macro}
@@ -4928,15 +6322,16 @@
\draw [thick, <-] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDap}{\raisebox{-0.333\height}{\SquareDap}\,}
+\newcommand{\rrhDap}{\raisebox{-0.333\height}{\@tlen\SquareDap\@tlen}}
%%
\newcommand{\RubikDap}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDap\\
-\rrDap
+\rrDap%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDap}{\rrDap\,\rrhDap}
% \end{macrocode}
% \end{macro}
@@ -4955,7 +6350,7 @@
% \begin{macro}{\textRubikE}
% These commands all draw forms which denote the E rotation.
% \begin{macrocode}
-\newcommand{\rrE}{\textbf{\textsf{E}}}
+\newcommand{\rrE}{\@rr{E}}
%%
\newcommand{\SquareE}{%
\begin{tikzpicture}[scale=0.5]
@@ -4965,15 +6360,16 @@
\draw [thick] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhE}{\raisebox{-0.333\height}{\SquareE}\,}
+\newcommand{\rrhE}{\raisebox{-0.333\height}{\@tlen\SquareE\@tlen}}
%%
\newcommand{\RubikE}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareE\\
-\rrE
+\rrE%
\end{minipage}%
-}
+}}
\newcommand{\textRubikE}{\rrE\,\rrhE}
% \end{macrocode}
% \end{macro}
@@ -4992,7 +6388,7 @@
% \begin{macro}{\textRubikEp}
% These commands all draw forms which denote the Ep rotation.
% \begin{macrocode}
-\newcommand{\rrEp}{\textbf{\textsf{E}$^\prime$}}
+\newcommand{\rrEp}{\@rrp{E}}
%%
\newcommand{\SquareEp}{%
\begin{tikzpicture}[scale=0.5]
@@ -5002,15 +6398,16 @@
\draw [thick] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhEp}{\raisebox{-0.333\height}{\SquareEp}\,}
+\newcommand{\rrhEp}{\raisebox{-0.333\height}{\@tlen\SquareEp\@tlen}}
%%
\newcommand{\RubikEp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareEp\\
-\rrEp
+\rrEp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikEp}{\rrEp\,\rrhEp}
% \end{macrocode}
% \end{macro}
@@ -5029,7 +6426,7 @@
% \begin{macro}{\textRubikF}
% These commands all draw forms which denote the F rotation.
% \begin{macrocode}
-\newcommand{\rrF}{\textbf{\textsf{F}}}
+\newcommand{\rrF}{\@rr{F}}
%%
\newcommand{\SquareF}{%
\begin{tikzpicture}[scale=0.5]
@@ -5037,15 +6434,16 @@
\draw [thick, <-] (\@scx, \@scy) arc[radius=0.35, start angle=-60, delta angle=290];
\end{tikzpicture}%
}
-\newcommand{\rrhF}{\raisebox{-0.333\height}{\SquareF}\,}
+\newcommand{\rrhF}{\raisebox{-0.333\height}{\@tlen\SquareF\@tlen}}
%%
\newcommand{\RubikF}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareF\\
-\rrF
+\rrF%
\end{minipage}%
-}
+}}
\newcommand{\textRubikF}{\rrF\,\rrhF}
% \end{macrocode}
% \end{macro}
@@ -5064,7 +6462,7 @@
% \begin{macro}{\textRubikFp}
% These commands all draw forms which denote the Fp rotation.
% \begin{macrocode}
-\newcommand{\rrFp}{\textbf{\textsf{F}$^\prime$}}
+\newcommand{\rrFp}{\@rrp{F}}
%%
\newcommand{\SquareFp}{%
\begin{tikzpicture}[scale=0.5]
@@ -5072,15 +6470,16 @@
\draw [thick, ->] (\@scx, \@scy) arc[radius=0.35, start angle=-60, delta angle=290];
\end{tikzpicture}%
}
-\newcommand{\rrhFp}{\raisebox{-0.333\height}{\SquareFp}\,}
+\newcommand{\rrhFp}{\raisebox{-0.333\height}{\@tlen\SquareFp\@tlen}}
%%
\newcommand{\RubikFp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareFp\\
-\rrFp
+\rrFp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikFp}{\rrFp\,\rrhFp}
% \end{macrocode}
% \end{macro}
@@ -5099,7 +6498,7 @@
% \begin{macro}{\textRubikFw}
% These commands all draw forms which denote the Fw rotation.
% \begin{macrocode}
-\newcommand{\rrFw}{\textbf{\textsf{F\footnotesize{w}}}}
+\newcommand{\rrFw}{\@rrw{F}}
%%
\newcommand{\SquareFw}{%
\begin{tikzpicture}[scale=0.5]
@@ -5109,15 +6508,16 @@
%\node (squareLab) at (0.5,0.5) {$o$};
\end{tikzpicture}%
}
-\newcommand{\rrhFw}{\raisebox{-0.333\height}{\SquareFw}\,}
+\newcommand{\rrhFw}{\raisebox{-0.333\height}{\@tlen\SquareFw\@tlen}}
%%
\newcommand{\RubikFw}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareFw\\
-\rrFw
+\rrFw%
\end{minipage}%
-}
+}}
\newcommand{\textRubikFw}{\rrFw\,\rrhFw}
% \end{macrocode}
% \end{macro}
@@ -5136,7 +6536,7 @@
% \begin{macro}{\textRubikFwp}
% These commands all draw forms which denote the Fwp rotation.
% \begin{macrocode}
-\newcommand{\rrFwp}{\textbf{\textsf{F\footnotesize{w}}$^\prime$}}
+\newcommand{\rrFwp}{\@rrwp{F}}
%%
\newcommand{\SquareFwp}{%
\begin{tikzpicture}[scale=0.5]
@@ -5145,15 +6545,16 @@
\draw [thick] (\@sqcx,\@sqcy) arc[radius=0.1, start angle=-60, delta angle=360];
\end{tikzpicture}%
}
-\newcommand{\rrhFwp}{\raisebox{-0.333\height}{\SquareFwp}\,}
+\newcommand{\rrhFwp}{\raisebox{-0.333\height}{\@tlen\SquareFwp\@tlen}}
%%
\newcommand{\RubikFwp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareFwp\\
-\rrFwp
+\rrFwp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikFwp}{\rrFwp\,\rrhFwp}
%%
% \end{macrocode}
@@ -5179,10 +6580,10 @@
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrFs}{\@rrs{F}}
-\newcommand{\SquareFs}{\@SquareLetter{\rrFs}}
-\newcommand{\rrhFs}{\raisebox{-0.25mm}{\SquareFs}\,}
-\newcommand{\RubikFs}{\raisebox{\@hRubik}{\SquareFs}\,}
-\newcommand{\textRubikFs}{\rrhFs\,}
+\newcommand{\SquareFs}{\@tlen\@SquareLetter{\rrFs}\@tlen}
+\newcommand{\rrhFs}{\raisebox{-0.25mm}{\SquareFs}}
+\newcommand{\RubikFs}{\raisebox{\@hRubik}{\SquareFs}}
+\newcommand{\textRubikFs}{\rrhFs}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -5205,10 +6606,10 @@
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrFsp}{\@rrsp{F}}
-\newcommand{\SquareFsp}{\@SquareLetter{\rrFsp}}
-\newcommand{\rrhFsp}{\raisebox{-0.25mm}{\SquareFsp}\,}
-\newcommand{\RubikFsp}{\raisebox{\@hRubik}{\SquareFsp}\,}
-\newcommand{\textRubikFsp}{\rrhFsp\,}
+\newcommand{\SquareFsp}{\@tlen\@SquareLetter{\rrFsp}\@tlen}
+\newcommand{\rrhFsp}{\raisebox{-0.25mm}{\SquareFsp}}
+\newcommand{\RubikFsp}{\raisebox{\@hRubik}{\SquareFsp}}
+\newcommand{\textRubikFsp}{\rrhFsp}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -5231,10 +6632,10 @@
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrFa}{\@rra{F}}
-\newcommand{\SquareFa}{\@SquareLetter{\rrFa}}
-\newcommand{\rrhFa}{\raisebox{-0.25mm}{\SquareFa}\,}
-\newcommand{\RubikFa}{\raisebox{\@hRubik}{\SquareFa}\,}
-\newcommand{\textRubikFa}{\rrhFa\,}
+\newcommand{\SquareFa}{\@tlen\@SquareLetter{\rrFa}\@tlen}
+\newcommand{\rrhFa}{\raisebox{-0.25mm}{\SquareFa}}
+\newcommand{\RubikFa}{\raisebox{\@hRubik}{\SquareFa}}
+\newcommand{\textRubikFa}{\rrhFa}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -5257,10 +6658,10 @@
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrFap}{\@rrap{F}}
-\newcommand{\SquareFap}{\@SquareLetter{\rrFap}}
-\newcommand{\rrhFap}{\raisebox{-0.25mm}{\SquareFap}\,}
-\newcommand{\RubikFap}{\raisebox{\@hRubik}{\SquareFap}\,}
-\newcommand{\textRubikFap}{\rrhFap\,}
+\newcommand{\SquareFap}{\@tlen\@SquareLetter{\rrFap}\@tlen}
+\newcommand{\rrhFap}{\raisebox{-0.25mm}{\SquareFap}}
+\newcommand{\RubikFap}{\raisebox{\@hRubik}{\SquareFap}}
+\newcommand{\textRubikFap}{\rrhFap}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -5277,7 +6678,7 @@
% \begin{macro}{\textRubikL}
% These commands all draw forms which denote the L rotation.
% \begin{macrocode}
-\newcommand{\rrL}{\textbf{\textsf{L}}}
+\newcommand{\rrL}{\@rr{L}}
%%
\newcommand{\SquareL}{%
\begin{tikzpicture}[scale=0.5]
@@ -5287,15 +6688,16 @@
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhL}{\raisebox{-0.333\height}{\SquareL}\,}
+\newcommand{\rrhL}{\raisebox{-0.333\height}{\@tlen\SquareL\@tlen}}
%%
\newcommand{\RubikL}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareL\\
-\rrL
+\rrL%
\end{minipage}%
-}
+}}
\newcommand{\textRubikL}{\rrL\,\rrhL}
% \end{macrocode}
% \end{macro}
@@ -5314,7 +6716,7 @@
% \begin{macro}{\textRubikLp}
% These commands all draw forms which denote the Lp rotation.
% \begin{macrocode}
-\newcommand{\rrLp}{\textbf{\textsf{L}$^\prime$}}
+\newcommand{\rrLp}{\@rrp{L}}
%%
\newcommand{\SquareLp}{%
\begin{tikzpicture}[scale=0.5]
@@ -5324,15 +6726,16 @@
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLp}{\raisebox{-0.333\height}{\SquareLp}\,}
+\newcommand{\rrhLp}{\raisebox{-0.333\height}{\@tlen\SquareLp\@tlen}}
%%
\newcommand{\RubikLp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLp\\
-\rrLp
+\rrLp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLp}{\rrLp\,\rrhLp}
% \end{macrocode}
% \end{macro}
@@ -5351,7 +6754,7 @@
% \begin{macro}{\textRubikLw}
% These commands all draw forms which denote the Lw rotation.
% \begin{macrocode}
-\newcommand{\rrLw}{\textbf{\textsf{L\footnotesize{w}}}}
+\newcommand{\rrLw}{\@rrw{L}}
%%
\newcommand{\SquareLw}{%
\begin{tikzpicture}[scale=0.5]
@@ -5361,15 +6764,16 @@
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLw}{\raisebox{-0.333\height}{\SquareLw}\,}
+\newcommand{\rrhLw}{\raisebox{-0.333\height}{\@tlen\SquareLw\@tlen}}
%%
\newcommand{\RubikLw}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLw\\
-\rrLw
+\rrLw%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLw}{\rrLw\,\rrhLw}
% \end{macrocode}
% \end{macro}
@@ -5388,7 +6792,7 @@
% \begin{macro}{\textRubikLwp}
% These commands all draw forms which denote the Lwp rotation.
% \begin{macrocode}
-\newcommand{\rrLwp}{\textbf{\textsf{L\footnotesize{w}}$^\prime$}}
+\newcommand{\rrLwp}{\@rrwp{L}}
%%
\newcommand{\SquareLwp}{%
\begin{tikzpicture}[scale=0.5]
@@ -5398,15 +6802,16 @@
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLwp}{\raisebox{-0.333\height}{\SquareLwp}\,}
+\newcommand{\rrhLwp}{\raisebox{-0.333\height}{\@tlen\SquareLwp\@tlen}}
%%
\newcommand{\RubikLwp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLwp\\
-\rrLwp
+\rrLwp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLwp}{\rrLwp\,\rrhLwp}
% \end{macrocode}
% \end{macro}
@@ -5435,15 +6840,16 @@
\draw [thick, <-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLs}{\raisebox{-0.333\height}{\SquareLs}\,}
+\newcommand{\rrhLs}{\raisebox{-0.333\height}{\@tlen\SquareLs\@tlen}}
%%
\newcommand{\RubikLs}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLs\\
-\rrLs
+\rrLs%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLs}{\rrLs\,\rrhLs}
% \end{macrocode}
% \end{macro}
@@ -5472,15 +6878,16 @@
\draw [thick, ->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLsp}{\raisebox{-0.333\height}{\SquareLsp}\,}
+\newcommand{\rrhLsp}{\raisebox{-0.333\height}{\@tlen\SquareLsp\@tlen}}
%%
\newcommand{\RubikLsp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLsp\\
-\rrLsp
+\rrLsp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLsp}{\rrLsp\,\rrhLsp}
% \end{macrocode}
% \end{macro}
@@ -5509,15 +6916,16 @@
\draw [thick, ->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLa}{\raisebox{-0.333\height}{\SquareLa}\,}
+\newcommand{\rrhLa}{\raisebox{-0.333\height}{\@tlen\SquareLa\@tlen}}
%%
\newcommand{\RubikLa}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLa\\
-\rrLa
+\rrLa%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLa}{\rrLa\,\rrhLa}
% \end{macrocode}
% \end{macro}
@@ -5546,15 +6954,16 @@
\draw [thick, <-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLap}{\raisebox{-0.333\height}{\SquareLap}\,}
+\newcommand{\rrhLap}{\raisebox{-0.333\height}{\@tlen\SquareLap\@tlen}}
%%
\newcommand{\RubikLap}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLap\\
-\rrLap
+\rrLap%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLap}{\rrLap\,\rrhLap}
% \end{macrocode}
% \end{macro}
@@ -5573,7 +6982,7 @@
% \begin{macro}{\textRubikM}
% These commands all draw forms which denote the M rotation.
% \begin{macrocode}
-\newcommand{\rrM}{\textbf{\textsf{M}}}
+\newcommand{\rrM}{\@rr{M}}
%%
\newcommand{\SquareM}{%
\begin{tikzpicture}[scale=0.5]
@@ -5583,15 +6992,16 @@
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhM}{\raisebox{-0.333\height}{\SquareM}\,}
+\newcommand{\rrhM}{\raisebox{-0.333\height}{\@tlen\SquareM\@tlen}}
%%
\newcommand{\RubikM}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareM\\
-\rrM
+\rrM%
\end{minipage}%
-}
+}}
\newcommand{\textRubikM}{\rrM\,\rrhM}
% \end{macrocode}
% \end{macro}
@@ -5610,7 +7020,7 @@
% \begin{macro}{\textRubikMp}
% These commands all draw forms which denote the Mp rotation.
% \begin{macrocode}
-\newcommand{\rrMp}{\textbf{\textsf{M}$^\prime$}}
+\newcommand{\rrMp}{\@rrp{M}}
%%
\newcommand{\SquareMp}{%
\begin{tikzpicture}[scale=0.5]
@@ -5620,15 +7030,16 @@
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhMp}{\raisebox{-0.333\height}{\SquareMp}\,}
+\newcommand{\rrhMp}{\raisebox{-0.333\height}{\@tlen\SquareMp\@tlen}}
%%
\newcommand{\RubikMp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareMp\\
-\rrMp
+\rrMp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikMp}{\rrMp\,\rrhMp}
% \end{macrocode}
% \end{macro}
@@ -5647,7 +7058,7 @@
% \begin{macro}{\textRubikR}
% These commands all draw forms which denote the R rotation.
% \begin{macrocode}
-\newcommand{\rrR}{\textbf{\textsf{R}}}
+\newcommand{\rrR}{\@rr{R}}
%%
\newcommand{\SquareR}{%
\begin{tikzpicture}[scale=0.5]
@@ -5658,15 +7069,16 @@
\draw [thick, ->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhR}{\raisebox{-0.333\height}{\SquareR}\,}
+\newcommand{\rrhR}{\raisebox{-0.333\height}{\@tlen\SquareR\@tlen}}
%%
\newcommand{\RubikR}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareR\\
-\rrR
+\rrR%
\end{minipage}%
-}
+}}
\newcommand{\textRubikR}{\rrR\,\rrhR}
% \end{macrocode}
% \end{macro}
@@ -5685,7 +7097,7 @@
% \begin{macro}{\textRubikRp}
% These commands all draw forms which denote the Rp rotation.
% \begin{macrocode}
-\newcommand{\rrRp}{\textbf{\textsf{R}$^\prime$}}
+\newcommand{\rrRp}{\@rrp{R}}
%%
\newcommand{\SquareRp}{%
\begin{tikzpicture}[scale=0.5]
@@ -5695,15 +7107,16 @@
\draw [thick, <-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRp}{\raisebox{-0.333\height}{\SquareRp}\,}
+\newcommand{\rrhRp}{\raisebox{-0.333\height}{\@tlen\SquareRp\@tlen}}
%%
\newcommand{\RubikRp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRp\\
-\rrRp
+\rrRp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRp}{\rrRp\,\rrhRp}
% \end{macrocode}
% \end{macro}
@@ -5722,7 +7135,7 @@
% \begin{macro}{\textRubikRw}
% These commands all draw forms which denote the Rw rotation.
% \begin{macrocode}
-\newcommand{\rrRw}{\textbf{\textsf{R\footnotesize{w}}}}
+\newcommand{\rrRw}{\@rrw{R}}
%%
\newcommand{\SquareRw}{%
\begin{tikzpicture}[scale=0.5]
@@ -5732,15 +7145,16 @@
\draw [thick, ->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRw}{\raisebox{-0.333\height}{\SquareRw}\,}
+\newcommand{\rrhRw}{\raisebox{-0.333\height}{\@tlen\SquareRw\@tlen}}
%%
\newcommand{\RubikRw}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRw\\
-\rrRw
+\rrRw%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRw}{\rrRw\,\rrhRw}
% \end{macrocode}
% \end{macro}
@@ -5759,7 +7173,7 @@
% \begin{macro}{\textRubikRwp}
% These commands all draw forms which denote the Rwp rotation.
% \begin{macrocode}
-\newcommand{\rrRwp}{\textbf{\textsf{R\footnotesize{w}}$^\prime$}}
+\newcommand{\rrRwp}{\@rrwp{R}}
%%
\newcommand{\SquareRwp}{%
\begin{tikzpicture}[scale=0.5]
@@ -5769,15 +7183,16 @@
\draw [thick, <-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRwp}{\raisebox{-0.333\height}{\SquareRwp}\,}
+\newcommand{\rrhRwp}{\raisebox{-0.333\height}{\@tlen\SquareRwp\@tlen}}
%%
\newcommand{\RubikRwp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRwp\\
-\rrRwp
+\rrRwp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRwp}{\rrRwp\,\rrhRwp}
% \end{macrocode}
% \end{macro}
@@ -5806,15 +7221,16 @@
\draw [thick,->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRs}{\raisebox{-0.333\height}{\SquareRs}\,}
+\newcommand{\rrhRs}{\raisebox{-0.333\height}{\@tlen\SquareRs\@tlen}}
%%
\newcommand{\RubikRs}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRs\\
-\rrRs
+\rrRs%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRs}{\rrRs\,\rrhRs}
% \end{macrocode}
% \end{macro}
@@ -5843,15 +7259,16 @@
\draw [thick,<-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRsp}{\raisebox{-0.333\height}{\SquareRsp}\,}
+\newcommand{\rrhRsp}{\raisebox{-0.333\height}{\@tlen\SquareRsp\@tlen}}
%%
\newcommand{\RubikRsp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRsp\\
-\rrRsp
+\rrRsp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRsp}{\rrRsp\,\rrhRsp}
% \end{macrocode}
% \end{macro}
@@ -5880,15 +7297,16 @@
\draw [thick,->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRa}{\raisebox{-0.333\height}{\SquareRa}\,}
+\newcommand{\rrhRa}{\raisebox{-0.333\height}{\@tlen\SquareRa\@tlen}}
%%
\newcommand{\RubikRa}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRa\\
-\rrRa
+\rrRa%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRa}{\rrRa\,\rrhRa}
% \end{macrocode}
% \end{macro}
@@ -5917,15 +7335,16 @@
\draw [thick,<-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRap}{\raisebox{-0.333\height}{\SquareRap}\,}
+\newcommand{\rrhRap}{\raisebox{-0.333\height}{\@tlen\SquareRap\@tlen}}
%%
\newcommand{\RubikRap}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRap\\
-\rrRap
+\rrRap%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRap}{\rrRap\,\rrhRap}
% \end{macrocode}
% \end{macro}
@@ -5946,10 +7365,10 @@
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrS}{\@rr{S}}
-\newcommand{\SquareS}{\@SquareLetter{\rrS}}
-\newcommand{\rrhS}{\raisebox{-0.25mm}{\SquareS}\,}
-\newcommand{\RubikS}{\raisebox{\@hRubik}{\SquareS}\,}
-\newcommand{\textRubikS}{\rrhS\,}
+\newcommand{\SquareS}{\@tlen\@SquareLetter{\rrS}\@tlen}
+\newcommand{\rrhS}{\raisebox{-0.25mm}{\SquareS}}
+\newcommand{\RubikS}{\raisebox{\@hRubik}{\SquareS}}
+\newcommand{\textRubikS}{\rrhS}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -5969,10 +7388,10 @@
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrSp}{\@rrp{S}}
-\newcommand{\SquareSp}{\@SquareLetter{\rrSp}}
-\newcommand{\rrhSp}{\raisebox{-0.25mm}{\SquareSp}\,}
-\newcommand{\RubikSp}{\raisebox{\@hRubik}{\SquareSp}\,}
-\newcommand{\textRubikSp}{\rrhSp\,}
+\newcommand{\SquareSp}{\@tlen\@SquareLetter{\rrSp}\@tlen}
+\newcommand{\rrhSp}{\raisebox{-0.25mm}{\SquareSp}}
+\newcommand{\RubikSp}{\raisebox{\@hRubik}{\SquareSp}}
+\newcommand{\textRubikSp}{\rrhSp}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -5988,18 +7407,19 @@
% \begin{macro}{\RubikSu}
% \begin{macro}{\textRubikSu}
% These commands draw forms of the Singmaster Su slice rotation.
-% We also need to finetune the spacing
+% We also need to fine-tune the spacing
% between these `slice' hieroglyphs (especially Fs and Bs).
% \begin{macrocode}
-\newcommand{\rrSu}{\textbf{\textsf{S\footnotesize{u}}}}
+\newcommand{\rrSu}{\@rru{S}}
\newcommand{\rrhSu}{\rrhEp}%
\newcommand{\RubikSu}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareEp\\
-\rrSu
+\rrSu%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSu}{\rrSu\,\rrhEp}
% \end{macrocode}
% \end{macro}
@@ -6015,18 +7435,19 @@
% \begin{macro}{\RubikSup}
% \begin{macro}{\textRubikSup}
% These commands draw forms of the Singmaster Sup slice rotation.
-% We also need to finetune the spacing
+% We also need to fine-tune the spacing
% between these `slice' hieroglyphs (especially Fs and Bs).
% \begin{macrocode}
-\newcommand{\rrSup}{\textbf{\textsf{S\footnotesize{u}}$^\prime$}}
+\newcommand{\rrSup}{\@rrup{S}}
\newcommand{\rrhSup}{\rrhE}%
\newcommand{\RubikSup}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareE\\
-\rrSup
+\rrSup%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSup}{\rrSup\,\rrhE}
% \end{macrocode}
% \end{macro}
@@ -6043,15 +7464,16 @@
% \begin{macro}{\textRubikSd}
% These commands draw forms of the Singmaster Sd slice rotation.
% \begin{macrocode}
-\newcommand{\rrSd}{\textbf{\textsf{S\footnotesize{d}}}}
+\newcommand{\rrSd}{\@rrd{S}}
\newcommand{\rrhSd}{\rrhE}%
\newcommand{\RubikSd}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareE\\
-\rrSd
+\rrSd%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSd}{\rrSd\,\rrhE}
% \end{macrocode}
% \end{macro}
@@ -6068,15 +7490,16 @@
% \begin{macro}{\textRubikSdp}
% These commands draw forms of the Singmaster Sdp slice rotation.
% \begin{macrocode}
-\newcommand{\rrSdp}{\textbf{\textsf{S\footnotesize{d}}$^\prime$}}
+\newcommand{\rrSdp}{\@rrdp{S}}
\newcommand{\rrhSdp}{\rrhEp}%
\newcommand{\RubikSdp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareEp\\
-\rrSdp
+\rrSdp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSdp}{\rrSdp\,\rrhEp}
% \end{macrocode}
% \end{macro}
@@ -6093,15 +7516,16 @@
% \begin{macro}{\textRubikSl}
% These commands draw forms of the Singmaster Sl slice rotation.
% \begin{macrocode}
-\newcommand{\rrSl}{\textbf{\textsf{S\footnotesize{l}}}}
+\newcommand{\rrSl}{\@rrl{S}}
\newcommand{\rrhSl}{\rrhM}%
\newcommand{\RubikSl}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareM\\
-\rrSl
+\rrSl%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSl}{\rrSl\,\rrhM}
% \end{macrocode}
% \end{macro}
@@ -6118,15 +7542,16 @@
% \begin{macro}{\textRubikSlp}
% These commands draw forms of the Singmaster Slp slice rotation.
% \begin{macrocode}
-\newcommand{\rrSlp}{\textbf{\textsf{S\footnotesize{l}}$^\prime$}}
+\newcommand{\rrSlp}{\@rrlp{S}}
\newcommand{\rrhSlp}{\rrhMp}%
\newcommand{\RubikSlp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareMp\\
-\rrSlp
+\rrSlp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSlp}{\rrSlp\,\rrhMp}
% \end{macrocode}
% \end{macro}
@@ -6143,15 +7568,16 @@
% \begin{macro}{\textRubikSr}
% These commands draw forms of the Singmaster Sr slice rotation.
% \begin{macrocode}
-\newcommand{\rrSr}{\textbf{\textsf{S\footnotesize{r}}}}
+\newcommand{\rrSr}{\@rrr{S}}
\newcommand{\rrhSr}{\rrhMp}%
\newcommand{\RubikSr}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareMp\\
-\rrSr
+\rrSr%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSr}{\rrSr\,\rrhMp}
% \end{macrocode}
% \end{macro}
@@ -6168,15 +7594,16 @@
% \begin{macro}{\textRubikSrp}
% These commands draw forms of the Singmaster Srp slice rotation.
% \begin{macrocode}
-\newcommand{\rrSrp}{\textbf{\textsf{S\footnotesize{r}}$^\prime$}}
+\newcommand{\rrSrp}{\@rrrp{S}}
\newcommand{\rrhSrp}{\rrhM}%
\newcommand{\RubikSrp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareM\\
-\rrSrp
+\rrSrp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSrp}{\rrSrp\,\rrhM}
% \end{macrocode}
% \end{macro}
@@ -6199,11 +7626,11 @@
% bounded by \{\} so no need to reset to defaults.
% Not visible from the front.
% \begin{macrocode}
-\newcommand{\rrSf}{\textbf{\textsf{S\footnotesize{f}}}}
-\newcommand{\SquareSf}{\@SquareLetter{\rrSf}}
-\newcommand{\rrhSf}{\raisebox{-0.25mm}{\SquareSf}\,}
-\newcommand{\RubikSf}{\raisebox{\@hRubik}{\SquareSf}\,}
-\newcommand{\textRubikSf}{\rrhSf\,}
+\newcommand{\rrSf}{\@rrf{S}}
+\newcommand{\SquareSf}{\@tlen\@SquareLetter{\rrSf}\@tlen}
+\newcommand{\rrhSf}{\raisebox{-0.25mm}{\SquareSf}}
+\newcommand{\RubikSf}{\raisebox{\@hRubik}{\SquareSf}}
+\newcommand{\textRubikSf}{\rrhSf}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -6225,11 +7652,11 @@
% bounded by \{\} so no need to reset to defaults.
% Not visible from the front.
% \begin{macrocode}
-\newcommand{\rrSfp}{\textbf{\textsf{S\footnotesize{f}}$^\prime$}}
-\newcommand{\SquareSfp}{\@SquareLetter{\rrSfp}}
-\newcommand{\rrhSfp}{\raisebox{-0.25mm}{\SquareSfp}\,}
-\newcommand{\RubikSfp}{\raisebox{\@hRubik}{\SquareSfp}\,}
-\newcommand{\textRubikSfp}{\rrhSfp\,}
+\newcommand{\rrSfp}{\@rrfp{S}}
+\newcommand{\SquareSfp}{\@tlen\@SquareLetter{\rrSfp}\@tlen}
+\newcommand{\rrhSfp}{\raisebox{-0.25mm}{\SquareSfp}}
+\newcommand{\RubikSfp}{\raisebox{\@hRubik}{\SquareSfp}}
+\newcommand{\textRubikSfp}{\rrhSfp}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -6251,11 +7678,11 @@
% bounded by \{\} so no need to reset to defaults.
% Not visible from the front.
% \begin{macrocode}
-\newcommand{\rrSb}{\textbf{\textsf{S\footnotesize{b}}}}
-\newcommand{\SquareSb}{\@SquareLetter{\rrSb}}
-\newcommand{\rrhSb}{\raisebox{-0.25mm}{\SquareSb}\,}
-\newcommand{\RubikSb}{\raisebox{\@hRubik}{\SquareSb}\,}
-\newcommand{\textRubikSb}{\rrhSb\,}
+\newcommand{\rrSb}{\@rrb{S}}
+\newcommand{\SquareSb}{\@tlen\@SquareLetter{\rrSb}\@tlen}
+\newcommand{\rrhSb}{\raisebox{-0.25mm}{\SquareSb}}
+\newcommand{\RubikSb}{\raisebox{\@hRubik}{\SquareSb}}
+\newcommand{\textRubikSb}{\rrhSb}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -6277,11 +7704,11 @@
% bounded by \{\} so no need to reset to defaults.
% Not visible from th front.
% \begin{macrocode}
-\newcommand{\rrSbp}{\textbf{\textsf{S\footnotesize{b}}$^\prime$}}
-\newcommand{\SquareSbp}{\@SquareLetter{\rrSbp}}
-\newcommand{\rrhSbp}{\raisebox{-0.25mm}{\SquareSbp}\,}
-\newcommand{\RubikSbp}{\raisebox{\@hRubik}{\SquareSbp}\,}
-\newcommand{\textRubikSbp}{\rrhSbp\,}
+\newcommand{\rrSbp}{\@rrbp{S}}
+\newcommand{\SquareSbp}{\@tlen\@SquareLetter{\rrSbp}\@tlen}
+\newcommand{\rrhSbp}{\raisebox{-0.25mm}{\SquareSbp}}
+\newcommand{\RubikSbp}{\raisebox{\@hRubik}{\SquareSbp}}
+\newcommand{\textRubikSbp}{\rrhSbp}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -6298,7 +7725,7 @@
% \begin{macro}{\textRubikU}
% These commands all draw forms which denote the U rotation.
% \begin{macrocode}
-\newcommand{\rrU}{\textbf{\textsf{U}}}
+\newcommand{\rrU}{\@rr{U}}
%%
\newcommand{\SquareU}{%
\begin{tikzpicture}[scale=0.5]
@@ -6308,15 +7735,16 @@
\draw [thick] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhU}{\raisebox{-0.333\height}{\SquareU}\,}
+\newcommand{\rrhU}{\raisebox{-0.333\height}{\@tlen\SquareU\@tlen}}
%%
\newcommand{\RubikU}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareU\\
-\rrU
+\rrU%
\end{minipage}%%
-}
+}}
\newcommand{\textRubikU}{\rrU\,\rrhU}
% \end{macrocode}
% \end{macro}
@@ -6335,7 +7763,7 @@
% \begin{macro}{\textRubikUw}
% These commands all draw forms which denote the Uw rotation.
% \begin{macrocode}
-\newcommand{\rrUw}{\textbf{\textsf{U\footnotesize{w}}}}
+\newcommand{\rrUw}{\@rrw{U}}
%%
\newcommand{\SquareUw}{%
\begin{tikzpicture}[scale=0.5]
@@ -6346,15 +7774,16 @@
\end{tikzpicture}%
}
%
-\newcommand{\rrhUw}{\raisebox{-0.333\height}{\SquareUw}\,}
+\newcommand{\rrhUw}{\raisebox{-0.333\height}{\@tlen\SquareUw\@tlen}}
%%
\newcommand{\RubikUw}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUw\\
-\rrUw
+\rrUw%
\end{minipage}%%
-}
+}}
%%
\newcommand{\textRubikUw}{\rrUw\,\rrhUw}
% \end{macrocode}
@@ -6374,7 +7803,7 @@
% \begin{macro}{\textRubikUp}
% These commands all draw forms which denote the Up rotation.
% \begin{macrocode}
-\newcommand{\rrUp}{\textbf{\textsf{U}$^\prime$}}
+\newcommand{\rrUp}{\@rrp{U}}
%%
\newcommand{\SquareUp}{%
\begin{tikzpicture}[scale=0.5]
@@ -6384,15 +7813,16 @@
\draw [thick] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUp}{\raisebox{-0.333\height}{\SquareUp}\,}
+\newcommand{\rrhUp}{\raisebox{-0.333\height}{\@tlen\SquareUp\@tlen}}
%%
\newcommand{\RubikUp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUp\\
-\rrUp
+\rrUp%
\end{minipage}%%
-}
+}}
\newcommand{\textRubikUp}{\rrUp\,\rrhUp}
% \end{macrocode}
% \end{macro}
@@ -6411,7 +7841,7 @@
% \begin{macro}{\textRubikUwp}
% These commands all draw forms which denote the Uwp rotation.
% \begin{macrocode}
-\newcommand{\rrUwp}{\textbf{\textsf{U\footnotesize{w}}$^\prime$}}
+\newcommand{\rrUwp}{\@rrwp{U}}
%%
\newcommand{\SquareUwp}{%
\begin{tikzpicture}[scale=0.5]
@@ -6421,15 +7851,16 @@
\draw [thick] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUwp}{\raisebox{-0.333\height}{\SquareUwp}\,}
+\newcommand{\rrhUwp}{\raisebox{-0.333\height}{\@tlen\SquareUwp\@tlen}}
%%
\newcommand{\RubikUwp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUwp\\
-\rrUwp
+\rrUwp%
\end{minipage}%%
-}
+}}
\newcommand{\textRubikUwp}{\rrUwp\,\rrhUwp}
% \end{macrocode}
% \end{macro}
@@ -6458,15 +7889,16 @@
\draw [thick, <-] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUs}{\raisebox{-0.333\height}{\SquareUs}\,}
+\newcommand{\rrhUs}{\raisebox{-0.333\height}{\@tlen\SquareUs\@tlen}}
%%
\newcommand{\RubikUs}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUs\\
-\rrUs
+\rrUs%
\end{minipage}%
-}
+}}
\newcommand{\textRubikUs}{\rrUs\,\rrhUs}
% \end{macrocode}
% \end{macro}
@@ -6495,15 +7927,16 @@
\draw [thick, ->] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUsp}{\raisebox{-0.333\height}{\SquareUsp}\,}
+\newcommand{\rrhUsp}{\raisebox{-0.333\height}{\@tlen\SquareUsp\@tlen}}
%%
\newcommand{\RubikUsp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUsp\\
-\rrUsp
+\rrUsp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikUsp}{\rrUsp\,\rrhUsp}
% \end{macrocode}
% \end{macro}
@@ -6532,15 +7965,16 @@
\draw [thick, ->] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUa}{\raisebox{-0.333\height}{\SquareUa}\,}
+\newcommand{\rrhUa}{\raisebox{-0.333\height}{\@tlen\SquareUa\@tlen}}
%%
\newcommand{\RubikUa}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUa\\
-\rrUa
+\rrUa%
\end{minipage}%
-}
+}}
\newcommand{\textRubikUa}{\rrUa\,\rrhUa}
% \end{macrocode}
% \end{macro}
@@ -6569,15 +8003,16 @@
\draw [thick, <-] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUap}{\raisebox{-0.333\height}{\SquareUap}\,}
+\newcommand{\rrhUap}{\raisebox{-0.333\height}{\@tlen\SquareUap\@tlen}}
%%
\newcommand{\RubikUap}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUap\\
-\rrUap
+\rrUap%
\end{minipage}%
-}
+}}
\newcommand{\textRubikUap}{\rrUap\,\rrhUap}
% \end{macrocode}
% \end{macro}
@@ -6595,7 +8030,7 @@
% \begin{macro}{\Rubikx}
% These commands all draw forms which denote the x rotation.
% \begin{macrocode}
-\newcommand{\rrx}{\textbf{\textsf{x}}}
+\newcommand{\rrx}{\@rr{x}}
\newcommand{\Rubikx}{\@xyzRubik{x}}
\newcommand{\rrhx}{\@xyzh{x}}
% \end{macrocode}
@@ -6607,7 +8042,7 @@
% \begin{macro}{\Rubikxp}
% These commands all draw forms which denote the xp rotation.
% \begin{macrocode}
-\newcommand{\rrxp}{\textbf{\textsf{x}$^\prime$}}
+\newcommand{\rrxp}{\@rrp{x}}
\newcommand{\Rubikxp}{\@xyzRubikp{x}}
\newcommand{\rrhxp}{\@xyzhp{x}}
% \end{macrocode}
@@ -6623,7 +8058,7 @@
% \begin{macro}{\Rubiky}
% These commands all draw forms which denote the y rotation.
% \begin{macrocode}
-\newcommand{\rry}{\textbf{\textsf{y}}}
+\newcommand{\rry}{\@rr{y}}
\newcommand{\Rubiky}{\@xyzRubik{y}}
\newcommand{\rrhy}{\@xyzh{y}}
% \end{macrocode}
@@ -6635,7 +8070,7 @@
% \begin{macro}{\Rubikyp}
% These commands all draw forms which denote the yp rotation.
% \begin{macrocode}
-\newcommand{\rryp}{\textbf{\textsf{y}$^\prime$}}
+\newcommand{\rryp}{\@rrp{y}}
\newcommand{\Rubikyp}{\@xyzRubikp{y}}
\newcommand{\rrhyp}{\@xyzhp{y}}
% \end{macrocode}
@@ -6651,7 +8086,7 @@
% \begin{macro}{\Rubikz}
% These commands all draw forms which denote the z rotation.
% \begin{macrocode}
-\newcommand{\rrz}{\textbf{\textsf{z}}}
+\newcommand{\rrz}{\@rr{z}}
\newcommand{\Rubikz}{\@xyzRubik{z}}
\newcommand{\rrhz}{\@xyzh{z}}
% \end{macrocode}
@@ -6663,7 +8098,7 @@
% \begin{macro}{\Rubikzp}
% These commands all draw forms which denote the zp rotation.
% \begin{macrocode}
-\newcommand{\rrzp}{\textbf{\textsf{z}$^\prime$}}
+\newcommand{\rrzp}{\@rrp{z}}
\newcommand{\Rubikzp}{\@xyzRubikp{z}}
\newcommand{\rrhzp}{\@xyzhp{z}}
% \end{macrocode}
@@ -6679,7 +8114,7 @@
% \begin{macro}{\Rubiku}
% These commands all draw forms which denote the u rotation.
% \begin{macrocode}
-\newcommand{\rru}{\textbf{\textsf{u}}}
+\newcommand{\rru}{\@rr{u}}
\newcommand{\Rubiku}{\@xyzRubik{u}}
\newcommand{\rrhu}{\@xyzh{u}}
% \end{macrocode}
@@ -6691,9 +8126,9 @@
% \begin{macro}{\Rubikd}
% These commands all draw forms which denote the d rotation.
% \begin{macrocode}
-\newcommand{\rrd}{\textbf{\textsf{d}}}
-\newcommand{\Rubikd}{\@xyzRubik{d}}
-\newcommand{\rrhd}{\@xyzh{d}}
+\newcommand{\rrd}{\@rr{d}}
+\newcommand{\rrhd}{\@xyzhbdfl{d}}
+\newcommand{\Rubikd}{\@xyzbdflRubik{d}}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -6707,9 +8142,9 @@
% \begin{macro}{\Rubikl}
% These commands all draw forms which denote the l rotation.
% \begin{macrocode}
-\newcommand{\rrl}{\textbf{\textsf{l}}}
-\newcommand{\Rubikl}{\@xyzRubik{l}}
-\newcommand{\rrhl}{\@xyzh{l}}
+\newcommand{\rrl}{\@rr{l}}
+\newcommand{\rrhl}{\@xyzhbdfl{l}}
+\newcommand{\Rubikl}{\@xyzbdflRubik{l}}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -6719,7 +8154,7 @@
% \begin{macro}{\Rubikr}
% These commands all draw forms which denote the r rotation.
% \begin{macrocode}
-\newcommand{\rrr}{\textbf{\textsf{r}}}
+\newcommand{\rrr}{\@rr{r}}
\newcommand{\Rubikr}{\@xyzRubik{r}}
\newcommand{\rrhr}{\@xyzh{r}}
% \end{macrocode}
@@ -6735,9 +8170,9 @@
% \begin{macro}{\Rubikf}
% These commands all draw forms which denote the f rotation.
% \begin{macrocode}
-\newcommand{\rrf}{\textbf{\textsf{f}}}
-\newcommand{\Rubikf}{\@xyzRubik{f}}
-\newcommand{\rrhf}{\@xyzh{f}}
+\newcommand{\rrf}{\@rr{f}}
+\newcommand{\rrhf}{\@xyzhbdfl{f}}
+\newcommand{\Rubikf}{\@xyzbdflRubik{f}}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -6747,15 +8182,1703 @@
% \begin{macro}{\Rubikb}
% These commands all draw forms which denote the b rotation.
% \begin{macrocode}
-\newcommand{\rrb}{\textbf{\textsf{b}}}
-\newcommand{\Rubikb}{\@xyzRubik{b}}
-\newcommand{\rrhb}{\@xyzh{b}}
+\newcommand{\rrb}{\@rr{b}}
+\newcommand{\rrhb}{\@xyzhbdfl{b}}
+\newcommand{\Rubikb}{\@xyzbdflRubik{b}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsection{\hspace{3mm}Face(c) and Face(m) rotations}
+% \label{sec:codeJaap}
+%
+% This subsection (added Nov 2016) is to accommodate some additional notation,
+% much used on the Jaap Puzzles website (Scherphius J), which, although quite
+% convenient, is technically `non-standard'. This additional notation
+% makes available the (middle slice) rotations of the form Rm, Rmp, Lm, Lmp, ... and
+% also the (whole cube) rotations Rc, Lc, ... (referenced to a face) as used on the
+% Cube Lovers usenet group (1981--1997). This notation was probably invented by Singmaster
+% (see Scherphius J).
+%
+% \begin{macro}{\@xyzhc}
+% \begin{macro}{\@xyzhcp}
+% \begin{macro}{\@xyzRubikc}
+% \begin{macro}{\@xyzRubikcp}
+% First we have some useful facilitating commands we shall make use of in
+% conjunction with the Face(c) and Face(cp) notation.
+% \begin{macrocode}
+\newcommand{\@xyzhc}[1]{[\raisebox{-1.2pt}%
+ {{\@rubikfont #1\@rubikfontFNS c}}]}
+\newcommand{\@xyzhcp}[1]{[\raisebox{-1.2pt}%
+ {{\@rubikfont #1{\@rubikfontFNS c}\@rubikprime}}]}
+\newcommand{\@xyzRubikc}[1]{\raisebox{3.45pt}%
+ {[\raisebox{-1.2pt}{{\@rubikfont #1\@rubikfontFNS c}}]}}
+\newcommand{\@xyzRubikcp}[1]{\raisebox{3.45pt}%
+ {[\raisebox{-1.2pt}{{\@rubikfont #1{\@rubikfontFNS c}\@rubikprime}}]}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations Rc and Rcp}
+%
+% Whole cube rotations Rc = x, Rcp = xp.
+%
+% \begin{macro}{\rrRc}
+% \begin{macro}{\rrhRc}
+% \begin{macro}{\RubikRc}
+% These commands all draw forms which denote the Rc rotation.
+% \begin{macrocode}
+\newcommand{\rrRc}{\@rrc{R}}
+\newcommand{\RubikRc}{\@xyzRubikc{R}}
+\newcommand{\rrhRc}{\@xyzhc{R}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\rrRcp}
+% \begin{macro}{\rrhRcp}
+% \begin{macro}{\RubikRcp}
+% These commands all draw forms which denote the Rcp rotation.
+% \begin{macrocode}
+\newcommand{\rrRcp}{\@rrcp{R}}
+\newcommand{\RubikRcp}{\@xyzRubikcp{R}}
+\newcommand{\rrhRcp}{\@xyzhcp{R}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations Lc and Lcp}
+%
+% Whole cube rotations Lc = xp, Lcp = x.
+%
+% \begin{macro}{\rrLc}
+% \begin{macro}{\rrhLc}
+% \begin{macro}{\RubikLc}
+% These commands all draw forms which denote the Lc rotation.
+% \begin{macrocode}
+\newcommand{\rrLc}{\@rrc{L}}
+\newcommand{\RubikLc}{\@xyzRubikc{L}}
+\newcommand{\rrhLc}{\@xyzhc{L}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\rrLcp}
+% \begin{macro}{\rrhLcp}
+% \begin{macro}{\RubikLcp}
+% These commands all draw forms which denote the Lcp rotation.
+% \begin{macrocode}
+\newcommand{\rrLcp}{\@rrcp{L}}
+\newcommand{\RubikLcp}{\@xyzRubikcp{L}}
+\newcommand{\rrhLcp}{\@xyzhcp{L}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations Uc and Ucp}
+%
+% Whole cube rotation Uc = y, Ucp=yp.
+%
+% \begin{macro}{\rrUc}
+% \begin{macro}{\rrhUc}
+% \begin{macro}{\RubikUc}
+% These commands all draw forms which denote the Uc rotation.
+% \begin{macrocode}
+\newcommand{\rrUc}{\@rrc{U}}
+\newcommand{\RubikUc}{\@xyzRubikc{U}}
+\newcommand{\rrhUc}{\@xyzhc{U}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\rrUcp}
+% \begin{macro}{\rrhUcp}
+% \begin{macro}{\RubikUcp}
+% These commands all draw forms which denote the Ucp rotation.
+% \begin{macrocode}
+\newcommand{\rrUcp}{\@rrcp{U}}
+\newcommand{\RubikUcp}{\@xyzRubikcp{U}}
+\newcommand{\rrhUcp}{\@xyzhcp{U}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations Dc and Dcp}
+%
+% Whole cube rotations Dc = yp, Dcp = y.
+%
+% \begin{macro}{\rrDc}
+% \begin{macro}{\rrhDc}
+% \begin{macro}{\RubikDc}
+% These commands all draw forms which denote the Dc rotation.
+% \begin{macrocode}
+\newcommand{\rrDc}{\@rrc{D}}
+\newcommand{\RubikDc}{\@xyzRubikc{D}}
+\newcommand{\rrhDc}{\@xyzhc{D}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\rrDcp}
+% \begin{macro}{\rrhDcp}
+% \begin{macro}{\RubikDcp}
+% These commands all draw forms which denote the Dcp rotation.
+% \begin{macrocode}
+\newcommand{\rrDcp}{\@rrcp{D}}
+\newcommand{\RubikDcp}{\@xyzRubikcp{D}}
+\newcommand{\rrhDcp}{\@xyzhcp{D}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations Fc and Fcp}
+%
+% Whole cube rotations Fc = z, Fcp = zp.
+%
+% \begin{macro}{\rrFc}
+% \begin{macro}{\rrhFc}
+% \begin{macro}{\RubikFc}
+% These commands all draw forms which denote the Fc rotation.
+% \begin{macrocode}
+\newcommand{\rrFc}{\@rrc{F}}
+\newcommand{\RubikFc}{\@xyzRubikc{F}}
+\newcommand{\rrhFc}{\@xyzhc{F}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\rrFcp}
+% \begin{macro}{\rrhFcp}
+% \begin{macro}{\RubikFcp}
+% These commands all draw forms which denote the Fcp rotation.
+% \begin{macrocode}
+\newcommand{\rrFcp}{\@rrcp{F}}
+\newcommand{\RubikFcp}{\@xyzRubikcp{F}}
+\newcommand{\rrhFcp}{\@xyzhcp{F}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations Bc and Bcp}
+%
+% Whole cube rotation Bc = zp, Bcp = z.
+%
+% \begin{macro}{\rrBc}
+% \begin{macro}{\rrhBc}
+% \begin{macro}{\RubikBc}
+% These commands all draw forms which denote the Bc rotation.
+% \begin{macrocode}
+\newcommand{\rrBc}{\@rrc{B}}
+\newcommand{\RubikBc}{\@xyzRubikc{B}}
+\newcommand{\rrhBc}{\@xyzhc{B}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\rrBcp}
+% \begin{macro}{\rrhBcp}
+% \begin{macro}{\RubikBcp}
+% These commands all draw forms which denote the Bcp rotation.
+% \begin{macrocode}
+\newcommand{\rrBcp}{\@rrcp{B}}
+\newcommand{\RubikBcp}{\@xyzRubikcp{B}}
+\newcommand{\rrhBcp}{\@xyzhcp{B}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations Rm and Rmp}
+%
+% Rm = Mp= Sr (M follows Left). We use Sr and Srp as the templates.
+%
+% \begin{macro}{\rrRm}
+% \begin{macro}{\rrhRm}
+% \begin{macro}{\RubikRm}
+% \begin{macro}{\textRubikRm}
+% These commands draw forms of the Rm slice rotation.
+% \begin{macrocode}
+\newcommand{\rrRm}{\@rrm{R}}
+\newcommand{\rrhRm}{\rrhMp}%
+\newcommand{\RubikRm}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareMp\\
+\rrRm%
+\end{minipage}%
+}}
+\newcommand{\textRubikRm}{\rrRm\,\rrhMp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrRmp}
+% \begin{macro}{\rrhRmp}
+% \begin{macro}{\RubikRmp}
+% \begin{macro}{\textRubikRmp}
+% These commands draw forms of the Rmp slice rotation.
+% \begin{macrocode}
+\newcommand{\rrRmp}{\@rrmp{R}}
+\newcommand{\rrhRmp}{\rrhM}%
+\newcommand{\RubikRmp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareM\\
+\rrRmp%
+\end{minipage}%
+}}
+\newcommand{\textRubikRmp}{\rrRmp\,\rrhM}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations Lm and Lmp}
+%
+% Lm = M = Sl (M follows Left). We use Sl and Slp as the templates.
+%
+% \begin{macro}{\rrLm}
+% \begin{macro}{\rrhLm}
+% \begin{macro}{\RubikLm}
+% \begin{macro}{\textRubikLm}
+% These commands draw forms of the Lm slice rotation.
+% \begin{macrocode}
+\newcommand{\rrLm}{\@rrm{L}}
+\newcommand{\rrhLm}{\rrhM}%
+\newcommand{\RubikLm}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareM\\
+\rrLm%
+\end{minipage}%
+}}
+\newcommand{\textRubikLm}{\rrLm\,\rrhM}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrLmp}
+% \begin{macro}{\rrhLmp}
+% \begin{macro}{\RubikLmp}
+% \begin{macro}{\textRubikLmp}
+% These commands draw forms of the Lmp slice rotation.
+% \begin{macrocode}
+\newcommand{\rrLmp}{\@rrmp{L}}
+\newcommand{\rrhLmp}{\rrhMp}%
+\newcommand{\RubikLmp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareMp\\
+\rrLmp%
+\end{minipage}%
+}}
+\newcommand{\textRubikLmp}{\rrLmp\,\rrhMp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations Um and Ump}
+%
+% Um = Ep = Su (E follows Down). We use Su and Sup as the templates.
+%
+% \begin{macro}{\rrUm}
+% \begin{macro}{\rrhUm}
+% \begin{macro}{\RubikUm}
+% \begin{macro}{\textRubikUm}
+% These commands draw forms of the Um slice rotation.
+% We also need to fine-tune the spacing
+% between these `slice' hieroglyphs (especially Fs and Bs).
+% \begin{macrocode}
+\newcommand{\rrUm}{\@rrm{U}}
+\newcommand{\rrhUm}{\rrhEp}%
+\newcommand{\RubikUm}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareEp\\
+\rrUm%
+\end{minipage}%
+}}
+\newcommand{\textRubikUm}{\rrUm\,\rrhEp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrUmp}
+% \begin{macro}{\rrhUmp}
+% \begin{macro}{\RubikUmp}
+% \begin{macro}{\textRubikUmp}
+% These commands draw forms of the Ump slice rotation.
+% We also need to fine-tune the spacing
+% between these `slice' hieroglyphs (especially Fs and Bs).
+% \begin{macrocode}
+\newcommand{\rrUmp}{\@rrmp{U}}
+\newcommand{\rrhUmp}{\rrhE}%
+\newcommand{\RubikUmp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareE\\
+\rrUmp%
+\end{minipage}%
+}}
+\newcommand{\textRubikUmp}{\rrUmp\,\rrhE}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations Dm and Dmp}
+%
+% Dm = E = Sd (E follows Down). We use Sd and Sdp as the templates.
+%
+% \begin{macro}{\rrDm}
+% \begin{macro}{\rrhDm}
+% \begin{macro}{\RubikDm}
+% \begin{macro}{\textRubikDm}
+% These commands draw forms of the Singmaster Dm slice rotation.
+% \begin{macrocode}
+\newcommand{\rrDm}{\@rrm{D}}
+\newcommand{\rrhDm}{\rrhE}%
+\newcommand{\RubikDm}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareE\\
+\rrDm%
+\end{minipage}%
+}}
+\newcommand{\textRubikDm}{\rrDm\,\rrhE}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrDmp}
+% \begin{macro}{\rrhDmp}
+% \begin{macro}{\RubikDmp}
+% \begin{macro}{\textRubikDmp}
+% These commands draw forms of the Singmaster Dmp slice rotation.
+% \begin{macrocode}
+\newcommand{\rrDmp}{\@rrmp{D}}
+\newcommand{\rrhDmp}{\rrhEp}%
+\newcommand{\RubikDmp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareEp\\
+\rrDmp%
+\end{minipage}%
+}}
+\newcommand{\textRubikDmp}{\rrDmp\,\rrhEp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations Fm and Fmp}
+%
+% Fm = S = Sf (S follows Front).
+% S is not visible from the front, so is represented in a square box.
+% We use Sf and Sfp as the templates.
+%
+% \begin{macro}{\rrFm}
+% \begin{macro}{\rrhFm}
+% \begin{macro}{\RubikFm}
+% \begin{macro}{\textRubikFm}
+% These commands draw forms of the Fm slice rotation.
+% We need to just make square with Fm in square;
+% adjust box height using a \cmd{\rule};
+% adjust \cmd{\fboxsep} (default=3pt);
+% adjust \cmd{\fboxrule} (default=0.4pt);
+% bounded by \{\} so no need to reset to defaults.
+% Not visible from the front.
+% \begin{macrocode}
+\newcommand{\rrFm}{\@rrm{F}}
+\newcommand{\SquareFm}{\@tlen\@SquareLetter{\rrFm}\@tlen}
+\newcommand{\rrhFm}{\raisebox{-0.25mm}{\SquareFm}}
+\newcommand{\RubikFm}{\raisebox{\@hRubik}{\SquareFm}}
+\newcommand{\textRubikFm}{\rrhFm}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrFmp}
+% \begin{macro}{\rrhFmp}
+% \begin{macro}{\RubikFmp}
+% \begin{macro}{\textRubikFmp}
+% These commands draw forms of the Fmp slice rotation.
+% We need to just make square with Fmp in square;
+% adjust box height using a \cmd{\rule};
+% adjust \cmd{\fboxsep} (default=3pt);
+% adjust \cmd{\fboxrule} (default=0.4pt);
+% bounded by \{\} so no need to reset to defaults.
+% Not visible from the front.
+% \begin{macrocode}
+\newcommand{\rrFmp}{\@rrmp{F}}
+\newcommand{\SquareFmp}{\@tlen\@SquareLetter{\rrFmp}\@tlen}
+\newcommand{\rrhFmp}{\raisebox{-0.25mm}{\SquareFmp}}
+\newcommand{\RubikFmp}{\raisebox{\@hRubik}{\SquareFmp}}
+\newcommand{\textRubikFmp}{\rrhFmp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations Bm and Bmp}
+%
+% Bm = Sp = Sb. We use Sb and Sbp as the templates.
+%
+% \begin{macro}{\rrBm}
+% \begin{macro}{\rrhBm}
+% \begin{macro}{\RubikBm}
+% \begin{macro}{\textRubikBm}
+% These commands draw forms of the Bm slice rotation.
+% We need to just make square with Bm in square;
+% adjust box height using a \cmd{\rule};
+% adjust \cmd{\fboxsep} (default=3pt);
+% adjust \cmd{\fboxrule} (default=0.4pt);
+% bounded by \{\} so no need to reset to defaults.
+% Not visible from the front.
+% \begin{macrocode}
+\newcommand{\rrBm}{\@rrm{B}}
+\newcommand{\SquareBm}{\@tlen\@SquareLetter{\rrBm}\@tlen}
+\newcommand{\rrhBm}{\raisebox{-0.25mm}{\SquareBm}}
+\newcommand{\RubikBm}{\raisebox{\@hRubik}{\SquareBm}}
+\newcommand{\textRubikBm}{\rrhBm}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrBmp}
+% \begin{macro}{\rrhBmp}
+% \begin{macro}{\RubikBmp}
+% \begin{macro}{\textRubikBmp}
+% These commands draw forms of the Bmp slice rotation.
+% We need to just make square with Bmp in square;
+% adjust box height using a \cmd{\rule};
+% adjust \cmd{\fboxsep} (default=3pt);
+% adjust \cmd{\fboxrule} (default=0.4pt);
+% bounded by \{\} so no need to reset to defaults.
+% Not visible from the front.
+% \begin{macrocode}
+\newcommand{\rrBmp}{\@rrmp{B}}
+\newcommand{\SquareBmp}{\@tlen\@SquareLetter{\rrBmp}\@tlen}
+\newcommand{\rrhBmp}{\raisebox{-0.25mm}{\SquareBmp}}
+\newcommand{\RubikBmp}{\raisebox{\@hRubik}{\SquareBmp}}
+\newcommand{\textRubikBmp}{\rrhBmp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+%
+% \subsection{\hspace{3mm}Randelshofer superset ENG rotations (CMST)}
+% \label{sec:codeRandelshofer}
+%
+% (see webpage: \verb!Randelshofer.ch/rubik/patterns/doc/supersetENG_3x3.html!)
+%
+% This section relates to the recent Rubik notation developed
+% by Randelshofer (see URL above), known as the ``superset ENG rotations''
+% (see Sections~\ref{sec:RubikCommands} and \ref{sec:listofRandelshofercommands}
+% for details).
+%
+% I denote this notation as ``CMST'' (i.e.,~his C, M, S and T notation).
+% Although this notation replicates previously existing World Cube Association notation,
+% we include it here for completeness. Fortunately the Randelshofer notation does
+% not conflict with existing notation.
+%
+% Briefly, the CMST letters denote whole Cube, Middle, outer-Slice and wide (T)
+% rotations associated with named faces. For example, the rotation-code MR
+% indicates a rotation of the middle slice parallel to the \textsc{right} face,
+% and in the same sense (direction) as \rr{R}\ (see Section~\ref{sec:RubikCommands} for details).
+%
+%
+% First we make some useful facilitating commands for the CX1 and CX1p forms
+% as these are handled with raised square brackets.
+% We model these four macros on the equivalent
+% \verb!\@xyzh!, \verb!\@xyzhp!,\verb!\@xyzRubik!,\verb!\@xyzRubikp! macros defined above.
+% \begin{macrocode}
+\newcommand{\@randhc}[1]{[\raisebox{-1.2pt}{{\@rubikfont C#1}}]}
+\newcommand{\@randhcp}[1]{[\raisebox{-1.2pt}{{\@rubikfont C#1\@rubikprime}}]}
+\newcommand{\@randRubikc}[1]%
+ {\raisebox{3.45pt}{[\raisebox{-1.2pt}{{\@rubikfont C#1}}]}}
+\newcommand{\@randRubikcp}[1]%
+ {\raisebox{3.45pt}{[\raisebox{-1.2pt}{{\@rubikfont C#1\@rubikprime}}]}}
+% \end{macrocode}
+%
+%
+% In the following we create the base form of a rotation code, eg \rrhCR\ and then
+% the user typesets this rotation using CR as the argument for \verb!\rrh{}!.
+% This works because the macro \verb!\@join{}{}! is used to join \cmd{\rrh}
+% and CR $\rightarrow$ \cmd{\rrhCR} etc.
+%
+% The = signs at the beginning of each new section indicate the equivalence
+% between the Randelshofer notation and the current (World Cube Association)
+% notation.
+%
+%
+% \subsubsection{\hspace{3mm}Rotations CR and CRp}
+%
+% Whole cube rotations CR = Rc = x, CRp = Rcp = xp.
+%
+% \begin{macro}{\rrCR}
+% \begin{macro}{\rrhCR}
+% \begin{macro}{\RubikCR}
+% These commands all draw forms which denote the CR = Rc rotation.
+% \begin{macrocode}
+\newcommand{\rrCR}{\@rr{CR}}
+\newcommand{\RubikCR}{\@randRubikc{R}}
+\newcommand{\rrhCR}{\@randhc{R}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\rrCRp}
+% \begin{macro}{\rrhCRp}
+% \begin{macro}{\RubikCRp}
+% These commands all draw forms which denote the CRp = Rcp rotation.
+% \begin{macrocode}
+\newcommand{\rrCRp}{\@rrp{CR}}
+\newcommand{\RubikCRp}{\@randRubikcp{R}}
+\newcommand{\rrhCRp}{\@randhcp{R}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations CL and CLp}
+%
+% Whole cube rotations CL = Lc = xp, CLp = Lcp = x.
+%
+% \begin{macro}{\rrCL}
+% \begin{macro}{\rrhCL}
+% \begin{macro}{\RubikCL}
+% These commands all draw forms which denote the CL rotation.
+% \begin{macrocode}
+\newcommand{\rrCL}{\@rr{CL}}
+\newcommand{\RubikCL}{\@randRubikc{L}}
+\newcommand{\rrhCL}{\@randhc{L}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\rrCLp}
+% \begin{macro}{\rrhCLp}
+% \begin{macro}{\RubikCLp}
+% These commands all draw forms which denote the CLp rotation.
+% \begin{macrocode}
+\newcommand{\rrCLp}{\@rrp{CL}}
+\newcommand{\RubikCLp}{\@randRubikcp{L}}
+\newcommand{\rrhCLp}{\@randhcp{L}}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
+% \subsubsection{\hspace{3mm}Rotations CU and CUp}
+%
+% Whole cube rotation CU = Uc = y, CUp = Ucp=yp.
+%
+% \begin{macro}{\rrCU}
+% \begin{macro}{\rrhCU}
+% \begin{macro}{\RubikCU}
+% These commands all draw forms which denote the CU rotation.
+% \begin{macrocode}
+\newcommand{\rrCU}{\@rr{CU}}
+\newcommand{\RubikCU}{\@randRubikc{U}}
+\newcommand{\rrhCU}{\@randhc{U}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\rrCUp}
+% \begin{macro}{\rrhCUp}
+% \begin{macro}{\RubikCUp}
+% These commands all draw forms which denote the CUp rotation.
+% \begin{macrocode}
+\newcommand{\rrCUp}{\@rrp{CU}}
+\newcommand{\RubikCUp}{\@randRubikcp{U}}
+\newcommand{\rrhCUp}{\@randhcp{U}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations CD and CDp}
+%
+% Whole cube rotations CD = Dc = yp, CDp = Dcp = y.
+%
+% \begin{macro}{\rrCD}
+% \begin{macro}{\rrhCD}
+% \begin{macro}{\RubikCD}
+% These commands all draw forms which denote the CD rotation.
+% \begin{macrocode}
+\newcommand{\rrCD}{\@rr{CD}}
+\newcommand{\RubikCD}{\@randRubikc{D}}
+\newcommand{\rrhCD}{\@randhc{D}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\rrCDp}
+% \begin{macro}{\rrhCDp}
+% \begin{macro}{\RubikCDp}
+% These commands all draw forms which denote the CDp rotation.
+% \begin{macrocode}
+\newcommand{\rrCDp}{\@rrp{CD}}
+\newcommand{\RubikCDp}{\@randRubikcp{D}}
+\newcommand{\rrhCDp}{\@randhcp{D}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations CF and CFp}
+%
+% Whole cube rotations CF = Fc = z, CFp = Fcp = zp.
+%
+% \begin{macro}{\rrCF}
+% \begin{macro}{\rrhCF}
+% \begin{macro}{\RubikCF}
+% These commands all draw forms which denote the CF rotation.
+% \begin{macrocode}
+\newcommand{\rrCF}{\@rr{CF}}
+\newcommand{\RubikCF}{\@randRubikc{F}}
+\newcommand{\rrhCF}{\@randhc{F}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\rrCFp}
+% \begin{macro}{\rrhCFp}
+% \begin{macro}{\RubikCFp}
+% These commands all draw forms which denote the CFp rotation.
+% \begin{macrocode}
+\newcommand{\rrCFp}{\@rrp{CF}}
+\newcommand{\RubikCFp}{\@randRubikcp{F}}
+\newcommand{\rrhCFp}{\@randhcp{F}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations CB and CBp}
+%
+% Whole cube rotation CB = Bc = zp, CBp = Bcp = z.
+%
+% \begin{macro}{\rrCB}
+% \begin{macro}{\rrhCB}
+% \begin{macro}{\RubikCB}
+% These commands all draw forms which denote the CB rotation.
+% \begin{macrocode}
+\newcommand{\rrCB}{\@rr{CB}}
+\newcommand{\RubikCB}{\@randRubikc{B}}
+\newcommand{\rrhCB}{\@randhc{B}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\rrCBp}
+% \begin{macro}{\rrhCBp}
+% \begin{macro}{\RubikCBp}
+% These commands all draw forms which denote the CBp rotation.
+% \begin{macrocode}
+\newcommand{\rrCBp}{\@rrp{CB}}
+\newcommand{\RubikCBp}{\@randRubikcp{B}}
+\newcommand{\rrhCBp}{\@randhcp{B}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsubsection{\hspace{3mm}Rotations MR and MRp}
+%
+% MR = Rm = Mp= Sr (M follows Left). We use Sr and Srp as the templates.
+%
+% \begin{macro}{\rrMR}
+% \begin{macro}{\rrhMR}
+% \begin{macro}{\RubikMR}
+% \begin{macro}{\textRubikMR}
+% These commands draw forms of the MR middle slice rotation.
+% \begin{macrocode}
+\newcommand{\rrMR}{\@rr{MR}}
+\newcommand{\rrhMR}{\rrhMp}%
+\newcommand{\RubikMR}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareMp\\
+\rrMR%
+\end{minipage}%
+}}
+\newcommand{\textRubikMR}{\rrMR\,\rrhMp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrMRp}
+% \begin{macro}{\rrhMRp}
+% \begin{macro}{\RubikMRp}
+% \begin{macro}{\textRubikMRp}
+% These commands draw forms of the MRp slice rotation.
+% \begin{macrocode}
+\newcommand{\rrMRp}{\@rrp{MR}}
+\newcommand{\rrhMRp}{\rrhM}%
+\newcommand{\RubikMRp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareM\\
+\rrMRp%
+\end{minipage}%
+}}
+\newcommand{\textRubikMRp}{\rrMRp\,\rrhM}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations ML and MLp}
+%
+% ML = Lm = M = Sl (M follows Left). We use Sl and Slp as the templates.
+%
+% \begin{macro}{\rrML}
+% \begin{macro}{\rrhML}
+% \begin{macro}{\RubikML}
+% \begin{macro}{\textRubikML}
+% These commands draw forms of the ML slice rotation.
+% \begin{macrocode}
+\newcommand{\rrML}{\@rr{ML}}
+\newcommand{\rrhML}{\rrhM}%
+\newcommand{\RubikML}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareM\\
+\rrML%
+\end{minipage}%
+}}
+\newcommand{\textRubikML}{\rrML\,\rrhM}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrMLp}
+% \begin{macro}{\rrhMLp}
+% \begin{macro}{\RubikMLp}
+% \begin{macro}{\textRubikMLp}
+% These commands draw forms of the MLp slice rotation.
+% \begin{macrocode}
+\newcommand{\rrMLp}{\@rrp{ML}}
+\newcommand{\rrhMLp}{\rrhMp}%
+\newcommand{\RubikMLp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareMp\\
+\rrMLp%
+\end{minipage}%
+}}
+\newcommand{\textRubikMLp}{\rrMLp\,\rrhMp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations MU and MUp}
+%
+% MU = Um = Ep = Su (E follows Down). We use Su and Sup as the templates.
+%
+% \begin{macro}{\rrMU}
+% \begin{macro}{\rrhMU}
+% \begin{macro}{\RubikMU}
+% \begin{macro}{\textRubikMU}
+% These commands draw forms of the MU slice rotation.
+% \begin{macrocode}
+\newcommand{\rrMU}{\@rr{MU}}
+\newcommand{\rrhMU}{\rrhEp}%
+\newcommand{\RubikMU}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareEp\\
+\rrMU%
+\end{minipage}%
+}}
+\newcommand{\textRubikMU}{\rrMU\,\rrhEp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrMUp}
+% \begin{macro}{\rrhMUp}
+% \begin{macro}{\RubikMUp}
+% \begin{macro}{\textRubikMUp}
+% These commands draw forms of the MUp slice rotation.
+% \begin{macrocode}
+\newcommand{\rrMUp}{\@rrp{MU}}
+\newcommand{\rrhMUp}{\rrhE}%
+\newcommand{\RubikMUp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareE\\
+\rrMUp%
+\end{minipage}%
+}}
+\newcommand{\textRubikMUp}{\rrMUp\,\rrhE}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations MD and MDp}
+%
+% MD = Dm = E = Sd (E follows Down). We use Sd and Sdp as the templates.
+%
+% \begin{macro}{\rrMD}
+% \begin{macro}{\rrhMD}
+% \begin{macro}{\RubikMD}
+% \begin{macro}{\textRubikMD}
+% These commands draw forms of the Randelshofer MD slice rotation.
+% \begin{macrocode}
+\newcommand{\rrMD}{\@rr{MD}}
+\newcommand{\rrhMD}{\rrhE}%
+\newcommand{\RubikMD}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareE\\
+\rrMD%
+\end{minipage}%
+}}
+\newcommand{\textRubikMD}{\rrMD\,\rrhE}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrMDp}
+% \begin{macro}{\rrhMDp}
+% \begin{macro}{\RubikMDp}
+% \begin{macro}{\textRubikMDp}
+% These commands draw forms of the Randelshofer MDp slice rotation.
+% \begin{macrocode}
+\newcommand{\rrMDp}{\@rrp{MD}}
+\newcommand{\rrhMDp}{\rrhEp}%
+\newcommand{\RubikMDp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareEp\\
+\rrMDp%
+\end{minipage}%
+}}
+\newcommand{\textRubikMDp}{\rrMDp\,\rrhEp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations MF and MFp}
+%
+% MF = Fm = S = Sf (S follows Front).
+% MF = S is not visible from the front, so is represented in a square box.
+% We use Sf and Sfp as the templates.
+%
+% \begin{macro}{\rrMF}
+% \begin{macro}{\rrhMF}
+% \begin{macro}{\RubikMF}
+% \begin{macro}{\textRubikMF}
+% These commands draw forms of the MF slice rotation.
+% We need to just make square with MF in square;
+% adjust box height using a \cmd{\rule};
+% adjust \cmd{\fboxsep} (default=3pt);
+% adjust \cmd{\fboxrule} (default=0.4pt);
+% bounded by \{\} so no need to reset to defaults.
+% Not visible from the front.
+% \begin{macrocode}
+\newcommand{\rrMF}{\@rr{MF}}
+\newcommand{\SquareMF}{\@tlen\@SquareLetter{\rrMF}\@tlen}
+\newcommand{\rrhMF}{\raisebox{-0.25mm}{\SquareMF}}
+\newcommand{\RubikMF}{\raisebox{\@hRubik}{\SquareMF}}
+\newcommand{\textRubikMF}{\rrhMF}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrMFp}
+% \begin{macro}{\rrhMFp}
+% \begin{macro}{\RubikMFp}
+% \begin{macro}{\textRubikMFp}
+% These commands draw forms of the MFp slice rotation.
+% We need to just make square with MFp in square;
+% adjust box height using a \cmd{\rule};
+% adjust \cmd{\fboxsep} (default=3pt);
+% adjust \cmd{\fboxrule} (default=0.4pt);
+% bounded by \{\} so no need to reset to defaults.
+% Not visible from the front.
+% \begin{macrocode}
+\newcommand{\rrMFp}{\@rrp{MF}}
+\newcommand{\SquareMFp}{\@tlen\@SquareLetter{\rrMFp}\@tlen}
+\newcommand{\rrhMFp}{\raisebox{-0.25mm}{\SquareMFp}}
+\newcommand{\RubikMFp}{\raisebox{\@hRubik}{\SquareMFp}}
+\newcommand{\textRubikMFp}{\rrhMFp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations MB and MBp}
+%
+% MB = Bm = Sp = Sb. We use Sb and Sbp as the templates.
+%
+% \begin{macro}{\rrMB}
+% \begin{macro}{\rrhMB}
+% \begin{macro}{\RubikMB}
+% \begin{macro}{\textRubikMB}
+% These commands draw forms of the MB slice rotation.
+% We need to just make square with MB in square;
+% adjust box height using a \cmd{\rule};
+% adjust \cmd{\fboxsep} (default=3pt);
+% adjust \cmd{\fboxrule} (default=0.4pt);
+% bounded by \{\} so no need to reset to defaults.
+% Not visible from the front.
+% \begin{macrocode}
+\newcommand{\rrMB}{\@rr{MB}}
+\newcommand{\SquareMB}{\@tlen\@SquareLetter{\rrMB}\@tlen}
+\newcommand{\rrhMB}{\raisebox{-0.25mm}{\SquareMB}}
+\newcommand{\RubikMB}{\raisebox{\@hRubik}{\SquareMB}}
+\newcommand{\textRubikMB}{\rrhMB}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrMBp}
+% \begin{macro}{\rrhMBp}
+% \begin{macro}{\RubikMBp}
+% \begin{macro}{\textRubikMBp}
+% These commands draw forms of the MBp slice rotation.
+% We need to just make square with MBp in square;
+% adjust box height using a \cmd{\rule};
+% adjust \cmd{\fboxsep} (default=3pt);
+% adjust \cmd{\fboxrule} (default=0.4pt);
+% bounded by \{\} so no need to reset to defaults.
+% Not visible from the front.
+% \begin{macrocode}
+\newcommand{\rrMBp}{\@rrp{MB}}
+\newcommand{\SquareMBp}{\@tlen\@SquareLetter{\rrMBp}\@tlen}
+\newcommand{\rrhMBp}{\raisebox{-0.25mm}{\SquareMBp}}
+\newcommand{\RubikMBp}{\raisebox{\@hRubik}{\SquareMBp}}
+\newcommand{\textRubikMBp}{\rrhMBp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsubsection{\hspace{3mm}Rotations T (wide)}
+%
+% TR = Rw \ \ (We use Rw and Rwp as the templates).
+%
+% {\noindent}We first set up some useful T and Tp macros for use with (L,R,U,D,F,B)
+% slightly more general than before. As before the rubikfont command needs to be
+% delimited using two curly brackets to contain the font expression.
+% \begin{macrocode}
+\newcommand{\@rrT}[1]{{\@rubikfont T#1}}
+\newcommand{\@rrhT}[1]{\@join{\rrh#1}{w}}%
+\newcommand{\@textRubikT}[1]{\@rrT{#1}\,\@join{\rrh#1}{w}}
+%
+\newcommand{\@RubikT}[1]{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%%
+\@join{\Square#1}{w}\\%
+\@rrT{#1}%%
+\end{minipage}%
+}}
+%%
+\newcommand{\@rrTp}[1]{{\@rubikfont T#1\@rubikprime}}
+\newcommand{\@rrhTp}[1]{\@join{\rrh#1}{wp}}%
+\newcommand{\@textRubikTp}[1]{\@rrTp{#1}\,\@join{\rrh#1}{wp}}
+%%
+\newcommand{\@RubikTp}[1]{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%%
+\@join{\Square#1}{wp}\\%
+\@rrTp{#1}%%
+\end{minipage}%
+}}
+% \end{macrocode}
+%
+%
+%
+% \begin{macro}{\rrTL}
+% \begin{macro}{\rrhTL}
+% \begin{macro}{\RubikTL}
+% \begin{macro}{\textRubikTL}
+% These commands draw forms of the TL = Lw wide slice rotation.
+% \begin{macrocode}
+\newcommand{\rrTL}{\@rrT{L}}% = rrLw
+\newcommand{\rrhTL}{\@rrhT{L}}
+\newcommand{\textRubikTL}{\@textRubikT{L}}
+\newcommand{\RubikTL}{\@RubikT{L}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\rrTLp}
+% \begin{macro}{\rrhTLp}
+% \begin{macro}{\RubikTLp}
+% \begin{macro}{\textRubikTLp}
+% These commands draw forms of the TLp = Lwp wide slice rotation.
+% \begin{macrocode}
+\newcommand{\rrTLp}{\@rrTp{L}}
+\newcommand{\rrhTLp}{\@rrhTp{L}}
+\newcommand{\textRubikTLp}{\@textRubikTp{L}}
+\newcommand{\RubikTLp}{\@RubikTp{L}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\rrTR}
+% \begin{macro}{\rrhTR}
+% \begin{macro}{\RubikTR}
+% \begin{macro}{\textRubikTR}
+% These commands draw forms of the TR = Rw wide slice rotation.
+% \begin{macrocode}
+\newcommand{\rrTR}{\@rrT{R}}
+\newcommand{\rrhTR}{\@rrhT{R}}
+\newcommand{\textRubikTR}{\@textRubikT{R}}
+\newcommand{\RubikTR}{\@RubikT{R}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\rrTRp}
+% \begin{macro}{\rrhTRp}
+% \begin{macro}{\RubikTRp}
+% \begin{macro}{\textRubikTRp}
+% These commands draw forms of the TRp = Rmp wide slice rotation.
+% \begin{macrocode}
+\newcommand{\rrTRp}{\@rrTp{R}}
+\newcommand{\rrhTRp}{\@rrhTp{R}}
+\newcommand{\textRubikTRp}{\@textRubikTp{R}}
+\newcommand{\RubikTRp}{\@RubikTp{R}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\rrTU}
+% \begin{macro}{\rrhTU}
+% \begin{macro}{\RubikTU}
+% \begin{macro}{\textRubikTU}
+% These commands draw forms of the TU = Uw wide slice rotation.
+% \begin{macrocode}
+\newcommand{\rrTU}{\@rrT{U}}
+\newcommand{\rrhTU}{\@rrhT{U}}
+\newcommand{\textRubikTU}{\@textRubikT{U}}
+\newcommand{\RubikTU}{\@RubikT{U}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\rrTUp}
+% \begin{macro}{\rrhTUp}
+% \begin{macro}{\RubikTUp}
+% \begin{macro}{\textRubikTUp}
+% These commands draw forms of the TUp = Uwp wide slice rotation.
+% \begin{macrocode}
+\newcommand{\rrTUp}{\@rrTp{U}}
+\newcommand{\rrhTUp}{\@rrhTp{U}}
+\newcommand{\textRubikTUp}{\@textRubikTp{U}}
+\newcommand{\RubikTUp}{\@RubikTp{U}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\rrTD}
+% \begin{macro}{\rrhTD}
+% \begin{macro}{\RubikTD}
+% \begin{macro}{\textRubikTD}
+% These commands draw forms of the TD = Dw wide slice rotation.
+% \begin{macrocode}
+\newcommand{\rrTD}{\@rrT{D}}
+\newcommand{\rrhTD}{\@rrhT{D}}
+\newcommand{\textRubikTD}{\@textRubikT{D}}
+\newcommand{\RubikTD}{\@RubikT{D}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\rrTDp}
+% \begin{macro}{\rrhTDp}
+% \begin{macro}{\RubikTDp}
+% \begin{macro}{\textRubikTDp}
+% These commands draw forms of the TDp = Dwp wide slice rotation.
+% \begin{macrocode}
+\newcommand{\rrTDp}{\@rrTp{D}}
+\newcommand{\rrhTDp}{\@rrhTp{D}}
+\newcommand{\textRubikTDp}{\@textRubikTp{D}}
+\newcommand{\RubikTDp}{\@RubikTp{D}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrTF}
+% \begin{macro}{\rrhTF}
+% \begin{macro}{\RubikTF}
+% \begin{macro}{\textRubikTF}
+% These commands draw forms of the TF = Fw wide slice rotation.
+% \begin{macrocode}
+\newcommand{\rrTF}{\@rrT{F}}
+\newcommand{\rrhTF}{\@rrhT{F}}
+\newcommand{\textRubikTF}{\@textRubikT{F}}
+\newcommand{\RubikTF}{\@RubikT{F}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\rrTFp}
+% \begin{macro}{\rrhTFp}
+% \begin{macro}{\RubikTFp}
+% \begin{macro}{\textRubikTFp}
+% These commands draw forms of the TFp = Fwp wide slice rotation.
+% \begin{macrocode}
+\newcommand{\rrTFp}{\@rrTp{F}}
+\newcommand{\rrhTFp}{\@rrhTp{F}}
+\newcommand{\textRubikTFp}{\@textRubikTp{F}}
+\newcommand{\RubikTFp}{\@RubikTp{F}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\rrTB}
+% \begin{macro}{\rrhTB}
+% \begin{macro}{\RubikTB}
+% \begin{macro}{\textRubikTB}
+% These commands draw forms of the TB = Bw wide slice rotation.
+% NOTE we just use the letters TB in a square
+% \begin{macrocode}
+\newcommand{\rrTB}{\@rrT{B}}
+\newcommand{\SquareTB}{\@tlen\@SquareLetter{\rrTB}\@tlen}
+\newcommand{\rrhTB}{\raisebox{-0.25mm}{\SquareTB}}
+\newcommand{\textRubikTB}{\rrhTB}
+\newcommand{\RubikTB}{\raisebox{\@hRubik}{\SquareTB}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\rrTBp}
+% \begin{macro}{\rrhTBp}
+% \begin{macro}{\RubikTBp}
+% \begin{macro}{\textRubikTBp}
+% These commands draw forms of the TBp = Bwp wide slice rotation.
+% NOTE we just use the letters TB' in a square
+% \begin{macrocode}
+\newcommand{\rrTBp}{\@rrTp{B}}
+\newcommand{\SquareTBp}{\@tlen\@SquareLetter{\rrTBp}\@tlen}
+\newcommand{\rrhTBp}{\raisebox{-0.25mm}{\SquareTBp}}
+\newcommand{\textRubikTBp}{\rrhTBp}
+\newcommand{\RubikTBp}{\raisebox{\@hRubik}{\SquareTBp}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsubsection{\hspace{3mm}Rotations SR and SRp (opposite slices)}
+%
+% opposite slices in same direction
+% SR = Rs (both rotating in R direction)
+%
+% \begin{macro}{\rrSR}
+% \begin{macro}{\rrhSR}
+% \begin{macro}{\RubikSR}
+% \begin{macro}{\textRubikSR}
+% These commands draw forms of the SR opposite slice rotation.
+% \begin{macrocode}
+\newcommand{\rrSR}{\@rr{SR}}
+\newcommand{\rrhSR}{\rrhRs}%
+\newcommand{\RubikSR}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareRs\\
+\rrSR%
+\end{minipage}%
+}}
+\newcommand{\textRubikSR}{\rrSR\,\rrhRs}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrSRp}
+% \begin{macro}{\rrhSRp}
+% \begin{macro}{\RubikSRp}
+% \begin{macro}{\textRubikSRp}
+% These commands draw forms of the SRp opposite slice rotation.
+% \begin{macrocode}
+\newcommand{\rrSRp}{\@rrp{SR}}
+\newcommand{\rrhSRp}{\rrhRsp}%
+\newcommand{\RubikSRp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareRsp\\
+\rrSRp%
+\end{minipage}%
+}}
+\newcommand{\textRubikSRp}{\rrSRp\,\rrhRsp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations SL and SLp}
+%
+% SL = Ls (both rotating in L direction)
+%
+% \begin{macro}{\rrSL}
+% \begin{macro}{\rrhSL}
+% \begin{macro}{\RubikSL}
+% \begin{macro}{\textRubikSL}
+% These commands draw forms of the SL opposite slice rotation.
+% \begin{macrocode}
+\newcommand{\rrSL}{\@rr{SL}}
+\newcommand{\rrhSL}{\rrhLs}%
+\newcommand{\RubikSL}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareLs\\
+\rrSL%
+\end{minipage}%
+}}
+\newcommand{\textRubikSL}{\rrSL\,\rrhLs}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrSLp}
+% \begin{macro}{\rrhSLp}
+% \begin{macro}{\RubikSLp}
+% \begin{macro}{\textRubikSLp}
+% These commands draw forms of the SLp opposite slice rotation.
+% \begin{macrocode}
+\newcommand{\rrSLp}{\@rrp{SL}}
+\newcommand{\rrhSLp}{\rrhLsp}%
+\newcommand{\RubikSLp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareLsp\\
+\rrSLp%
+\end{minipage}%
+}}
+\newcommand{\textRubikSLp}{\rrSLp\,\rrhLsp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations SU and SUp}
+%
+% SU = Us (both rotating in U direction)
+%
+% \begin{macro}{\rrSU}
+% \begin{macro}{\rrhSU}
+% \begin{macro}{\RubikSU}
+% \begin{macro}{\textRubikSU}
+% These commands draw forms of the SU opposite slice rotation.
+% \begin{macrocode}
+\newcommand{\rrSU}{\@rr{SU}}
+\newcommand{\rrhSU}{\rrhUs}%
+\newcommand{\RubikSU}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareUs\\
+\rrSU%
+\end{minipage}%
+}}
+\newcommand{\textRubikSU}{\rrSU\,\rrhUs}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrSUp}
+% \begin{macro}{\rrhSUp}
+% \begin{macro}{\RubikSUp}
+% \begin{macro}{\textRubikSUp}
+% These commands draw forms of the SUp opposite slice rotation.
+% \begin{macrocode}
+\newcommand{\rrSUp}{\@rrp{SU}}
+\newcommand{\rrhSUp}{\rrhUsp}%
+\newcommand{\RubikSUp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareUsp\\
+\rrSUp%
+\end{minipage}%
+}}
+\newcommand{\textRubikSUp}{\rrSUp\,\rrhUsp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations SD and SDp}
+%
+% SD = Ds (both rotating in D direction)
+%
+% \begin{macro}{\rrSD}
+% \begin{macro}{\rrhSD}
+% \begin{macro}{\RubikSD}
+% \begin{macro}{\textRubikSD}
+% These commands draw forms of the SD opposite slice rotation.
+% \begin{macrocode}
+\newcommand{\rrSD}{\@rr{SD}}
+\newcommand{\rrhSD}{\rrhDs}%
+\newcommand{\RubikSD}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareDs\\
+\rrSD%
+\end{minipage}%
+}}
+\newcommand{\textRubikSD}{\rrSD\,\rrhDs}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrSDp}
+% \begin{macro}{\rrhSDp}
+% \begin{macro}{\RubikSDp}
+% \begin{macro}{\textRubikSDp}
+% These commands draw forms of the SDp opposite slice rotation.
+% \begin{macrocode}
+\newcommand{\rrSDp}{\@rrp{SD}}
+\newcommand{\rrhSDp}{\rrhDsp}%
+\newcommand{\RubikSDp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareDsp\\
+\rrSDp%
+\end{minipage}%
+}}
+\newcommand{\textRubikSDp}{\rrSDp\,\rrhDsp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsubsection{\hspace{3mm}Rotations SF and SFp}
+%
+% SF = Fs is not visible from the front, so is represented in a square box.
+% Both rotating in the F direction
+% We use Fs and Fsp as the templates.
+%
+% \begin{macro}{\rrSF}
+% \begin{macro}{\rrhSF}
+% \begin{macro}{\RubikSF}
+% \begin{macro}{\textRubikSF}
+% These commands draw forms of the SF opposite slice rotation.
+% We need to just make square with SF in square;
+% adjust box height using a \cmd{\rule};
+% adjust \cmd{\fboxsep} (default=3pt);
+% adjust \cmd{\fboxrule} (default=0.4pt);
+% bounded by \{\} so no need to reset to defaults.
+% Not visible from the front.
+% \begin{macrocode}
+\newcommand{\rrSF}{\@rr{SF}}
+\newcommand{\SquareSF}{\@tlen\@SquareLetter{\rrSF}\@tlen}
+\newcommand{\rrhSF}{\raisebox{-0.25mm}{\SquareSF}}
+\newcommand{\RubikSF}{\raisebox{\@hRubik}{\SquareSF}}
+\newcommand{\textRubikSF}{\rrhSF}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrSFp}
+% \begin{macro}{\rrhSFp}
+% \begin{macro}{\RubikSFp}
+% \begin{macro}{\textRubikSFp}
+% These commands draw forms of the SFp opposite slice rotation.
+% We need to just make square with SFp in square;
+% adjust box height using a \cmd{\rule};
+% adjust \cmd{\fboxsep} (default=3pt);
+% adjust \cmd{\fboxrule} (default=0.4pt);
+% bounded by \{\} so no need to reset to defaults.
+% Not visible from the front.
+% \begin{macrocode}
+\newcommand{\rrSFp}{\@rrp{SF}}
+\newcommand{\SquareSFp}{\@tlen\@SquareLetter{\rrSFp}\@tlen}
+\newcommand{\rrhSFp}{\raisebox{-0.25mm}{\SquareSFp}}
+\newcommand{\RubikSFp}{\raisebox{\@hRubik}{\SquareSFp}}
+\newcommand{\textRubikSFp}{\rrhSFp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+%
+% \subsubsection{\hspace{3mm}Rotations SB and SBp}
+%
+% SB = Bs is not visible from the front, so is represented in a square box.
+% Both rotating in the B direction
+% We use Bs and Bsp as the templates.
+%
+% \begin{macro}{\rrSB}
+% \begin{macro}{\rrhSB}
+% \begin{macro}{\RubikSB}
+% \begin{macro}{\textRubikSB}
+% These commands draw forms of the SB opposite slice rotation.
+% We need to just make square with SB in square;
+% adjust box height using a \cmd{\rule};
+% adjust \cmd{\fboxsep} (default=3pt);
+% adjust \cmd{\fboxrule} (default=0.4pt);
+% bounded by \{\} so no need to reset to defaults.
+% Not visible from the front.
+% \begin{macrocode}
+\newcommand{\rrSB}{\@rr{SB}}
+\newcommand{\SquareSB}{\@tlen\@SquareLetter{\rrSB}\@tlen}
+\newcommand{\rrhSB}{\raisebox{-0.25mm}{\SquareSB}}
+\newcommand{\RubikSB}{\raisebox{\@hRubik}{\SquareSB}}
+\newcommand{\textRubikSB}{\rrhSB}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\rrSBp}
+% \begin{macro}{\rrhSBp}
+% \begin{macro}{\RubikSBp}
+% \begin{macro}{\textRubikSBp}
+% These commands draw forms of the SBp opposite slice rotation.
+% We need to just make square with SBp in square;
+% adjust box height using a \cmd{\rule};
+% adjust \cmd{\fboxsep} (default=3pt);
+% adjust \cmd{\fboxrule} (default=0.4pt);
+% bounded by \{\} so no need to reset to defaults.
+% Not visible from the front.
+% \begin{macrocode}
+\newcommand{\rrSBp}{\@rrp{SB}}
+\newcommand{\SquareSBp}{\@tlen\@SquareLetter{\rrSBp}\@tlen}
+\newcommand{\rrhSBp}{\raisebox{-0.25mm}{\SquareSBp}}
+\newcommand{\RubikSBp}{\raisebox{\@hRubik}{\SquareSBp}}
+\newcommand{\textRubikSBp}{\rrhSBp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsection{\hspace{3mm}Axis rotations (textRubik versions)}
+% \label{sec:codetextrubikaxisversions}
+%
+% For completeness we include a \cmd{\textRubik} version of all the
+% axis rotation codes (making them equal to their hieroglyphic \cmd{\rrh} version).
+% Obviously this list must go at the end of this file. While these commands are perhaps
+% strictly unnecessary, the motivation is to allow users to include them in
+% a \cmd{\ShowSequence} command when using the \cmd{\textRubik} font argument.
+%
+% \begin{macrocode}
+\newcommand{\textRubikx}{\rrhx}
+\newcommand{\textRubikxp}{\rrhxp}
+\newcommand{\textRubiky}{\rrhy}
+\newcommand{\textRubikyp}{\rrhyp}
+\newcommand{\textRubikz}{\rrhz}
+\newcommand{\textRubikzp}{\rrhzp}
+\newcommand{\textRubikl}{\rrhl}
+\newcommand{\textRubikr}{\rrhr}
+\newcommand{\textRubiku}{\rrhu}
+\newcommand{\textRubikd}{\rrhd}
+\newcommand{\textRubikf}{\rrhf}
+\newcommand{\textRubikb}{\rrhb}
+\newcommand{\textRubikLc}{\rrhLc}
+\newcommand{\textRubikLcp}{\rrhLcp}
+\newcommand{\textRubikRc}{\rrhRc}
+\newcommand{\textRubikRcp}{\rrhRcp}
+\newcommand{\textRubikUc}{\rrhUc}
+\newcommand{\textRubikUcp}{\rrhUcp}
+\newcommand{\textRubikDc}{\rrhDc}
+\newcommand{\textRubikDcp}{\rrhDcp}
+\newcommand{\textRubikFc}{\rrhFc}
+\newcommand{\textRubikFcp}{\rrhFcp}
+\newcommand{\textRubikBc}{\rrhBc}
+\newcommand{\textRubikBcp}{\rrhBcp}
+\newcommand{\textRubikCL}{\rrhCL}
+\newcommand{\textRubikCLp}{\rrhCLp}
+\newcommand{\textRubikCR}{\rrhCR}
+\newcommand{\textRubikCRp}{\rrhCRp}
+\newcommand{\textRubikCU}{\rrhCU}
+\newcommand{\textRubikCUp}{\rrhCUp}
+\newcommand{\textRubikCD}{\rrhCD}
+\newcommand{\textRubikCDp}{\rrhCDp}
+\newcommand{\textRubikCF}{\rrhCF}
+\newcommand{\textRubikCFp}{\rrhCFp}
+\newcommand{\textRubikCB}{\rrhCB}
+\newcommand{\textRubikCBp}{\rrhCBp}
+% \end{macrocode}
+%
+%
+%
% --------------------------
% End of this package
% --------------------------
diff --git a/Master/texmf-dist/source/latex/rubik/rubikcube.ins b/Master/texmf-dist/source/latex/rubik/rubikcube.ins
index a50acb88fd4..80a62849b26 100644
--- a/Master/texmf-dist/source/latex/rubik/rubikcube.ins
+++ b/Master/texmf-dist/source/latex/rubik/rubikcube.ins
@@ -5,21 +5,7 @@
%% Authors: RWD Nickalls (dick@nickalls.org)
%% and Apostolos Syropoulos (asyropoulos@yahoo.com)
%%
-%% VERSION 3.0 September 25, 2015
-%% Copyright 2015 RWD Nickalls + 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 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 ------------------
%%
\def\batchfile{rubikcube.ins}
@@ -31,8 +17,9 @@
Authors: RWD Nickalls (dick@nickalls.org)
and Apostolos Syropoulos (asyropoulos@yahoo.com)
- Copyright 2015 RWD Nickalls and A Syropoulos
+ Copyright 03 March 2017 RWD Nickalls and A Syropoulos
+ VERSION 4.0
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
diff --git a/Master/texmf-dist/source/latex/rubik/rubikexamples.bat b/Master/texmf-dist/source/latex/rubik/rubikexamples.bat
new file mode 100644
index 00000000000..b16f8146e4c
--- /dev/null
+++ b/Master/texmf-dist/source/latex/rubik/rubikexamples.bat
@@ -0,0 +1,3 @@
+ pdflatex --shell-escape rubikexamples.tex
+
+
diff --git a/Master/texmf-dist/source/latex/rubik/rubikpatterns.dtx b/Master/texmf-dist/source/latex/rubik/rubikpatterns.dtx
new file mode 100644
index 00000000000..a6711d471ea
--- /dev/null
+++ b/Master/texmf-dist/source/latex/rubik/rubikpatterns.dtx
@@ -0,0 +1,540 @@
+% \iffalse meta-comment
+%
+% rubikpatterns.dtx
+%
+% version 4.0
+%
+% Authors: RWD Nickalls (dick@nickalls.org)
+% and Apostolos Syropoulos (asyropoulos@yahoo.com)
+%
+% Copyright 03 March 2017 RWD Nickalls + 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. The latest version of this licence is in
+%
+% http://www.latex-project.org/lppl.txt
+%
+%<*readme>
+%
+% The rubikpatterns package provides a collection of LaTeX commands and macros
+% for the typesetting of Rubik cube configurations and rotation
+% sequences using the TikZ graphic language.
+%
+% Please report errors or suggestions for improvement to
+%
+% Dick Nickalls or Apostolos Syropoulos
+%
+% This package requires the basic TikZ package to be loaded already
+%</readme>
+%
+%<*driver>
+\listfiles
+\documentclass{ltxdoc}
+\IfFileExists{rubikpatterns.sty}{\usepackage{rubikpatterns}}{%
+ \GenericWarning{rubikpatterns.dtx}{Package file rubikpatterns.sty not found.
+ Documentation will be messed up!^^J
+ (Generate rubikpatterns.sty by (La)TeXing rubikpatterns.ins, and then^^J
+ process rubikpatterns.dtx again)^^J}\stop
+}%
+%
+\usepackage{ifpdf}
+\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
+\setcounter{StandardModuleDepth}{1}
+\begin{document}
+ \DocInput{rubikpatterns.dtx}
+ \PrintChanges
+ \PrintIndex
+\end{document}
+%</driver>
+% \fi
+%
+%
+%
+%%% \CheckSum{187}
+%
+%%% \CharacterTable
+%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%
+%
+%
+% \title{%
+% \ifpdf\pdfbookmark[1]{Title}{Title}\else\fi%
+% The \textsc{rubikpatterns} package}
+%
+% \author{
+% RWD Nickalls (dick@nickalls.org) \\
+% A Syropoulos (asyropoulos@yahoo.com)
+% }
+% \date{This file describes version \RPfileversion\ (\RPfiledate)\\
+% \texttt{www.ctan.org/pkg/rubik}}
+% \maketitle
+%
+% \begin{abstract}
+% The \rubikpatterns\ package is a small data-base of well-known named
+% Rubik patterns and associated rotation sequences, for use in conjunction
+% with the \textsc{rubikcube} and \textsc{rubikrotation} packages. It is part
+% of the Rubik `bundle'.
+% \end{abstract}
+%
+%
+% \tableofcontents
+%
+% \pagebreak
+%
+% \section{Introduction}
+%
+% The \textsc{rubikpatterns} package is a small a data-base of well-known Rubik
+% rotation sequences for use in conjunction with the \textsc{rubikcube}
+% and \textsc{rubikrotation} packages.
+% These sequences, which are well-known and widely available, were sourced from the Rubik-related
+% websites of Reid M and Kociemba H (see References for URLs).
+%
+%
+%
+% \subsection{Installation}
+%
+% Place the file \texttt{rubikpatterns.zip} into a temporary directory, and unzip it.
+% This will generate the following files:
+%\begin{quote}
+% \begin{verbatim}
+% rubikpatterns.ins
+% rubikpatterns.dtx
+% rubikpatterns.pdf --this document
+% rubikpatternsLIST.tex
+% rubikpatternsLIST.pdf
+%\end{verbatim}
+%\end{quote}
+% The package documentation is the file \texttt{rubikpatterns.pdf}.
+% The style option \texttt{rubikpatterns.sty} is generated by running (pdf)\LaTeX\ on
+% the file \texttt{rubikpatterns.ins} as follows:
+%\begin{quote}
+%\begin{verbatim}
+% pdflatex rubikpatterns.ins
+%\end{verbatim}
+%\end{quote}
+% The documentation file (\texttt{rubikpatterns.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 rubikpatterns.dtx
+% pdflatex rubikpatterns.dtx
+% makeindex -s gind.ist rubikpatterns
+% makeindex -s gglo.ist -o rubikpatterns.gls rubikpatterns.glo
+% pdflatex rubikpatterns.dtx
+% pdflatex rubikpatterns.dtx
+%\end{verbatim}
+%\end{quote}
+%
+%
+%
+% \subsubsection{Placing the files}
+% \label{sec:placingfiles}
+%
+% 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/rubik/}
+%{\newline}*.pdf $\rightarrow$ \texttt{/usr/local/texlive/texmf-local/doc/rubik/}
+%
+%\medskip
+%
+%\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.
+%
+%
+%
+% \subsection{Usage}
+% \label{sec:usage}
+% Load the packages \textsc{rubikcube},
+% \textsc{rubikrotation} and \textsc{rubikpatterns} in the \TeX\ file preamble \textit{after} loading
+% the TikZ package; for example, as follows:
+%\begin{quote}
+% \begin{verbatim}
+% \usepackage{tikz}
+% \usepackage{rubikcube,rubikrotation,rubikpatterns}
+%\end{verbatim}
+%\end{quote}
+% Since the sequence macros made available by this package are accessed using commands
+% provided by the \textsc{rubikcube} and \textsc{rubikrotation} packages, please read the
+% documentation of these packages.
+%
+%
+%
+% \section{Rubik patterns}
+%
+% A Rubik pattern is the configuration generated by a sequence of rotations
+% (or `moves') from some initial starting configuration (typically a `solved'
+% configuration). For example, `sixspot' is a well known pattern generated
+% from a solved Rubik cube by the rotation sequence
+% \texttt{U,Dp,R,Lp,F,Bp,U,Dp}, as follows:
+%
+% \bigskip
+%
+% \noindent\begin{minipage}{\textwidth}
+% \centering
+% \ifpdf
+% \includegraphics[height=3cm]{rubikpatterns-doc-figA.pdf}
+% \else
+% \fi
+% \end{minipage}
+%
+% \bigskip
+%
+% {\noindent}The code for the above image is as follows:
+%
+%\begin{verbatim}
+% \noindent\hfil%
+% \RubikCubeSolvedWB%
+% \ShowCube{2.4cm}{0.6}{\DrawRubikCubeRU}%
+% \RubikRotation{\SixSpot}%
+% \quad\SequenceBraceA{sixspot}{\ShowSequence{}{\Rubik}{\SequenceLong}}\quad%
+% \ShowCube{2.4cm}{0.6}{\DrawRubikCubeRU}%
+% \hfil%
+%\end{verbatim}
+%
+% \bigskip
+%
+% Note that the appearance of a pattern generated by a given
+% rotation sequence is, of course, sensitive to (a)~the particular colour
+% configuration of the solved cube used, and (b)~the initial orientation of
+% the Rubik cube.
+%
+%
+% Consequently the appearance generated by a given sequence
+% may appear slightly different from
+% that on some websites, although the colour configuration (pattern's \textit{geometry})
+% will, of course, be the same (isomorphic). You may therefore need
+% to adjust the pre- (and possibly the post-) x,y,z rotations in
+% order to obtain a particular configuration as displayed elsewhere.
+%
+%
+% \subsection{Sequence macros}
+%
+% Each of the rotation sequences of `patterns' made available by the
+% \textsc{rubikpatterns} package is defined in the file \texttt{rubikpatterns.sty}
+% in the following compact macro form.
+% For~example, the rotation sequence associated with the pattern known
+% as `SixSpot' (shown in the figure above) is defined as follows:
+%\begin{verbatim}
+%\newcommand{\SixSpot}{[SixSpot],U,Dp,R,Lp,F,Bp,U,Dp,<(8q*, 8f*)>}
+%\newcommand{\sixspot}{\SixSpot}
+%\end{verbatim}
+% The macro name is \verb!\SixSpot! (the lower-case version \verb!\sixspot! can also be used).
+% Note that the second argument which
+% includes the rotation sequence, also includes the pattern name in
+% square brackets \verb![SixSpot]! as the first element in the sequence.
+% Additional metadata (held by the macro \verb!\SequenceInfo!) is appended
+% in angle brackets (separated by a comma) as follows: \verb!<(8q*, 8f*)>!.
+% For details see the \textsc{rubikrotation} package documentation.
+%
+%
+%
+% \subsection{List of macros}
+%
+% The following is a list of the macro names of all the Rubik patterrns supplied by
+% the \textsc{rubikpatterns} package. Note that for convenience each macro-name listed
+% has an equivalent lower-case version. See the companion file \texttt{rubikpatternsLIST.pdf}
+% for a detailed list showing each pattern and its associated
+% sequence\,\footnote{We show all these images in a separate
+% file (\texttt{rubikpatternsLIST.pdf}) purely because generating them requires
+% using the \LaTeX\ command-line option \texttt{--shell-escape} in conjunction
+% with the \textsc{rubikrotation} package.}.
+%
+% All the pattern names encoded here (as macros) are well-known and widely available.
+% However, some pattern names have been slightly modified
+% in order to avoid spaces and to keep them as similar to the original as possible.
+% On finding different sequences which generate the same pattern, then the
+% shortest sequence has been selected (they can be readily distinguished by their metadata).
+%
+% Finally, we note that there is a serious need for a standardised one-word nomenclature
+% in order to avoid confusion, and to facilitate computerisation and an electronic database.
+% Such a notation also needs to accommodate those sequence variations which generate the same pattern.
+% We welcome suggestions and/or help for improvement.
+
+%
+%\begin{verbatim}
+% \PonsAsinorum
+% \CheckerboardsThree
+% \CheckerboardsSix
+% \Stripes
+% \CubeInCube
+% \CubeInCubeInCube
+% \ChristmasCross
+% \PlummersCross
+% \Anaconda
+% \Python
+% \BlackMamba
+% \GreenMamba
+% \FemaleRattlesnake
+% \MaleRattlesnake
+% \FemaleBoa
+% \MaleBoa
+% \FourSpot
+% \SixSpot
+% \OrthogonalBars
+% \SixTs
+% \SixTwoOne
+% \ExchangedPeaks
+% \TwoTwistedPeaks
+% \FourTwistedPeaks
+% \ExchangedChickenFeet
+% \TwistedChickenFeet
+% \ExchangedRings
+% \TwistedRings
+% \EdgeHexagonTwo
+% \EdgeHexagonThree
+% \TomParksPattern
+% \RonsCubeInCube
+% \TwistedDuckFeet
+% \ExchangedDuckFeet
+% \Superflip
+%\end{verbatim}
+%
+% Note that the particular superflip sequence made available by this package
+% (shown in \texttt{rubikpatternsLIST.pdf}) is due to Reid (1995), and is detailed
+% on the Kociemba webpage \texttt{http://www.kociemba.org/math/oh.htm}. Indeed, this was the
+% first sequence to define the `20-move' (HTM) upper boundary for solving a Rubik cube
+% (see Rokicki \textit{et~al.}, 2013).
+%
+% The superflip configuration is also significant since it is its own inverse.
+% For example, the following two \verb!\RubikRotation! commands will generate the same
+% configuration (starting from a solved cube):
+%\begin{verbatim}
+% \RubikRotation{\superflip}
+% \RubikRotation{\superflip,<inverse>}
+%\end{verbatim}
+% This property is shown as one of the examples in the Rubik bundle file \texttt{rubikexamples.pdf}.
+%
+%
+%
+% \section{Change history}
+%
+% \begin{itemize}
+%
+% \item Version 4.0 (March 2017)
+%
+% --- First release of this package.
+%
+% \end{itemize}
+%
+%
+%
+% \section{References}
+% \label{sec:references}
+%
+%\begin{itemize}
+%
+% \item Fridrich website (Fridrich J).
+% See the `Pretty patterns' webpage \url{http://www.ws.binghamton.edu/fridrich/ptrns.html}
+%
+% \item Kociemba website (Kociemba H). \url{http://www.kociemba.org/cube.htm}
+% {\newline}---for superflip see: \url{http://www.kociemba.org/math/oh.htm}
+%
+% \item Randelshofer website (Randelshofer W). Pretty patterns.
+% \url{http://www.randelshofer.ch/rubik/patterns/U080.01.html}
+%
+% \item Reid M. \ Patterns. \url{http://www.cflmath.com/Rubik/patterns.html}
+%
+% \item Reid M. (1995). Superflip requires 20 face turns. (January 1995)
+% \url{http://www.math.ucf.edu/~reid/Rubik/CubeLovers/}
+% (see Section~\ref{sec:superflip})
+% {\newline}[cited from Rokicki \textit{et~al.}, 2013].
+% {\newline}(Note: easier to use is the following html indexed version of the
+% archive of the Cube-Lovers usenet group (1982--1997)
+% \url{http://www.math.rwth-aachen.de/~Martin.Schoenert/Cube-Lovers/})
+%
+% \item Rokicki T, Kociemba H, Davidson M and Dethridge J (2013). The diameter of the Rubik's
+% cube is twenty. \textit{SIAM.\ J.\ Discrete Math.}, \textbf{27}, 1082--1105.
+% \url{http://tomas.rokicki.com/rubik20.pdf}
+%
+%\end{itemize}
+%
+%
+%
+%
+% ^^A ==================================================
+% \StopEventually{\PrintIndex}
+%
+%
+%
+% \section[The code]{The code (\texttt{rubikpatterns.sty})}
+%
+%
+% \subsection{Package heading}
+% \label{sec:CodePackageHeading}
+%
+% \begin{macrocode}
+%<*rubikpatterns>
+\def\RPfileversion{4.0}%
+\def\RPfiledate{2017/03/03}%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{rubikpatterns}[\RPfiledate\space (v\RPfileversion)]
+% \end{macrocode}
+%
+%
+% \begin{macro}{\rubikpatterns}
+% First we create a suitable logo
+% \begin{macrocode}
+\newcommand{\rubikpatterns}{\textsc{rubikpatterns}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Patterns}
+% \label{sec:patternscode}
+%
+%
+%
+%
+% \subsubsection{Superflip}
+% \label{sec:superflip}
+%
+% This particular superflip sequence is from the Kociemba website (his Oh webpage).
+% It is due to Reid (1995).
+% \begin{macrocode}
+\newcommand{\Superflip}{[Superflip],Dp,R2,Fp,D2,F2,U2,Lp,R,Dp,R2,B,F,Rp,%
+U2,Lp,F2,Rp,U2,Rp,Up,<(20f*)>}%
+\newcommand{\superflip}{\Superflip}
+% \end{macrocode}
+%
+%
+% \subsubsection{Reid data}
+%
+% These named sequences are derived from the Reid website.
+% \begin{macrocode}
+\newcommand{\PonsAsinorum}{[PonsAsinorum],F2,B2,R2,L2,U2,D2,<(12q*, 6f*)>}%
+\newcommand{\ponsasinorum}{\PonsAsinorum}%
+\newcommand{\CheckerboardsThree}%
+{[CheckerboardsThree],F,B2,Rp,D2,B,R,U,Dp,R,Lp,Dp,Fp,R2,D,F2,Bp,<(20q*, 16f*), order 3>}%
+\newcommand{\checkerboardsthree}{\CheckerboardsThree}%
+\newcommand{\CheckerboardsSix}%
+{[CheckerboardsSix],R2,L2,U,B,L2,Dp,F,B2,R,Lp,Fp,B,R,D,F2,Lp,Up,<(17f*, 22q), order 6>}%
+\newcommand{\checkerboardssix}{\CheckerboardsSix}%
+\newcommand{\Stripes}{[Stripes],F,U,F,R,L2,B,Dp,R,D2,L,Dp,B,R2,L,F,U,F,<(20q*, 17f*)>}%
+\newcommand{\stripes}{\Stripes}%
+\newcommand{\CubeInCube}{[CubeInCube],F,L,F,Up,R,U,F2,L2,Up,Lp,B,Dp,Bp,L2,U,<(18q*, 15f*)>}%
+\newcommand{\cubeincube}{\CubeInCube}%
+\newcommand{\CubeInCubeInCube}%
+{[CubeInCubeInCube],Fp,U,Bp,Rp,U,F2,U2,Fp,Up,F,U2,D,Bp,Dp,R2,B2,Up,<(17f*, 22q)>}%
+\newcommand{\cubeincubeincube}{\CubeInCubeInCube}%
+\newcommand{\ChristmasCross}{[ChristmansCross],U,F,Bp,L2,U2,L2,Fp,B,U2,L2,U,<(16q*, 11f*)>}%
+\newcommand{\christmascross}{\ChristmansCross}%
+\newcommand{\PlummersCross}%
+{[PlummersCross],R2,Lp,D,F2,Rp,Dp,Rp,L,Up,D,R,D,B2,Rp,U,D2,<(20q*, 16f*)>}%
+\newcommand{\plummerscross}{\PlummersCross}%
+\newcommand{\Anaconda}{[Anaconda],L,U,Bp,Up,R,Lp,B,Rp,F,Bp,D,R,Dp,Fp,<(14q*, 14f*)>}%
+\newcommand{\anaconda}{\Anaconda}%
+\newcommand{\Python}{[Python],F2,Rp,Bp,U,Rp,L,Fp,L,Fp,B,Dp,R,B,L2,<(16q*, 14f*)>}%
+\newcommand{\python}{\Python}%
+\newcommand{\BlackMamba}{[BlackMamba],R,D,L,Fp,R,Lp,D,Rp,U,Dp,B,Up,Rp,Dp,<(14q*, 14f*)>}%
+\newcommand{\blackmamba}{\BlackMamba}%
+\newcommand{\GreenMamba}{[GreenMamba],R,D,R,F,Rp,Fp,B,D,Rp,Up,Bp,U,D2,<(14q*, 13f*)>}%
+\newcommand{\greenmamba}{\GreenMamba}%
+\newcommand{\FemaleRattlesnake}%
+{[FemaleRattlesnake],U2,Dp,L2,D,B,U,Bp,Rp,L2,U2,F,Up,F,R,<(18q*, 14f*)>}%
+\newcommand{\femalerattlesnake}{\FemaleRattlesnake}%
+\newcommand{\MaleRattlesnake}%
+{[MaleRattlesnake],Rp,Fp,U,Fp,U2,R,L2,B,Up,Bp,Dp,L2,U2,D,<(18q*, 14f*)>}%
+\newcommand{\malerattlesnake}{\MaleRattlesnake}%
+\newcommand{\FemaleBoa}{[FemaleBoa],R,Up,R2,U2,F,D2,R2,Up,Dp,R,Dp,Fp,<(16q*, 12f*)>}%
+\newcommand{\femaleboa}{\FemaleBoa}%
+\newcommand{\MaleBoa}{[MaleBoa],F,D,Rp,U,D,R2,D2,Fp,U2,R2,U,Rp,<(16q*, 12f*)>}%
+\newcommand{\maleboa}{\MaleBoa}%
+\newcommand{\FourSpot}{[FourSpot],F2,B2,U,Dp,R2,L2,U,Dp,<(12q*, 8f*)>}%
+\newcommand{\fourspot}{\FourSpot}%
+\newcommand{\SixSpot}{[SixSpot],U,Dp,R,Lp,F,Bp,U,Dp,<(8q*, 8f*)>}%
+\newcommand{\sixspot}{\SixSpot}%
+\newcommand{\OrthogonalBars}%
+{[OrthogonalBars],F,Rp,U,L,Fp,Lp,F,Up,R,U,Lp,Up,L,Fp,<(14q*, 14f*)>}%
+\newcommand{\orthogonalbars}{\OrthogonalBars}%
+\newcommand{\SixTs}{[SixTs],F2,R2,U2,Fp,B,D2,L2,F,B,<(14q*, 9f*)>}%
+\newcommand{\sixts}{\SixTs}%
+\newcommand{\SixTwoOne}{[SixTwoOne],U,B2,D2,L,Bp,Lp,Up,Lp,B,D2,B2,<(15q*, 11f*)>}%
+\newcommand{\sixtwoone}{\SixTwoOne}%
+\newcommand{\ExchangedPeaks}%
+{[ExchangedPeaks],F2,R2,D,R2,U,D,F2,Dp,Rp,Dp,F,L2,Fp,D,R,Up,<(16f*, 21q)>}%
+\newcommand{\exchangedpeaks}{\ExchangedPeaks}%
+\newcommand{\TwoTwistedPeaks}%
+{[TwoTwistedPeaks],F,D2,B,R,Bp,Lp,F,Dp,L2,F2,R,Fp,Rp,F2,Lp,Fp,<(16f*, 20q)>}%
+\newcommand{\twotwistedpeaks}{\TwoTwistedPeaks}%
+\newcommand{\FourTwistedPeaks}%
+{[FourTwistedPeaks],Up,D,B,Rp,F,R,Bp,Lp,Fp,B,L,F,Rp,Bp,R,Fp,Up,D,<(18q*, 18f*)>}%
+\newcommand{\fourtwistedpeaks}{\FourTwistedPeaks}%
+\newcommand{\ExchangedChickenFeet}%
+{[ExchangedChickenFeet],F,Lp,Dp,Bp,L,F,U,Fp,Dp,F,L2,Bp,Rp,U,L2,Dp,F,<(19q*, 17f*)>}%
+\newcommand{\exchangedchickenfeet}{\ExchangedChickenFeet}%
+\newcommand{\TwistedChickenFeet}%
+{[TwistedChickenFeet],F,Lp,D,Fp,Up,B,U,F,Up,F,Rp,F2,L,Up,Rp,D2,<(18q*, 16f*)>}%
+\newcommand{\twistedchickenfeet}{\TwistedChickenFeet}%
+\newcommand{\ExchangedRings}%
+{[ExchangedRings],F,U,Dp,Lp,B2,L,Up,D,F,U,R2,L2,Up,L2,F2,<(15f*, 20q)>}%
+\newcommand{\exchangedrings}{\ExchangedRings}%
+\newcommand{\TwistedRings}%
+{[TwistedRings],F,D,Fp,D2,Lp,Bp,U,L,D,R,U,Lp,Fp,U,L,U2,<(18q*, 16f*)>}%
+\newcommand{\twistedrings}{\TwistedRings}%
+\newcommand{\EdgeHexagonTwo}%
+{[EdgeHexagonTwo],U,B2,Up,Fp,Up,D,Lp,D2,L,U,Dp,F,Dp,L2,B2,Dp,<(20q*, 16f*) order2>}%
+\newcommand{\edgehexagontwo}{\EdgeHexagonTwo}%
+\newcommand{\EdgeHexagonThree}%
+{[EdgeHexagonThree],F,L,B,U,L,F2,B2,Rp,F2,B2,Up,Bp,Lp,Fp,<(14f*, 18q) order 3>}%
+\newcommand{\edgehexagonthree}{\EdgeHexagonThree}%
+\newcommand{\TomParksPattern}%
+{[TomParksPattern],L,U,F2,R,Lp,U2,Bp,U,D,B2,L,F,Bp,Rp,L,Fp,R,<(20q*, 17f*)>}%
+\newcommand{\tomparkspattern}{\TomParksPattern}%
+\newcommand{\RonsCubeInCube}%
+{[RonsCubeInCube],L2,D2,Lp,D2,B2,L2,B2,Lp,D2,L2,B2,Lp,B2,<(13f*, 23q)>}%
+\newcommand{\ronscubeincube}{\RonsCubeInCube}%
+\newcommand{\TwistedDuckFeet}%
+{[TwistedDuckFeet],F,Rp,B,R,U,Fp,Lp,Fp,U2,Lp,Up,D2,B,Dp,F,Bp,U2,<(20q*, 17f*)>}%
+\newcommand{\twistedduckfeet}{\TwistedDuckFeet}%
+\newcommand{\ExchangedDuckFeet}%
+{[ExchangedDuckFeet],U,F,R2,Fp,Dp,R,U,B2,U2,Fp,R2,F,D,B2,R,Bp,<(21q*, 16f*)>}%
+\newcommand{\exchangedduckfeet}{\ExchangedDuckFeet}%
+% \end{macrocode}
+% --------------------------
+% End of this package
+% --------------------------
+% \begin{macrocode}
+%</rubikpatterns>
+% \end{macrocode}
+%
+%
+%
+%
+% \Finale
+%
+\endinput
+
+
+
+
+
diff --git a/Master/texmf-dist/source/latex/rubik/rubikpatterns.ins b/Master/texmf-dist/source/latex/rubik/rubikpatterns.ins
new file mode 100644
index 00000000000..9260827909b
--- /dev/null
+++ b/Master/texmf-dist/source/latex/rubik/rubikpatterns.ins
@@ -0,0 +1,65 @@
+%% rubikpatterns.ins
+%%
+%% version 4.0
+%%
+%% --- automatic overwriting of .sty is disabled-------
+%% =========================================================
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+\def\batchfile{rubikpatterns.ins}
+\input docstrip.tex
+
+\preamble
+
+-----------------------------------------------------------------
+ Authors: RWD Nickalls (dick@nickalls.org)
+ and Apostolos Syropoulos (asyropoulos@yahoo.com)
+
+ Copyright March 03, 2017 RWD Nickalls and A Syropoulos
+
+ VERSION 4.0
+
+ 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 is a LaTeX/TikZ package for drawing Rubik cubes
+ Please report errors or suggestions for improvement to
+
+ RWD Nickalls (dick@nickalls.org)
+ Apostolos Syropoulos (asyropoulos@yahoo.com)
+
+ This package requires the basic TikZ package to be loaded already
+------------------------------------------------------------------
+\endpreamble
+
+\keepsilent %%disables most of the screen output
+%% \askforoverwritefalse %%enables automatic overwriting of .sty
+\generate{\file{rubikpatterns.sty}{\from{rubikpatterns.dtx}{rubikpatterns}}}
+
+%%now write a screen message for the user
+\obeyspaces
+\Msg{*******************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the *}
+\Msg{* following file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* rubikpatterns.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file *}
+\Msg{* rubikpatterns.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 *}
+\Msg{* makeindex -s gglo.ist -o filename.gls filename.glo *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{*******************************************************}
+
+\endbatchfile
+%%------------EOF---------------
diff --git a/Master/texmf-dist/source/latex/rubik/rubikpatternsLIST.bat b/Master/texmf-dist/source/latex/rubik/rubikpatternsLIST.bat
new file mode 100644
index 00000000000..a8e9b92cd13
--- /dev/null
+++ b/Master/texmf-dist/source/latex/rubik/rubikpatternsLIST.bat
@@ -0,0 +1,3 @@
+ pdflatex --shell-escape rubikpatternsLIST.tex
+
+
diff --git a/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx b/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx
index 57302ac37a7..2b554ef7128 100644
--- a/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx
+++ b/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx
@@ -1,12 +1,12 @@
% \iffalse meta-comment
% rubikrotation.dtx
%
-% version 3.0
+% version 4.0
%
-% Authors: RWD Nickalls (dick@nickalls.org)
+% Authors: RWD Nickalls (dick@nickalls.org)
% and Apostolos Syropoulos (asyropoulos@yahoo.com)
-% Copyright 25 September 2015 RWD Nickalls + A Syropoulos
+% Copyright 03 March 2017 RWD Nickalls + A Syropoulos
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -58,7 +58,7 @@
%
%
%
-% \CheckSum{310}
+%%% \CheckSum{322}
%
%%% \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
@@ -78,7 +78,9 @@
%
%
%
-% \title{The \rubikrotation\ package}
+% \title{%
+% \ifpdf\pdfbookmark[1]{Title}{Title}\else\fi%
+% The \rubikrotation\ package}
%
% \author{
% RWD Nickalls (dick@nickalls.org) \\
@@ -91,49 +93,49 @@
% \begin{abstract}
% 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
+% This 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).
+% The \rubikrotation\ package also provides commands for saving the cube state
+% to a file (\cmd{\SaveRubikState}), and for displaying any
+% errors (\cmd{\ShowRubikErrors}).
% \end{abstract}
-%
+%
+%
% \begin{minipage}{11cm}
% \centering
% \ifpdf
-% \includegraphics[width=10cm]{Rubikrot-doc-figD.pdf}
+% \strut\hspace{6mm}\includegraphics[width=10cm]{rubikrot-doc-figD.pdf}
% \else
% \fi
% \end{minipage}
+%
%
% \vspace{-1\baselineskip}
%
% \tableofcontents
%
+% \pagebreak
+%
% \section{Introduction}
%
% The \rubikrotation\ package is a dynamic extension to the \textsc{rubikcube} package.
% It consists of a style option (\texttt{rubikrotation.sty}), a
-% Perl script (\texttt{rubikrotation.pl}) and some examples.
+% Perl script (\texttt{rubikrotation.pl}).
%
% 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
-% command-line control of the Perl script, which is really the `engine' of this package.
+% Rubik rotation moves on-the-fly using the \cmd{\RubikRotation} command.
+% Consequently the \rubikrotation\ package requires access to the \TeX\ \texttt{write18}
+% facility, which is enabled by using the \texttt{--shell-escape} command-line switch.
+% This allows 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'
+% platform (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.}), on a Linux platform (Mandriva using
-% {\TeX}Live), and on a Solaris platform (OpenIndiana).
+% environment of Unix/Linux systems.}), on a Linux platform (Debian v8.2.0,
+% {\TeX}Live 2016, and Perl v5.20.2), and on a Solaris platform (OpenIndiana).
%
% The following commands are made available by \texttt{rubikrotation.sty}:
% \begin{quote}
@@ -142,6 +144,10 @@
% \SaveRubikState
% \CheckRubikState
% \ShowRubikErrors
+% \SequenceName
+% \SequenceInfo
+% \SequenceShort
+% \SequenceLong
%\end{verbatim}
% \end{quote}
%
@@ -164,21 +170,15 @@
% 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
+% rubikrotation.1 --manual file for rubikrotation.pl (`man' file)
+% rubikrot-doc-figA.pdf
+% rubikrot-doc-figB.pdf
+% rubikrot-doc-figC.pdf
+% rubikrot-doc-figD.pdf
%\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 documentation of the Perl program \texttt{rubikrotation.pl} is the file \texttt{rubikrotationPL.pdf}
%
% The style option \texttt{rubikrotation.sty} is generated by running (pdf)\LaTeX\ on
% the file \texttt{rubikrotation.ins} as follows:
@@ -189,7 +189,7 @@
%\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}
+% system as well as an 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}
@@ -232,7 +232,7 @@
% file is named \texttt{rubikrotation.cfg}.
%
%\medskip
-%{\noindent}\textsc{the `man' file}:\ \ On a Linux platform this file
+%{\noindent}\textsc{the `man' file}:\ \ On a Linux platform this manual file
% (\texttt{rubikrotation.1}) would be typically located in the
% directory \verb!/usr/share/man/man1!.
%
@@ -251,7 +251,7 @@
%\end{quote}
% which should generate something like the following:
% \begin{verbatim}
-% This is rubikrotation version 3.0
+% This is rubikrotation version 4.0
% Usage: rubikrotation [-h] -i <input file> [-o <out file>]
% where,
% [-h] gives this help listing
@@ -264,27 +264,31 @@
%
% \section{Usage}
% \label{sec:usage}
-% Load the packages \texttt{rubikcube.sty}
-% 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:
+% Load the packages \texttt{rubikcube.sty},
+% \texttt{rubikrotation.sty} and \texttt{rubikpatterns.sty} in the \TeX\ file
+% preamble \textit{after} loading the TikZ package (all the Rubik packages
+% require the TikZ package); for example, as follows:
%\begin{quote}
% \begin{verbatim}
% \usepackage{tikz}
-% \usepackage{rubikcube,rubikrotation}
+% \usepackage{rubikcube,rubikrotation,rubikpatterns}
%\end{verbatim}
%\end{quote}
-% and run (pdf)\LaTeX\ using the \texttt{--shell-escape} command-line switch
+% and run (pdf)\LaTeX\ using the \texttt{--shell-escape} command-line option
% (see the following section).
%
%
+%
% \subsection{Enabling the \TeX\ `shell' facility}
+% \label{sec:shellescape}
%
-% In order to enable the \TeX\ `write18' facility (so it can run the Perl script)
-% it is necessary to invoke (pdf)\LaTeX\ using the \texttt{--shell-escape} switch
-% as follows:
+% In order to access the \TeX\ \cmd{\write18} syntax (so we can access system commands,
+% and hence run the Perl script),
+% it is necessary to invoke the \LaTeX\ engine (e.g.,~(pdf)\LaTeX\ or Lua\LaTeX)
+% using the \texttt{--shell-escape} command-line option; for example:
%\begin{quote}
% \begin{verbatim}
-% pdflatex --shell-escape filename.tex
+% pdflatex --shell-escape filename.tex
%\end{verbatim}
%\end{quote}
% In practice, it is probably most convenient to run this command via a
@@ -298,34 +302,18 @@
% acroread filename.pdf &
%\end{verbatim}
%\end{quote}
-%
-%
-% \subsection{Test file}
-%
-% 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-rot.tex (shows 8 worked examples)
-%\end{verbatim}
-%\end{quote}
-% This file needs to be run using \texttt{--shell-escape} switch; for example:
-%\begin{quote}
-% \begin{verbatim}
-% pdflatex --shell-escape example-rot.tex
-%\end{verbatim}
-%\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:
+% If the \LaTeX\ engine is Lua\LaTeX, e.g.,
%\begin{quote}
% \begin{verbatim}
-% bash example-rot.sh
+% lualatex --shell-escape filename.tex
%\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.
+%then \texttt{rubikrotation.sty} will automatically load
+% the recently developed \textsf{shellesc} package in order to facilitate system access to Perl
+% (see Section~\ref{sec:CodePackageHeading}). See \textit{\LaTeX\ News}, issue~24,
+% Feb~2016 for further details of the \textsf{shellesc} package.
+% Consequently, if you intend to use Lua\LaTeX\ then you will need to ensure your system
+% has access to the \textsf{shellesc} package (it can always be downloaded from CTAN directly).
%
%
% \subsection{Configuration-file}
@@ -350,9 +338,9 @@
% 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,
+% For~the \rubikrotation\ package there are two particular macros we may wish to adjust.
+% The~first is that holding the filename of the Perl script, namely
+% \cmd{\rubikperlname}. The second is that holding 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
@@ -364,8 +352,8 @@
% -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
+% Note the need here (in the second macro) to use \cmd{\space} on the end of
+% (\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.
%
@@ -374,7 +362,8 @@
% 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:
+% (it \textit{must} be named exactly \texttt{rubikrotation.cfg}) and contains just
+% the following line:
%\begin{quote}
%\begin{verbatim}
%\renewcommand{\rubikperlname}{rubikrotationR77}
@@ -387,7 +376,8 @@
% 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:
+% need to implement \textit{both} these changes (of name and command) in
+% the configuration-file, as follows:
%\begin{quote}
%\begin{verbatim}
%\renewcommand{\rubikperlname}{rubikrotationR55.pl}
@@ -395,8 +385,11 @@
% -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.
+%{\noindent}Remember to make sure the PATH associated with the command is also correct.
+%
+%
+%{\noindent\textsc{placing the configuration-file}:\ \ The simplest arrangement is
+% just to include the \texttt{.cfg} file in the working 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
@@ -422,7 +415,7 @@
% \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
+% therefore accessible outside that \textit{particular} environment
% (see also Section~4.1 in the \textsc{rubikcube} documentation).
%
% Conversely, the only \rubikrotation\ command which should \textit{not}
@@ -430,72 +423,257 @@
% (see the notes on this command below).
%
%
-% \subsection[RubikRotation command]{\cmd{\RubikRotation} command}
-% \label{sec:rubikrotationcmd}
+%
+%
+% \subsection[RubikRotation]{\cmd{\RubikRotation} command}
+% \label{sec:rubikrotationcmd}
%
% \DescribeMacro{\RubikRotation}
-% 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.
+% The \cmd{\RubikRotation}\oarg{integer}\marg{comma-separated sequence}
+% command processes a sequence of rotation codes, and returns
+% the final state. The inverse sequence can also be
+% implemented (see \textbf{Inverse} below).
+%
+%
+% The first (optional) argument \oarg{integer} of the \cmd{\RubikRotation} command is the number
+% of times the whole command itself should be repeated; for example
+% as follows: \verb!\RubikRotation[2]{...}!.
+%
+% The second (mandatory) argument consists of a comma-separated sequence
+% of rotation codes, e.g.,~\texttt{U, D2}, which may be encoded as a macro. In addition, there
+% may be additional comma-separated macros and optional \verb![name]!,
+% `repeat blocks' and `info blocks' (see below).
+% The general structure of the second argument is as follows:
+% \verb!\RubikRotation{[name],...,\macro,...,(repeat)n,...,<info>}!.
+% These elements are now described in detail.
+%
+%
+%
+% \textbf{Square brackets}: \ This is an optional `sequence name' facility.
+% The contents of square brackets are not processed
+% as rotations, and can therefore be used as a `name' of the sequence, e.g.,~\verb![CrossSeq]!,
+% or as a tag, to be visible in the log file. The contents must \textit{not} include commas, but
+% can have other separators, e.g.,~spaces, semicolons etc. Importantly, the contents of the
+% first square bracket will be designated the sequence name and will be held as the
+% macro \cmd{\SequenceName}. Square brackets can also be used in repeat blocks (see below).
+% Square brackets must be separated by a comma from adjacent codes.
+%
+%
+% \textbf{Repeat block}: \ This is an optional comma-separated sequence of rotation
+% codes which is to be repeated a specified number of times. It must be delimited
+% by balanced curved brackets, and an optional terminal integer $n$ (repeat number)
+% can be used. For example, \verb!(F,B3)2,! where the `2' indicates that the rotation
+% sequence \verb!F,B3! is to be processed twice. If the repeat number is omitted
+% then $n=1$ is assumed. Repeat blocks must be separated by a comma from adjacent codes,
+% and can include balanced square brackets (see below).
+%
+%
+% \textbf{Info block}: \
+% This is an optional block of meta information, and must be
+% delimited by balanced angle-brackets \verb!<..>!. An info-block typically carries
+% information regarding the sequence itself; typically, something
+% like \verb!<(20f*) //C2(a)>!. If an infoblock includes the keyword `inverse' then
+% the program will implement the inverse sequence of rotations (see below).
+% An info-block must be separated by a comma from the adjacent codes.
+% The contents of all info blocks will be held collectively as the macro \cmd{\SequenceInfo}.
+%
+%
+% \textbf{Inverse sequence}: \
+% The (mathematically) inverse sequence of the given sequence can be implemented by including
+% the keyword `inverse' (or INVERSE) in an infoblock,
+% as follows \verb!\RubikRotation{<inverse>, ... }!. The keyword can be either in its
+% own separate infoblock, or inside a larger infoblock. The program simply checks for the
+% string `inverse', which can be either lower-case or upper-case. The implemented sequence
+% can be checked by looking at (or printing) the contents of the macro
+% \cmd{\SequenceLong} (see section on \textit{Sequence strings} below). Note that the macro
+% \cmd{\SequenceLong} is also shown (expanded) in the log file.
+%
+%
+% \subsubsection{Examples}
+%
+% Some examples of the use of the \cmd{\RubikRotation} command are as follows; the commas are important and brackets must
+% be balanced and not nested:
%\begin{quote}
% \begin{verbatim}
-% \RubikCubeSolved % sets up the colours for a solved cube state
-% \RubikRotation{R2,L,U,D}
-% \begin{tikzpicture}[scale=0.7]
-% \DrawRubikCubeRU
-% \end{tikzpicture}%
+% \RubikRotation[2]{x,R2,U}
+% \RubikRotation{\sixspot}
+% \RubikRotation{<inverse>,[myseqB],U,D,L,R2,(M,U)3,D2}
+% \RubikRotation{[K32466],U,F,U2,F,L2,B,U2,F,Lp,Rp,F2,D,R2,U2,L2,B,Fp,
+% L,F2,D,<(20f*) //Oh{I}>}
+%\end{verbatim}
+%\end{quote}
+%
+% \noindent\textbf{Inverse sequence}
+%
+% Inverting a sequence involves (a)~reversing the order, and (b)~inverting each element.
+% Thus, the inverse of the sequence \verb!(Up,D,L2,Rp)! is \verb!(R,Lp,Lp,Dp,U)!.
+% But~\verb!(Lp,Lp)! $\equiv$ \verb!L2!, and so the inverse
+% of \verb!(Up,D,L2,Rp)! would generally be expressed as \verb!(R,L2,Dp,U)!.
+% However, since the macro \cmd{\SequenceLong} records the individual elements as they are processed,
+% when a sequence is inverted notational compressions such as \verb!Lp,Lp! $\rightarrow$ \verb!L2!
+% are not made.
+% For example, processing the command \verb!\RubikRotation{<inverse>,Up,D,L2,Rp}! results in the macro
+% \cmd{\SequenceLong} being displayed in the subsequent \texttt{rubikstateNEW.dat} file as
+%\begin{quote}
+% \begin{verbatim}
+% \renewcommand\SequenceLong{R,Lp,Lp,Dp,U}%
+%\end{verbatim}
+%\end{quote}
+% A more extensive example is given at the end of Section~\ref{sec:sequencestrings}.
+%
+%
+% \medskip\noindent\textbf{Repetitions}
+%
+% Repetitions can be achieved in various ways. First, all the rotations in the second argument
+% can be repeated multiple times, say $n$ times, by
+% using the optional \verb![n]! argument of the \cmd{\RubikRotation[]\{\}} command;
+% i.e.,~the whole of the mandatory argument of the \cmd{\RubikRotation} command is then
+% executed $n$ times.
+%
+% Second, a sub-sequence of rotations can be repeated within the main
+% argument multiple times, by delimiting such groups with curved brackets
+% and a trailing integer (i.e.,~in a repeat-block), as described above.
+% If no integer is given, then $n=1$ is assumed, and hence curved brackets can also be used
+% simply to highlight particular sequences.
+% For example, the following five commands are equivalent:
+%\begin{quote}
+% \begin{verbatim}
+% \RubikRotation[3]{x,R2,U}
+% \RubikRotation{(x,R2,U)3}
+% \RubikRotation{(x,R2,U)2,x,R2,U}
+% \RubikRotation{x,R2,U,x,R2,U,x,R2,U}
+% \RubikRotation{(x,R2,U),(x,R2,U),(x,R2,U)}
+%\end{verbatim}
+%\end{quote}
+%
+%
+% \medskip\noindent\textbf{Macros}
+%
+% Note also that macros representing a rotation sequence can also appear as part of the main argument.
+% So, extending the previous example, if we were to define \verb!\newcommand{\ShortSeq}{x,R2,U}!, then
+% the following three commands would also be equivalent to the five previous ones:
+%\begin{quote}
+% \begin{verbatim}
+% \RubikRotation[3]{\ShortSeq}
+% \RubikRotation{(\ShortSeq)3}
+% \RubikRotation{(x,R2,U),\ShortSeq,\ShortSeq}
%\end{verbatim}
%\end{quote}
-% The \cmd{\RubikRotation} command results in \LaTeX\ first writing
+%
+%
+% \medskip\noindent\textbf{Process overview}
+%
+% 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 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. 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:
+% file, performs all the rotations, and then writes the new Rubik state,
+% and the four \cmd{\Sequence...} macros (see below), and any error messages, all to the
+% file \texttt{rubikstateNEW.dat},
+% which is then input on-the-fly by the \texttt{.tex} file. This new Rubik state
+% can then be used either as the input for another \cmd{\RubikRotation} command, or used
+% to generate a graphic image of the cube. The \cmd{\Sequence...} macros can then
+% be used for typesetting the sequence of rotations in various formats.
+%
+%
+% \subsubsection{Sequence strings}
+% \label{sec:sequencestrings}
+%
+% \DescribeMacro{\SequenceName}
+% \DescribeMacro{\SequenceInfo}
+% \DescribeMacro{\SequenceShort}
+% \DescribeMacro{\SequenceLong}
+% The sequence of rotation codes used as the main argument for the \cmd{\RubikRotation}
+% command is also returned in the form of four macros, namely \cmd{\SequenceName} (contains the
+% `name' of the sequence if a \texttt{[name]} exists), \cmd{\SequenceInfo} (contains any sequence
+% meta data in `info-blocks'), \cmd{\SequenceShort} (contains the original
+% sequence of rotation codes), and \cmd{\SequenceLong} (contains the expanded or `Long' form of the
+% original sequence---i.e.,~in which any `short' rotation codes (e.g.,~\texttt{R2, L3}) in the original
+% sequence have been expanded into their separate codes---e.g.,~\texttt{R, R, L, L, L} etc.).
+%
+% For example, if we wanted to see the effect of the sequence associated with the `SixTs'
+% cube configuration
+% \verb![SixTs],F2,R2,U2,Fp,B,D2,L2,F,B,<(14q*,14f*)>!
+% on a solved Rubik cube (where `SixTs' is the `name' of the sequence),
+% we could use the following commands:
%\begin{quote}
% \begin{verbatim}
-% \RubikRotation[3]{x,R,U}
-% \RubikRotation{x,R,U,x,R,U,x,R,U}
+% \RubikCubeSolved % sets up the colours for a solved cube state
+% \RubikRotation{[SixTs],F2,R2,U2,Fp,B,D2,L2,F,B,<(14q*,14f*)>}
+% \ShowCube{2.8cm}{0.7}{\DrawRubikCubeRU}
%\end{verbatim}
%\end{quote}
+% Note (a)~contents of a square bracket [..] are not processed as rotations, (b)~the contents
+% of the first square bracket in a sequence is taken to be the `name' of the sequence
+% (see Section~\ref{sec:prefixedargument} for more details).
+% In this example the four \cmd{\Sequence..} macros described above would now hold
+% the following strings:
+%\begin{quote}
+% \cmd{\SequenceName} = SixTs
+%{\newline} \cmd{\SequenceInfo} = (14q*,14f*)
+%{\newline} \cmd{\SequenceShort} = [SixTs],F2,R2,U2,Fp,B,D2,L2,F,B
+%{\newline} \cmd{\SequenceLong} = F,F,R,R,U,U,Fp,B,D,D,L,L,F,B
+%\end{quote}
+%
+% As another example, we now show how to implement the inverse of the above \verb!SixTs!
+% sequence, by including the key word `inverse' in an infoblock, and, more conveniently,
+% using the macro \verb!\sixts! from the \textsc{rubikpatterns} package, as follows:
+%\begin{quote}
+% \begin{verbatim}
+% \RubikRotation{<inverse>,\sixts}
+%\end{verbatim}
+%\end{quote}
+% In this case, the log file would then show the associated \cmd{\Sequence..} macros as follows:
+%\begin{quote}
+% \begin{verbatim}
+%...SequenceName = SixTs
+%...SequenceInfo = inverse; (14q*; 9f*)
+%...SequenceShort = [SixTs],F2,R2,U2,Fp,B,D2,L2,F,B
+%...SequenceLong = Bp,Fp,Lp,Lp,Dp,Dp,Bp,F,Up,Up,Rp,Rp,Fp,Fp
+%\end{verbatim}
+%\end{quote}
+% showing that the macro \cmd{\SequenceShort} holds the \verb!\sixts! sequence, while
+% the macro \cmd{\SequenceLong} holds the inverse sequence which was actually implemented.
+%
+% For further details regarding the use of these \cmd{\Sequence..} macros for typesetting
+% the various components of a sequence, and why the \cmd{\SequenceLong} command is
+% particularly useful, see Section~10 in the \textsc{rubikcube} documentation
+% (the \cmd{\ShowSequence} command).
+%
+%
%
-
% \subsubsection{Sequences as macros}
-% \label{sec:seq-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.
+% one to store lots of different rotation sequences by name alone. Note that
+% \texttt{rubikpatterns.sty} (part of the Rubik bundle) is a collection/database
+% of many such well-known named sequences.
%
-% For example, we can use the name `sixspot' for a macro denoting the rotation sequence
+% For example, by installing the \textsc{rubikpatterns} package we are able to 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:
+% Reid website)[\,see refs Section~\ref{sec:references}\,]. The `sixspot' sequence is
+% defined as follows:
%\begin{quote}
% \begin{verbatim}
-% \newcommand{\sixspot}{U,Dp,R,Lp,F,Bp,U,Dp}
+% \newcommand{\sixspot}{U,Dp,R,Lp,F,Bp,U,Dp,<(8q*, 8f*)>}
%\end{verbatim}
%\end{quote}
-% With this new \cmd{\sixspot} command we are now able to generate the graphic (sixspot cube)
+% Armed with the \cmd{\sixspot} macro 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{minipage}{7cm}
% \begin{verbatim}
+% \usepackage{rubikcube,rubikrotation}
+% \usepackage{rubikpatterns}
+% ...
% \RubikCubeSolved
% \RubikRotation{\sixspot}
% \ShowCube{3cm}{0.7}{\DrawRubikCubeRU}
@@ -504,7 +682,7 @@
% \begin{minipage}{3.4cm}
% \centering
% \ifpdf
-% \includegraphics[height=3cm]{Rubikrot-doc-figA.pdf}
+% \includegraphics[height=3cm]{rubikrot-doc-figA.pdf}
% \else
% \fi
% \end{minipage}
@@ -515,87 +693,75 @@
% and macros; for example, \verb!\RubikRotation{x,y,\sixspot,x}!.
%
%
-% \subsubsection{Arguments prefixed with *, [, ]}
+% \subsubsection{Arguments in square brackets }
% \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.
+% The contents of a square bracket are not processed as rotations, but are simply
+% interpreted as an inactive `string'. This feature therefore
+% allows the contents to be used as a label, which can be very useful.
+% Note the contents of square brackets must not include commas, but spaces and semicolons
+% are allowed.
%
-% For example, we can use this facility to label the `sixspot' configuration mentioned above,
+% For example, we can use this facility to `name' the `SixSpot' configuration mentioned above,
% as follows:
%\begin{quote}
% \begin{verbatim}
-% \RubikRotation{[sixspot],U,Dp,R,Lp,F,Bp,U,Dp}
+% \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 [\,] label feature in the \cmd{\sixspot} command, as follows,
+% the [\,] label-name 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}
%\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,
+% Note that using the \texttt{[name]} facility has the great advantage of making the
+% label-name visible in the log-file.
+% For example, the following command, which uses the rotations \textbf{x2},
+% and \textbf{y} to rotate the Rubik cube after applying
+% the `sixspot' sequence of rotations:
%\begin{quote}
% \begin{verbatim}
-% \RubikRotation{x2,y,\sixspot}
+% \RubikRotation{\sixspot,x2,y}
%\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 ...
-% ...rotation x OK (= rrR + rrSr + rrLp)
-% ...rotation x OK (= rrR + rrSr + rrLp)
-% ...rotation y OK (= rrU + rrSu + rrDp)
-% ...[sixspot] is a label OK
-% ...rotation U OK
-% ...rotation Dp OK
-% ...rotation R OK
-% ...rotation Lp OK
-% ...rotation F OK
-% ...rotation Bp OK
-% ...rotation U OK
-% ...rotation Dp OK
+% ...dataline = rotation,[SixSpot],U,Dp,R,Lp,F,Bp,U,Dp,<(8q*; 8f*)>,x2,y
+% ...[SixSpot] is a label OK
+% ...rotation U, OK
+% ...rotation Dp, OK
+% ...rotation R, OK
+% ...rotation Lp, OK
+% ...rotation F, OK
+% ...rotation Bp, OK
+% ...rotation U, OK
+% ...rotation Dp, OK
+% ...Expanding x2 ...
+% ...rotation x, OK (= x = R + Sr + Lp)
+% ...rotation x, OK (= x = R + Sr + Lp)
+% ...rotation y, OK (= y = U + Su + Dp)
+% ...writing new Rubik state to file rubikstateNEW.dat
+% ...SequenceName = SixSpot
+% ...SequenceInfo = (8q*; 8f*)
+% ...SequenceShort = [SixSpot],U,Dp,R,Lp,F,Bp,U,Dp,x2,y
+% ...SequenceLong = U,Dp,R,Lp,F,Bp,U,Dp,x,x,y
%\end{verbatim}
%\end{quote}
-% In this way, several named rotation sequences can be easily distinguished
-% in the log file from adjacent rotation sequences.
+% Note that the \verb!\sixspot! macro, as held in the \textsc{rubikpatterns} package, includes a terminal
+% infoblock holding the `SequenceInfo' as indicated in the above example.
+%
+% Also, note that the square bracket feature allows for several named rotation sequences
+% to be easily distinguished 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.
+% See also the \cmd{\ShowSequence} command (in the \textsc{rubikcube} package)
+% for a convenient way of displaying a sequence of rotations in various formats.
+%
%
% \subsubsection{Groups}
%
@@ -604,7 +770,8 @@
% 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$,
+% original state. More formally this is equivalent to
+% $($\cmd{\sixspot}$)3 \equiv e$\,\footnote{$e$ is the `identity' element},
% and can be nicely illustrated by implementing the following pseudocode:
%\begin{verbatim}
% \RubikCubeSolved . \RubikRotation[3]{\sixspot} = \RubikCubeSolved
@@ -613,7 +780,7 @@
% \begin{minipage}{11cm}
% \centering
% \ifpdf
-% \includegraphics[width=10cm]{Rubikrot-doc-figC.pdf}
+% \includegraphics[width=10cm]{rubikrot-doc-figC.pdf}
% \else
% \fi
% \end{minipage}
@@ -623,30 +790,31 @@
%
% The \cmd{\RubikRotation} command can also be used to scramble the
% cube using a random sequence of rotations. If the first argument
-% is the lowercase word `random' \textsc{and} the second argument
+% is the lower-case word `random' \textsc{and} the second argument
% 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 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
+% 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 we currently have
+% (see the `random' subroutine in the document \texttt{rubikrotationPL.pdf})
%\begin{quote}
%\begin{verbatim}
% my $maxn=200;
%\end{verbatim}
%\end{quote}
%
-% For example, the following commands will scramble a solved cube using a
+% For example, the following commands scramble a solved cube using a
% sequence of 120 random rotations, and display the state in the form of
-% a semi-flat cube.
+% a semi-flat (SF) cube.
%
% \begin{minipage}{3.4cm}
% \centering
% \ifpdf
-% \includegraphics[height=4cm]{Rubikrot-doc-figB.pdf}
+% \includegraphics[height=4cm]{rubikrot-doc-figB.pdf}
% \else
% \fi
% \end{minipage}
@@ -655,7 +823,7 @@
%\begin{verbatim}
% \RubikCubeSolved%
% \RubikRotation{random,120}%
-% \ShowCube{5.5cm}{0.5}{\DrawRubikCubeFlat}
+% \ShowCube{5.5cm}{0.5}{\DrawRubikCubeSF}
%\end{verbatim}
% \end{minipage}
%
@@ -691,7 +859,7 @@
%\begin{quote}
%\begin{verbatim}
% \RubikCubeSolved%
-% \RubikRotation{*sixspot,U,Dp,R,Lp,F,Bp,U,Dp}%
+% \RubikRotation{U,Dp,R,Lp,F,Bp,U,Dp}%
% \SaveRubikState{sixspot.tex}%
%\end{verbatim}
%\end{quote}
@@ -709,12 +877,12 @@
% \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:
+% We can therefore access and draw this configuration in a Semi-Flat format
+% later, when required, simply by inputting the file as follows:
%\begin{quote}
%\begin{verbatim}
%\input{sixspot.tex}
-%\ShowCube{7cm}{0.7}{\DrawRubikCubeFlat}
+%\ShowCube{7cm}{0.7}{\DrawRubikCubeSF}
%\end{verbatim}
%\end{quote}
%
@@ -724,7 +892,7 @@
% \DescribeMacro{\CheckRubikState}
% Since it is easy to inadvertently define an invalid Rubik cube
% (e.g.,~enter an invalid number of, say, yellow facelets), this command
-% checks the current colour state of all the cubies
+% simply checks the current colour state of all the cubies
% 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
@@ -736,7 +904,9 @@
% \CheckRubikState%
%\end{verbatim}
%\end{quote}
-% Note that such a check is implemented automatically with each \cmd{\RubikRotation} command.
+% Note (1)~that such a check is implemented automatically with each \cmd{\RubikRotation}
+% command, and (2)~this is actually only a very superficial check---simply counting the number
+% of cubies of each colour.
%
%
%
@@ -758,6 +928,7 @@
% 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}
%
%
@@ -780,21 +951,22 @@
%
%
% \section{General overview}
-% \label{generaloverview}
-% When \LaTeX\ processes \texttt{rubikrotation.sty} the following steps
-% are implemented.
-% \begin{itemize}
+% \label{generaloverview}
%
+% When \LaTeX\ processes \texttt{rubikrotation.sty} the following steps
+% are implemented.
+% \begin{itemize}
%
% \item[1.] A check is made to see if \texttt{fancyvrb.sty} is loaded: if not
-% then this package is loaded if it is available (this package is required
-% for inputting the file \texttt{rubikstateERRORS.dat}).
+% then this package is loaded (this package supplies the command \cmd{\VerbatimInput} which
+% is required for inputting the file \texttt{rubikstateERRORS.dat} in verbatim form).
%
% \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[3.] The text file \texttt{rubikstateNEW.dat} is overwritten (if it exists),
+% otherwise the file is created (this prevents an `old' version of the file being
+% used by \LaTeX).
%
% \item[4.] The plain-text file \texttt{rubikstateERRORS.dat} is created.
% This file collects error messages generated by the Perl script.
@@ -804,14 +976,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}).
+% \texttt{rubikstate.dat} (this will 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}.
%
% For example, if we use the command \cmd{\RubikCubeSolved}
% followed by the command \verb!\RubikRotation[2]{U,D,L,R}!, then the associated
-% \texttt{rubikstate.dat} file would be as follows:
+% \texttt{rubikstate.dat} file will be written as follows:
%\begin{quote}
% \begin{verbatim}
% % filename: rubikstate.dat
@@ -826,12 +998,12 @@
% rotation,U,D,L,R
%\end{verbatim}
%\end{quote}
-% Note that the \cmd{\RubikRotation} option \texttt{[2]} results in the line \texttt{rotation,U,D,L,R}
+% Note that the \cmd{\RubikRotation} option \texttt{[2]} results in the string ``\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}', as follows:
+% would be the string ``\texttt{rotation,random,45}'', as follows:
%\begin{quote}
% \begin{verbatim}
% % filename: rubikstate.dat
@@ -846,29 +1018,31 @@
%\end{verbatim}
%\end{quote}
% A \cmd{\CheckRubikState} command triggers the same sequence of events except
-% no `rotation' line is written.
+% that no ``\texttt{rotation,....}'' line is written.
%
% 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 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$,
+% by loading the current rubikstate (prompted by the keywords `\texttt{up}', `\texttt{down}',
+% `\texttt{left}', `\texttt{right}', `\texttt{front}', `\texttt{back}'), and performing
+% a syntax check---significant syntax errors at this stage
+% will cause the program to issue appropriate error messages and then terminate cleanly.
+% Next, the Perl script performs some basic cube checks
+% (prompted by the key word `\texttt{checkstate}'), and then the program processes
+% the sequence of Rubik rotations (prompted by the keyword
+% `\texttt{rotation}'). If, instead, the second argument of the `\texttt{rotation,...}' string
+% is the keyword `\texttt{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
+% 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.
+% 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 \cmd{\Draw...} command
-% of some form is reached and the final rubikstate is drawn in a TikZ picture
-% environment.
+% (in the \texttt{.tex} file) then this cycle repeats accordingly.
+% Eventually a \cmd{\Draw...} command is reached (in the \texttt{.tex} file) 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
@@ -911,13 +1085,22 @@
% \newline\url{http://pgfplots.sourceforge.net/TeX-programming-notes.pdf}
% {\newline}[\,re:~loop macros in Section~\ref{sec:feuersanger}\,]
%
+% \item Kociemba website (Kociemba H). \url{http://www.kociemba.org/cube.htm}
%
-% \item Nickalls RWD and Syropoulos A (2015). The \textsc{rubikcube} package.
+% \item Nickalls RWD and Syropoulos A (2015). The \textsc{rubikcube} package, v3.0.
% \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}\,]
%
+% \item Randelshofer website (Randelshofer W). \url{http://www.randelshofer.ch/rubik/}
+% \ [\,re:~sequences and supersetENG notation\,]
+%
+%
+% \item Reid website (Reid M). \ Patterns. \url{http://www.cflmath.com/Rubik/patterns.html}
+% \ [\,re:~sequences as macros; in Section~\ref{sec:seq-as-macros}\,]
+%
+%
+% \item Tellechea C and Segletes SB (2016). The \textsf{listofitems} package, v1.2
+% \newline\url{http://www.ctan.org/pkg/listofitems}
%\end{itemize}
%
%
@@ -925,6 +1108,27 @@
% \section{Change history}
%
% \begin{itemize}
+%
+% \item Version 4.0 (March 2017)
+%
+% --- The \cmd{\RubikRotation} command has been enhanced to allow its argument to include
+% so-called repeat-blocks (rotation-sequences which can be repeated multiple times), and
+% info-blocks for holding sequence metadata (see Section~\ref{sec:rubikrotationcmd}).
+% Syntax checking of the \cmd{\RubikRotation} argument is much improved
+% (see \texttt{rubikrotationPL.pdf} for details of the Perl script).
+%
+% --- Four new macros which hold derived data (see Section~\ref{sec:rubikrotationcmd}).
+% \begin{quote}
+% \cmd{\SequenceName}
+% \newline\cmd{\SequenceInfo}
+% \newline\cmd{\SequenceShort}
+% \newline\cmd{\SequenceLong}
+% \end{quote}
+%
+% --- Better syntax checking of the \cmd{\RubikRotation} argument by the Perl program \texttt{rubikrotation.pl}.
+%
+%
+%
% \item Version 3.0 (25 September 2015)
%
% --- The \cmd{\RubikRotation} command now actions multiple instances of its argument
@@ -932,7 +1136,7 @@
% \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}
+% --- If a comma separated element used as an argument for the \cmd{\RubikRotation}
% command is prefixed with either a * or [ or ] character then it is not actioned
% as a rotation (see Section~\ref{sec:prefixedargument}).
%
@@ -940,7 +1144,8 @@
% 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.
+% --- A `man' file (manual 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
@@ -964,7 +1169,7 @@
%
%
%
-% \section{The code (\texttt{rubikrotation.sty})}
+% \section[The code]{The code (\texttt{rubikrotation.sty})}
%
% {\noindent}In the following, the term `Perl script' denotes the script
% \texttt{rubikrotation.pl}. Useful information regarding the
@@ -973,11 +1178,12 @@
% Abrahams \textit{et.~al} (1990).
%
% \subsection{Package heading}
+% \label{sec:CodePackageHeading}
%
% \begin{macrocode}
%<*rubikrotation>
-\def\RRfileversion{3.0}%
-\def\RRfiledate{2015/09/25}%
+\def\RRfileversion{4.0}%
+\def\RRfiledate{2017/03/03}%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rubikrotation}[\RRfiledate\space (v\RRfileversion)]
% \end{macrocode}
@@ -994,7 +1200,7 @@
%
%
%
-% {\noindent}The \rubikrotation\ package requires access to the fancyvrb package
+% {\noindent}The \rubikrotation\ package requires access to the \textsf{fancyvrb} package
% for the \cmd{\VerbatimInput\{\}} command which we use for inputting and displaying
% the error file (see Section~\ref{sec:showrubikerrors}).
% \begin{macrocode}
@@ -1004,6 +1210,24 @@
\RequirePackage{fancyvrb}}
% \end{macrocode}
%
+%
+% {\noindent}For the \cmd{\write18} syntax to work with
+% Lua\TeX\ (so we can access system commands) we require
+% the recent \textsf{shellesc} package, which we load using the
+% \textsf{ifluatex} conditional (see Section~\ref{sec:shellescape}).
+% \begin{macrocode}
+\@ifpackageloaded{ifluatex}{}{%
+ \typeout{---rubikrotation requires the ifluatex package.}%
+ \RequirePackage{ifluatex}}
+\ifluatex%
+ \@ifpackageloaded{shellesc}{}{%
+ \typeout{---rubikrotation requires the shellesc package
+ to run using Lua\LaTeX.}%
+ \RequirePackage{shellesc}}
+\fi%
+% \end{macrocode}
+%
+%
% \medskip
%
% \subsection{Some useful commands}
@@ -1059,30 +1283,30 @@
\newcommand{\rubikperlname}{rubikrotation}
% \end{macrocode}
% \end{macro}
-%
+% Note that here we are assuming that the script is an executable file.
%
% \begin{macro}{\rubikperlcmd}
% 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
+% Note that it is very important that we do actually specify 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}.
+% configured to read its input (i.e.,~data generated by the Perl script)
+% from the file \texttt{rubikstateNEW.dat}.
% \begin{macrocode}
\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).
+% Remember to use the \cmd{\space} macro following the \cmd{\rubikperlname} macro
+% in order to generate the mandatory space before 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
@@ -1094,7 +1318,7 @@
%
% 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.
+% macros and \textit{before} creating the \texttt{rubikstateERRORS.dat} file.
% \begin{macrocode}
\typeout{---checking for config file (rubikrotation.cfg)...}
\IfFileExists{rubikrotation.cfg}{%
@@ -1139,7 +1363,7 @@
\newwrite\outfile%
\immediate\openout\outfile=rubikstateERRORS.dat%
\@print{\@comment rubikstateERRORS.dat}%
-\@print{\@comment ---(RR.sty v\RRfileversion): comments output by Perl script}%
+\@print{\@comment --------------------}%
\immediate\closeout\outfile%
% \end{macrocode}
%
@@ -1184,7 +1408,7 @@
% 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
+% associated with each facelet of a 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.
@@ -1256,10 +1480,12 @@
% 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
+% The way we allow the user to (optionally) process the main argument multiple
+% times is simply by writing the associated output command multiple
+% times to the output data-file. Consequently, we require the \cmd{\RubikRotation}
+% command to allow a square-bracket 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
+% In order to implement this 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:
@@ -1286,8 +1512,9 @@
% the command to write the main argument to the output data file.
% \begin{macrocode}
\newcommand{\RubikRotation}[2][1]{%
+ \typeout{---TeX process (rubikrotation.sty)-------}%
\typeout{---NEW rotation command------------------}%
- \typeout{---command = RubikRotation{#1}}%
+ \typeout{---command = RubikRotation[#1]{#2}}%
\typeout{---writing current Rubik state to file rubikstate.dat}%
\@openstatefile% open data file
\@print{\@comment filename: rubikstate.dat}%
@@ -1299,14 +1526,20 @@
\@countingloop{\ourRRcounter} in 1:{#1}{%
\immediate\write\outfile{rotation,#2}}%
\@closestatefile% close data file
- \typeout{---running Perl script (rubikrotation)}%
+ \typeout{---CALLing Perl script (rubikrotation.pl)}%
\immediate\write18{\rubikperlcmd}%
- \typeout{---inputting NEW datafile (written by Perl script)}%
+ \typeout{---inputting NEW datafile (data written by Perl script)}%
\input{rubikstateNEW.dat}%
\typeout{-----------------------------------------}%
}
% \end{macrocode}
% \end{macro}
+% Note that the new \cmd{\ShellEscape} command implemented by the recent
+% \textsf{shellesc} package is equivalent to \cmd{\immediate}\cmd{\write18} (see above),
+% and so we probably ought to use \cmd{\ShellEscape} instead in future (and hence load
+% \textsf{shellesc} automatically). At present, however, we leave the user to make
+% sure that the \textsf{shellesc} package is actually available on their system.
+%
%
%
% \subsection{ShowRubikErrors command}
@@ -1314,11 +1547,13 @@
%
% \begin{macro}{\ShowRubikErrors}
% This command inputs the file \texttt{rubikstateERRORS.dat}.
+% Also made a more convenient synonym = \cmd{\ShowErrors}.
% \begin{macrocode}
\newcommand{\ShowRubikErrors}{%
\typeout{---ShowRubikErrors: inputting file rubikstateERRORS.dat}%
\VerbatimInput{rubikstateERRORS.dat}%
}
+\newcommand{\ShowErrors}{\ShowRubikErrors}
% \end{macrocode}
% \end{macro}
%
@@ -1340,9 +1575,9 @@
\@print{\@comment filename: rubikstate.dat}%
\@printrubikstate%
\@closestatefile% close data file
- \typeout{---running Perl script (rubikrotation)}%
+ \typeout{---running Perl script (rubikrotation.pl)}%
\immediate\write18{\rubikperlcmd}%
- \typeout{---inputting NEW datafile (written by Perl script)}%
+ \typeout{---inputting NEW datafile (data written by Perl script)}%
\input{rubikstateNEW.dat}%
\typeout{-----------------------------------------}%
}
diff --git a/Master/texmf-dist/source/latex/rubik/rubikrotation.ins b/Master/texmf-dist/source/latex/rubik/rubikrotation.ins
index 99384f15aa4..0c2aed56982 100644
--- a/Master/texmf-dist/source/latex/rubik/rubikrotation.ins
+++ b/Master/texmf-dist/source/latex/rubik/rubikrotation.ins
@@ -1,26 +1,9 @@
%% rubikrotation.ins
%%
-%% version 3.0
+%% version 4.0
%%
%% --- automatic overwriting of .sty is disabled-------
%% =========================================================
-%% Authors: RWD Nickalls (dick@nickalls.org)
-%% and
-%% Apostolos Syropoulos (asyropoulos@yahoo.com)
-%%
-%% 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
-%% 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 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 ------------------
%%
@@ -33,8 +16,9 @@
Authors: RWD Nickalls (dick@nickalls.org)
and Apostolos Syropoulos (asyropoulos@yahoo.com)
- Copyright 25 September 2015 RWD Nickalls and A Syropoulos
+ Copyright 03 March 2017 RWD Nickalls and A Syropoulos
+ VERSION 4.0
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
diff --git a/Master/texmf-dist/tex/latex/rubik/rubikcube.sty b/Master/texmf-dist/tex/latex/rubik/rubikcube.sty
index f86987c7092..40e52aa7266 100644
--- a/Master/texmf-dist/tex/latex/rubik/rubikcube.sty
+++ b/Master/texmf-dist/tex/latex/rubik/rubikcube.sty
@@ -10,8 +10,9 @@
%% Authors: RWD Nickalls (dick@nickalls.org)
%% and Apostolos Syropoulos (asyropoulos@yahoo.com)
%%
-%% Copyright 2015 RWD Nickalls and A Syropoulos
+%% Copyright 03 March 2017 RWD Nickalls and A Syropoulos
%%
+%% VERSION 4.0
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
@@ -29,6 +30,7 @@
%%
%% This package requires the basic TikZ package to be loaded already
%% ------------------------------------------------------------------
+%%% \CheckSum{5683}
%%% \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
@@ -46,33 +48,28 @@
%% Right brace \} Tilde \~}
-\def\RCfileversion{3.0}%
-\def\RCfiledate{2015/09/25}%
+%% \textsc{white space}: \
+
+
+%% \DescribeMacro{\RubikCubeSolvedWB}
+%%set up the UP face
+%%draw the UP face and sides
+
+\def\RCfileversion{4.0}%
+\def\RCfiledate{2017/03/03}%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rubikcube}[\RCfiledate\space (v\RCfileversion)]
\@ifpackageloaded{tikz}{}{%
\typeout{---rubikcube requires the TikZ package.}%
\RequirePackage{tikz}}%
+\@ifpackageloaded{forarray}{}{%
+ \typeout{---rubikcube requires the Forarray package.}%
+ \RequirePackage{forarray}}%
+\@ifpackageloaded{ifthen}{}{%
+ \typeout{---rubikcube requires the IfThen package.}%
+ \RequirePackage{ifthen}}%
\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}}}}
-\newcommand{\@rrwp}[1]{\textbf{\textsf{#1\footnotesize{w}}$^\prime$}}
-\newcommand{\@rrs}[1]{\textbf{\textsf{#1\footnotesize{s}}}}
-\newcommand{\@rrsp}[1]{\textbf{\textsf{#1\footnotesize{s}}$^\prime$}}
-\newcommand{\@rra}[1]{\textbf{\textsf{#1\footnotesize{a}}}}
-\newcommand{\@rrap}[1]{\textbf{\textsf{#1\footnotesize{a}}$^\prime$}}
-\newcommand{\@xyzh}[1]{\textbf{[\textsf{#1}]}\,}
-\newcommand{\@xyzhp}[1]{\textbf{[\textsf{#1}$^\prime$]}\,}
-\newcommand{\@xyzRubik}[1]{\raisebox{3.45pt}{\textbf{[\textsf{#1}]}}}
-\newcommand{\@xyzRubikp}[1]{\raisebox{3.45pt}{\textbf{[\textsf{#1}$^\prime$]}}}
-\newcommand{\@SquareLetter}[1]{\setlength\fboxsep{2.5pt}\fboxrule=0.8pt%
- \fbox{\rule[-1pt]{0pt}{8.5pt}\raisebox{-0.5pt}{#1}}}
-\newlength\@hRubik%
-\setlength{\@hRubik}{0.185cm}%
-\newcommand*\@join[2]{%
- \csname\expandafter\@gobble\string#1#2\endcsname}
\definecolor{R}{HTML}{C41E33}%
\definecolor{G}{HTML}{00BE38}%
\definecolor{B}{HTML}{0051BA}%
@@ -80,23 +77,60 @@
\colorlet{X}{black!30}% grey
\colorlet{O}{orange}%
\colorlet{W}{white}%
+\newcommand{\@rubikfont}{\fontsize{10}{12pt}\usefont{T1}{cmss}{bx}{n}}
+\newcommand{\@rubikfontFNS}{\fontsize{8}{12pt}\usefont{T1}{cmss}{bx}{n}}
+\newcommand{\@rubikprime}{'}
+\newlength{\@showcubewidth}%
\newcommand{\ShowCube}[3]{%
- \begin{minipage}{#1}%
+ \setlength{\fboxsep}{0cm}%
+ \setlength{\@showcubewidth}{#1}%
+ \advance\@showcubewidth by 1.6pt\relax%
+ \begin{minipage}{\the\@showcubewidth}%
\centering%
\begin{tikzpicture}[scale=#2]%
#3%
\end{tikzpicture}%
\end{minipage}%
-}
+}%
\newcommand{\ShowCubeF}[3]{%
- \fbox{%
- \begin{minipage}{#1}%
+ \setlength{\fboxsep}{0cm}%
+ \setlength{\fboxrule}{0.4pt}%
+ \setlength{\@showcubewidth}{#1}%
+ \advance\@showcubewidth by 1.6pt\relax%
+ \framebox{%
+ \begin{minipage}{\the\@showcubewidth}%
\centering%
\begin{tikzpicture}[scale=#2]%
#3%
\end{tikzpicture}%
\end{minipage}%
-}}
+}}%
+\newcommand{\x}{\thislevelitem}
+\newcommand{\xcount}{\thislevelcount}
+\newcommand{\ShowSequence}[3]{%
+ \ForEachX{,}{%
+ \ifthenelse{\xcount=1}{#2{\x}}{#1#2{\x}}%
+ }{#3}%
+}%
+\newcommand{\ShowSequenceF}[3]{%
+\fbox{%
+ \ForEachX{,}{%
+ \ifthenelse{\xcount=1}{#2{\x}}{#1#2{\x}}%
+ }{#3}%
+}}%
+\newcommand{\ShowSequencef}[3]{%
+ \ForEachX{,}{%
+ \ifthenelse{\xcount=1}{\fbox{#2{\x}}}{#1{\fbox{#2{\x}}}}%
+ }{#3}%
+}%
+\newcommand{\SequenceInfo}{{}}% %% INFO only
+\newcommand{\SequenceName}{{}}% %% NAME only
+\newcommand{\SequenceShort}{{}}% %% original SHORT seq but with NO NAME
+\newcommand{\SequenceLong}{{}}% %% just the LONG string \& no name
+\newcommand{\SequenceBraceA}[2]{$\overbrace{\mbox{#2}}^{\mbox{#1}}$}%
+\newcommand{\SequenceBraceB}[2]{$\underbrace{\mbox{#2}}_{\mbox{#1}}$}%
+\newcommand{\SequenceBraceAF}[2]{\fbox{$\overbrace{\mbox{#2}}^{\mbox{#1}}$}}%
+\newcommand{\SequenceBraceBF}[2]{\fbox{$\underbrace{\mbox{#2}}_{\mbox{#1}}$}}%
\newcommand{\RubikFaceUp}[9]{%
\def\Ult{#1}\def\Umt{#2}\def\Urt{#3}%
\def\Ulm{#4}\def\Umm{#5}\def\Urm{#6}%
@@ -172,14 +206,20 @@
\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}%
- \RubikFaceLeftAll{B}%
- \RubikFaceRightAll{G}%
- \RubikFaceFrontAll{O}%
- \RubikFaceBackAll{R}%
-}
+\newcommand{\RubikCubeGray}{\RubikCubeGrey}
+\newcommand{\SolvedConfig}[6]{%
+ \RubikFaceRightAll{#1}%
+ \RubikFaceLeftAll{#2}%
+ \RubikFaceUpAll{#3}%
+ \RubikFaceDownAll{#4}%
+ \RubikFaceFrontAll{#5}%
+ \RubikFaceBackAll{#6}%
+}
+\newcommand{\RubikCubeGreyAll}{\SolvedConfig{X}{X}{X}{X}{X}{X}}%
+\newcommand{\RubikCubeGrayAll}{\RubikCubeGreyAll}
+\newcommand{\RubikCubeSolved}{\SolvedConfig{G}{B}{W}{Y}{O}{R}}%
+\newcommand{\RubikCubeSolvedWY}{\RubikCubeSolved}%
+\newcommand{\RubikCubeSolvedWB}{\SolvedConfig{R}{O}{W}{B}{G}{Y}}%
\newcommand{\RubikSliceTopR}[6]{%
\def\Flt{#1}\def\Fmt{#2}\def\Frt{#3}%
\def\Rlt{#4}\def\Rmt{#5}\def\Rrt{#6}%
@@ -596,7 +636,7 @@
}
%%-----------------------
\newcommand{\DrawFlatFront}{%
-%% This command is used /only/ by the \cmd{\DrawRubikFlat} command.
+%% This command is used /only/ by the \cmd{\DrawRubikCubeF} command.
%% NOTE: x, y variables not implemented as not required here
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Flt]%
@@ -661,7 +701,7 @@
(\bx + 2,\by + 0) -- (\bx + 2,\by + 1) -- (\bx + 3,\by + 1)%
-- (\bx + 3,\by + 0) -- cycle;
}
-\newcommand{\DrawRubikFlat}{%
+\newcommand{\DrawRubikCubeF}{%
\DrawFlatUp{0}{3}%
\DrawFlatDown{0}{-3}%
\DrawFlatLeft{-3}{0}%
@@ -669,7 +709,7 @@
\DrawFlatRight{3}{0}%
\DrawFlatBack{6}{0}%
}
-\newcommand{\DrawRubikCubeFlat}{%
+\newcommand{\DrawRubikCubeSF}{%
\DrawRubikCube%
\DrawFlatDown{0}{-3}%
\DrawFlatLeft{-3}{0}%
@@ -717,6 +757,18 @@
\DrawRubikLayerSideR{\Rlb}{\Rmb}{\Rrb}%
\DrawRubikLayerSideB{\Brb}{\Bmb}{\Blb}%
}
+\newcommand{\DrawFaceUp}{\DrawFlatUp{0}{0}}
+\newcommand{\DrawFaceDown}{\DrawFlatDown{0}{0}}
+\newcommand{\DrawFaceLeft}{\DrawFlatLeft{0}{0}}
+\newcommand{\DrawFaceRight}{\DrawFlatRight{0}{0}}
+\newcommand{\DrawFaceFront}{\DrawFlatFront{0}{0}}
+\newcommand{\DrawFaceBack}{\DrawFlatBack{0}{0}}
+\newcommand{\DrawFaceUpSide}{\DrawFlatUpSide}
+\newcommand{\DrawFaceDownSide}{\DrawFlatDownSide}
+\newcommand{\DrawFaceLeftSide}{\DrawFlatLeftSide}
+\newcommand{\DrawFaceRightSide}{\DrawFlatRightSide}
+\newcommand{\DrawFaceFrontSide}{\DrawFlatFrontSide}
+\newcommand{\DrawFaceBackSide}{\DrawFlatBackSide}
\newcommand{\RubikSideBarWidth}[1]{\pgfmathsetmacro{\bw}{#1}}
\newcommand{\RubikSideBarLength}[1]{\pgfmathsetmacro{\bl}{#1}}
\newcommand{\RubikSideBarSep}[1]{\pgfmathsetmacro{\bs}{#1}}
@@ -806,6 +858,30 @@
\DrawRubikLayerSideLBx{#5}%
\DrawRubikLayerSideRBx{#6}%
}
+\newcommand{\RubikSideFront}[3]{%
+\def\Flt{#1}\def\Fmt{#2}\def\Frt{#3}%
+}
+\newcommand{\RubikSideRight}[3]{%
+\def\Rlt{#1}\def\Rmt{#2}\def\Rrt{#3}%
+}
+\newcommand{\RubikSideLeft}[3]{%
+\def\Llt{#1}\def\Lmt{#2}\def\Lrt{#3}%
+}
+\newcommand{\RubikSideBack}[3]{%
+\def\Blt{#1}\def\Bmt{#2}\def\Brt{#3}%
+}
+\newcommand{\RubikSideFrontAll}[1]{%
+\def\Flt{#1}\def\Fmt{#1}\def\Frt{#1}%
+}
+\newcommand{\RubikSideRightAll}[1]{%
+\def\Rlt{#1}\def\Rmt{#1}\def\Rrt{#1}%
+}
+\newcommand{\RubikSideLeftAll}[1]{%
+\def\Llt{#1}\def\Lmt{#1}\def\Lrt{#1}%
+}
+\newcommand{\RubikSideBackAll}[1]{%
+\def\Blt{#1}\def\Bmt{#1}\def\Brt{#1}%
+}
\newcommand{\DrawNCubeAll}[4]{%
\pgfmathsetmacro{\ncubes}{#1-1}%
%% need to subtract 1 from the given number of cubies per side
@@ -829,7 +905,7 @@
\draw[line join=round,line cap=round,ultra thick,fill=#4]%
(#5,#6,\dz) -- (\dx,#6,\dz) -- (\dx,\dy,\dz) -- (#5,\dy,\dz) -- cycle;
%% The 'rectangle' command does not work with 3D coordinates,
-%% so this is the way to draw the squres with space coordinates
+%% so this is the way to draw the squares with space coordinates
%% Draw UP face (using the Y colour = #3)
\draw[line join=round,line cap=round,ultra thick,fill=#3]%
(#5,\dy,\dz) -- (\dx,\dy,\dz) -- (\dx,\dy,#7) -- (#5,\dy,#7) -- cycle;
@@ -934,51 +1010,89 @@
\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{\@rr}[1]{{\@rubikfont #1}}
+\newcommand{\@rrp}[1]{{\@rubikfont #1\@rubikprime}}
+\newcommand{\@rrw}[1]{{\@rubikfont #1{\@rubikfontFNS w}}}
+\newcommand{\@rrwp}[1]{{\@rubikfont #1{\@rubikfontFNS w}\@rubikprime}}
+\newcommand{\@rrs}[1]{{\@rubikfont #1{\@rubikfontFNS s}}}
+\newcommand{\@rrsp}[1]{{\@rubikfont #1{\@rubikfontFNS s}\@rubikprime}}
+\newcommand{\@rra}[1]{{\@rubikfont #1{\@rubikfontFNS a}}}
+\newcommand{\@rrap}[1]{{\@rubikfont #1{\@rubikfontFNS a}\@rubikprime}}
+\newcommand{\@rru}[1]{{\@rubikfont #1{\@rubikfontFNS u}}}
+\newcommand{\@rrup}[1]{{\@rubikfont #1{\@rubikfontFNS u}\@rubikprime}}
+\newcommand{\@rrd}[1]{{\@rubikfont #1{\@rubikfontFNS d}}}
+\newcommand{\@rrdp}[1]{{\@rubikfont #1{\@rubikfontFNS d}\@rubikprime}}
+\newcommand{\@rrl}[1]{{\@rubikfont #1{\@rubikfontFNS l}}}
+\newcommand{\@rrlp}[1]{{\@rubikfont #1{\@rubikfontFNS l}\@rubikprime}}
+\newcommand{\@rrr}[1]{{\@rubikfont #1{\@rubikfontFNS r}}}
+\newcommand{\@rrrp}[1]{{\@rubikfont #1{\@rubikfontFNS r}\@rubikprime}}
+\newcommand{\@rrf}[1]{{\@rubikfont #1{\@rubikfontFNS f}}}
+\newcommand{\@rrfp}[1]{{\@rubikfont #1{\@rubikfontFNS f}\@rubikprime}}
+\newcommand{\@rrb}[1]{{\@rubikfont #1{\@rubikfontFNS b}}}
+\newcommand{\@rrbp}[1]{{\@rubikfont #1{\@rubikfontFNS b}\@rubikprime}}
+\newcommand{\@rrc}[1]{{\@rubikfont #1{\@rubikfontFNS c}}}
+\newcommand{\@rrcp}[1]{{\@rubikfont #1{\@rubikfontFNS c}\@rubikprime}}
+\newcommand{\@rrm}[1]{{\@rubikfont #1{\@rubikfontFNS m}}}
+\newcommand{\@rrmp}[1]{{\@rubikfont #1{\@rubikfontFNS m}\@rubikprime}}
+\newcommand{\@xyzh}[1]{[{\@rubikfont #1}]}
+\newcommand{\@xyzhp}[1]{[{\@rubikfont #1\@rubikprime}]}
+\newcommand{\@xyzRubik}[1]{\raisebox{3.45pt}{[{\@rubikfont #1}]}}
+\newcommand{\@xyzRubikp}[1]{\raisebox{3.45pt}{[{\@rubikfont #1\@rubikprime}]}}
+\newcommand{\@xyzhbdfl}[1]{[\raisebox{-0.6pt}{{\@rubikfont #1}}]}
+\newcommand{\@xyzbdflRubik}[1]{\raisebox{3.45pt}{[\raisebox{-0.6pt}{{\@rubikfont #1}}]}}
+\newcommand{\@SquareLetter}[1]{\setlength{\fboxsep}{2.5pt}%
+ \setlength{\fboxrule}{0.8pt}%
+ \fbox{\rule[-1pt]{0pt}{8.5pt}\raisebox{-0.5pt}{#1}}}
+\newlength\@hRubik%
+\setlength{\@hRubik}{0.185cm}%
+\newcommand{\@tlen}{\hspace{1pt}}%
+\newcommand*\@join[2]{%
+ \csname\expandafter\@gobble\string#1#2\endcsname}
\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}\,}
-\newcommand{\RubikB}{\raisebox{\@hRubik}{\SquareB}\,}
-\newcommand{\textRubikB}{\rrhB\,}
+\newcommand{\SquareB}{\@tlen\@SquareLetter{\rrB}\@tlen}
+\newcommand{\rrhB}{\raisebox{-0.25mm}{\SquareB}}
+\newcommand{\RubikB}{\raisebox{\@hRubik}{\SquareB}}
+\newcommand{\textRubikB}{\rrhB}
\newcommand{\rrBp}{\@rrp{B}}
-\newcommand{\SquareBp}{\@SquareLetter{\rrBp}}
-\newcommand{\rrhBp}{\raisebox{-0.25mm}{\SquareBp}\,}
-\newcommand{\RubikBp}{\raisebox{\@hRubik}{\SquareBp}\,}
-\newcommand{\textRubikBp}{\rrhBp\,}
+\newcommand{\SquareBp}{\@tlen\@SquareLetter{\rrBp}\@tlen}
+\newcommand{\rrhBp}{\raisebox{-0.25mm}{\SquareBp}}
+\newcommand{\RubikBp}{\raisebox{\@hRubik}{\SquareBp}}
+\newcommand{\textRubikBp}{\rrhBp}
\newcommand{\rrBw}{\@rrw{B}}
-\newcommand{\SquareBw}{\@SquareLetter{\rrBw}}
-\newcommand{\rrhBw}{\raisebox{-0.25mm}{\SquareBw}\,}
-\newcommand{\RubikBw}{\raisebox{\@hRubik}{\SquareBw}\,}
-\newcommand{\textRubikBw}{\rrhBw\,}
+\newcommand{\SquareBw}{\@tlen\@SquareLetter{\rrBw}\@tlen}
+\newcommand{\rrhBw}{\raisebox{-0.25mm}{\SquareBw}}
+\newcommand{\RubikBw}{\raisebox{\@hRubik}{\SquareBw}}
+\newcommand{\textRubikBw}{\rrhBw}
\newcommand{\rrBwp}{\@rrwp{B}}
-\newcommand{\SquareBwp}{\@SquareLetter{\rrBwp}}
-\newcommand{\rrhBwp}{\raisebox{-0.25mm}{\SquareBwp}\,}
-\newcommand{\RubikBwp}{\raisebox{\@hRubik}{\SquareBwp}\,}
-\newcommand{\textRubikBwp}{\rrhBwp\,}
+\newcommand{\SquareBwp}{\@tlen\@SquareLetter{\rrBwp}\@tlen}
+\newcommand{\rrhBwp}{\raisebox{-0.25mm}{\SquareBwp}}
+\newcommand{\RubikBwp}{\raisebox{\@hRubik}{\SquareBwp}}
+\newcommand{\textRubikBwp}{\rrhBwp}
\newcommand{\rrBs}{\@rrs{B}}
-\newcommand{\SquareBs}{\@SquareLetter{\rrBs}}
-\newcommand{\rrhBs}{\raisebox{-0.25mm}{\SquareBs}\,}
-\newcommand{\RubikBs}{\raisebox{\@hRubik}{\SquareBs}\,}
-\newcommand{\textRubikBs}{\rrhBs\,}
+\newcommand{\SquareBs}{\@tlen\@SquareLetter{\rrBs}\@tlen}
+\newcommand{\rrhBs}{\raisebox{-0.25mm}{\SquareBs}}
+\newcommand{\RubikBs}{\raisebox{\@hRubik}{\SquareBs}}
+\newcommand{\textRubikBs}{\rrhBs}
\newcommand{\rrBsp}{\@rrsp{B}}
-\newcommand{\SquareBsp}{\@SquareLetter{\rrBsp}}
-\newcommand{\rrhBsp}{\raisebox{-0.25mm}{\SquareBsp}\,}
-\newcommand{\RubikBsp}{\raisebox{\@hRubik}{\SquareBsp}\,}
-\newcommand{\textRubikBsp}{\rrhBsp\,}
+\newcommand{\SquareBsp}{\@tlen\@SquareLetter{\rrBsp}\@tlen}
+\newcommand{\rrhBsp}{\raisebox{-0.25mm}{\SquareBsp}}
+\newcommand{\RubikBsp}{\raisebox{\@hRubik}{\SquareBsp}}
+\newcommand{\textRubikBsp}{\rrhBsp}
\newcommand{\rrBa}{\@rra{B}}
-\newcommand{\SquareBa}{\@SquareLetter{\rrBa}}
-\newcommand{\rrhBa}{\raisebox{-0.25mm}{\SquareBa}\,}
-\newcommand{\RubikBa}{\raisebox{\@hRubik}{\SquareBa}\,}
-\newcommand{\textRubikBa}{\rrhBa\,}
+\newcommand{\SquareBa}{\@tlen\@SquareLetter{\rrBa}\@tlen}
+\newcommand{\rrhBa}{\raisebox{-0.25mm}{\SquareBa}}
+\newcommand{\RubikBa}{\raisebox{\@hRubik}{\SquareBa}}
+\newcommand{\textRubikBa}{\rrhBa}
\newcommand{\rrBap}{\@rrap{B}}
-\newcommand{\SquareBap}{\@SquareLetter{\rrBap}}
-\newcommand{\rrhBap}{\raisebox{-0.25mm}{\SquareBap}\,}
-\newcommand{\RubikBap}{\raisebox{\@hRubik}{\SquareBap}\,}
-\newcommand{\textRubikBap}{\rrhBap\,}
-\newcommand{\rrD}{\textbf{\textsf{D}}}
+\newcommand{\SquareBap}{\@tlen\@SquareLetter{\rrBap}\@tlen}
+\newcommand{\rrhBap}{\raisebox{-0.25mm}{\SquareBap}}
+\newcommand{\RubikBap}{\raisebox{\@hRubik}{\SquareBap}}
+\newcommand{\textRubikBap}{\rrhBap}
+\newcommand{\rrD}{\@rr{D}}
%%
\newcommand{\SquareD}{%
\begin{tikzpicture}[scale=0.5]
@@ -988,17 +1102,18 @@
\draw [thick, ->] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhD}{\raisebox{-0.333\height}{\SquareD}\,}
+\newcommand{\rrhD}{\raisebox{-0.333\height}{\@tlen\SquareD\@tlen}}
%%
\newcommand{\RubikD}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareD\\
-\rrD
+\rrD%
\end{minipage}%
-}
+}}
\newcommand{\textRubikD}{\rrD\,\rrhD}
-\newcommand{\rrDp}{\textbf{\textsf{D}$^\prime$}}
+\newcommand{\rrDp}{\@rrp{D}}
%%
\newcommand{\SquareDp}{%
\begin{tikzpicture}[scale=0.5]
@@ -1008,17 +1123,18 @@
\draw [thick, <-] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDp}{\raisebox{-0.333\height}{\SquareDp}\,}
+\newcommand{\rrhDp}{\raisebox{-0.333\height}{\@tlen\SquareDp\@tlen}}
%%
\newcommand{\RubikDp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDp\\
-\rrDp
+\rrDp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDp}{\rrDp\,\rrhDp}
-\newcommand{\rrDw}{\textbf{\textsf{D\footnotesize{w}}}}
+\newcommand{\rrDw}{\@rrw{D}}
%%
\newcommand{\SquareDw}{%
\begin{tikzpicture}[scale=0.5]
@@ -1028,17 +1144,18 @@
\draw [thick, ->] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDw}{\raisebox{-0.333\height}{\SquareDw}\,}
+\newcommand{\rrhDw}{\raisebox{-0.333\height}{\@tlen\SquareDw\@tlen}}
%%
\newcommand{\RubikDw}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDw\\
-\rrDw
+\rrDw%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDw}{\rrDw\,\rrhDw}
-\newcommand{\rrDwp}{\textbf{\textsf{D\footnotesize{w}}$^\prime$}}
+\newcommand{\rrDwp}{\@rrwp{D}}
%%
\newcommand{\SquareDwp}{%
\begin{tikzpicture}[scale=0.5]
@@ -1048,15 +1165,16 @@
\draw [thick, <-] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDwp}{\raisebox{-0.333\height}{\SquareDwp}\,}
+\newcommand{\rrhDwp}{\raisebox{-0.333\height}{\@tlen\SquareDwp\@tlen}}
%%
\newcommand{\RubikDwp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDwp\\
-\rrDwp
+\rrDwp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDwp}{\rrDwp\,\rrhDwp}
\newcommand{\rrDs}{\@rrs{D}}
%%
@@ -1068,15 +1186,16 @@
\draw [thick, ->] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDs}{\raisebox{-0.333\height}{\SquareDs}\,}
+\newcommand{\rrhDs}{\raisebox{-0.333\height}{\@tlen\SquareDs\@tlen}}
%%
\newcommand{\RubikDs}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDs\\
-\rrDs
+\rrDs%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDs}{\rrDs\,\rrhDs}
\newcommand{\rrDsp}{\@rrsp{D}}
%%
@@ -1088,15 +1207,16 @@
\draw [thick, <-] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDsp}{\raisebox{-0.333\height}{\SquareDsp}\,}
+\newcommand{\rrhDsp}{\raisebox{-0.333\height}{\@tlen\SquareDsp\@tlen}}
%%
\newcommand{\RubikDsp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDsp\\
-\rrDsp
+\rrDsp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDsp}{\rrDsp\,\rrhDsp}
\newcommand{\rrDa}{\@rra{D}}
%%
@@ -1108,15 +1228,16 @@
\draw [thick, ->] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDa}{\raisebox{-0.333\height}{\SquareDa}\,}
+\newcommand{\rrhDa}{\raisebox{-0.333\height}{\@tlen\SquareDa\@tlen}}
%%
\newcommand{\RubikDa}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDa\\
-\rrDa
+\rrDa%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDa}{\rrDa\,\rrhDa}
\newcommand{\rrDap}{\@rrap{D}}
%%
@@ -1128,17 +1249,18 @@
\draw [thick, <-] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhDap}{\raisebox{-0.333\height}{\SquareDap}\,}
+\newcommand{\rrhDap}{\raisebox{-0.333\height}{\@tlen\SquareDap\@tlen}}
%%
\newcommand{\RubikDap}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareDap\\
-\rrDap
+\rrDap%
\end{minipage}%
-}
+}}
\newcommand{\textRubikDap}{\rrDap\,\rrhDap}
-\newcommand{\rrE}{\textbf{\textsf{E}}}
+\newcommand{\rrE}{\@rr{E}}
%%
\newcommand{\SquareE}{%
\begin{tikzpicture}[scale=0.5]
@@ -1148,17 +1270,18 @@
\draw [thick] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhE}{\raisebox{-0.333\height}{\SquareE}\,}
+\newcommand{\rrhE}{\raisebox{-0.333\height}{\@tlen\SquareE\@tlen}}
%%
\newcommand{\RubikE}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareE\\
-\rrE
+\rrE%
\end{minipage}%
-}
+}}
\newcommand{\textRubikE}{\rrE\,\rrhE}
-\newcommand{\rrEp}{\textbf{\textsf{E}$^\prime$}}
+\newcommand{\rrEp}{\@rrp{E}}
%%
\newcommand{\SquareEp}{%
\begin{tikzpicture}[scale=0.5]
@@ -1168,17 +1291,18 @@
\draw [thick] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhEp}{\raisebox{-0.333\height}{\SquareEp}\,}
+\newcommand{\rrhEp}{\raisebox{-0.333\height}{\@tlen\SquareEp\@tlen}}
%%
\newcommand{\RubikEp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareEp\\
-\rrEp
+\rrEp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikEp}{\rrEp\,\rrhEp}
-\newcommand{\rrF}{\textbf{\textsf{F}}}
+\newcommand{\rrF}{\@rr{F}}
%%
\newcommand{\SquareF}{%
\begin{tikzpicture}[scale=0.5]
@@ -1186,17 +1310,18 @@
\draw [thick, <-] (\@scx, \@scy) arc[radius=0.35, start angle=-60, delta angle=290];
\end{tikzpicture}%
}
-\newcommand{\rrhF}{\raisebox{-0.333\height}{\SquareF}\,}
+\newcommand{\rrhF}{\raisebox{-0.333\height}{\@tlen\SquareF\@tlen}}
%%
\newcommand{\RubikF}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareF\\
-\rrF
+\rrF%
\end{minipage}%
-}
+}}
\newcommand{\textRubikF}{\rrF\,\rrhF}
-\newcommand{\rrFp}{\textbf{\textsf{F}$^\prime$}}
+\newcommand{\rrFp}{\@rrp{F}}
%%
\newcommand{\SquareFp}{%
\begin{tikzpicture}[scale=0.5]
@@ -1204,17 +1329,18 @@
\draw [thick, ->] (\@scx, \@scy) arc[radius=0.35, start angle=-60, delta angle=290];
\end{tikzpicture}%
}
-\newcommand{\rrhFp}{\raisebox{-0.333\height}{\SquareFp}\,}
+\newcommand{\rrhFp}{\raisebox{-0.333\height}{\@tlen\SquareFp\@tlen}}
%%
\newcommand{\RubikFp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareFp\\
-\rrFp
+\rrFp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikFp}{\rrFp\,\rrhFp}
-\newcommand{\rrFw}{\textbf{\textsf{F\footnotesize{w}}}}
+\newcommand{\rrFw}{\@rrw{F}}
%%
\newcommand{\SquareFw}{%
\begin{tikzpicture}[scale=0.5]
@@ -1223,17 +1349,18 @@
\draw [thick] (\@sqcx,\@sqcy) arc[radius=0.1, start angle=-60, delta angle=360];
\end{tikzpicture}%
}
-\newcommand{\rrhFw}{\raisebox{-0.333\height}{\SquareFw}\,}
+\newcommand{\rrhFw}{\raisebox{-0.333\height}{\@tlen\SquareFw\@tlen}}
%%
\newcommand{\RubikFw}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareFw\\
-\rrFw
+\rrFw%
\end{minipage}%
-}
+}}
\newcommand{\textRubikFw}{\rrFw\,\rrhFw}
-\newcommand{\rrFwp}{\textbf{\textsf{F\footnotesize{w}}$^\prime$}}
+\newcommand{\rrFwp}{\@rrwp{F}}
%%
\newcommand{\SquareFwp}{%
\begin{tikzpicture}[scale=0.5]
@@ -1242,38 +1369,39 @@
\draw [thick] (\@sqcx,\@sqcy) arc[radius=0.1, start angle=-60, delta angle=360];
\end{tikzpicture}%
}
-\newcommand{\rrhFwp}{\raisebox{-0.333\height}{\SquareFwp}\,}
+\newcommand{\rrhFwp}{\raisebox{-0.333\height}{\@tlen\SquareFwp\@tlen}}
%%
\newcommand{\RubikFwp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareFwp\\
-\rrFwp
+\rrFwp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikFwp}{\rrFwp\,\rrhFwp}
%%
\newcommand{\rrFs}{\@rrs{F}}
-\newcommand{\SquareFs}{\@SquareLetter{\rrFs}}
-\newcommand{\rrhFs}{\raisebox{-0.25mm}{\SquareFs}\,}
-\newcommand{\RubikFs}{\raisebox{\@hRubik}{\SquareFs}\,}
-\newcommand{\textRubikFs}{\rrhFs\,}
+\newcommand{\SquareFs}{\@tlen\@SquareLetter{\rrFs}\@tlen}
+\newcommand{\rrhFs}{\raisebox{-0.25mm}{\SquareFs}}
+\newcommand{\RubikFs}{\raisebox{\@hRubik}{\SquareFs}}
+\newcommand{\textRubikFs}{\rrhFs}
\newcommand{\rrFsp}{\@rrsp{F}}
-\newcommand{\SquareFsp}{\@SquareLetter{\rrFsp}}
-\newcommand{\rrhFsp}{\raisebox{-0.25mm}{\SquareFsp}\,}
-\newcommand{\RubikFsp}{\raisebox{\@hRubik}{\SquareFsp}\,}
-\newcommand{\textRubikFsp}{\rrhFsp\,}
+\newcommand{\SquareFsp}{\@tlen\@SquareLetter{\rrFsp}\@tlen}
+\newcommand{\rrhFsp}{\raisebox{-0.25mm}{\SquareFsp}}
+\newcommand{\RubikFsp}{\raisebox{\@hRubik}{\SquareFsp}}
+\newcommand{\textRubikFsp}{\rrhFsp}
\newcommand{\rrFa}{\@rra{F}}
-\newcommand{\SquareFa}{\@SquareLetter{\rrFa}}
-\newcommand{\rrhFa}{\raisebox{-0.25mm}{\SquareFa}\,}
-\newcommand{\RubikFa}{\raisebox{\@hRubik}{\SquareFa}\,}
-\newcommand{\textRubikFa}{\rrhFa\,}
+\newcommand{\SquareFa}{\@tlen\@SquareLetter{\rrFa}\@tlen}
+\newcommand{\rrhFa}{\raisebox{-0.25mm}{\SquareFa}}
+\newcommand{\RubikFa}{\raisebox{\@hRubik}{\SquareFa}}
+\newcommand{\textRubikFa}{\rrhFa}
\newcommand{\rrFap}{\@rrap{F}}
-\newcommand{\SquareFap}{\@SquareLetter{\rrFap}}
-\newcommand{\rrhFap}{\raisebox{-0.25mm}{\SquareFap}\,}
-\newcommand{\RubikFap}{\raisebox{\@hRubik}{\SquareFap}\,}
-\newcommand{\textRubikFap}{\rrhFap\,}
-\newcommand{\rrL}{\textbf{\textsf{L}}}
+\newcommand{\SquareFap}{\@tlen\@SquareLetter{\rrFap}\@tlen}
+\newcommand{\rrhFap}{\raisebox{-0.25mm}{\SquareFap}}
+\newcommand{\RubikFap}{\raisebox{\@hRubik}{\SquareFap}}
+\newcommand{\textRubikFap}{\rrhFap}
+\newcommand{\rrL}{\@rr{L}}
%%
\newcommand{\SquareL}{%
\begin{tikzpicture}[scale=0.5]
@@ -1283,17 +1411,18 @@
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhL}{\raisebox{-0.333\height}{\SquareL}\,}
+\newcommand{\rrhL}{\raisebox{-0.333\height}{\@tlen\SquareL\@tlen}}
%%
\newcommand{\RubikL}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareL\\
-\rrL
+\rrL%
\end{minipage}%
-}
+}}
\newcommand{\textRubikL}{\rrL\,\rrhL}
-\newcommand{\rrLp}{\textbf{\textsf{L}$^\prime$}}
+\newcommand{\rrLp}{\@rrp{L}}
%%
\newcommand{\SquareLp}{%
\begin{tikzpicture}[scale=0.5]
@@ -1303,17 +1432,18 @@
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLp}{\raisebox{-0.333\height}{\SquareLp}\,}
+\newcommand{\rrhLp}{\raisebox{-0.333\height}{\@tlen\SquareLp\@tlen}}
%%
\newcommand{\RubikLp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLp\\
-\rrLp
+\rrLp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLp}{\rrLp\,\rrhLp}
-\newcommand{\rrLw}{\textbf{\textsf{L\footnotesize{w}}}}
+\newcommand{\rrLw}{\@rrw{L}}
%%
\newcommand{\SquareLw}{%
\begin{tikzpicture}[scale=0.5]
@@ -1323,17 +1453,18 @@
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLw}{\raisebox{-0.333\height}{\SquareLw}\,}
+\newcommand{\rrhLw}{\raisebox{-0.333\height}{\@tlen\SquareLw\@tlen}}
%%
\newcommand{\RubikLw}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLw\\
-\rrLw
+\rrLw%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLw}{\rrLw\,\rrhLw}
-\newcommand{\rrLwp}{\textbf{\textsf{L\footnotesize{w}}$^\prime$}}
+\newcommand{\rrLwp}{\@rrwp{L}}
%%
\newcommand{\SquareLwp}{%
\begin{tikzpicture}[scale=0.5]
@@ -1343,15 +1474,16 @@
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLwp}{\raisebox{-0.333\height}{\SquareLwp}\,}
+\newcommand{\rrhLwp}{\raisebox{-0.333\height}{\@tlen\SquareLwp\@tlen}}
%%
\newcommand{\RubikLwp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLwp\\
-\rrLwp
+\rrLwp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLwp}{\rrLwp\,\rrhLwp}
\newcommand{\rrLs}{\@rrs{L}}
%%
@@ -1363,15 +1495,16 @@
\draw [thick, <-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLs}{\raisebox{-0.333\height}{\SquareLs}\,}
+\newcommand{\rrhLs}{\raisebox{-0.333\height}{\@tlen\SquareLs\@tlen}}
%%
\newcommand{\RubikLs}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLs\\
-\rrLs
+\rrLs%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLs}{\rrLs\,\rrhLs}
\newcommand{\rrLsp}{\@rrsp{L}}
%%
@@ -1383,15 +1516,16 @@
\draw [thick, ->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLsp}{\raisebox{-0.333\height}{\SquareLsp}\,}
+\newcommand{\rrhLsp}{\raisebox{-0.333\height}{\@tlen\SquareLsp\@tlen}}
%%
\newcommand{\RubikLsp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLsp\\
-\rrLsp
+\rrLsp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLsp}{\rrLsp\,\rrhLsp}
\newcommand{\rrLa}{\@rra{L}}
%%
@@ -1403,15 +1537,16 @@
\draw [thick, ->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLa}{\raisebox{-0.333\height}{\SquareLa}\,}
+\newcommand{\rrhLa}{\raisebox{-0.333\height}{\@tlen\SquareLa\@tlen}}
%%
\newcommand{\RubikLa}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLa\\
-\rrLa
+\rrLa%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLa}{\rrLa\,\rrhLa}
\newcommand{\rrLap}{\@rrap{L}}
%%
@@ -1423,17 +1558,18 @@
\draw [thick, <-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhLap}{\raisebox{-0.333\height}{\SquareLap}\,}
+\newcommand{\rrhLap}{\raisebox{-0.333\height}{\@tlen\SquareLap\@tlen}}
%%
\newcommand{\RubikLap}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareLap\\
-\rrLap
+\rrLap%
\end{minipage}%
-}
+}}
\newcommand{\textRubikLap}{\rrLap\,\rrhLap}
-\newcommand{\rrM}{\textbf{\textsf{M}}}
+\newcommand{\rrM}{\@rr{M}}
%%
\newcommand{\SquareM}{%
\begin{tikzpicture}[scale=0.5]
@@ -1443,17 +1579,18 @@
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhM}{\raisebox{-0.333\height}{\SquareM}\,}
+\newcommand{\rrhM}{\raisebox{-0.333\height}{\@tlen\SquareM\@tlen}}
%%
\newcommand{\RubikM}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareM\\
-\rrM
+\rrM%
\end{minipage}%
-}
+}}
\newcommand{\textRubikM}{\rrM\,\rrhM}
-\newcommand{\rrMp}{\textbf{\textsf{M}$^\prime$}}
+\newcommand{\rrMp}{\@rrp{M}}
%%
\newcommand{\SquareMp}{%
\begin{tikzpicture}[scale=0.5]
@@ -1463,17 +1600,18 @@
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhMp}{\raisebox{-0.333\height}{\SquareMp}\,}
+\newcommand{\rrhMp}{\raisebox{-0.333\height}{\@tlen\SquareMp\@tlen}}
%%
\newcommand{\RubikMp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareMp\\
-\rrMp
+\rrMp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikMp}{\rrMp\,\rrhMp}
-\newcommand{\rrR}{\textbf{\textsf{R}}}
+\newcommand{\rrR}{\@rr{R}}
%%
\newcommand{\SquareR}{%
\begin{tikzpicture}[scale=0.5]
@@ -1484,17 +1622,18 @@
\draw [thick, ->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhR}{\raisebox{-0.333\height}{\SquareR}\,}
+\newcommand{\rrhR}{\raisebox{-0.333\height}{\@tlen\SquareR\@tlen}}
%%
\newcommand{\RubikR}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareR\\
-\rrR
+\rrR%
\end{minipage}%
-}
+}}
\newcommand{\textRubikR}{\rrR\,\rrhR}
-\newcommand{\rrRp}{\textbf{\textsf{R}$^\prime$}}
+\newcommand{\rrRp}{\@rrp{R}}
%%
\newcommand{\SquareRp}{%
\begin{tikzpicture}[scale=0.5]
@@ -1504,17 +1643,18 @@
\draw [thick, <-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRp}{\raisebox{-0.333\height}{\SquareRp}\,}
+\newcommand{\rrhRp}{\raisebox{-0.333\height}{\@tlen\SquareRp\@tlen}}
%%
\newcommand{\RubikRp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRp\\
-\rrRp
+\rrRp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRp}{\rrRp\,\rrhRp}
-\newcommand{\rrRw}{\textbf{\textsf{R\footnotesize{w}}}}
+\newcommand{\rrRw}{\@rrw{R}}
%%
\newcommand{\SquareRw}{%
\begin{tikzpicture}[scale=0.5]
@@ -1524,17 +1664,18 @@
\draw [thick, ->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRw}{\raisebox{-0.333\height}{\SquareRw}\,}
+\newcommand{\rrhRw}{\raisebox{-0.333\height}{\@tlen\SquareRw\@tlen}}
%%
\newcommand{\RubikRw}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRw\\
-\rrRw
+\rrRw%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRw}{\rrRw\,\rrhRw}
-\newcommand{\rrRwp}{\textbf{\textsf{R\footnotesize{w}}$^\prime$}}
+\newcommand{\rrRwp}{\@rrwp{R}}
%%
\newcommand{\SquareRwp}{%
\begin{tikzpicture}[scale=0.5]
@@ -1544,15 +1685,16 @@
\draw [thick, <-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRwp}{\raisebox{-0.333\height}{\SquareRwp}\,}
+\newcommand{\rrhRwp}{\raisebox{-0.333\height}{\@tlen\SquareRwp\@tlen}}
%%
\newcommand{\RubikRwp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRwp\\
-\rrRwp
+\rrRwp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRwp}{\rrRwp\,\rrhRwp}
\newcommand{\rrRs}{\@rrs{R}}
%%
@@ -1564,15 +1706,16 @@
\draw [thick,->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRs}{\raisebox{-0.333\height}{\SquareRs}\,}
+\newcommand{\rrhRs}{\raisebox{-0.333\height}{\@tlen\SquareRs\@tlen}}
%%
\newcommand{\RubikRs}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRs\\
-\rrRs
+\rrRs%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRs}{\rrRs\,\rrhRs}
\newcommand{\rrRsp}{\@rrsp{R}}
%%
@@ -1584,15 +1727,16 @@
\draw [thick,<-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRsp}{\raisebox{-0.333\height}{\SquareRsp}\,}
+\newcommand{\rrhRsp}{\raisebox{-0.333\height}{\@tlen\SquareRsp\@tlen}}
%%
\newcommand{\RubikRsp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRsp\\
-\rrRsp
+\rrRsp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRsp}{\rrRsp\,\rrhRsp}
\newcommand{\rrRa}{\@rra{R}}
%%
@@ -1604,15 +1748,16 @@
\draw [thick,->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRa}{\raisebox{-0.333\height}{\SquareRa}\,}
+\newcommand{\rrhRa}{\raisebox{-0.333\height}{\@tlen\SquareRa\@tlen}}
%%
\newcommand{\RubikRa}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRa\\
-\rrRa
+\rrRa%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRa}{\rrRa\,\rrhRa}
\newcommand{\rrRap}{\@rrap{R}}
%%
@@ -1624,127 +1769,136 @@
\draw [thick,<-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
-\newcommand{\rrhRap}{\raisebox{-0.333\height}{\SquareRap}\,}
+\newcommand{\rrhRap}{\raisebox{-0.333\height}{\@tlen\SquareRap\@tlen}}
%%
\newcommand{\RubikRap}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareRap\\
-\rrRap
+\rrRap%
\end{minipage}%
-}
+}}
\newcommand{\textRubikRap}{\rrRap\,\rrhRap}
\newcommand{\rrS}{\@rr{S}}
-\newcommand{\SquareS}{\@SquareLetter{\rrS}}
-\newcommand{\rrhS}{\raisebox{-0.25mm}{\SquareS}\,}
-\newcommand{\RubikS}{\raisebox{\@hRubik}{\SquareS}\,}
-\newcommand{\textRubikS}{\rrhS\,}
+\newcommand{\SquareS}{\@tlen\@SquareLetter{\rrS}\@tlen}
+\newcommand{\rrhS}{\raisebox{-0.25mm}{\SquareS}}
+\newcommand{\RubikS}{\raisebox{\@hRubik}{\SquareS}}
+\newcommand{\textRubikS}{\rrhS}
\newcommand{\rrSp}{\@rrp{S}}
-\newcommand{\SquareSp}{\@SquareLetter{\rrSp}}
-\newcommand{\rrhSp}{\raisebox{-0.25mm}{\SquareSp}\,}
-\newcommand{\RubikSp}{\raisebox{\@hRubik}{\SquareSp}\,}
-\newcommand{\textRubikSp}{\rrhSp\,}
-\newcommand{\rrSu}{\textbf{\textsf{S\footnotesize{u}}}}
+\newcommand{\SquareSp}{\@tlen\@SquareLetter{\rrSp}\@tlen}
+\newcommand{\rrhSp}{\raisebox{-0.25mm}{\SquareSp}}
+\newcommand{\RubikSp}{\raisebox{\@hRubik}{\SquareSp}}
+\newcommand{\textRubikSp}{\rrhSp}
+\newcommand{\rrSu}{\@rru{S}}
\newcommand{\rrhSu}{\rrhEp}%
\newcommand{\RubikSu}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareEp\\
-\rrSu
+\rrSu%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSu}{\rrSu\,\rrhEp}
-\newcommand{\rrSup}{\textbf{\textsf{S\footnotesize{u}}$^\prime$}}
+\newcommand{\rrSup}{\@rrup{S}}
\newcommand{\rrhSup}{\rrhE}%
\newcommand{\RubikSup}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareE\\
-\rrSup
+\rrSup%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSup}{\rrSup\,\rrhE}
-\newcommand{\rrSd}{\textbf{\textsf{S\footnotesize{d}}}}
+\newcommand{\rrSd}{\@rrd{S}}
\newcommand{\rrhSd}{\rrhE}%
\newcommand{\RubikSd}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareE\\
-\rrSd
+\rrSd%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSd}{\rrSd\,\rrhE}
-\newcommand{\rrSdp}{\textbf{\textsf{S\footnotesize{d}}$^\prime$}}
+\newcommand{\rrSdp}{\@rrdp{S}}
\newcommand{\rrhSdp}{\rrhEp}%
\newcommand{\RubikSdp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareEp\\
-\rrSdp
+\rrSdp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSdp}{\rrSdp\,\rrhEp}
-\newcommand{\rrSl}{\textbf{\textsf{S\footnotesize{l}}}}
+\newcommand{\rrSl}{\@rrl{S}}
\newcommand{\rrhSl}{\rrhM}%
\newcommand{\RubikSl}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareM\\
-\rrSl
+\rrSl%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSl}{\rrSl\,\rrhM}
-\newcommand{\rrSlp}{\textbf{\textsf{S\footnotesize{l}}$^\prime$}}
+\newcommand{\rrSlp}{\@rrlp{S}}
\newcommand{\rrhSlp}{\rrhMp}%
\newcommand{\RubikSlp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareMp\\
-\rrSlp
+\rrSlp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSlp}{\rrSlp\,\rrhMp}
-\newcommand{\rrSr}{\textbf{\textsf{S\footnotesize{r}}}}
+\newcommand{\rrSr}{\@rrr{S}}
\newcommand{\rrhSr}{\rrhMp}%
\newcommand{\RubikSr}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareMp\\
-\rrSr
+\rrSr%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSr}{\rrSr\,\rrhMp}
-\newcommand{\rrSrp}{\textbf{\textsf{S\footnotesize{r}}$^\prime$}}
+\newcommand{\rrSrp}{\@rrrp{S}}
\newcommand{\rrhSrp}{\rrhM}%
\newcommand{\RubikSrp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareM\\
-\rrSrp
+\rrSrp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikSrp}{\rrSrp\,\rrhM}
-\newcommand{\rrSf}{\textbf{\textsf{S\footnotesize{f}}}}
-\newcommand{\SquareSf}{\@SquareLetter{\rrSf}}
-\newcommand{\rrhSf}{\raisebox{-0.25mm}{\SquareSf}\,}
-\newcommand{\RubikSf}{\raisebox{\@hRubik}{\SquareSf}\,}
-\newcommand{\textRubikSf}{\rrhSf\,}
-\newcommand{\rrSfp}{\textbf{\textsf{S\footnotesize{f}}$^\prime$}}
-\newcommand{\SquareSfp}{\@SquareLetter{\rrSfp}}
-\newcommand{\rrhSfp}{\raisebox{-0.25mm}{\SquareSfp}\,}
-\newcommand{\RubikSfp}{\raisebox{\@hRubik}{\SquareSfp}\,}
-\newcommand{\textRubikSfp}{\rrhSfp\,}
-\newcommand{\rrSb}{\textbf{\textsf{S\footnotesize{b}}}}
-\newcommand{\SquareSb}{\@SquareLetter{\rrSb}}
-\newcommand{\rrhSb}{\raisebox{-0.25mm}{\SquareSb}\,}
-\newcommand{\RubikSb}{\raisebox{\@hRubik}{\SquareSb}\,}
-\newcommand{\textRubikSb}{\rrhSb\,}
-\newcommand{\rrSbp}{\textbf{\textsf{S\footnotesize{b}}$^\prime$}}
-\newcommand{\SquareSbp}{\@SquareLetter{\rrSbp}}
-\newcommand{\rrhSbp}{\raisebox{-0.25mm}{\SquareSbp}\,}
-\newcommand{\RubikSbp}{\raisebox{\@hRubik}{\SquareSbp}\,}
-\newcommand{\textRubikSbp}{\rrhSbp\,}
-\newcommand{\rrU}{\textbf{\textsf{U}}}
+\newcommand{\rrSf}{\@rrf{S}}
+\newcommand{\SquareSf}{\@tlen\@SquareLetter{\rrSf}\@tlen}
+\newcommand{\rrhSf}{\raisebox{-0.25mm}{\SquareSf}}
+\newcommand{\RubikSf}{\raisebox{\@hRubik}{\SquareSf}}
+\newcommand{\textRubikSf}{\rrhSf}
+\newcommand{\rrSfp}{\@rrfp{S}}
+\newcommand{\SquareSfp}{\@tlen\@SquareLetter{\rrSfp}\@tlen}
+\newcommand{\rrhSfp}{\raisebox{-0.25mm}{\SquareSfp}}
+\newcommand{\RubikSfp}{\raisebox{\@hRubik}{\SquareSfp}}
+\newcommand{\textRubikSfp}{\rrhSfp}
+\newcommand{\rrSb}{\@rrb{S}}
+\newcommand{\SquareSb}{\@tlen\@SquareLetter{\rrSb}\@tlen}
+\newcommand{\rrhSb}{\raisebox{-0.25mm}{\SquareSb}}
+\newcommand{\RubikSb}{\raisebox{\@hRubik}{\SquareSb}}
+\newcommand{\textRubikSb}{\rrhSb}
+\newcommand{\rrSbp}{\@rrbp{S}}
+\newcommand{\SquareSbp}{\@tlen\@SquareLetter{\rrSbp}\@tlen}
+\newcommand{\rrhSbp}{\raisebox{-0.25mm}{\SquareSbp}}
+\newcommand{\RubikSbp}{\raisebox{\@hRubik}{\SquareSbp}}
+\newcommand{\textRubikSbp}{\rrhSbp}
+\newcommand{\rrU}{\@rr{U}}
%%
\newcommand{\SquareU}{%
\begin{tikzpicture}[scale=0.5]
@@ -1754,17 +1908,18 @@
\draw [thick] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhU}{\raisebox{-0.333\height}{\SquareU}\,}
+\newcommand{\rrhU}{\raisebox{-0.333\height}{\@tlen\SquareU\@tlen}}
%%
\newcommand{\RubikU}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareU\\
-\rrU
+\rrU%
\end{minipage}%%
-}
+}}
\newcommand{\textRubikU}{\rrU\,\rrhU}
-\newcommand{\rrUw}{\textbf{\textsf{U\footnotesize{w}}}}
+\newcommand{\rrUw}{\@rrw{U}}
%%
\newcommand{\SquareUw}{%
\begin{tikzpicture}[scale=0.5]
@@ -1774,18 +1929,19 @@
\draw [thick] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUw}{\raisebox{-0.333\height}{\SquareUw}\,}
+\newcommand{\rrhUw}{\raisebox{-0.333\height}{\@tlen\SquareUw\@tlen}}
%%
\newcommand{\RubikUw}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUw\\
-\rrUw
+\rrUw%
\end{minipage}%%
-}
+}}
%%
\newcommand{\textRubikUw}{\rrUw\,\rrhUw}
-\newcommand{\rrUp}{\textbf{\textsf{U}$^\prime$}}
+\newcommand{\rrUp}{\@rrp{U}}
%%
\newcommand{\SquareUp}{%
\begin{tikzpicture}[scale=0.5]
@@ -1795,17 +1951,18 @@
\draw [thick] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUp}{\raisebox{-0.333\height}{\SquareUp}\,}
+\newcommand{\rrhUp}{\raisebox{-0.333\height}{\@tlen\SquareUp\@tlen}}
%%
\newcommand{\RubikUp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUp\\
-\rrUp
+\rrUp%
\end{minipage}%%
-}
+}}
\newcommand{\textRubikUp}{\rrUp\,\rrhUp}
-\newcommand{\rrUwp}{\textbf{\textsf{U\footnotesize{w}}$^\prime$}}
+\newcommand{\rrUwp}{\@rrwp{U}}
%%
\newcommand{\SquareUwp}{%
\begin{tikzpicture}[scale=0.5]
@@ -1815,15 +1972,16 @@
\draw [thick] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUwp}{\raisebox{-0.333\height}{\SquareUwp}\,}
+\newcommand{\rrhUwp}{\raisebox{-0.333\height}{\@tlen\SquareUwp\@tlen}}
%%
\newcommand{\RubikUwp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUwp\\
-\rrUwp
+\rrUwp%
\end{minipage}%%
-}
+}}
\newcommand{\textRubikUwp}{\rrUwp\,\rrhUwp}
\newcommand{\rrUs}{\@rrs{U}}
%%
@@ -1835,15 +1993,16 @@
\draw [thick, <-] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUs}{\raisebox{-0.333\height}{\SquareUs}\,}
+\newcommand{\rrhUs}{\raisebox{-0.333\height}{\@tlen\SquareUs\@tlen}}
%%
\newcommand{\RubikUs}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUs\\
-\rrUs
+\rrUs%
\end{minipage}%
-}
+}}
\newcommand{\textRubikUs}{\rrUs\,\rrhUs}
\newcommand{\rrUsp}{\@rrsp{U}}
%%
@@ -1855,15 +2014,16 @@
\draw [thick, ->] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUsp}{\raisebox{-0.333\height}{\SquareUsp}\,}
+\newcommand{\rrhUsp}{\raisebox{-0.333\height}{\@tlen\SquareUsp\@tlen}}
%%
\newcommand{\RubikUsp}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUsp\\
-\rrUsp
+\rrUsp%
\end{minipage}%
-}
+}}
\newcommand{\textRubikUsp}{\rrUsp\,\rrhUsp}
\newcommand{\rrUa}{\@rra{U}}
%%
@@ -1875,15 +2035,16 @@
\draw [thick, ->] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUa}{\raisebox{-0.333\height}{\SquareUa}\,}
+\newcommand{\rrhUa}{\raisebox{-0.333\height}{\@tlen\SquareUa\@tlen}}
%%
\newcommand{\RubikUa}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUa\\
-\rrUa
+\rrUa%
\end{minipage}%
-}
+}}
\newcommand{\textRubikUa}{\rrUa\,\rrhUa}
\newcommand{\rrUap}{\@rrap{U}}
%%
@@ -1895,52 +2056,573 @@
\draw [thick, <-] (\@sb,\@sd) -- (\@sbh, \@sd);
\end{tikzpicture}%
}
-\newcommand{\rrhUap}{\raisebox{-0.333\height}{\SquareUap}\,}
+\newcommand{\rrhUap}{\raisebox{-0.333\height}{\@tlen\SquareUap\@tlen}}
%%
\newcommand{\RubikUap}{%
+{\@rubikfont%
\begin{minipage}{0.6cm}
-\centering
+\centering%
\SquareUap\\
-\rrUap
+\rrUap%
\end{minipage}%
-}
+}}
\newcommand{\textRubikUap}{\rrUap\,\rrhUap}
-\newcommand{\rrx}{\textbf{\textsf{x}}}
+\newcommand{\rrx}{\@rr{x}}
\newcommand{\Rubikx}{\@xyzRubik{x}}
\newcommand{\rrhx}{\@xyzh{x}}
-\newcommand{\rrxp}{\textbf{\textsf{x}$^\prime$}}
+\newcommand{\rrxp}{\@rrp{x}}
\newcommand{\Rubikxp}{\@xyzRubikp{x}}
\newcommand{\rrhxp}{\@xyzhp{x}}
-\newcommand{\rry}{\textbf{\textsf{y}}}
+\newcommand{\rry}{\@rr{y}}
\newcommand{\Rubiky}{\@xyzRubik{y}}
\newcommand{\rrhy}{\@xyzh{y}}
-\newcommand{\rryp}{\textbf{\textsf{y}$^\prime$}}
+\newcommand{\rryp}{\@rrp{y}}
\newcommand{\Rubikyp}{\@xyzRubikp{y}}
\newcommand{\rrhyp}{\@xyzhp{y}}
-\newcommand{\rrz}{\textbf{\textsf{z}}}
+\newcommand{\rrz}{\@rr{z}}
\newcommand{\Rubikz}{\@xyzRubik{z}}
\newcommand{\rrhz}{\@xyzh{z}}
-\newcommand{\rrzp}{\textbf{\textsf{z}$^\prime$}}
+\newcommand{\rrzp}{\@rrp{z}}
\newcommand{\Rubikzp}{\@xyzRubikp{z}}
\newcommand{\rrhzp}{\@xyzhp{z}}
-\newcommand{\rru}{\textbf{\textsf{u}}}
+\newcommand{\rru}{\@rr{u}}
\newcommand{\Rubiku}{\@xyzRubik{u}}
\newcommand{\rrhu}{\@xyzh{u}}
-\newcommand{\rrd}{\textbf{\textsf{d}}}
-\newcommand{\Rubikd}{\@xyzRubik{d}}
-\newcommand{\rrhd}{\@xyzh{d}}
-\newcommand{\rrl}{\textbf{\textsf{l}}}
-\newcommand{\Rubikl}{\@xyzRubik{l}}
-\newcommand{\rrhl}{\@xyzh{l}}
-\newcommand{\rrr}{\textbf{\textsf{r}}}
+\newcommand{\rrd}{\@rr{d}}
+\newcommand{\rrhd}{\@xyzhbdfl{d}}
+\newcommand{\Rubikd}{\@xyzbdflRubik{d}}
+\newcommand{\rrl}{\@rr{l}}
+\newcommand{\rrhl}{\@xyzhbdfl{l}}
+\newcommand{\Rubikl}{\@xyzbdflRubik{l}}
+\newcommand{\rrr}{\@rr{r}}
\newcommand{\Rubikr}{\@xyzRubik{r}}
\newcommand{\rrhr}{\@xyzh{r}}
-\newcommand{\rrf}{\textbf{\textsf{f}}}
-\newcommand{\Rubikf}{\@xyzRubik{f}}
-\newcommand{\rrhf}{\@xyzh{f}}
-\newcommand{\rrb}{\textbf{\textsf{b}}}
-\newcommand{\Rubikb}{\@xyzRubik{b}}
-\newcommand{\rrhb}{\@xyzh{b}}
+\newcommand{\rrf}{\@rr{f}}
+\newcommand{\rrhf}{\@xyzhbdfl{f}}
+\newcommand{\Rubikf}{\@xyzbdflRubik{f}}
+\newcommand{\rrb}{\@rr{b}}
+\newcommand{\rrhb}{\@xyzhbdfl{b}}
+\newcommand{\Rubikb}{\@xyzbdflRubik{b}}
+\newcommand{\@xyzhc}[1]{[\raisebox{-1.2pt}%
+ {{\@rubikfont #1\@rubikfontFNS c}}]}
+\newcommand{\@xyzhcp}[1]{[\raisebox{-1.2pt}%
+ {{\@rubikfont #1{\@rubikfontFNS c}\@rubikprime}}]}
+\newcommand{\@xyzRubikc}[1]{\raisebox{3.45pt}%
+ {[\raisebox{-1.2pt}{{\@rubikfont #1\@rubikfontFNS c}}]}}
+\newcommand{\@xyzRubikcp}[1]{\raisebox{3.45pt}%
+ {[\raisebox{-1.2pt}{{\@rubikfont #1{\@rubikfontFNS c}\@rubikprime}}]}}
+\newcommand{\rrRc}{\@rrc{R}}
+\newcommand{\RubikRc}{\@xyzRubikc{R}}
+\newcommand{\rrhRc}{\@xyzhc{R}}
+\newcommand{\rrRcp}{\@rrcp{R}}
+\newcommand{\RubikRcp}{\@xyzRubikcp{R}}
+\newcommand{\rrhRcp}{\@xyzhcp{R}}
+\newcommand{\rrLc}{\@rrc{L}}
+\newcommand{\RubikLc}{\@xyzRubikc{L}}
+\newcommand{\rrhLc}{\@xyzhc{L}}
+\newcommand{\rrLcp}{\@rrcp{L}}
+\newcommand{\RubikLcp}{\@xyzRubikcp{L}}
+\newcommand{\rrhLcp}{\@xyzhcp{L}}
+\newcommand{\rrUc}{\@rrc{U}}
+\newcommand{\RubikUc}{\@xyzRubikc{U}}
+\newcommand{\rrhUc}{\@xyzhc{U}}
+\newcommand{\rrUcp}{\@rrcp{U}}
+\newcommand{\RubikUcp}{\@xyzRubikcp{U}}
+\newcommand{\rrhUcp}{\@xyzhcp{U}}
+\newcommand{\rrDc}{\@rrc{D}}
+\newcommand{\RubikDc}{\@xyzRubikc{D}}
+\newcommand{\rrhDc}{\@xyzhc{D}}
+\newcommand{\rrDcp}{\@rrcp{D}}
+\newcommand{\RubikDcp}{\@xyzRubikcp{D}}
+\newcommand{\rrhDcp}{\@xyzhcp{D}}
+\newcommand{\rrFc}{\@rrc{F}}
+\newcommand{\RubikFc}{\@xyzRubikc{F}}
+\newcommand{\rrhFc}{\@xyzhc{F}}
+\newcommand{\rrFcp}{\@rrcp{F}}
+\newcommand{\RubikFcp}{\@xyzRubikcp{F}}
+\newcommand{\rrhFcp}{\@xyzhcp{F}}
+\newcommand{\rrBc}{\@rrc{B}}
+\newcommand{\RubikBc}{\@xyzRubikc{B}}
+\newcommand{\rrhBc}{\@xyzhc{B}}
+\newcommand{\rrBcp}{\@rrcp{B}}
+\newcommand{\RubikBcp}{\@xyzRubikcp{B}}
+\newcommand{\rrhBcp}{\@xyzhcp{B}}
+\newcommand{\rrRm}{\@rrm{R}}
+\newcommand{\rrhRm}{\rrhMp}%
+\newcommand{\RubikRm}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareMp\\
+\rrRm%
+\end{minipage}%
+}}
+\newcommand{\textRubikRm}{\rrRm\,\rrhMp}
+\newcommand{\rrRmp}{\@rrmp{R}}
+\newcommand{\rrhRmp}{\rrhM}%
+\newcommand{\RubikRmp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareM\\
+\rrRmp%
+\end{minipage}%
+}}
+\newcommand{\textRubikRmp}{\rrRmp\,\rrhM}
+\newcommand{\rrLm}{\@rrm{L}}
+\newcommand{\rrhLm}{\rrhM}%
+\newcommand{\RubikLm}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareM\\
+\rrLm%
+\end{minipage}%
+}}
+\newcommand{\textRubikLm}{\rrLm\,\rrhM}
+\newcommand{\rrLmp}{\@rrmp{L}}
+\newcommand{\rrhLmp}{\rrhMp}%
+\newcommand{\RubikLmp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareMp\\
+\rrLmp%
+\end{minipage}%
+}}
+\newcommand{\textRubikLmp}{\rrLmp\,\rrhMp}
+\newcommand{\rrUm}{\@rrm{U}}
+\newcommand{\rrhUm}{\rrhEp}%
+\newcommand{\RubikUm}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareEp\\
+\rrUm%
+\end{minipage}%
+}}
+\newcommand{\textRubikUm}{\rrUm\,\rrhEp}
+\newcommand{\rrUmp}{\@rrmp{U}}
+\newcommand{\rrhUmp}{\rrhE}%
+\newcommand{\RubikUmp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareE\\
+\rrUmp%
+\end{minipage}%
+}}
+\newcommand{\textRubikUmp}{\rrUmp\,\rrhE}
+\newcommand{\rrDm}{\@rrm{D}}
+\newcommand{\rrhDm}{\rrhE}%
+\newcommand{\RubikDm}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareE\\
+\rrDm%
+\end{minipage}%
+}}
+\newcommand{\textRubikDm}{\rrDm\,\rrhE}
+\newcommand{\rrDmp}{\@rrmp{D}}
+\newcommand{\rrhDmp}{\rrhEp}%
+\newcommand{\RubikDmp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareEp\\
+\rrDmp%
+\end{minipage}%
+}}
+\newcommand{\textRubikDmp}{\rrDmp\,\rrhEp}
+\newcommand{\rrFm}{\@rrm{F}}
+\newcommand{\SquareFm}{\@tlen\@SquareLetter{\rrFm}\@tlen}
+\newcommand{\rrhFm}{\raisebox{-0.25mm}{\SquareFm}}
+\newcommand{\RubikFm}{\raisebox{\@hRubik}{\SquareFm}}
+\newcommand{\textRubikFm}{\rrhFm}
+\newcommand{\rrFmp}{\@rrmp{F}}
+\newcommand{\SquareFmp}{\@tlen\@SquareLetter{\rrFmp}\@tlen}
+\newcommand{\rrhFmp}{\raisebox{-0.25mm}{\SquareFmp}}
+\newcommand{\RubikFmp}{\raisebox{\@hRubik}{\SquareFmp}}
+\newcommand{\textRubikFmp}{\rrhFmp}
+\newcommand{\rrBm}{\@rrm{B}}
+\newcommand{\SquareBm}{\@tlen\@SquareLetter{\rrBm}\@tlen}
+\newcommand{\rrhBm}{\raisebox{-0.25mm}{\SquareBm}}
+\newcommand{\RubikBm}{\raisebox{\@hRubik}{\SquareBm}}
+\newcommand{\textRubikBm}{\rrhBm}
+\newcommand{\rrBmp}{\@rrmp{B}}
+\newcommand{\SquareBmp}{\@tlen\@SquareLetter{\rrBmp}\@tlen}
+\newcommand{\rrhBmp}{\raisebox{-0.25mm}{\SquareBmp}}
+\newcommand{\RubikBmp}{\raisebox{\@hRubik}{\SquareBmp}}
+\newcommand{\textRubikBmp}{\rrhBmp}
+\newcommand{\@randhc}[1]{[\raisebox{-1.2pt}{{\@rubikfont C#1}}]}
+\newcommand{\@randhcp}[1]{[\raisebox{-1.2pt}{{\@rubikfont C#1\@rubikprime}}]}
+\newcommand{\@randRubikc}[1]%
+ {\raisebox{3.45pt}{[\raisebox{-1.2pt}{{\@rubikfont C#1}}]}}
+\newcommand{\@randRubikcp}[1]%
+ {\raisebox{3.45pt}{[\raisebox{-1.2pt}{{\@rubikfont C#1\@rubikprime}}]}}
+\newcommand{\rrCR}{\@rr{CR}}
+\newcommand{\RubikCR}{\@randRubikc{R}}
+\newcommand{\rrhCR}{\@randhc{R}}
+\newcommand{\rrCRp}{\@rrp{CR}}
+\newcommand{\RubikCRp}{\@randRubikcp{R}}
+\newcommand{\rrhCRp}{\@randhcp{R}}
+\newcommand{\rrCL}{\@rr{CL}}
+\newcommand{\RubikCL}{\@randRubikc{L}}
+\newcommand{\rrhCL}{\@randhc{L}}
+\newcommand{\rrCLp}{\@rrp{CL}}
+\newcommand{\RubikCLp}{\@randRubikcp{L}}
+\newcommand{\rrhCLp}{\@randhcp{L}}
+\newcommand{\rrCU}{\@rr{CU}}
+\newcommand{\RubikCU}{\@randRubikc{U}}
+\newcommand{\rrhCU}{\@randhc{U}}
+\newcommand{\rrCUp}{\@rrp{CU}}
+\newcommand{\RubikCUp}{\@randRubikcp{U}}
+\newcommand{\rrhCUp}{\@randhcp{U}}
+\newcommand{\rrCD}{\@rr{CD}}
+\newcommand{\RubikCD}{\@randRubikc{D}}
+\newcommand{\rrhCD}{\@randhc{D}}
+\newcommand{\rrCDp}{\@rrp{CD}}
+\newcommand{\RubikCDp}{\@randRubikcp{D}}
+\newcommand{\rrhCDp}{\@randhcp{D}}
+\newcommand{\rrCF}{\@rr{CF}}
+\newcommand{\RubikCF}{\@randRubikc{F}}
+\newcommand{\rrhCF}{\@randhc{F}}
+\newcommand{\rrCFp}{\@rrp{CF}}
+\newcommand{\RubikCFp}{\@randRubikcp{F}}
+\newcommand{\rrhCFp}{\@randhcp{F}}
+\newcommand{\rrCB}{\@rr{CB}}
+\newcommand{\RubikCB}{\@randRubikc{B}}
+\newcommand{\rrhCB}{\@randhc{B}}
+\newcommand{\rrCBp}{\@rrp{CB}}
+\newcommand{\RubikCBp}{\@randRubikcp{B}}
+\newcommand{\rrhCBp}{\@randhcp{B}}
+\newcommand{\rrMR}{\@rr{MR}}
+\newcommand{\rrhMR}{\rrhMp}%
+\newcommand{\RubikMR}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareMp\\
+\rrMR%
+\end{minipage}%
+}}
+\newcommand{\textRubikMR}{\rrMR\,\rrhMp}
+\newcommand{\rrMRp}{\@rrp{MR}}
+\newcommand{\rrhMRp}{\rrhM}%
+\newcommand{\RubikMRp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareM\\
+\rrMRp%
+\end{minipage}%
+}}
+\newcommand{\textRubikMRp}{\rrMRp\,\rrhM}
+\newcommand{\rrML}{\@rr{ML}}
+\newcommand{\rrhML}{\rrhM}%
+\newcommand{\RubikML}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareM\\
+\rrML%
+\end{minipage}%
+}}
+\newcommand{\textRubikML}{\rrML\,\rrhM}
+\newcommand{\rrMLp}{\@rrp{ML}}
+\newcommand{\rrhMLp}{\rrhMp}%
+\newcommand{\RubikMLp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareMp\\
+\rrMLp%
+\end{minipage}%
+}}
+\newcommand{\textRubikMLp}{\rrMLp\,\rrhMp}
+\newcommand{\rrMU}{\@rr{MU}}
+\newcommand{\rrhMU}{\rrhEp}%
+\newcommand{\RubikMU}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareEp\\
+\rrMU%
+\end{minipage}%
+}}
+\newcommand{\textRubikMU}{\rrMU\,\rrhEp}
+\newcommand{\rrMUp}{\@rrp{MU}}
+\newcommand{\rrhMUp}{\rrhE}%
+\newcommand{\RubikMUp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareE\\
+\rrMUp%
+\end{minipage}%
+}}
+\newcommand{\textRubikMUp}{\rrMUp\,\rrhE}
+\newcommand{\rrMD}{\@rr{MD}}
+\newcommand{\rrhMD}{\rrhE}%
+\newcommand{\RubikMD}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareE\\
+\rrMD%
+\end{minipage}%
+}}
+\newcommand{\textRubikMD}{\rrMD\,\rrhE}
+\newcommand{\rrMDp}{\@rrp{MD}}
+\newcommand{\rrhMDp}{\rrhEp}%
+\newcommand{\RubikMDp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareEp\\
+\rrMDp%
+\end{minipage}%
+}}
+\newcommand{\textRubikMDp}{\rrMDp\,\rrhEp}
+\newcommand{\rrMF}{\@rr{MF}}
+\newcommand{\SquareMF}{\@tlen\@SquareLetter{\rrMF}\@tlen}
+\newcommand{\rrhMF}{\raisebox{-0.25mm}{\SquareMF}}
+\newcommand{\RubikMF}{\raisebox{\@hRubik}{\SquareMF}}
+\newcommand{\textRubikMF}{\rrhMF}
+\newcommand{\rrMFp}{\@rrp{MF}}
+\newcommand{\SquareMFp}{\@tlen\@SquareLetter{\rrMFp}\@tlen}
+\newcommand{\rrhMFp}{\raisebox{-0.25mm}{\SquareMFp}}
+\newcommand{\RubikMFp}{\raisebox{\@hRubik}{\SquareMFp}}
+\newcommand{\textRubikMFp}{\rrhMFp}
+\newcommand{\rrMB}{\@rr{MB}}
+\newcommand{\SquareMB}{\@tlen\@SquareLetter{\rrMB}\@tlen}
+\newcommand{\rrhMB}{\raisebox{-0.25mm}{\SquareMB}}
+\newcommand{\RubikMB}{\raisebox{\@hRubik}{\SquareMB}}
+\newcommand{\textRubikMB}{\rrhMB}
+\newcommand{\rrMBp}{\@rrp{MB}}
+\newcommand{\SquareMBp}{\@tlen\@SquareLetter{\rrMBp}\@tlen}
+\newcommand{\rrhMBp}{\raisebox{-0.25mm}{\SquareMBp}}
+\newcommand{\RubikMBp}{\raisebox{\@hRubik}{\SquareMBp}}
+\newcommand{\textRubikMBp}{\rrhMBp}
+\newcommand{\@rrT}[1]{{\@rubikfont T#1}}
+\newcommand{\@rrhT}[1]{\@join{\rrh#1}{w}}%
+\newcommand{\@textRubikT}[1]{\@rrT{#1}\,\@join{\rrh#1}{w}}
+\newcommand{\@RubikT}[1]{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%%
+\@join{\Square#1}{w}\\%
+\@rrT{#1}%%
+\end{minipage}%
+}}
+%%
+\newcommand{\@rrTp}[1]{{\@rubikfont T#1\@rubikprime}}
+\newcommand{\@rrhTp}[1]{\@join{\rrh#1}{wp}}%
+\newcommand{\@textRubikTp}[1]{\@rrTp{#1}\,\@join{\rrh#1}{wp}}
+%%
+\newcommand{\@RubikTp}[1]{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%%
+\@join{\Square#1}{wp}\\%
+\@rrTp{#1}%%
+\end{minipage}%
+}}
+\newcommand{\rrTL}{\@rrT{L}}% = rrLw
+\newcommand{\rrhTL}{\@rrhT{L}}
+\newcommand{\textRubikTL}{\@textRubikT{L}}
+\newcommand{\RubikTL}{\@RubikT{L}}
+\newcommand{\rrTLp}{\@rrTp{L}}
+\newcommand{\rrhTLp}{\@rrhTp{L}}
+\newcommand{\textRubikTLp}{\@textRubikTp{L}}
+\newcommand{\RubikTLp}{\@RubikTp{L}}
+\newcommand{\rrTR}{\@rrT{R}}
+\newcommand{\rrhTR}{\@rrhT{R}}
+\newcommand{\textRubikTR}{\@textRubikT{R}}
+\newcommand{\RubikTR}{\@RubikT{R}}
+\newcommand{\rrTRp}{\@rrTp{R}}
+\newcommand{\rrhTRp}{\@rrhTp{R}}
+\newcommand{\textRubikTRp}{\@textRubikTp{R}}
+\newcommand{\RubikTRp}{\@RubikTp{R}}
+\newcommand{\rrTU}{\@rrT{U}}
+\newcommand{\rrhTU}{\@rrhT{U}}
+\newcommand{\textRubikTU}{\@textRubikT{U}}
+\newcommand{\RubikTU}{\@RubikT{U}}
+\newcommand{\rrTUp}{\@rrTp{U}}
+\newcommand{\rrhTUp}{\@rrhTp{U}}
+\newcommand{\textRubikTUp}{\@textRubikTp{U}}
+\newcommand{\RubikTUp}{\@RubikTp{U}}
+\newcommand{\rrTD}{\@rrT{D}}
+\newcommand{\rrhTD}{\@rrhT{D}}
+\newcommand{\textRubikTD}{\@textRubikT{D}}
+\newcommand{\RubikTD}{\@RubikT{D}}
+\newcommand{\rrTDp}{\@rrTp{D}}
+\newcommand{\rrhTDp}{\@rrhTp{D}}
+\newcommand{\textRubikTDp}{\@textRubikTp{D}}
+\newcommand{\RubikTDp}{\@RubikTp{D}}
+\newcommand{\rrTF}{\@rrT{F}}
+\newcommand{\rrhTF}{\@rrhT{F}}
+\newcommand{\textRubikTF}{\@textRubikT{F}}
+\newcommand{\RubikTF}{\@RubikT{F}}
+\newcommand{\rrTFp}{\@rrTp{F}}
+\newcommand{\rrhTFp}{\@rrhTp{F}}
+\newcommand{\textRubikTFp}{\@textRubikTp{F}}
+\newcommand{\RubikTFp}{\@RubikTp{F}}
+\newcommand{\rrTB}{\@rrT{B}}
+\newcommand{\SquareTB}{\@tlen\@SquareLetter{\rrTB}\@tlen}
+\newcommand{\rrhTB}{\raisebox{-0.25mm}{\SquareTB}}
+\newcommand{\textRubikTB}{\rrhTB}
+\newcommand{\RubikTB}{\raisebox{\@hRubik}{\SquareTB}}
+\newcommand{\rrTBp}{\@rrTp{B}}
+\newcommand{\SquareTBp}{\@tlen\@SquareLetter{\rrTBp}\@tlen}
+\newcommand{\rrhTBp}{\raisebox{-0.25mm}{\SquareTBp}}
+\newcommand{\textRubikTBp}{\rrhTBp}
+\newcommand{\RubikTBp}{\raisebox{\@hRubik}{\SquareTBp}}
+\newcommand{\rrSR}{\@rr{SR}}
+\newcommand{\rrhSR}{\rrhRs}%
+\newcommand{\RubikSR}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareRs\\
+\rrSR%
+\end{minipage}%
+}}
+\newcommand{\textRubikSR}{\rrSR\,\rrhRs}
+\newcommand{\rrSRp}{\@rrp{SR}}
+\newcommand{\rrhSRp}{\rrhRsp}%
+\newcommand{\RubikSRp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareRsp\\
+\rrSRp%
+\end{minipage}%
+}}
+\newcommand{\textRubikSRp}{\rrSRp\,\rrhRsp}
+\newcommand{\rrSL}{\@rr{SL}}
+\newcommand{\rrhSL}{\rrhLs}%
+\newcommand{\RubikSL}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareLs\\
+\rrSL%
+\end{minipage}%
+}}
+\newcommand{\textRubikSL}{\rrSL\,\rrhLs}
+\newcommand{\rrSLp}{\@rrp{SL}}
+\newcommand{\rrhSLp}{\rrhLsp}%
+\newcommand{\RubikSLp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareLsp\\
+\rrSLp%
+\end{minipage}%
+}}
+\newcommand{\textRubikSLp}{\rrSLp\,\rrhLsp}
+\newcommand{\rrSU}{\@rr{SU}}
+\newcommand{\rrhSU}{\rrhUs}%
+\newcommand{\RubikSU}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareUs\\
+\rrSU%
+\end{minipage}%
+}}
+\newcommand{\textRubikSU}{\rrSU\,\rrhUs}
+\newcommand{\rrSUp}{\@rrp{SU}}
+\newcommand{\rrhSUp}{\rrhUsp}%
+\newcommand{\RubikSUp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareUsp\\
+\rrSUp%
+\end{minipage}%
+}}
+\newcommand{\textRubikSUp}{\rrSUp\,\rrhUsp}
+\newcommand{\rrSD}{\@rr{SD}}
+\newcommand{\rrhSD}{\rrhDs}%
+\newcommand{\RubikSD}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareDs\\
+\rrSD%
+\end{minipage}%
+}}
+\newcommand{\textRubikSD}{\rrSD\,\rrhDs}
+\newcommand{\rrSDp}{\@rrp{SD}}
+\newcommand{\rrhSDp}{\rrhDsp}%
+\newcommand{\RubikSDp}{%
+{\@rubikfont%
+\begin{minipage}{0.6cm}
+\centering%
+\SquareDsp\\
+\rrSDp%
+\end{minipage}%
+}}
+\newcommand{\textRubikSDp}{\rrSDp\,\rrhDsp}
+\newcommand{\rrSF}{\@rr{SF}}
+\newcommand{\SquareSF}{\@tlen\@SquareLetter{\rrSF}\@tlen}
+\newcommand{\rrhSF}{\raisebox{-0.25mm}{\SquareSF}}
+\newcommand{\RubikSF}{\raisebox{\@hRubik}{\SquareSF}}
+\newcommand{\textRubikSF}{\rrhSF}
+\newcommand{\rrSFp}{\@rrp{SF}}
+\newcommand{\SquareSFp}{\@tlen\@SquareLetter{\rrSFp}\@tlen}
+\newcommand{\rrhSFp}{\raisebox{-0.25mm}{\SquareSFp}}
+\newcommand{\RubikSFp}{\raisebox{\@hRubik}{\SquareSFp}}
+\newcommand{\textRubikSFp}{\rrhSFp}
+\newcommand{\rrSB}{\@rr{SB}}
+\newcommand{\SquareSB}{\@tlen\@SquareLetter{\rrSB}\@tlen}
+\newcommand{\rrhSB}{\raisebox{-0.25mm}{\SquareSB}}
+\newcommand{\RubikSB}{\raisebox{\@hRubik}{\SquareSB}}
+\newcommand{\textRubikSB}{\rrhSB}
+\newcommand{\rrSBp}{\@rrp{SB}}
+\newcommand{\SquareSBp}{\@tlen\@SquareLetter{\rrSBp}\@tlen}
+\newcommand{\rrhSBp}{\raisebox{-0.25mm}{\SquareSBp}}
+\newcommand{\RubikSBp}{\raisebox{\@hRubik}{\SquareSBp}}
+\newcommand{\textRubikSBp}{\rrhSBp}
+\newcommand{\textRubikx}{\rrhx}
+\newcommand{\textRubikxp}{\rrhxp}
+\newcommand{\textRubiky}{\rrhy}
+\newcommand{\textRubikyp}{\rrhyp}
+\newcommand{\textRubikz}{\rrhz}
+\newcommand{\textRubikzp}{\rrhzp}
+\newcommand{\textRubikl}{\rrhl}
+\newcommand{\textRubikr}{\rrhr}
+\newcommand{\textRubiku}{\rrhu}
+\newcommand{\textRubikd}{\rrhd}
+\newcommand{\textRubikf}{\rrhf}
+\newcommand{\textRubikb}{\rrhb}
+\newcommand{\textRubikLc}{\rrhLc}
+\newcommand{\textRubikLcp}{\rrhLcp}
+\newcommand{\textRubikRc}{\rrhRc}
+\newcommand{\textRubikRcp}{\rrhRcp}
+\newcommand{\textRubikUc}{\rrhUc}
+\newcommand{\textRubikUcp}{\rrhUcp}
+\newcommand{\textRubikDc}{\rrhDc}
+\newcommand{\textRubikDcp}{\rrhDcp}
+\newcommand{\textRubikFc}{\rrhFc}
+\newcommand{\textRubikFcp}{\rrhFcp}
+\newcommand{\textRubikBc}{\rrhBc}
+\newcommand{\textRubikBcp}{\rrhBcp}
+\newcommand{\textRubikCL}{\rrhCL}
+\newcommand{\textRubikCLp}{\rrhCLp}
+\newcommand{\textRubikCR}{\rrhCR}
+\newcommand{\textRubikCRp}{\rrhCRp}
+\newcommand{\textRubikCU}{\rrhCU}
+\newcommand{\textRubikCUp}{\rrhCUp}
+\newcommand{\textRubikCD}{\rrhCD}
+\newcommand{\textRubikCDp}{\rrhCDp}
+\newcommand{\textRubikCF}{\rrhCF}
+\newcommand{\textRubikCFp}{\rrhCFp}
+\newcommand{\textRubikCB}{\rrhCB}
+\newcommand{\textRubikCBp}{\rrhCBp}
\endinput
%%
%% End of file `rubikcube.sty'.
diff --git a/Master/texmf-dist/tex/latex/rubik/rubikpatterns.sty b/Master/texmf-dist/tex/latex/rubik/rubikpatterns.sty
new file mode 100644
index 00000000000..3415a93d29f
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/rubik/rubikpatterns.sty
@@ -0,0 +1,148 @@
+%%
+%% This is file `rubikpatterns.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% rubikpatterns.dtx (with options: `rubikpatterns')
+%%
+%% -----------------------------------------------------------------
+%% Authors: RWD Nickalls (dick@nickalls.org)
+%% and Apostolos Syropoulos (asyropoulos@yahoo.com)
+%%
+%% Copyright March 03, 2017 RWD Nickalls and A Syropoulos
+%%
+%% VERSION 4.0
+%%
+%% 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 is a LaTeX/TikZ package for drawing Rubik cubes
+%% Please report errors or suggestions for improvement to
+%%
+%% RWD Nickalls (dick@nickalls.org)
+%% Apostolos Syropoulos (asyropoulos@yahoo.com)
+%%
+%% This package requires the basic TikZ package to be loaded already
+%% ------------------------------------------------------------------
+%%% \CheckSum{187}
+%%% \CharacterTable
+%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+
+\def\RPfileversion{4.0}%
+\def\RPfiledate{2017/03/03}%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{rubikpatterns}[\RPfiledate\space (v\RPfileversion)]
+\newcommand{\rubikpatterns}{\textsc{rubikpatterns}}
+\newcommand{\Superflip}{[Superflip],Dp,R2,Fp,D2,F2,U2,Lp,R,Dp,R2,B,F,Rp,%
+U2,Lp,F2,Rp,U2,Rp,Up,<(20f*)>}%
+\newcommand{\superflip}{\Superflip}
+\newcommand{\PonsAsinorum}{[PonsAsinorum],F2,B2,R2,L2,U2,D2,<(12q*, 6f*)>}%
+\newcommand{\ponsasinorum}{\PonsAsinorum}%
+\newcommand{\CheckerboardsThree}%
+{[CheckerboardsThree],F,B2,Rp,D2,B,R,U,Dp,R,Lp,Dp,Fp,R2,D,F2,Bp,<(20q*, 16f*), order 3>}%
+\newcommand{\checkerboardsthree}{\CheckerboardsThree}%
+\newcommand{\CheckerboardsSix}%
+{[CheckerboardsSix],R2,L2,U,B,L2,Dp,F,B2,R,Lp,Fp,B,R,D,F2,Lp,Up,<(17f*, 22q), order 6>}%
+\newcommand{\checkerboardssix}{\CheckerboardsSix}%
+\newcommand{\Stripes}{[Stripes],F,U,F,R,L2,B,Dp,R,D2,L,Dp,B,R2,L,F,U,F,<(20q*, 17f*)>}%
+\newcommand{\stripes}{\Stripes}%
+\newcommand{\CubeInCube}{[CubeInCube],F,L,F,Up,R,U,F2,L2,Up,Lp,B,Dp,Bp,L2,U,<(18q*, 15f*)>}%
+\newcommand{\cubeincube}{\CubeInCube}%
+\newcommand{\CubeInCubeInCube}%
+{[CubeInCubeInCube],Fp,U,Bp,Rp,U,F2,U2,Fp,Up,F,U2,D,Bp,Dp,R2,B2,Up,<(17f*, 22q)>}%
+\newcommand{\cubeincubeincube}{\CubeInCubeInCube}%
+\newcommand{\ChristmasCross}{[ChristmansCross],U,F,Bp,L2,U2,L2,Fp,B,U2,L2,U,<(16q*, 11f*)>}%
+\newcommand{\christmascross}{\ChristmansCross}%
+\newcommand{\PlummersCross}%
+{[PlummersCross],R2,Lp,D,F2,Rp,Dp,Rp,L,Up,D,R,D,B2,Rp,U,D2,<(20q*, 16f*)>}%
+\newcommand{\plummerscross}{\PlummersCross}%
+\newcommand{\Anaconda}{[Anaconda],L,U,Bp,Up,R,Lp,B,Rp,F,Bp,D,R,Dp,Fp,<(14q*, 14f*)>}%
+\newcommand{\anaconda}{\Anaconda}%
+\newcommand{\Python}{[Python],F2,Rp,Bp,U,Rp,L,Fp,L,Fp,B,Dp,R,B,L2,<(16q*, 14f*)>}%
+\newcommand{\python}{\Python}%
+\newcommand{\BlackMamba}{[BlackMamba],R,D,L,Fp,R,Lp,D,Rp,U,Dp,B,Up,Rp,Dp,<(14q*, 14f*)>}%
+\newcommand{\blackmamba}{\BlackMamba}%
+\newcommand{\GreenMamba}{[GreenMamba],R,D,R,F,Rp,Fp,B,D,Rp,Up,Bp,U,D2,<(14q*, 13f*)>}%
+\newcommand{\greenmamba}{\GreenMamba}%
+\newcommand{\FemaleRattlesnake}%
+{[FemaleRattlesnake],U2,Dp,L2,D,B,U,Bp,Rp,L2,U2,F,Up,F,R,<(18q*, 14f*)>}%
+\newcommand{\femalerattlesnake}{\FemaleRattlesnake}%
+\newcommand{\MaleRattlesnake}%
+{[MaleRattlesnake],Rp,Fp,U,Fp,U2,R,L2,B,Up,Bp,Dp,L2,U2,D,<(18q*, 14f*)>}%
+\newcommand{\malerattlesnake}{\MaleRattlesnake}%
+\newcommand{\FemaleBoa}{[FemaleBoa],R,Up,R2,U2,F,D2,R2,Up,Dp,R,Dp,Fp,<(16q*, 12f*)>}%
+\newcommand{\femaleboa}{\FemaleBoa}%
+\newcommand{\MaleBoa}{[MaleBoa],F,D,Rp,U,D,R2,D2,Fp,U2,R2,U,Rp,<(16q*, 12f*)>}%
+\newcommand{\maleboa}{\MaleBoa}%
+\newcommand{\FourSpot}{[FourSpot],F2,B2,U,Dp,R2,L2,U,Dp,<(12q*, 8f*)>}%
+\newcommand{\fourspot}{\FourSpot}%
+\newcommand{\SixSpot}{[SixSpot],U,Dp,R,Lp,F,Bp,U,Dp,<(8q*, 8f*)>}%
+\newcommand{\sixspot}{\SixSpot}%
+\newcommand{\OrthogonalBars}%
+{[OrthogonalBars],F,Rp,U,L,Fp,Lp,F,Up,R,U,Lp,Up,L,Fp,<(14q*, 14f*)>}%
+\newcommand{\orthogonalbars}{\OrthogonalBars}%
+\newcommand{\SixTs}{[SixTs],F2,R2,U2,Fp,B,D2,L2,F,B,<(14q*, 9f*)>}%
+\newcommand{\sixts}{\SixTs}%
+\newcommand{\SixTwoOne}{[SixTwoOne],U,B2,D2,L,Bp,Lp,Up,Lp,B,D2,B2,<(15q*, 11f*)>}%
+\newcommand{\sixtwoone}{\SixTwoOne}%
+\newcommand{\ExchangedPeaks}%
+{[ExchangedPeaks],F2,R2,D,R2,U,D,F2,Dp,Rp,Dp,F,L2,Fp,D,R,Up,<(16f*, 21q)>}%
+\newcommand{\exchangedpeaks}{\ExchangedPeaks}%
+\newcommand{\TwoTwistedPeaks}%
+{[TwoTwistedPeaks],F,D2,B,R,Bp,Lp,F,Dp,L2,F2,R,Fp,Rp,F2,Lp,Fp,<(16f*, 20q)>}%
+\newcommand{\twotwistedpeaks}{\TwoTwistedPeaks}%
+\newcommand{\FourTwistedPeaks}%
+{[FourTwistedPeaks],Up,D,B,Rp,F,R,Bp,Lp,Fp,B,L,F,Rp,Bp,R,Fp,Up,D,<(18q*, 18f*)>}%
+\newcommand{\fourtwistedpeaks}{\FourTwistedPeaks}%
+\newcommand{\ExchangedChickenFeet}%
+{[ExchangedChickenFeet],F,Lp,Dp,Bp,L,F,U,Fp,Dp,F,L2,Bp,Rp,U,L2,Dp,F,<(19q*, 17f*)>}%
+\newcommand{\exchangedchickenfeet}{\ExchangedChickenFeet}%
+\newcommand{\TwistedChickenFeet}%
+{[TwistedChickenFeet],F,Lp,D,Fp,Up,B,U,F,Up,F,Rp,F2,L,Up,Rp,D2,<(18q*, 16f*)>}%
+\newcommand{\twistedchickenfeet}{\TwistedChickenFeet}%
+\newcommand{\ExchangedRings}%
+{[ExchangedRings],F,U,Dp,Lp,B2,L,Up,D,F,U,R2,L2,Up,L2,F2,<(15f*, 20q)>}%
+\newcommand{\exchangedrings}{\ExchangedRings}%
+\newcommand{\TwistedRings}%
+{[TwistedRings],F,D,Fp,D2,Lp,Bp,U,L,D,R,U,Lp,Fp,U,L,U2,<(18q*, 16f*)>}%
+\newcommand{\twistedrings}{\TwistedRings}%
+\newcommand{\EdgeHexagonTwo}%
+{[EdgeHexagonTwo],U,B2,Up,Fp,Up,D,Lp,D2,L,U,Dp,F,Dp,L2,B2,Dp,<(20q*, 16f*) order2>}%
+\newcommand{\edgehexagontwo}{\EdgeHexagonTwo}%
+\newcommand{\EdgeHexagonThree}%
+{[EdgeHexagonThree],F,L,B,U,L,F2,B2,Rp,F2,B2,Up,Bp,Lp,Fp,<(14f*, 18q) order 3>}%
+\newcommand{\edgehexagonthree}{\EdgeHexagonThree}%
+\newcommand{\TomParksPattern}%
+{[TomParksPattern],L,U,F2,R,Lp,U2,Bp,U,D,B2,L,F,Bp,Rp,L,Fp,R,<(20q*, 17f*)>}%
+\newcommand{\tomparkspattern}{\TomParksPattern}%
+\newcommand{\RonsCubeInCube}%
+{[RonsCubeInCube],L2,D2,Lp,D2,B2,L2,B2,Lp,D2,L2,B2,Lp,B2,<(13f*, 23q)>}%
+\newcommand{\ronscubeincube}{\RonsCubeInCube}%
+\newcommand{\TwistedDuckFeet}%
+{[TwistedDuckFeet],F,Rp,B,R,U,Fp,Lp,Fp,U2,Lp,Up,D2,B,Dp,F,Bp,U2,<(20q*, 17f*)>}%
+\newcommand{\twistedduckfeet}{\TwistedDuckFeet}%
+\newcommand{\ExchangedDuckFeet}%
+{[ExchangedDuckFeet],U,F,R2,Fp,Dp,R,U,B2,U2,Fp,R2,F,D,B2,R,Bp,<(21q*, 16f*)>}%
+\newcommand{\exchangedduckfeet}{\ExchangedDuckFeet}%
+\endinput
+%%
+%% End of file `rubikpatterns.sty'.
diff --git a/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty b/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty
index 6a8e25d6561..6c3a06347aa 100644
--- a/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty
+++ b/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty
@@ -10,8 +10,9 @@
%% Authors: RWD Nickalls (dick@nickalls.org)
%% and Apostolos Syropoulos (asyropoulos@yahoo.com)
%%
-%% Copyright 25 September 2015 RWD Nickalls and A Syropoulos
+%% Copyright 03 March 2017 RWD Nickalls and A Syropoulos
%%
+%% VERSION 4.0
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
@@ -30,6 +31,7 @@
%% This package requires the basic TikZ package to be loaded already
%% ------------------------------------------------------------------
+%%% \CheckSum{322}
%%% \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
@@ -46,9 +48,8 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
-
-\def\RRfileversion{3.0}%
-\def\RRfiledate{2015/09/25}%
+\def\RRfileversion{4.0}%
+\def\RRfiledate{2017/03/03}%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rubikrotation}[\RRfiledate\space (v\RRfileversion)]
\@ifpackageloaded{rubikcube}{}{%
@@ -58,6 +59,15 @@
\typeout{---rubikrotation requires the fancyvrb package%
for VerbatimInput{} command.}%
\RequirePackage{fancyvrb}}
+\@ifpackageloaded{ifluatex}{}{%
+ \typeout{---rubikrotation requires the ifluatex package.}%
+ \RequirePackage{ifluatex}}
+\ifluatex%
+ \@ifpackageloaded{shellesc}{}{%
+ \typeout{---rubikrotation requires the shellesc package
+ to run using Lua\LaTeX.}%
+ \RequirePackage{shellesc}}
+\fi%
\newcommand{\rubikrotation}{\textsc{rubikrotation}}
\newcommand{\Rubikrotation}{\textsc{Rubikrotation}}
\newcommand{\@print}[1]{\immediate\write\outfile{#1}}
@@ -81,7 +91,7 @@
\newwrite\outfile%
\immediate\openout\outfile=rubikstateERRORS.dat%
\@print{\@comment rubikstateERRORS.dat}%
-\@print{\@comment ---(RR.sty v\RRfileversion): comments output by Perl script}%
+\@print{\@comment --------------------}%
\immediate\closeout\outfile%
\typeout{---setting up newwrite for rubikrotation.sty to use...}%
\newwrite\outfile%
@@ -134,8 +144,9 @@
\next
}
\newcommand{\RubikRotation}[2][1]{%
+ \typeout{---TeX process (rubikrotation.sty)-------}%
\typeout{---NEW rotation command------------------}%
- \typeout{---command = RubikRotation{#1}}%
+ \typeout{---command = RubikRotation[#1]{#2}}%
\typeout{---writing current Rubik state to file rubikstate.dat}%
\@openstatefile% open data file
\@print{\@comment filename: rubikstate.dat}%
@@ -147,9 +158,9 @@
\@countingloop{\ourRRcounter} in 1:{#1}{%
\immediate\write\outfile{rotation,#2}}%
\@closestatefile% close data file
- \typeout{---running Perl script (rubikrotation)}%
+ \typeout{---CALLing Perl script (rubikrotation.pl)}%
\immediate\write18{\rubikperlcmd}%
- \typeout{---inputting NEW datafile (written by Perl script)}%
+ \typeout{---inputting NEW datafile (data written by Perl script)}%
\input{rubikstateNEW.dat}%
\typeout{-----------------------------------------}%
}
@@ -157,6 +168,7 @@
\typeout{---ShowRubikErrors: inputting file rubikstateERRORS.dat}%
\VerbatimInput{rubikstateERRORS.dat}%
}
+\newcommand{\ShowErrors}{\ShowRubikErrors}
\newcommand{\CheckRubikState}{%
\typeout{---NEW check command------------------}%
\typeout{---command = CheckRubikState}%
@@ -165,9 +177,9 @@
\@print{\@comment filename: rubikstate.dat}%
\@printrubikstate%
\@closestatefile% close data file
- \typeout{---running Perl script (rubikrotation)}%
+ \typeout{---running Perl script (rubikrotation.pl)}%
\immediate\write18{\rubikperlcmd}%
- \typeout{---inputting NEW datafile (written by Perl script)}%
+ \typeout{---inputting NEW datafile (data written by Perl script)}%
\input{rubikstateNEW.dat}%
\typeout{-----------------------------------------}%
}