diff options
30 files changed, 8926 insertions, 2944 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl b/Build/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl index 05e69ef0049..d9b02d5a473 100755 --- a/Build/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl +++ b/Build/source/texk/texlive/linked_scripts/rubik/rubikrotation.pl @@ -4,71 +4,119 @@ use Fatal; use warnings; ## - our $version = "v4.0 (03 March 2017)"; + our $version = "v5.0 (25 February 2018)"; ## ## rubikrotation.pl - ## VERSION 4.0 + ## VERSION 5.0 ## - ## Copyright 03 March 2017, + ## Copyright February 2018, ## RWD Nickalls (dick@nickalls.org) ## A Syropoulos (asyropoulos@yahoo.com) ## + ## HISTORY + ##------------------------------- + ## v5.0 (25 February 2018) ##------------------------------- - ## 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.2h (07 February 2018) + ## --- adjusted the no of leading dots for the gprint command + ## when writing the up, down,.. colour state to the log file + ## so as to make the array form a square block (ie easier to read) + ## (in MAIN) ## - ## 4) v3.2c: added new commands: - ## \RotationSequenceName{} - ## \RotationSequenceClean{} + ## 4.2g + ## --- 29 October 2017 added syntax checking for (( )) /inside/ squarebrackets + ## (in SUB checksyntax) + ## --- 24 October 2017 changed {};--> (), in SequenceNameNew (in SUB writestate) + ## this repairs these chars back to their original state. + ## --- 22 October 2017 minor adjustments to syntax checking (in SUB checksyntax) + ## to allow some extra chars in the [name] and <info> blocks. + ## Ideally, we want to be able to use /any/ chars inside these infoblocks. ## - ## 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 + ## 4.2f + ## --- 05 Oct 2017 bugfix: added a ShowSequence [\space] bug fix in SUB checksyntax + ## --- 04 Oct 2017 adjusted brackets < > error messages (lines 2643--2659) + ## + ## 4.2e: (29 Sept 2017) + ## --- added a ``Western'' notation filter (provisional \& works) + ## + ## 4.2d: (10 August 2017) + ## --- placed a checkstate() command inside the rotation keyword + ## and stopped TEX writing the keyword checkstate to the rubikstate.dat file + ## + ## 4.2c: (2 August 2017) + ## --- added new rubikkeyword "cubesize" to hold cube size (three or two) + ## so we can tell which sort of cube is being processed + ## We can use this to detect when using the TwoRotation command + ## (for the TWOcube) vs when using the RubikRotation command + ## (for the THREEcube); for eample with regard to random rotations + ## (see random SUB; see RubikTwoCube.sty) + ## + ## 4.2b: (1 Aug 2017) + ## --- Removed the random,0 option --> n=50 (random SUB) + ## a zero or missing integer now generates an error message. ## - ## 6) v3.2e:(25 Sept 2016) + ## 4.2a: (28 July 2017) + ## --- bugfix: error if spaces in RubikRotation{random,n} string from LaTeX. + ## Fixed to accommodate spaces, and uppercase random (lines 366 -- 388 approx) + ## + ##------------------------------- + ## v4.0 (3 March 2017) + ##------------------------------- + ## changes in v3.6 (January 2017) + ## --- included Jaap Rm and Rc notation + ## --- new sub for improved expansion of mod-4 multiples of rotations (Oct 2016) + ## --- restructured to facilitate processing arrays through the rotation sub + ## --- included option for an <info> block + ## --- included Randelshofer superset ENG 3x3 notation + ## --- implemented an `inverse' mode + ## --- improved syntax checking + ## --- used perltidy to polish the program layout + ## (but only when making the pdf documentation-- see file rubikrotationPL.pdf) + ## --- included a lot of new subroutines + ##-------------------------------- + ## changes in v3.2: + ## v3.2h: (2 Oct 2016) + ## improved the mod 4 routine using SUB rubikmod() + ## improved comments to log file re: rotation processing + ## + ## 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 + ## 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 ## + ## v3.2c: added new commands: + ## \RotationSequenceName{} + ## \RotationSequenceClean{} + ## + ## v3.2a: added a \RubikSeqNEW{...} output line in the output file + ## to facilitate typesetting the rotation sequence (works OK just now) + ## + ## v3.2: --- added leading ... to the comments written by the <writestate> sub + ## (the ... code indicates that comments are written by the Perl script) + ## --- changed the word program, prog --> script ##-------------------------------- - ## 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 v3.0: + ## --- accepts command-line arguments for input (mandatory) and output (optional) filenames + ## default output filename is: rubikOUT.txt + ## --- included the symbols [ and ] to denote a rotation-name label (ie as well as *) + ## --- 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.3: + ## --- accepts a single commandline argument (datafilename) + ## --- 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 + ## changes in v2.2: + ## --- changed licence --> LatexPP + ## --- included random n errors in ERROR messages (lines 492--495) + ## --- included version number in error message ##------------------------------ # # This file is part of the LaTeX rubikrotation package, and @@ -98,16 +146,16 @@ ## three associated with each XYZ axis. ##---------------------------------------------------------------------- - ##------------------ MAIN -------------------------- - + ##==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), + ## reads in the rubik state data file =rubikstate.dat (written by rubikrotation.sty), ## 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'') + ## Each line of the input file (rubikstate.dat) is a comma separated list of arguments. + ## The first argument in each line of the file rubikstate.dat is a rubikkeyword. + ## ##--------------- ## set autoflush for outputs ## $|=1; @@ -198,11 +246,12 @@ our $erroralert = ""; # error flag our $errornumber = 0; #set number of errors to zero - gprint ("...reading the current rubik state (from File: $source_file)"); + gprint ("...reading the current cube state (from File: $source_file)"); our $dataline = ""; our $newdataline =""; our $rubikkeyword = ""; + our $cubesize = ""; ## to hold the size, as three (Rubik) or two (twocube) our $rotationcommand = ""; our @data=(); @@ -215,6 +264,10 @@ our $SequenceLong=""; our $SequenceInfo=""; + + our $jrcode = 0; ## We initialise a loop counter for use in the rotation sub + ## (see line 624) + #---------inverse mode------------ # a keyword INVERSE or inverse in an infoblock <..> # FLAG is set (line 400) in response to detecting an infloblock. @@ -238,9 +291,10 @@ $dataline = $_; # grab the whole line as a string chomp $dataline; # remove the line-ending character - ## now we can clean whitespace + ## clean leading and trailing whitespace $dataline = cleanstring($dataline); - + + #check syntax of the string $rotationcommand=$dataline; ## needed for error messages CheckSyntax($dataline); @@ -252,24 +306,47 @@ #------------------------- ## we have 10 fields (0--9) - ## check for rubikkeyword= up,down,left,right,front,back,checkstate,rotation: + ## check for rubikkeyword= cubesize, up,down,left,right,front,back,checkstate,rotation: $rubikkeyword=$data[0]; - if ($rubikkeyword eq 'up') { gprint ("...$dataline"); + ##-------------------------------- + ## RWDN 2 August 2017 + ## introduced keyword cubesize so prog can distinguish + ## between a TWOcube and an THREEcube. + ## Here we check for the rubikkeyword `cubesize' + ## cubesize is currently only being used to change the array size in random SUB + if ($rubikkeyword eq 'cubesize') { + gprint ("..."); + $rotationcommand=$dataline; ## used in output message + gprint ("...command = $rotationcommand"); + $cubesize = RemoveAllSpaces($data[1]); + if ($cubesize eq "two") {gprint ("...cube = TWOcube")}; + if ($cubesize eq "three") {gprint ("...cube = THREEcube")}; + gprint ("..."); + next LINE ; + }; + ## ------------------------------------ + + ## RWDN 7 February 2018 + ## we vary the number of leading dots for the gprint command + ## so as to make the array of colour codes (X,W,Y, etc) form + ## a nice square when printed to the log file (the standard no is 3 dots) + + 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]; next LINE; }; - if ($rubikkeyword eq 'down') { gprint ("...$dataline"); + 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]; next LINE; }; - if ($rubikkeyword eq 'left') { gprint ("...$dataline"); + 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]; @@ -290,7 +367,7 @@ next LINE; }; - if ($rubikkeyword eq 'back') { gprint ("...$dataline"); + 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]; @@ -302,7 +379,7 @@ if ($rubikkeyword eq 'checkstate') { gprint ("..."); $rotationcommand=$dataline; ## used in output message - gprint ("...command=$rotationcommand"); + gprint ("...command = $rotationcommand"); checkstate(); next LINE ; }; @@ -314,18 +391,26 @@ ## ELSE it must be a rotation sequence --> send elements to rotation sub. - #------------------------ - if ($rubikkeyword eq 'rotation') - { - gprint ("..."); + if ($rubikkeyword eq 'rotation') + + { ## this IF runs down to near end of MAIN + + ##RWDN 10 Aug 2017 + ## moved checkstate to be inside rotation (so a next LINE will terminate prog) + gprint ("..."); + gprint ("...rotation keyword"); + checkstate(); + + + gprint ("..."); ## logfile marker for begining of `rotation/random' process # 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"); - + gprint ("...command = $rotationcommand"); + # need to check that a second argument exists (else --> ErrorMessage). # ---should be either `random', # ---or a macroname for a rotation sequence, @@ -341,30 +426,72 @@ - ##-----random----------------- - ## if second argument = random, + ##---------keyword = random----------------- + ## (command used for scrambling the cube) + ## if second argument in $dataline = 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/) { - ## 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 + ## if so send integer --> random sub. + + ##---------------------------- + ## (28 July 2017: RWDN) : bugfix: + ## better syntax checking required for the <random,n> command + ## as spaces before or after commas caused errors. + ##----------------------------- + + + ## allow upper and lowercase keyword random + if ( lc( $data[1] ) =~ m/random/ ) + { + ## the string contains the keyword random + + ## now check for missing comma after the keyword + if ( lc( RemoveAllSpaces($data[1]) ) ne "random" ) + {## error, ? missing comma + ErrorMessage("[$data[1]] --- missing comma after `random' "); + next LINE; + }; + + ## now check for the trailing integer + + if ( ( lc( RemoveAllSpaces($data[1]) ) eq "random") and ($data[2] eq "") ) + { + ## missing integer + ErrorMessage("[$data[2]] --- missing integer after `random,'"); + next LINE; + }; + + + if (RemoveAllSpaces($data[2]) =~ /\D/) + { + ## Note that the \D operator sees , 23, as a word not an integer. + ## so if true then cannot be a number (D matches word and space elements) + ErrorMessage("[$data[2]] --- this is not an integer"); next LINE; - } - else{ - ## the next argument is an integer (n), so we do n random rotations - random($data[2]); - next LINE; - }; - } ## end of IF - #--------------- + } + else {## string consists of one or more integers + ## check to see if more than one integer exists + ## by seeing if the string changes if we remove all the spaces + ## (note we have to use a string with the m operator) + my $RAS = RemoveAllSpaces($data[2]); + if ($data[2] =~ m/$RAS/ ) + { + ## OK so this must be a single integer + ## so we can now do n random rotations + ## by sending the integer to the random SUB + random($data[2]); + next LINE; + } + else {## there must be spaces separating several integers; + ErrorMessage("[$data[2]] --- only one integer allowed"); + next LINE; + }; + }; ## end of else + } ## end of IF + ##----------------------------------------------------------- else { - # -----rotation sequence--------- - # the line must be a rotation sequence line, so send the sequence + ## -----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 @@ -372,17 +499,36 @@ # 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 + #----<infoblocks>--------------------------- + + # infoblocks are strings bounded by angle brackets <..> + # and are designed for holding metadata. + # + # Multiple comma separated infoblocks are allowed (but NOT nested). + # All infoblocks are eventually concaternated into a colon separated string, and + # returned into the OUT file (= rubikstateNEW.dat) as the macro \SequenceInfo. + # + # We process and then remove any infoblocks which exist. + # infoblocks are chars delimited by <...> + # + # The SUB infoblockcolon replaces any commas with a colon (so as to + # facilitate string manipulation, and allows us to distinguish between + # a string and a data array), and returns a new string (= $newdataline). + # + # The RubikRotation argument allows <infoblocks> for carrying special + # keywords, eg <inverse> which can be used to influence the process. # If several infoblocks exist, then we collect the contents into # variable SequenceInfo, and separate them with a colon; + # + # The SUB cutinfoblock returns TWO strings: + # (1) the name of the new revised string = newdataline, (with infoblocks removed) + # (2) the contents of the infoblock = $SequenceInfo + infoblockcolon($dataline); + + ## rename the returned newdataline string to dataline + ## and reinitialise the string newdataline so it can be used again. $dataline=$newdataline; $newdataline=""; ## reset the variable @@ -393,28 +539,42 @@ ## 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; + cutinfoblock($dataline); + # best to use the whole word <inverse> to avoid errors + # best to force lowercase so users can type the word as they want + + if ( lc($SequenceInfo) =~ m/(inverse)/) { + ## set a FLAG + $directionflag=$inverse; print " FLAG set to = $inverse\n"; }; - # append each infoblock to an array - push @seq, $SequenceInfo; - $dataline = $newdataline; + # 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); + - #---------------------------------- + #--------repeat blocks-------------------------- + ## there are now no more infoblocks, so we now look for repeat-blocks. + ## these are embedded inside the rotation sequence - ## reformulate any repeat blocks (,) --> {;} if they exist + ## we first 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. + ## so we look for curved brackets ie indicating a repeat block, and + ## if we find a ( we then send the dataline to the SUB fixrepeatelement() + ## the SUB fixrepeatelement() then returns the new revised dataline string + ## containing the FIRST repeat block which has been expanded. + ## If there is another ( then we repeat the procedure until all + ## repeat blocks have been expanded, and incorporated into the mail rotation string. + while ( (index $dataline, '(') !=-1 ){ fixrepeatelement ($dataline); $dataline=$newdataline; @@ -422,7 +582,8 @@ }; ## rename remaining dataline string as SequenceShortBrace - ## since if there are any repeat blocks, they are now reformulated with braces + ## since if there are any repeat blocks, they are now reformulated with braces and semicolons + ## ie (,) --> {;} etc $SequenceShortBrace=$dataline; @@ -450,16 +611,18 @@ #-----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. + # since the `rotating' keyword has been removed from the string, + # we can replace (repair to original state) any braces or or semicolons + # around repeat strings (if exist) and then rename it as SequenceShort + # which we will output at the end (in SUB writestate). + if ( (index $SequenceShortBrace, '{') !=-1 ) { - print " repairing braces--> ()\n"; + print " repairing braces and semicolon--> ()\n"; ## swap: BBook p 138--139 - $SequenceShortBrace =~ tr/\{/(/; # swap , --> ; - $SequenceShortBrace =~ tr/\}/)/; # swap ( --> { - $SequenceShortBrace =~ tr/;/,/; # swap ) --> } + $SequenceShortBrace =~ tr/\{/(/; # swap { --> ( + $SequenceShortBrace =~ tr/\}/)/; # swap } --> ) + $SequenceShortBrace =~ tr/;/,/; # swap ; --> , }; #rename to SequenceShort @@ -474,12 +637,8 @@ 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. @@ -511,7 +670,7 @@ }; } # end of else - }; # end of IF (rotation keyword) + }; # end of IF ( re: rotation keyword) #---------------------------------------------- ## place any new keywords for processing here @@ -574,19 +733,27 @@ print " SUB rotation\n"; ## grab a copy of the element (char) for use if m Mod4=0 $originalrcode=$rcode; - - ## increment the loop counter (initialised in MAIN) + + + ## increment the LOOP counter + ## (initialised using <our> in MAIN = line 226) + ## for use in the rotation SUB. + ## This counter is used to identify the first element (rcode) + ## and used to grab [name] --> SequenceName. $jrcode=$jrcode+1; ## increment rotation element (char) counter - ## ---------------------------------- + ## -----check for [nameblocks]----------------------------- + ## ## 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 + ## 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? + ## BUT if trailing comma is missing, then (error as next rotation will be included + ## as part of the label) so need to trap this and + ## make the test: is first AND last char a sq bracket? + ## (strictly only need to look at /first/ char, as the early syntax check will have + ## detected any unbalanced brackets already) if ( (substr ($rcode,0,1) =~ /\[/) and (substr ($rcode,-1) ) =~ /\]/) { @@ -594,24 +761,28 @@ print " SUB rotation\n"; if ($directionflag eq $inverse) { # do nothing - } + } else{ - ## if this `label' is also the FIRST element, then label = name + ## if this `label' is also the FIRST element, then label = nameblock if ($jrcode ==1) {$SequenceName=$rcode}; }; # end of IF - ## now get next rotation element - next; - }; ## 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. + ##-------check for (repeatblocks)--------------------------------- + ## + ## we have already replaced any repeat chars (,) with {;} + ## so we now check for elements with leading { and then expand them + ## the appropriate number of times. + ## Note that the actual expansion is done by SUB repeat() ## Note that if there is NO comma before the {} of a {repeat block}, then ## the true repeat block will not be recognised by the @@ -743,6 +914,32 @@ print " SUB rotation\n"; ## ie will not be in the following list, and hence will be trapped as an error, eg R3) + +##----------------------- +## RWDN Sept29 2017 testing to fix WESTERN notation problem +## arrange for user to be able to include <western> in metadata etc +## -- as this will mean that one can store these algorithms as a macro + + if ( lc($SequenceInfo) =~ m/(western)/ ) { + + if ($rcode eq "l") {$rcode = "Lw"; gprint ("...WESTERN NOTATION: rotation l --> Lw, OK") }; + if ($rcode eq "lp") {$rcode = "Lwp"; gprint ("...WESTERN NOTATION: rotation lp --> Lwp, OK") }; + if ($rcode eq "r") {$rcode = "Rw"; gprint ("...WESTERN NOTATION: rotation r --> Rw, OK") }; + if ($rcode eq "rp") {$rcode = "Rwp"; gprint ("...WESTERN NOTATION: rotation rp --> Rwp, OK") }; + if ($rcode eq "f") {$rcode = "Fw"; gprint ("...WESTERN NOTATION: rotation f --> Fw, OK") }; + if ($rcode eq "fp") {$rcode = "Fwp"; gprint ("...WESTERN NOTATION: rotation fp --> Fwp, OK") }; + if ($rcode eq "b") {$rcode = "Bw"; gprint ("...WESTERN NOTATION: rotation b --> Bw, OK") }; + if ($rcode eq "bp") {$rcode = "Bwp"; gprint ("...WESTERN NOTATION: rotation bp --> Bwp, OK") }; + if ($rcode eq "u") {$rcode = "Uw"; gprint ("...WESTERN NOTATION: rotation u --> Uw, OK") }; + if ($rcode eq "up") {$rcode = "Uwp"; gprint ("...WESTERN NOTATION: rotation up --> Uwp, OK") }; + if ($rcode eq "d") {$rcode = "Dw"; gprint ("...WESTERN NOTATION: rotation d --> Dw, OK") }; + if ($rcode eq "dp") {$rcode = "Dwp"; gprint ("...WESTERN NOTATION: rotation dp --> Dwp, OK") }; + + }; +##----------------------- + + + 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}} @@ -889,17 +1086,17 @@ print " SUB rotation\n"; ## 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") + elsif ($rcode eq "X" or $rcode eq "x" or $rcode eq "r" or $rcode eq "lp") {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") + elsif ($rcode eq "Xp" or $rcode eq "xp" or $rcode eq "l" or $rcode eq "rp") {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") + elsif ($rcode eq "Y" or $rcode eq "y" or $rcode eq "u" or $rcode eq "dp") {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") + elsif ($rcode eq "Yp" or $rcode eq "yp" or $rcode eq "d" or $rcode eq "up") {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") + elsif ($rcode eq "Z" or $rcode eq "z" or $rcode eq "f" or $rcode eq "bp") {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") + elsif ($rcode eq "Zp" or $rcode eq "zp" or $rcode eq "b" or $rcode eq "fp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= zp = Fp + Sfp + B)");&rrFp;&rrSfp;&rrB}} ## more whole cube notation @@ -955,16 +1152,14 @@ print " SUB rotation\n"; 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"); + ## DO NOT --> (next LINE;) here as need to check /all/ the rotation codes in the string. } else{ gprint ("..*rotation $rcode ERROR -- code not known ? typo or missing comma"); ErrorMessage("$originalrcode -- code not known ? typo or missing comma"); + ## DO NOT --> (next LINE;) here as need to check /all/ the rotation codes in the string. }; - # missing comma after random is a common error - if ($originalrcode =~ m/random/i ) { - ErrorMessage("$originalrcode -- ? missing comma after random"); - }; #----------------------------- next; }; #end of else @@ -980,6 +1175,7 @@ print " SUB rotation\n"; 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 @@ -988,22 +1184,48 @@ print " SUB random\n"; ## 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. +## but here I have included all the slice (Xm) ones as well. + + + ## initialise the array for the random rotations + my @rrlist = (); -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"); + ## (RWDN 2 Aug 2017): + ## now check to see if TWOcube or Rubikcube being used + ## use cubesize as the filter + + if ($cubesize eq 'two') + { + ## using the TwoRotation command (from RubikTwoCube.sty) + ## no slice rotations + ## + @rrlist = ("U", "Up", + "D", "Dp", + "L", "Lp", + "R", "Rp", + "F", "Fp", + "B", "Bp"); + } + + else { + ## using the RubikRotation command (from RubikRotation.sty) + @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"; + gprint ("...random SUB: rrlistnumber (array size) = $rrlistnumber"); # these are numbered 0--$rrlistnumber, ## let default no of random rotations for scrambling = 50 -my $defaultn = 50; +my $defaultn = 50; ## RWDN (1 Aug 2017): not being used any more my $maxn = 200; ## grab the integer passed from the random() command in main @@ -1011,16 +1233,18 @@ my $maxn = 200; 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)")}; + ErrorMessage ("random: max n = 200 (n=200 was used)")} + elsif ($s == 0) {## $s = $defaultn; + gprint ("..*ERR: integer n = 0 (invalid)"); + ErrorMessage (" --- integer n = 0 (invalid)"); + next LINE; + }; my @rr; ## array to hold all the random rotations print " randomising the available rotations\n"; - ## set the seed for the randomisation (BlackBook p 235) + ## set the seed for the randomisation (Perl BlackBook p 235) srand; ## now select s numbers at random (with replacement) from range 0--listnumber+1 @@ -1040,7 +1264,7 @@ 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"); + gprint ("...scrambling cube using $s random rotations"); ## now send the array off to the rotation sub @@ -1061,7 +1285,7 @@ print " SUB writestate\n"; 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 "\\typeout{...writing new cube 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"); @@ -1109,7 +1333,16 @@ if ($numberofcharsinstring <= 2) $SequenceNameNew = substr($SequenceName,1,$nmiddlecharsinstring); }; - + ## RWDN 24 October 2017 + ## swap char changes back before writing output string + ## only swap the brackets + ## (do NOT swap ; --> , as ONLY use commas /outside/ infoblocks and between rotation sequences) + ## swap: BBook p 138--139 + + $SequenceNameNew =~ tr/\{/(/; # swap { --> ( + $SequenceNameNew =~ tr/\}/)/; # swap } --> ) + + print (TeX_OUT_FILE "\\renewcommand\\SequenceName\{$SequenceNameNew\}\%\n"); print (TeX_OUT_FILE "\\typeout{...SequenceName = $SequenceNameNew}\%\n"); @@ -1118,9 +1351,9 @@ 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 +## we need to preserve any {} structures in the info string (as used by Kociemba), +## so we have to change { } --> [ ] since otherwise they will disappear +## or cause an error when printed in LaTeX $SequenceInfo=~ tr/\{/\[/; ## swap { --> [ $SequenceInfo=~ tr/\}/\]/; ## swap } --> ] @@ -1142,7 +1375,7 @@ print (TeX_OUT_FILE "\\renewcommand\\SequenceShort\{$SequenceShort\}\%\n"); print (TeX_OUT_FILE "\\typeout{...SequenceShort = $SequenceShort}\%\n"); ##----------------------- - +##-----------SequenceLong------------------- ## 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 @@ -1274,27 +1507,34 @@ print " SUB checkstate\n"; if ($R >9){ ErrorMessage("red cubies > 9 (=$R)"); - gprint ("..*red cubies > 9 (=$R)") }; + gprint ("..*red cubies > 9 (=$R)"); + }; if ($O >9){ ErrorMessage("orange cubies > 9 (=$O)"); - gprint ("..*orange cubies > 9 (=$O)") }; + gprint ("..*orange cubies > 9 (=$O)"); + }; if ($Y >9){ ErrorMessage("yellow cubies > 9 (=$Y)"); - gprint ("..*yellow cubies > 9 (=$Y)") }; + gprint ("..*yellow cubies > 9 (=$Y)"); + # next LINE + }; if ($G >9){ ErrorMessage("green cubies > 9 (=$G)"); - gprint ("..*green cubies > 9 (=$G)") }; + gprint ("..*green cubies > 9 (=$G)"); + }; if ($B >9){ ErrorMessage("blue cubies > 9 (=$B)"); - gprint ("..*blue cubies > 9 (=$B)") }; + gprint ("..*blue cubies > 9 (=$B)"); + }; if ($W >9){ ErrorMessage("white cubies > 9 (=$W)"); - gprint ("..*white cubies > 9 (=$W)") }; + gprint ("..*white cubies > 9 (=$W)"); + }; if ($X == 54){ ErrorMessage("no colours allocated (X=54)"); @@ -1979,6 +2219,7 @@ print " SUB rubikmod\n"; sub cleanstring { # to clean leading and trailing whitespace from a string + # from Black Book page 147 my $line=""; @@ -2150,11 +2391,19 @@ print " SUB rubikmod\n"; sub repeat { - # to expand the repeating elements + print " SUB repeat\n"; + + ## this SUB expand the repeating elements + ## this SUB receives a repeat string in the form {L,R, }3 + ## The original () were converted (above) into {} so we can distinguish the brackets. + ## we than extract the code sequence and the terminal repeat number + ## Then we join n copies of the code string to form a long cs string. + ## then we insert this new long string into the main rotation sequence without the {} + ## Ultimately the fully expanded rotation sequence is fed into SUB rotation for processing. + -print " SUB repeat\n"; - ## pass the whole repeatstring = {...}n + ## grab the whole repeatstring = {...}n my $repeatstring = $_[0]; # the string ={code}n @@ -2184,6 +2433,8 @@ print " SUB repeat\n"; print " p = $p\n"; print " q = $q\n"; + ##----------------------- + ## now get the repeat number if ($lenrepeatcode == ($lenrepeatstring-2)) { print " there is no trailing number --> 1\n"; @@ -2206,9 +2457,10 @@ print " SUB repeat\n"; }; }; #end of else - + ##------------------- - ## make n copies of repeatcode + ## now make n copies of repeatcode and name the string = $insert + ## (which is then used by another part of the prog) ## we need commas only between elements (not at end) $insert=""; ## $insert = global @@ -2390,7 +2642,7 @@ print " SUB repeat\n"; sub RemoveAllSpaces { # remove all spaces in a string - # Black book page 143 + # from Black book page 143 my $string=$_[0]; @@ -2404,22 +2656,24 @@ print " SUB repeat\n"; 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 + ## this check is used at an early stage in the program, so we can terminate early + ## if necessary. We check that all () {} <> are matched (if any exist), + ## missing commas, illegal combinations of chars etc. + ## if any serious errors (eg brackets 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 + ## first clean out all spaces in a string + ## so we can then look for specific combinations of characters $dataline=RemoveAllSpaces($dataline); print " dataline = $dataline\n"; - - - + ##------------------------------------- + ## first we check for unbalanced brackets ## count brackets; Angle, Square, Curved my ($nleftA, $nrightA) = 0; my ($nleftS, $nrightS) = 0; @@ -2440,77 +2694,124 @@ sub CheckSyntax { 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 ) + ## Square brackets { - gprint ("..*brackets ERROR [ ] Left [$nleftS not equal to Right $nrightS]"); - ErrorMessage ("brackets [ ]: Left [$nleftS not equal to Right $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 ) + ## Curved brackets { - gprint ("..*brackets ERROR ( ) Left ($nleftC not equal to Right $nrightC)"); - ErrorMessage ("brackets ( ): Left ($nleftC not equal to Right $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 ) + ## Angle brackets { - gprint ("..*brackets ERROR < > Left <$nleftA not equal to Right $nrightA>"); - ErrorMessage ("brackets < >: Left <$nleftA not equal to Right $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 + ## check for other bad syntax, eg illegal pairings of characters + ## BlackBook p136 my ($char1, $char2, $charpair) = ""; my ($j, $lenstring) = 0; $lenstring= length $dataline; - print "lenstring = $lenstring\n"; + print " lenstring = $lenstring\n"; + + + ## we set up a system which allows us to know whether or not we are + ## inside a set of brackets. To do this we increment / decrement counters + ## each time we pass through a bracket. + ## If sum NOT equal to zero, then we are inside etc. + + ## first initialise each left and right variable. + ## seems important that these initialisations are done separately. + + my $angleNumLeft = 0; + my $angleNumRight = 0; + my $angleNumSum = 0; + + my $squareNumLeft = 0; + my $squareNumRight = 0; + my $squareNumSum = 0; + + my $curvedNumLeft = 0; + my $curvedNumRight = 0; + my $curvedNumSum = 0; + - # set initial state of inout-flag - my $angleflag = "outside"; - my $squareflag = "outside"; - my $curvedflag = "outside"; + ## look at each char, and each pair of chars + ## with brackets, we increment (right) and decrement (left) the count + ## so we can tell if we are inside or outside a set of nested brackets. + ## (we need to detect errors in the rotation sequence itself + ## and also inside squarebrackets] since these can occur anywhere, + ## but not in the angle infoblocks <..> where we want to be able to write anything) - # 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"}; + ## at top of FOR loop + if ($char1 eq '<'){ $angleNumLeft = $angleNumLeft+1}; + if ($char1 eq '>'){$angleNumRight = $angleNumRight-1}; + if ($char1 eq '['){$squareNumLeft = $squareNumLeft+1}; + if ($char1 eq ']'){$squareNumRight = $squareNumRight-1}; + + if ($char1 eq '('){$curvedNumLeft = $curvedNumLeft+1}; + if ($char1 eq ')'){$curvedNumRight = $curvedNumRight-1}; + + + $angleNumSum = $angleNumLeft + $angleNumRight; + $squareNumSum = $squareNumLeft + $squareNumRight; + $curvedNumSum = $curvedNumLeft + $curvedNumRight; - if ($angleflag eq "outside"){ - + ##RWDN 22 Oct 2017 + + ##------------ + ## need to trap nested (( )) inside squarebrackets + + if ($squareNumSum != 0) { + if ( $charpair =~ m/(\(\(|\)\))/ ) + { # nested curved brackets inside sq brackets + gprint ("..*syntax error: $charpair -- nested ((..)) in [ ]"); + ErrorMessage("$charpair -- syntax error: nested ((..)) not allowed in [ ]"); + $errorflag="SET"; + }; + }; + ##-------------- + + ## if outside angle brackets AND outside square brackets + ## then we are checking ONLY the rotation sequence codes + + if ( ($angleNumSum == 0) and ($squareNumSum == 0) ) { + ## A-Za-z< A-Za-z[ A-Za-z( )A-Za-z >A-Za-z ]A-Za-z ## ]< ][ ]( ]) ]< )< )[ )( >< >[ >( d( d[ d< @@ -2522,32 +2823,25 @@ sub CheckSyntax { next; }; - # trap nested curved brackets - if ( ($char2 eq "(" ) and ($curvedflag eq "inside" ) ) { + # trap nested curved brackets (= inside) + if ( ($char2 eq "(" ) and ($curvedNumSum != 0) ) { ## 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 - + #-----remove-------------------------------------- + # trap comma inside [ ] ( eq inside) + # if ($squareNumSum != 0){ + # 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}; @@ -2565,6 +2859,35 @@ sub CheckSyntax { gprint ("..*Quiting Perl program -- syntax error"); ErrorMessage ("QUITTING PERL PROGRAM -- syntax error"); + ##------bug fix----------------------- + ## RWDN 5 October 2017 + ## problem = since we are here checking syntax (ie before processing any + ## output SequenceXX strings) all four SequenceXX strings will be empty just now. + ## This then causes an error if the Rubik user code includes a ShowSequence command, + ## since the ForEachX macro used by ShowSequence macro cannot handle an empty string + ## when dealing with SequenceShort and SequenceLong. + ## So we heve to force these two strings to be just a [\space] before they are output + ## by the SUB writestate. + ## ie we set SequenceShort and SequenceLong strings to \space here before + ## CALLing the SUB quitprogram(). + ## (to avoid a Rubikcube ShowSequence{}{}{} error if argument is empty + ## or is an expandable macro) + ## This problem arises because the ShowSequence macro uses the ForEachX macro + ## to process each cs element in a string. + ## Also need to add at least one empty char or comma at end of SequenceLong string, + ## as final char (comma) is removed when writing to the out file in SUB writestate + ## (CALLed by SUB quitprogram) just prior to closing down. + ## NB: if there is no extra terminal char for SequenceLong string, + ## then \space --> \spac --> TEX error message + ## + ## This issue does not seem to be a problem for SequenceInfo and SequenceName, + ## as they are not returned as cs strings. + + $SequenceShort="\\space"; + $SequenceLong= "\\space,"; + + ##--------------------------- + print " closing down -- writing state........... OK\n"; quitprogram(); @@ -2599,4 +2922,5 @@ return $newE; } ##====================== +##EOF diff --git a/Master/texmf-dist/doc/latex/rubik/README.txt b/Master/texmf-dist/doc/latex/rubik/README.txt index 1874d1938a3..232a271069b 100644 --- a/Master/texmf-dist/doc/latex/rubik/README.txt +++ b/Master/texmf-dist/doc/latex/rubik/README.txt @@ -1,83 +1,129 @@ - March 3, 2017 --------------------------------------------------------------------------- - 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 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. - (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 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/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 - - 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. - - rubikrotation: - --- better syntax checking - --- 4 new macros SequenceInfo, SequenceName, SequenceShort, SequenceLong - - rubikpatterns: - --- a new package (a small database of patterns and sequences) - --------------------------------------------------------------------------- +-------------------------------------------------------- +The RUBIK bundle (version 5) February 24, 2018 + +rubikcube package : macros for typesetting 3x3x3 cubes +rubiktwocube package : macros for typesetting 2x2x2 cubes +rubikrotation package: macros Perl program for rotations +rubikpatterns package: macros for typesetting +-------------------------------------------------------- + +The RUBIK bundle provides four complementary packages for +documenting the Rubik cube (3x3x3) and Twocube (2x2x2) +notation and configurations, and for processing rotation +sequences for both cubes. A Perl program which processes +rotation sequences on the fly is also included. The four +packages are: +(a) the rubikcube (3x3x3) package, +(b) the rubiktwocube (2x2x2) package (NEW), +(c) the rubikrotation package, +(d) the rubikpatterns package. + + + (1) rubikcube package (3x3x3 cubes) + + 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. + + + (2) rubiktwocube package (2x2x2 cubes) NEW + + The rubiktwocube package provides a collection of LaTeX + commands and macros for typesetting TwoCube configurations + and rotation instructions using the PGF/TikZ graphic + languages. + + + (3) rubikrotation package + + The rubikrotation package, is a dynamic extension to the + rubikcube and rubiktwocube packages. 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 the RubikRotation command. It returns + the new Rubik state in a form which can then be typeset + using commands from the Rubik bundle. + + 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/Lua)LaTeX to be run using the --shell-escape + command-line switch (available from the shellesc package). + + + (4) rubikpatterns package + + The RubikPatterns package is a small database of well-known + patterns and sequences in the form of named macros which + can be processed easily using the RubikRotation command. + + + (5) New features + + rubikcube: + --- Improved documentation. + --- Minor improvements to log-file documentation. + --- New commands for drawing cube sidebars adjacent to + cube edges. + --- Two new commands for setting up WY (White opposite + Yellow) and WB (White opposite Blue) `starter grey + cubes'. + --- Bugfix for the \ShowSequence command (fixes a problem + of fonts not being contained appropriately). + --- Added some missing lower case rotation notation. + --- A new \NoSidebar command for disabling sidebars of a + specified colour (mainly for use with OLL displays). + + rubiktwocube: + --- this is new package dealing with 2x2x2 cubes, having + similar functionality to the rubikcube package. + + rubikrotation: + --- minor code improvements in Perl programme, and + improved syntax checking. + --- some minor bugfixes in Perl programme + (eg: a zero or missing integer with random keyword + now generates an error message). + --- added new keyword `cubesize' to hold cube size + ie either `three' or `two' to inform Perl programme + as to which sort of cube is being processed. + + rubikpatterns: + --- (no change from v4). + + +------------------------------------------------------- RWD Nickalls email: dick@nickalls.org A Syropoulos email: asyropoulos@yahoo.com --------------------------------------------------------------------------- -Copyright 2017 RWD Nickalls & A Syropoulos +------------------------------------------------------- + +Copyright 2018 RWD Nickalls & A Syropoulos Licence -This work may be distributed and/or modified under the -conditions of the LaTeX Project Public License, either version 1.3 -of this license or (at your option) any later version. -The latest version of this license is in - http://www.latex-project.org/lppl.txt -and version 1.3 or later is part of all distributions of LaTeX -version 2005/12/01 or later. --------------------------------------------------------------------------- +This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3 of this license or (at your option) any + later version. The latest version of this license is + in http://www.latex-project.org/lppl.txt and + version 1.3 or later is part of all distributions of + LaTeX version 2005/12/01 or later. +------------------------------------------------------- The RUBIK bundle consists of the following files -package files: +Package files: - rubikcube.ins, - rubikcube.dtx, - rubikcube.sty, + - rubiktwocube.ins, + - rubiktwocube.dtx, + - rubiktwocube.sty, - rubikrotation.ins, - rubikrotation.dtx, - rubikrotation.sty, @@ -85,8 +131,9 @@ package files: - rubikpatterns.ins - rubikpatterns.dtx - rubikpatterns.sty -documentation and README: +Documentation and README: - rubikcube.pdf + - rubiktwocube.pdf - rubikrotation.pdf, - rubikrotationPL.pdf (Perl script documentation) - rubikrotationPL.tex @@ -95,16 +142,18 @@ documentation and README: - 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: +Examples: - rubikexamples.pdf, - rubikexamples.tex -bash and bat files (for running rubikexamples.tex and rubikpatternsLIST.tex) --------------------------------------------------------------------------- +Image files: + - pdf files for rubikcube documentation (6 pictures) + - pdf files for rubiktwocube documentation (1 picture) + - pdf files for rubikrotation documentation (4 pictures) + - pdf files for rubikpatterns documentation (1 picture) +Bash and bat files (for processing rubikexamples.tex and + rubikpatternsLIST.tex) +------------------------------------------------------- -If you have any ideas, suggestions, questions, or bugs to report, please -feel free to contact us. --------------------------------------------------------------------------- +If you have any ideas, suggestions, questions, or bugs +to report, please contact us. +------------------------------------------------------- diff --git a/Master/texmf-dist/doc/latex/rubik/rubik-doc-figD.pdf b/Master/texmf-dist/doc/latex/rubik/rubik-doc-figD.pdf Binary files differindex 26fb68fe62c..5f33c1e28f4 100644 --- a/Master/texmf-dist/doc/latex/rubik/rubik-doc-figD.pdf +++ b/Master/texmf-dist/doc/latex/rubik/rubik-doc-figD.pdf diff --git a/Master/texmf-dist/doc/latex/rubik/rubikcube.pdf b/Master/texmf-dist/doc/latex/rubik/rubikcube.pdf Binary files differindex 769582bad7a..24c67a11725 100644 --- a/Master/texmf-dist/doc/latex/rubik/rubikcube.pdf +++ b/Master/texmf-dist/doc/latex/rubik/rubikcube.pdf diff --git a/Master/texmf-dist/doc/latex/rubik/rubikexampfig4.tex b/Master/texmf-dist/doc/latex/rubik/rubikexampfig4.tex deleted file mode 100644 index d21fedf22c5..00000000000 --- a/Master/texmf-dist/doc/latex/rubik/rubikexampfig4.tex +++ /dev/null @@ -1,7 +0,0 @@ -%% 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 Binary files differindex 34e91dc761f..18e9af6868d 100644 --- a/Master/texmf-dist/doc/latex/rubik/rubikexamples.pdf +++ b/Master/texmf-dist/doc/latex/rubik/rubikexamples.pdf diff --git a/Master/texmf-dist/doc/latex/rubik/rubikexamples.sh b/Master/texmf-dist/doc/latex/rubik/rubikexamples.sh index 52b86832b02..2ddad50b4d2 100644 --- a/Master/texmf-dist/doc/latex/rubik/rubikexamples.sh +++ b/Master/texmf-dist/doc/latex/rubik/rubikexamples.sh @@ -1,5 +1,6 @@ ## rubikexamples.sh +## Rubik bundle v5.0, 2018 ## run twice to get hyperref links correct pdflatex --shell-escape rubikexamples.tex diff --git a/Master/texmf-dist/doc/latex/rubik/rubikexamples.tex b/Master/texmf-dist/doc/latex/rubik/rubikexamples.tex index 053efe2e17e..7e14e1a6e35 100644 --- a/Master/texmf-dist/doc/latex/rubik/rubikexamples.tex +++ b/Master/texmf-dist/doc/latex/rubik/rubikexamples.tex @@ -1,26 +1,19 @@ %% %% 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) +%% February 25, 2018 +%% Requires ALL the rubik bundle packages and also the tikz package +%% Part of the Rubik bundle v5.0 (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{rubikcube,rubikrotation,rubikpatterns,rubiktwocube} +%---------------------- \usepackage{url} \usepackage{ifpdf} \usepackage{lmodern} @@ -37,64 +30,70 @@ } \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} -%--------------------------------- +(Rubik bundle v5.0, 2018) \ \ \texttt{www.ctan.org/pkg/rubik}} + %% increase text height and width \addtolength{\oddsidemargin}{-1.5cm} \addtolength{\textwidth}{3cm} \addtolength{\textheight}{1cm} %---------------------- +%==========Rubik stuff================ +%----edge sequences for 3x3x3 cubes-------------------------- +\newcommand{\CycleThreeEdgesFlipTwo}{[CycleThreeEdgesFlipTwo],F,R,U,Rp,Up,Fp}% +\newcommand{\cyclethreeedgesfliptwo}{\CycleThreeEdgesFlipTwo}% +% +%----corner sequences-------------------------- +\newcommand{\AllYellow}{[allyellow],R,U,Rp,U,R,Up,Up,Rp}% = SUNE %cross -->allyellow +\newcommand{\allyellow}{\AllYellow}% +\newcommand{\CycleThreeCorners}{[cyclethreecorners],Lp,U,R,Up,L,U,Rp,Up}% +\newcommand{\cyclethreecorners}{\CycleThreeCorners}% +\newcommand{\SwapTwoCorners}{[swaptwocorners],Rp,F,Rp,B2,R,Fp,Rp,B2,R2,Up} +\newcommand{\swaptwocorners}{\SwapTwoCorners} +% +%% brace and bracket macros +\newcommand{\Rubikbracket}[1]{$\left(\mbox{#1}\right)$} +\newcommand{\Rubikbrace}[1]{$\left\{\mbox{#1}\right\}$} +\newcommand{\cubenumber}[1]{\strut\raisebox{1cm}{#1}} +%----------------- +% \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, +\,\footnote{This file is part of the Rubik bundle v5.0. 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)} +\date{25 February, 2018 (Rubik bundle v5.0)} \maketitle +\tableofcontents - -%%------------------ +\pagebreak +%%---------------------- \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: +Rubik bundle\,\footnote{\url{http://www.ctan.org/pkg/rubik}} v5.0. +They assume some familiarity with the four packages \textsc{rubikcube}, +\textsc{rubikrotation}, \textsc{rubikpatterns} and \textsc{rubiktwocube}. +For~documentation see the following files: \begin{quote} \begin{verbatim} -rubikcube.pdf -rubikrotation.pdf -rubikpatterns.pdf -rubikpatternsLIST.pdf +rubikcube.pdf 3x3x3 documentation +rubikrotation.pdf commands for implementing rotation sequences +rubikrotationPL.pdf documentation of rubikrotation.pl (Perl program) +rubikpatterns.pdf small database of well-known 3x3x3 configurations +rubikpatternsLIST.pdf shows all configurations in the rubikpatterns database +rubiktwocube.pdf 2x2x2 documentation \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. +rubikpatterns, rubiktwocube}; 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: @@ -105,19 +104,35 @@ pdflatex --shell-escape rubikexample.tex \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. - +If you do forget to use the \verb!--shell-escape! command-line switch, +the file will still run, but all the cubes will remain in the initial +unprocessed configuration\,\footnote{As a quick check, run this file +(\texttt{rubikexamples.tex}) in a separate directory and look at Figure~1; +if this appears as a `solved' cube then your system has failed to call the Perl +script \texttt{rubikrotation.pl} correctly for some reason. The most likely +causes of this are (a)~failure to invoke the \texttt{--shell-escape} command-line +option correctly, or (b)~failure to use a configuration file correctly +(ie your system can't find the Perl program)---search the \texttt{.log} file +to see whether the file \texttt{rubikrotation.pl} has been used.}. + +\subsection{3x3x3 vs 2x2x2 command names} +The introduction of the \textsc{rubiktwocube} package (Rubik bundle v5) +has necessitated a few command name changes in order to avoid confusion +(see the \textsc{rubikcube} package documentation \S\,3.1 for details). +Consequently, command names containing the word `\texttt{Rubik}' denote +a 3x3x3 cube action; similarly those containing the word `\texttt{Two}' +denote a 2x2x2 cube action. \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. +commands and TikZ commands (e.g.,~\verb!\draw! and \verb!\node!) +actually need to be inside a TikZ picture environment, and hence +inside a \verb!\ShowCube! command. This issue arises because the Rubik bundle allows you to create figures showing different stages during a sequence of rotations. Consequently @@ -129,43 +144,46 @@ See Example~3 for an illustration of how to handle environments. \pagebreak %%------------------ -\section{Examples} +\section{RubikCube examples (3x3x3)} \subsection{Sixspot} \typeout{---Example (sixspot)} -In Figure~\ref{fig:cubeincube} we show the so-called ``sixspot'' configuration, +In Figure~\ref{fig:sixspot} 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 +\RubikCubeSolvedWY \RubikRotation{\sixspot} \ShowCube{7cm}{0.7}{\DrawRubikCubeSF} -\caption{\label{fig:cubeincube}The `sixspot' configuration.} +\caption{\label{fig:sixspot}The `sixspot' configuration.} \end{figure} %---------------- -{\noindent}Creating a macro to hold a rotation sequence greatly facilitates -their use, as follows: +{\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: +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 + \RubikCubeSolvedWY \RubikRotation{\sixspot} \ShowCube{7cm}{0.7}{\DrawRubikCubeSF} \caption{...} @@ -173,64 +191,64 @@ TikZ \texttt{tikzpicture} environment. The code for the above figure is as follo \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 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. - - + \verb!\DrawRubikCubeSF! command, where the terminal SF denotes + the Semi-Flat form. To draw it completely flat use a terminal F, + e.g.,~\verb!\DrawRubikCubeF! (see Figure~\ref{fig:sixspotE}). \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. -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). +The following is part of the log-file extract associated with Example~1. \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------------------ +---TeX process--------------------------- +---script = rubikrotation.sty v5.0 (2018/02/25) +---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 +---writing current cube state to file rubikstate.dat \openout7 = `rubikstate.dat'. -\ourRRcounter=\count121 +\ourRRcounter=\count134 ---CALLing Perl script (rubikrotation.pl) -runsystem(perl rubikrotation.pl -i rubikstate.dat -o rubikstateNEW.dat)...execu -ted. +runsystem(perl $HOME/RubikTeX/PERLstuff/dtx-rubikrotation/rubikrotation.pl + -i rubikstate.dat -o rubikstateNEW.dat)...executed. ---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 +...script = rubikrotation.pl v5.0 (25 February 2018) +...reading the current cube state (from File: rubikstate.dat) +... +...command = cubesize,three +...cube = THREEcube +... +......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 +....back,R,R,R,R,R,R,R,R,R ... -...command=checkstate +...rotation keyword ...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*)> +...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 @@ -241,7 +259,7 @@ ted. ...rotation Bp, OK ...rotation U, OK ...rotation Dp, OK -...writing new Rubik state to file rubikstateNEW.dat +...writing new cube state to file rubikstateNEW.dat ...SequenceName = SixSpot ...SequenceInfo = (8q*; 8f*) ...SequenceShort = [SixSpot],U,Dp,R,Lp,F,Bp,U,Dp @@ -250,42 +268,41 @@ ted. \end{verbatim} \end{quote} - - \pagebreak -%%------------------------- -\subsection{ShowRubikErrors} +\subsection{ShowErrors} \typeout{---Example (ShowRubikErrors)} - - In this example we demonstrate the use of the \verb!\ShowRubikErrors! command, + In this example we demonstrate the use of the \verb!\ShowErrors! + command\,\footnote{ The \texttt{ {\textbackslash}ShowErrors} command + replaces the earlier \texttt{{\textbackslash}ShowRubikErrors} command + which is now deprecated. However, the earlier command is still + supported (for now) for backward compatibility.}, 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 + It is important to note that the \verb!\ShowErrors! 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. +Note that full details of all errors are also included in the .log file (search for \texttt{*ERR}). %%--------FIGURE 2 ----------- - -\RubikCubeSolved +% +\RubikCubeSolvedWY \RubikRotation{[sixspot],U,Dp,R,Lp,F,Bp,U,Dpppp,cat,dog} - \begin{figure}[hbt] - \centering - \ShowCubeF{4.5cm}{0.5}{\DrawRubikCubeF} - \ShowRubikErrors +\centering +\ShowCubeF{4.5cm}{0.5}{\DrawRubikCubeF} +\ShowErrors \parbox{0.8\textwidth}{% -\caption{\label{fig:cubeincubeE}The same `sixspot' sequence of rotations as shown +\caption{\label{fig:sixspotE}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 @@ -299,24 +316,20 @@ was generated by the following code. %----------------- \begin{quote} \begin{verbatim} -\RubikCubeSolved +\RubikCubeSolvedWY \RubikRotation{[sixspot],U,Dp,R,Lp,F,Bp,U,Dpppp,cat,dog} \begin{figure}[hbt] \centering - \ShowCubeF{4.5cm}{0.7}{\DrawRubikCubeF} - \ShowRubikErrors + \ShowCubeF{4.5cm}{0.5}{\DrawRubikCubeF} + \ShowErrors \caption{....} \end{figure} \end{verbatim} \end{quote} -Even if the \verb!\ShowRubikErrors! command is not used, it is always a good idea +Even if the \verb!\ShowErrors! 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 %---------------------- @@ -329,36 +342,35 @@ 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. +settings, which will then be accessible to subsequent \verb!\Draw..! commands. Since we are drawing images, this is primarily an issue -with the the \verb!\minipage!, \verb!\figure!, and TikZ picture environments. +with 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! +the TikZ picture environment only for \verb!\Draw..! commands and TikZ +commands. Importantly, this also applies to our main display tool the \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 +In this example the first cube (9a) uses a \verb!\RubikCubeSolvedWY! 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 +in a quite unexpected effect on cube (9b) (and obviously not correct). +This is because the action 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. - + of this earlier attempt to update the global colour-state information. + It turns out that the internal colour-state 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 cube 9b is not what we expected. \medskip \noindent% \cubenumber{9a}% \ShowCube{2cm}{0.5}{% - \RubikCubeSolved% + \RubikCubeSolvedWY% \DrawRubikCubeRU}% \quad\Rubik{R}% \RubikRotation{R}% @@ -373,7 +385,7 @@ the strange form of cube (9b) is not what we expected. ... \cubenumber{9a}% \ShowCube{2cm}{0.5}{% - \RubikCubeSolved% + \RubikCubeSolvedWY% \DrawRubikCubeRU% }% \quad\Rubik{R}% @@ -385,16 +397,17 @@ the strange form of cube (9b) is not what we expected. \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. +If we now bring the \verb!\RubikCubeSolvedWY! command out of the \verb!\ShowCube! +environment and place it \textit{before} the \verb!\ShowCube! command (see cubes 9c, 9d), +then its colour `state' information becomes globally accessible (i.e.,~colour-state +gets updated) and therefore gets used by the subsequent \verb!\RubikRotation{R}! +command, and hence the cube (9d) is now rendered correctly. \bigskip \noindent% -\RubikCubeSolved% \cubenumber{9c}% +\RubikCubeSolvedWY% \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% \quad\Rubik{R}% \RubikRotation{R}% @@ -404,8 +417,8 @@ accessible (i.e.,~colour-state gets updated), and therefore gets used by the \hspace{5mm} \begin{minipage}{0.5\textwidth} \begin{verbatim} -\RubikCubeSolved% \cubenumber{9c}% +\RubikCubeSolvedWY% \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% \quad\Rubik{R}% \RubikRotation{R}% @@ -415,6 +428,11 @@ accessible (i.e.,~colour-state gets updated), and therefore gets used by the \end{verbatim} \end{minipage} +\bigskip + +Note that the horizontal space occupied by \texttt{9d} is almost exactly +the same as \verb!\quad!, and so we don't need to include any additional +space before the \verb!\cubenumber{9d}! command. @@ -425,18 +443,18 @@ accessible (i.e.,~colour-state gets updated), and therefore gets used by the 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). - +the \textsc{front} face. 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$ (bottom back left corner) 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 + \DrawRubikFaceFront \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 @@ -445,7 +463,6 @@ convenience point $P$ is designed to be $(-1,-1)$ on the 2D view. \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]% @@ -471,13 +488,11 @@ convenience point $P$ is designed to be $(-1,-1)$ on the 2D view. } \end{figure} - - {\noindent}The code for the figure is given below. -We draw everything in the \verb!\ShowCube! environment; the \frontface\ +We draw everything in the \verb!\ShowCube! environment; the \textsc{front} face in grey (colour code = \texttt{X}) using the Rubik command -\verb!\DrawFlatFront{X}!, and then draw all the lines and text using standard +\verb!\DrawRubikFlatFront!, 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 @@ -491,7 +506,7 @@ start with a lower-case letter (e.g.,~\verb!\draw..!). \centering \RubikFaceFrontAll{X}% X = default non-colour (grey) \ShowCube{5.6cm}{0.7}{% - \DrawFlatFront + \DrawRubikFaceFront \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$}; @@ -516,16 +531,12 @@ start with a lower-case letter (e.g.,~\verb!\draw..!). \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] @@ -569,8 +580,7 @@ The following diagram is Fig~2 from the \textsc{rubikcube} package documentatio \end{figure} {\noindent}The code for the figure is as follows -(the origin $(0,0)$ is at the bottom left corner of the \frontface). - +(the origin $(0,0)$ is at the bottom left corner of the \textsc{front} (green) face). \begin{quote} \begin{verbatim} @@ -608,31 +618,30 @@ The following diagram is Fig~2 from the \textsc{rubikcube} package documentatio \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 +When explaining elementary layer-1 moves, it can be useful to use the `grey cube' +(\verb!\RubikCubeGreyWY!) ---White opposite Yellow--- as this sets up only +the central cubie on each face. +We have shown the first cube here in Semi-Flat (SF) mode simply to show how the grey +cube is configured (note that a WB version (\verb!\RubikCubeGreyWB!) +and an `all-grey' version (\verb!\RubikCubeAllGrey!) are also available. +Note that all 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% +\RubikCubeGreyWY% + \RubikFaceUp{X}{X}{X}% {X}{W}{O}% {X}{X}{X}% @@ -655,7 +664,6 @@ cubie in the top layer. \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. @@ -670,7 +678,7 @@ G~(green), B~(blue), W~(white), and X~(grey). \begin{figure}[hbt] \centering % set up the first cube -\RubikCubeGrey% +\RubikCubeGreyWY% \RubikFaceUp{X}{X}{X}% {X}{W}{O}% {X}{X}{X}% @@ -693,8 +701,6 @@ G~(green), B~(blue), W~(white), and X~(grey). \end{quote} - - \pagebreak %------------------------------- @@ -702,7 +708,6 @@ G~(green), B~(blue), W~(white), and X~(grey). \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): @@ -713,20 +718,20 @@ Rubik cube via a sequence of 120 random rotations, using the following command \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}!, +the configuration (state) displayed here in Figure~3 to a file +(\texttt{rubikexampfig3.tex}) using \verb!\SaveRubikState{rubikexampfig3.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 +but the same state will be shown both here and in Example~\ref{sec:saverubikstate}. %%--------FIGURE 3 ----------- \begin{figure}[hbt] \centering - \RubikCubeSolved + \RubikCubeSolvedWY \RubikRotation{random,120} - \SaveRubikState{rubikexampfig4.tex} + \SaveRubikState{rubikexampfig3.tex} \ShowCubeF{6cm}{0.5}{\DrawRubikCubeF} \parbox{0.7\textwidth}{% \caption{\label{fig:randomone}This shows a cube generated by 120 random rotations}} @@ -737,10 +742,9 @@ here and in Example~\ref{sec:saverubikstate}. \usepackage{tikz,rubikcube,rubikrotation} ... \begin{figure}[hbt] - \centering - \RubikCubeSolved + \centering\RubikCubeSolvedWY \RubikRotation{random,120} - \SaveRubikState{rubikexampfig4.tex} + \SaveRubikState{rubikexampfig3.tex} \ShowCubeF{6cm}{0.5}{\DrawRubikCubeF} \caption{....} \end{figure} @@ -753,7 +757,7 @@ here and in Example~\ref{sec:saverubikstate}. \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 +argument of the \verb!\ShowCube! command (cms/unit length) 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 @@ -771,7 +775,6 @@ 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 @@ -780,22 +783,26 @@ It is often useful, therefore, to check the size of the fbox (using the \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 +In this example we display a cube having the same colour state as that shown in +the previous example (Example~\ref{sec:scrambleacube}) ---see Figure~\ref{fig:randomone}. +The cube's colour state was saved from the previous example using the command +\verb!\SaveRubikState{rubikexampfig3.tex}!, and then input here +using the command \verb!\input{rubikexampfig3.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} + \input{rubikexampfig3.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}} } + \caption{\label{fig:randomtwo} This shows a Rubik cube in exactly the same + colour state as the one shown in Figure~\ref{fig:randomone}, but here displayed + as a cube seen from the LD (Left-Down) viewpoint.}% +}% \end{figure} + %%--------------------------------- \begin{quote} \begin{verbatim} @@ -803,35 +810,41 @@ state as the one shown in Figure~\ref{fig:randomone}} } ... \begin{figure}[hbt] \centering - \input{rubikexampfig4.tex} - \Showcube{4cm}{0.8}{\DrawRubikCubeLD} -\caption{....} + \input{rubikexampfig3.tex} + \ShowCube{4cm}{0.8}{\DrawRubikCubeLD} + \parbox{0.7\textwidth}{% + \caption{....}% + }% \end{figure} \end{verbatim} \end{quote} - +\noindent\textsc{note}: The command \verb!\SaveRubikState{}! is part of the +\textsc{rubikrotation} package; see the documentation for further details. \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}). - +the action of a sequence of rotations (\rr{U}, \rr{R}, \rr{F}) on a solved cube. \begin{figure}[hbt] \centering -\RubikCubeSolved +\RubikCubeSolvedWY% \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% \quad\Rubik{U}\quad% -\RubikRotation{U}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% +\RubikRotation{U}% +\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% \quad\Rubik{R}\quad% -\RubikRotation{R}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% +\RubikRotation{R}% +\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% \quad\Rubik{F}\quad% -\RubikRotation{F}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% +\RubikRotation{F}% +\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% \caption{The rotations \rr{U}, \rr{R}, \rr{F}\ on a solved cube.} \end{figure} @@ -842,29 +855,46 @@ a sequence of rotations (\rr{U}, \rr{R}, \rr{F}). ... \begin{figure}[hbt] \centering% - \RubikCubeSolved% + \RubikCubeSolvedWY% \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% \quad\Rubik{U}\quad% - \RubikRotation{U}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% + \RubikRotation{U}% + \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% \quad\Rubik{R}\quad% - \RubikRotation{R}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% + \RubikRotation{R}% + \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% \quad\Rubik{F}\quad% - \RubikRotation{F}\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% + \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!. +{\noindent}\textsc{Note} 1: We start with the White-opposite-Yellow (WY) +solved cube, using the command \verb!\RubikCubeSolvedWY!. +A White-opposite-Blue (WB) solved cube is available as \verb!\RubikCubeSolvedWB!. +\medskip +{\noindent}\textsc{Note} 2: There are four different commands for typesetting + 3x3x3 rotation codes in various formats (a slightly different set of four +commands are used for the equivalent 2x2x2 rotation codes). +In~this (3x3x3) example, we have used two of them; for example: +{\newline}\verb!\rr{U}! $\rightarrow$ \rr{U} \ (here the \verb!\rr{}! stands +for `rubik rotation'), and also +{\newline}\verb!\Rubik{U}! $\rightarrow$ \Rubik{U}. This command typesets +both the hieroglyph and the rotation code vertically one above the other. + The other two commands are as follows: +{\newline}\verb!\rrh{U}! $\rightarrow$ \rrh{U} \ (here the \verb!\rrh{}! +stands for `rubik rotation hieroglyph'), and also +{\newline}\verb!\textRubik{U}! $\rightarrow$ \textRubik{U}. This command +typesets both the rotation code and the hieroglyph on the same line one +after the other. \pagebreak + %---------------------- \subsection{Rotation sequence} \typeout{---Example (rotation sequence)} @@ -879,7 +909,7 @@ and (b)~allows the easy application of software tools. (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: + defined in the \textsc{rubikpatterns} package as follows: \begin{quote} \begin{verbatim} \newcommand{\FourSpot}{[FourSpot],F2,B2,U,Dp,R2,L2,U,Dp,<(12q*, 8f*)>} @@ -894,13 +924,15 @@ and (b)~allows the easy application of software tools. \bigskip \noindent% -\RubikCubeSolvedWY +\RubikCubeSolvedWY% \ShowCube{2cm}{0.5}{\DrawRubikCubeRD} \RubikRotation{\FourSpot} -\quad\SequenceBraceA{FourSpot}{% +\quad% +\SequenceBraceA{FourSpot}{% \ShowSequence{}{\Rubik}{\SequenceLong}% } -\quad\ShowCube{2cm}{0.5}{\DrawRubikCubeSF} +\quad% +\ShowCube{5cm}{0.5}{\DrawRubikCubeSF} \bigskip @@ -912,15 +944,15 @@ and (b)~allows the easy application of software tools. \usepackage{tikz,rubikcube,rubikrotation,rubikpatterns} ... \noindent% -\RubikCubeSolvedWY +\RubikCubeSolvedWY% \ShowCube{2cm}{0.5}{\DrawRubikCubeRD} \RubikRotation{\FourSpot} -\quad +\quad% \SequenceBraceA{FourSpot}{% \ShowSequence{}{\Rubik}{\SequenceLong}% } -\quad -\ShowCube{2cm}{0.5}{\DrawRubikCubeSF} +\quad% +\ShowCube{5cm}{0.5}{\DrawRubikCubeSF} \end{verbatim} \end{quote} Note that we have spread the code slightly here in order to emphasise that @@ -933,6 +965,13 @@ The first cube is drawn from the RD (Right-Down) viewpoint (\verb!\DrawRubikCub The second cube is drawn from the SF (Semi-Flat) viewpoint (\verb!\DrawRubikCubeSF!) so we can see all the faces. +Note that we execute the \verb!\RubikRotation{}! command \textit{before} showing +the sequence itself. This is because the Perl program (CALLed by +\verb!\RubikRotation!) allocates the rotation sequence to the variable +\verb!\SequenceLong! which we then display using the \verb!\ShowSequence! command +(see the \textsc{rubikrotation} documentation for details). + + \pagebreak %---------------------- @@ -941,17 +980,25 @@ so we can see all the faces. 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: +different way (adding an extra face and also some cube sidebars), as follows: \bigskip \noindent\hfil% -\RubikCubeSolvedWB% -\ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU\DrawFlatDown{0}{-3.3}}% +\RubikCubeSolvedWB +\ShowCube{1.6cm}{0.4}{ + \DrawRubikCubeRU + \DrawRubikFlatDown{0}{-3.3}} \RubikRotation{\sixts} \quad\SequenceBraceA{SixTs}{\ShowSequence{,\ }{\texttt}{\SequenceLong}} -\quad\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% -\quad\ShowCube{2cm}{0.5}{\DrawFaceFrontSide}% +\quad\ShowCube{3cm}{0.5}{ + \DrawRubikCubeRU + \DrawRubikCubeSidebarFL{RU} + \DrawRubikCubeSidebarFD{RU} + \DrawRubikCubeSidebarBR{RU} + \DrawRubikCubeSidebarBU{RU} + } + \hfil \bigskip @@ -959,36 +1006,36 @@ different way (adding an extra face), as follows: 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 +(we have added the \textsc{down} face (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 final image shows the sixT cube together with the main cube sidebars + indicating the colours of the adjacent facelets, +using the \verb!\DrawRubikCubeSidebarXX! commands. 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}% - } + \DrawRubikCubeRU% + \DrawRubikFlatDown{0}{-3.3}% + } \RubikRotation{\SixTs} \quad\SequenceBraceA{SixTs}{% - \ShowSequence{,\ }{\texttt}{\SequenceLong}% - } -\quad\ShowCube{2cm}{0.5}{\DrawRubikCubeRU} -\quad\ShowCube{2cm}{0.5}{\DrawFaceFrontSide} -\hfil + \ShowSequence{,\ }{\texttt}{\SequenceLong}% + } +\quad\ShowCube{2cm}{0.5}{ + \DrawRubikCubeRU + \DrawRubikCubeSidebarFL{RU} + \DrawRubikCubeSidebarFD{RU} + \DrawRubikCubeSidebarBR{RU} + \DrawRubikCubeSidebarBU{RU} + } \end{verbatim} \end{quote} @@ -998,11 +1045,13 @@ The code for the above figure is as follows: \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 We have drawn the \textsc{down} face of the first cube using the command +\verb!\DrawRubikFlatDown{0}{-3.3}! where the two arguments are the $x$ and +$y$ coordinates of the \textit{bottom left} corner of the \textsc{down} face +(blue); these $(x,y)$ arguments allow us to position the blue `flat' face in +relation to the cube. Note that the grid origin of a cube image (on the page) +coincides with the \textit{bottom left} corner of the \textsc{front} face +(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 @@ -1014,38 +1063,46 @@ $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). +%---------------------- +\subsection[Cycle three edges]{Cycle three edges (flip two)} +\typeout{---Example (cycle three edges (flip two))} + +The following example illustrates a sequence used for cycling three edges, +which is often used in generating the `cross' formation while solving the +final layer. However, it is a useful exercise to perform this sequence on +a solved cube, as this reveals quite clearly its rather complex actions +(it~also swaps two pairs of corners). + + The black arrow (no flip) and magenta arrows (flip) indicate the \textsc{up} + face edge cubies which are cycled anti-clockwise by the sequence +\ShowSequence{,}{\rr}{F,R,U,Rp,Up,Fp}. The blue arrows indicate the associated +`collateral damage' actions (two pairs of corner cubies swap positions); +depending on the circumstances, these other actions may be an acceptable +cost since they can be fixed at a later stage. (This diagram is from +Section~13 in the \textsc{rubikcube} package documentation). + +Note that we include the \textsc{up}-face sidebars to reveal the remaining +facelet colours of the top layer (using the command \verb!\DrawRubikFaceUpSide!) +so we can see how the sequence makes the cubies rotate and turn as they move. \bigskip% \noindent\hfil% - \RubikCubeSolved% - \ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}% - \quad\ShowCube{1.6cm}{0.4}{% - \DrawFlatUpSide% + \RubikCubeSolvedWY% + \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% + \quad\ShowCube{2.3cm}{0.5}{% + \DrawRubikFaceUpSide% \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}% + \RubikRotation{\CycleThreeEdgesFlipTwo}% \quad\ShowSequence{}{\Rubik}{\SequenceLong}\quad$\longrightarrow$\quad% - \ShowCube{1.6cm}{0.4}{\DrawFlatUpSide}% + \ShowCube{2.3cm}{0.5}{\DrawRubikFaceUpSide}% \hfil% - \bigskip% @@ -1053,26 +1110,27 @@ at a later stage. (This diagram is from Section~13 in the \begin{verbatim} - \bigskip% - \noindent\hfil% +\newcommand{\CycleThreeEdgesFlipTwo}{F,R,U,Rp,Up,Fp}% + ... + ... \RubikCubeSolved% - \ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}% - \quad\ShowCube{1.6cm}{0.4}{% - \DrawFlatUpSide% + \ShowCube{2cm}{0.4}{\DrawRubikCubeRU}% + \quad\ShowCube{2.3cm}{0.4}{% + \DrawRubikFaceUpSide% \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}% + \RubikRotation{\CycleThreeEdgesFlipTwo}% \quad\ShowSequence{}{\Rubik}{\SequenceLong}\quad$\longrightarrow$\quad% - \ShowCube{1.6cm}{0.4}{\DrawFlatUpSide}% - \hfil% - - \bigskip + \ShowCube{2.3cm}{0.4}{\DrawRubikFaceUpSide}% \end{verbatim} +{\noindent}Note that the TikZ \verb!\draw! commands (for drawing the arrows +on the cube face) start with a lower-case letter, and also require a terminal +semicolon. @@ -1080,7 +1138,7 @@ at a later stage. (This diagram is from Section~13 in the \pagebreak %---------------------- \subsection{Superflip} -\typeout{---Example (subperflip)} +\typeout{---Example (superflip)} Once you can solve Rubik's cube, then an interesting exercise is to generate @@ -1088,51 +1146,52 @@ 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}}. +\url{http://kociemba.org/math/oh.htm}}. %--------draw the images------------- \begin{figure}[hbt] \centering - \RubikCubeSolved - \ShowCube{2cm}{0.5}{\DrawRubikCubeRU} - \quad$\longrightarrow$\quad% + \RubikCubeSolvedWY% + \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% + \qquad$\longrightarrow$\qquad% \RubikRotation{\superflip}% - \ShowCube{2cm}{0.5}{\DrawRubikCubeLD} - \quad\quad% - \ShowCube{5cm}{0.5}{\DrawRubikCubeSF} + \ShowCube{2cm}{0.5}{\DrawRubikCubeLD}% + \qquad% + \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: +The code for the above figure is shown below (the~\verb!\superflip! macro +used here is from the \textsc{rubikpatterns} package). \begin{verbatim} \usepackage{tikz,rubikcube,rubikrotation,rubikpatterns} ... \begin{figure}[hbt] \centering - \RubikCubeSolved - \ShowCube{2cm}{0.5}{\DrawRubikCubeRU} - \quad$\longrightarrow$\quad% + \RubikCubeSolvedWY% + \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% + \qquad$\longrightarrow$\qquad% \RubikRotation{\superflip}% \ShowCube{2cm}{0.5}{\DrawRubikCubeLD} - \quad\quad% + \qquad% \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! +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: @@ -1141,24 +1200,25 @@ as follows: %% 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. +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 are not actioned as a rotation by 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 +Next we present the same superflip sequence but without commas and 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 Section~11 in the \textsc{rubikcube} +documentation), using the following code: \begin{quote} \begin{verbatim} \usepackage{tikz,rubikcube,rubikrotation,rubikpatterns} ... -\RubikCubeSolved +\RubikCubeSolvedWY \RubikRotation{\superflip} \noindent\strut\hspace{-8mm}\ShowSequence{}{\Rubik}{\SequenceLong} \end{verbatim} @@ -1168,7 +1228,7 @@ which gives \bigskip -\RubikCubeSolved +\RubikCubeSolvedWY \RubikRotation{\superflip} \noindent\strut\hspace{-8mm}\ShowSequence{}{\Rubik}{\SequenceLong} @@ -1180,16 +1240,17 @@ which gives 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: +\Rubikbrace{\Rubikbracket{\Rubik{Rm}\Rubik{U}}4, \Rubik{x}, +\Rubik{yp}}3 \ \ (Harris (2008), p151). +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}% +\RubikCubeSolvedWF +\RubikRotation[3]{[superflip],(Rm,U)4,x,yp,<Harris (2008), p151>} +\ShowCube{4cm}{0.4}{\DrawRubikCubeSF} \end{verbatim} \end{quote} which generates the following @@ -1197,45 +1258,46 @@ which generates the following %------------------- \begin{figure}[hbt] \centering - \RubikCubeSolved% - \RubikRotation[3]{[shortsuper],(Rmp,Up)4,yp,x}% + \RubikCubeSolvedWY + %%% \RubikRotation[3]{[shortsuper],(Rmp,Up)4,yp,x}% ORG + \RubikRotation[3]{[shortsuper],(Rm,U)4,x,yp,<Harris (2008), p151>} \ShowCube{5cm}{0.5}{\DrawRubikCubeSF} -\end{figure} + \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]! +Note that to do this we made 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). +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.1.1 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 +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}. -} +\fbox{\strut\rule{0pt}{10pt}% + The inverse of the sixspot sequence is: + \RubikRotation{\sixspot,<inverse>} + \ShowSequence{,}{\texttt}{\SequenceLong}. + } \end{verbatim} \end{quote} -is \quad\fbox{\strut\ % +is \quad\fbox{\strut\rule{0pt}{10pt} % The inverse of the sixspot sequence is: \RubikRotation{\sixspot,<inverse>} \ShowSequence{,}{\texttt}{\SequenceLong}. @@ -1243,56 +1305,49 @@ The inverse of the sixspot sequence is: \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. +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% +\RubikCubeSolvedWY% + \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% \RubikRotation{\sixspot}% - \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}\sixspotINVarrow% -\RubikRotation{\sixspotINV}% + \sixspotarrow% + \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% +\RubikRotation{\sixspot,<inverse>}% + \sixspotINVarrow% \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% +... +\RubikCubeSolvedWY\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% \RubikRotation{\sixspot}% - \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}\sixspotINVarrow% -\RubikRotation{\sixspotINV}% + \sixspotarrow% + \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% +\RubikRotation{\sixspot,<inverse>}% + \sixspotINVarrow% \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 +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% @@ -1304,6 +1359,636 @@ superflip sequence \textit{twice in succession}, as follows: \end{figure} +\pagebreak + +%------------------- +\subsection{OLL example} + +% ThreeCube YellowCross (from dnRUBIKsolution15) +\newcommand{\yellowcross}{[yellowcross],F,R,U,Rp,Up,Fp} +\newcommand{\arrow}[1]{$\overrightarrow{\strut\mbox{#1}}$} +\newcommand{\ShowYellowFace}{\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUpSide}} + +Here we illustrate the use of the \verb!\NoSidebar! command (see the +\textsc{rubikcube} package documentation) to generate nice displays +of so-called OLL (Orientate Lower Layer) configurations, which are +typically rendered using the yellow face. + +For example, the following sequence shows an efficient +algorithm (sequence) for `solving' the OLL configuration shown +in cube~A (listed as OLL case~33 in Harris +(2008, page~61)\footnote{Harris D (2008). \textit{Speedsolving the cube}, +(Stirling Publishing Co, New York) {\newline}(\texttt{www.stirlingpublishing.com}) +[covers 2x2x2, 3x3x3, 4x4x4, 5x5x5 cubes].} and also on the Harris OLL webpage \url{http://www.cubestation/3x3x3/cfop/oll/ollprintablepage.php}). + + +%% Dan Harris case 33 (in his 2008 book) +\newcommand{\CaseXXXIII}{[caseHarris33],R, U, Rp, U, R, Up, Rp, Up, Rp, F, R, Fp} +% {\DH2008thth} + +\bigskip + +%% setup OLL position DH33 (Dan Harris) +\RubikCubeGreyAll +\RubikFaceUp{X}{Y}{Y} + {Y}{Y}{X} + {Y}{X}{X} +\RubikFaceBack XXY XXXXXX +\RubikFaceLeft XXX XXXXXX +\RubikFaceRight YYX XXXXXX +\RubikFaceFront XYX XXXXXX +% +\cubenumber{A}% +\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUpSide}% +% +\RubikRotation{\CaseXXXIII}% +\quad\SequenceBraceA{OLLcase33Harris}{% + \ShowSequence{}{\Rubik}{\CaseXXXIII}% + }% +\quad$\longrightarrow$\quad% +\cubenumber{B}% +\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUpSide}% + +\bigskip + +{\noindent}The code for the above figure is as follows (note that +the \verb!\NoSidebar{X}! command is placed inside the \verb!\ShowCube! +environment in order to limit its action). + +\begin{quote} +\begin{verbatim} +\newcommand{\cubenumber}[1]{\strut\raisebox{1cm}{#1}} +\newcommand{\CaseXXXIII}{[caseHarris33],R,U,Rp,U,R,Up,Rp,Up,Rp,F,R,Fp} +% +\RubikCubeGreyAll +\RubikFaceUp{X}{Y}{Y} + {Y}{Y}{X} + {Y}{X}{X} +\RubikFaceBack XXY XXXXXX +\RubikFaceLeft XXX XXXXXX +\RubikFaceRight YYX XXXXXX +\RubikFaceFront XYX XXXXXX +\cubenumber{A}% +\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUpSide}% +\RubikRotation{\CaseXXXIII}% +\quad\SequenceBraceA{OLLcase33Harris}{% + \ShowSequence{}{\Rubik}{\CaseXXXIII}% + }% +\quad$\longrightarrow$\quad% +\cubenumber{B}% +\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUpSide}% +\end{verbatim} +\end{quote} +Note that since we originally defined the OLL case~33 algorithm +(Harris 2008) as a macro, it follows that we could instead have +recovered the OLL~33 configuration (cube~A above) using the +inverse algorithm, as follows: + +\bigskip + +\RubikCubeGreyAll +\RubikFaceUpAll{Y} +\RubikRotation{<inverse>,\CaseXXXIII} +\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUS}% +\hspace{1cm} +\begin{minipage}{4cm} +\begin{verbatim} +\RubikCubeGreyAll +\RubikFaceUpAll{Y} +\RubikRotation{<inverse>,\CaseXXXIII} +\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUS} +\end{verbatim} +\end{minipage} + +\bigskip + +{\noindent}Note that in this last example we have used the more convenient +short-hand US (UpSide) version of the \verb!\DrawRubikFaceUpSide! command, +namely \verb!\DrawRubikFaceUS!. + + + +\pagebreak +%---------------------- +\subsection{Cube patterns} +\typeout{---Example (Cube patterns)} + +\newcommand{\CycleThreeUpEdges}{[CycleUpEdges],F2,U,Rm,Up,Up,Lm,U,Fp2} +\newcommand{\StripesOrtho}{[StripesOrtho],Lp,Fp,Rp,L,U,D, Rp,Dp,Lp,Bp,U2,Lp,Up,R,L,Up,F2,Rp,<Harris 2008, p150>} + +We now look at how the \verb!\RubikRotation! command can be used to +investigate cube patterns, which are typically shown only as a +regular cube. For example, consider the following interesting sequence +\linebreak\texttt{L' F' R' L U D R' D' L' B' U2 L' U' R L U' F2 R'} +(Harris 2008, page~150), which is presented as a cube with orthogonal +stripes (see figure~A). In order to show the pattern using the Rubik + bundle, it is often useful to first express the sequence as a macro. + In this particular case we need to adjust the Harris (2008) notation + slightly to make it compatible (ie, insert commas, change trailing + `primes' into a trailing `p'), give it a suitable name + (say, \verb![StripesOrtho]!), and, for completion, include the citation +in an `infoblock' ($<$...$>$), as follows: + +\begin{verbatim} +\newcommand{\StripesOrtho}{% + [StripesOrtho],Lp,Fp,Rp,L,U,D,Rp,Dp,Lp,Bp,U2,Lp,Up,R,L,Up,F2,Rp,<Harris 2008, p150>} +\end{verbatim} +We can now process it simply by using its macro-name as the argument for +the \verb!\RubikRotation! command; for example, the following code displays +it as figure~A. + +\begin{verbatim} +\RubikCubeSolved +\RubikRotation{\StripesOrtho} +\ShowCube{2.6cm}{0.6}{\DrawRubikCubeRU} +\end{verbatim} + +At first sight this looks like a nice example of orthogonal stripes, +but if we look at all the faces by rendering the cube in a Semi-Flat +(SF) view (using the command \verb!\DrawRubikCubeSF!) + ---see~figure~B--- this reveals that unfortunately only five faces +actually have a center stripe. + +\bigskip + +\RubikCubeSolved +\RubikRotation{\StripesOrtho} +\cubenumber{A} +\ShowCube{2.6cm}{0.6}{\DrawRubikCubeRU} +\hspace{3cm} +\cubenumber{B} +\ShowCube{4cm}{0.4}{\DrawRubikCubeSF} + +\bigskip + +{\noindent}So the question is: can we improve on this and create a cube +with a fully orthogonal pattern, by swapping the relevant red/yellow +and blue/yellow edge cubies in the back layer? Since it is impossible +to swap just two edge cubies within the same layer in a 3x3x3 cube +without changing any other cubies, the answer is no. However, we are +able to cycle cleanly three edge cubies within one face, and a single +cycle could at least create the final stripe with only minimal collateral +damage. + +For example, if we rotate the whole cube using the rotation denoted +as \rr{Rcp} (= \verb!\rr{Rcp}!)\,\footnote{There are several equivalent +notations for this: \rr{Rcp} $\equiv$ \rr{xp} $\equiv$ \rr{CRp}; +the c and C denote a whole cube rotation.} to bring the \textsc{back} face to +the \textsc{up} position (as shown in figure~C), we can then cycle the three +\textsc{up} edge cubies UL, UR, UF clockwise using the following +`CycleThreeUpEdges' sequence: +\begin{verbatim} +\newcommand{\CycleThreeUpEdges}{F2,U,Rm,Up,Up,Lm,U,Fp2} +\end{verbatim} +We can combine these two actions using the command +\verb!\RubikRotation{Rcp,\CycleThreeUpEdges}!, which will then align the +three red facelets in the \textsc{up} face and form the final stripe +(see figure~D). + +\RubikCubeSolved +\RubikRotation{\StripesOrtho,Rcp} +\cubenumber{C} +\ShowCube{2.6cm}{0.6}\DrawRubikCubeRU +\hspace{3cm} +\RubikRotation{\CycleThreeUpEdges} +\cubenumber{D} +\ShowCube{4cm}{0.4}\DrawRubikCubeSF + +\medskip + +The downside, of course, is that a yellow and a white facelet are also +swapped in the top layer, but at least we now have a cube with six +mutually adjacent orthogonal central stripes\,! + + +\pagebreak + +%%=====================TWOcube stuff====================================== +%%======================================================================== + +\section{TwoCube examples (2x2x2)} + +\subsection{Commands \& notation} + +Regarding the 2x2x2 cube as a `TwoCube' (instead of a RubikCube) makes +the 2x2x2 commands very intuitive (assuming you are familiar with the +3x3x3 commands), since they are mostly obtained just by exchanging +the word `Rubik' in 3x3x3 commands for the word `Two'. For example, + +\medskip + +\verb!3x3x3!\quad\hspace{1cm}$\rightarrow$\quad\hspace{1cm}\verb!2x2x2! + +\smallskip + +\verb!\RubikCubeSolvedWY! $\rightarrow$ \verb!\TwoCubeSolvedWY! + +\verb!\RubikRotation!\qquad\ $\rightarrow$ \quad\verb!\TwoRotation! + +\verb!\SaveRubikState!\qquad\ $\rightarrow$ \quad\verb!\SaveTwoState! + +\medskip + +Note that although the 2x2x2 cube does not have any middle slices, one can still + actually use the 3x3x3 commands \verb!\RubikRotation! and \verb!\SaveRubikState! + in the usual way (because the corner cubies are still processed in +the usual way). However, in the interests of consistency +both of these commands have equivalent `Two' versions: namely +\verb!\TwoRotation! and \verb!\SaveTwoState!. + +Of course there are considerably fewer rotation codes and hieroglyphs +associated with the TwoCube (since there are no middle slices), and +their commands also mirror the 3x3x3 equivalents in the \textsc{rubikcube} +package; i.e.,~\verb!Rubik! $\rightarrow$ \verb!Two! and +\verb!r! $\rightarrow$ \verb!t!. Thus the changes associated with the +four key commands can be summarised as follows : + + \medskip + + \verb!3x3x3! \hphantom{$\rightarrow$} \verb!2x2x2! + + \smallskip + + \verb!\rr{}! $\rightarrow$ \verb!\tr{}! + + \verb!\rrh{}! $\rightarrow$ \verb!\trh{}! + + \verb!\Rubik{}! $\rightarrow$ \verb!\Two{}! + + \verb!\textRubik{}! $\rightarrow$ \verb!\textTwo{}! + + +%----------------------- + +\bigskip + +%------------------- +\subsection{Visualising white-space} + +This example shows how the F version of the \verb!\ShowCube{}{}{}! command can be useful for revealing excess white space. + + + + \bigskip + +\TwoCubeSolvedWB% +\ShowCubeF{3cm}{0.6}{\DrawTwoCubeRU}% +\quad\ShowCubeF{1.7cm}{0.6}{\DrawTwoFaceUS}% +\hspace{1cm} +\begin{minipage}{0.3\textwidth} +\begin{verbatim} +\TwoCubeSolvedWB% +\ShowCubeF{3cm}{0.6}{\DrawTwoCubeRU}% +\quad% +\ShowCubeF{1.7cm}{0.5}{\DrawTwoFaceUS}% +\end{verbatim} +\end{minipage} + + +\bigskip + + Both images above have an F-box drawn around them (so we can see the + extent of any white space) using the F version of the \verb!\ShowCube!$\{\mbox{\textit{width}}\}\{\mbox{\textit{scale-factor}}\}\{\}$ command, + namely \verb!\ShowCubeF{}{}{}!. Clearly the \verb!3cm! width we have + used for the first cube above is too much, and so in the second pair + of images below we have reduced this width for the first image to + its correct value of \verb!1.6cm!, and have removed the F from the + \verb!\ShowCubeF! command accordingly. + +\bigskip + +\quad% +\TwoCubeSolvedWB% +\ShowCube{1.6cm}{0.6}{\DrawTwoCubeRU}% +\quad% +\ShowCube{1.7cm}{0.6}{\DrawTwoFaceUS}% +\hspace{1cm} +\begin{minipage}{0.3\textwidth} +\begin{verbatim} +\TwoCubeSolvedWB% +\ShowCube{1.6cm}{0.6}{\DrawTwoCubeRU}% +\quad% +\ShowCube{1.7cm}{0.5}{\DrawTwoFaceUS}% +\end{verbatim} +\end{minipage} + +\bigskip + +Thus use of the F version of the the \verb!ShowCube! command allows +the user to easily determine---by trial \& error---the correct minipage +width for a particular cube. + + +\pagebreak + +%------------------- +\subsection{Flat and semi-flat formats} + +We can view the hidden faces of a cube using the semi-flat (SF) and +flat (F) versions of the \verb!\DrawTwoCube..! command as follows. + +In the first figure we have also used the F version of the +\verb!\ShowCube{}{}{}! command to reveal the size of the minipage +which contains the image. Notice that since the 2D width of the side +face (red) is approximately 1 unit, we can estimate that the total +width of the image will be 6 + 1 = 7 units, and hence as we have +specified a TikZ scale factor of 0.6, then the required width of +the minipage is approximately $4.2$ ($= 7 \times 0.6$) +---see Section~4.1 in the \textsc{rubikcube} package documentation +for details). + +\bigskip + +\begin{minipage}{0.3\textwidth} +\centering +\TwoCubeSolvedWB% +\ShowCubeF{4.2cm}{0.6}{\DrawTwoCubeSF}% +\end{minipage} + \hspace{2cm} +\begin{minipage}{0.3\textwidth} +\begin{verbatim} +\TwoCubeSolvedWB% +\ShowCubeF{4.2cm}{0.6}{\DrawTwoCubeSF}% +\end{verbatim} + \end{minipage} + +\bigskip + +\begin{minipage}{0.3\textwidth} +\centering +\TwoCubeSolvedWB% +\ShowCube{4.8cm}{0.6}{\DrawTwoCubeF}% +\end{minipage} + \hspace{2cm} +\begin{minipage}{0.3\textwidth} +\begin{verbatim} +\TwoCubeSolvedWB% +\ShowCube{4.8cm}{0.6}{\DrawTwoCubeF}% +\end{verbatim} + \end{minipage} + + + + \pagebreak + +%------------------- +\subsection{Grey cube} + + +A cube with all of the facelets coloured grey (a `grey' cube) can be +useful as a starting state for instruction. Such a cube is generated +by the command \verb!\TwoCubeGreyAll!. +We can then allocate colours to those facelets demonstrating +some feature of cube manipulation. + Here we are showing how to rotate the GWR corner cubie in the bottom layer + up into its `solved' position in the top layer. We also use two cube + sidebars to show the colours of the hidden facelets of the corner cubie. + + \bigskip + + +\noindent\hfil% +\TwoCubeGrey +\ShowCube{2cm}{0.7}{\DrawTwoCube}% +% +\TwoFaceUp{X}{X} + {R}{W}% +\TwoFaceFront{G}{R} + {W}{X}% +\TwoFaceLeft XX + XG% +\TwoFaceDown{R}{X} + {X}{X}% +\quad\ShowCube{2cm}{0.7}{ + \DrawTwoCube + \DrawTwoCubeSidebarFD{RU} + \DrawTwoCubeSidebarFL{RU} + }% +\quad\Two{Lp}\quad +\TwoRotation{Lp} +\ShowCube{2cm}{0.7}{\DrawTwoCube}% +\hfil% + +\bigskip + +{\noindent}The code for the above figure is as follows: +\begin{quote} +\begin{verbatim} +\noindent\hfil% +\TwoCubeGrey +\ShowCube{2cm}{0.6}{\DrawTwoCube}% +% +\TwoFaceUp{X}{X} + {R}{W}% +\TwoFaceFront{G}{R} + {W}{X}% +\TwoFaceLeft XX + XG% +\TwoFaceDown{R}{X} + {X}{X}% +\ShowCube{2cm}{0.6}{ + \DrawTwoCube + \DrawTwoCubeSidebarFD{RU} + \DrawTwoCubeSidebarFL{RU} + }% +\quad\Two{Lp}\quad +\TwoRotation{Lp} +\ShowCube{2cm}{0.6}{\DrawTwoCube}% +\hfil% +\end{verbatim} +\end{quote} +Notice that the curly brackets associated with the \verb!\TwoFace..! commands +can be omitted providing at least one space is left before the first colour code +(see the \verb!\TwoFaceLeft..! command above). + + + \pagebreak + +%------------------- +\subsection{Scrambled cube} + +In the following example we scramble the cube using 20 random rotations using +$\langle$\texttt{random,20}$\rangle$ as the argument +for the \verb!\TwoRotation{}! command. We have also added a set of cube sidebars +to the second cube. The final semi-flat (SF) cube has the same colour configuration +and shows the hidden faces, allowing you to check the colours of the sidebars. + +\bigskip + + \noindent\hfil% + \TwoCubeSolvedWY% + \ShowCube{1.8cm}{0.7}{\DrawTwoCubeRU}% + \qquad$\longrightarrow$\qquad% + %--------------- + \TwoRotation{random,20} + %---------------- + \ShowCube{2.8cm}{0.7}{ + \DrawTwoCubeRU + \DrawTwoCubeSidebarFL{RU} % Front-Left edge sidebar + \DrawTwoCubeSidebarFD{RU} % Front-Down edge + \DrawTwoCubeSidebarBR{RU} % Back-Right edge + \DrawTwoCubeSidebarBU{RU} % Back-Up edge + }% + \qquad\ShowCube{5cm}{0.7}{\DrawTwoCubeSF}% + \hfil% + + \bigskip + + + \begin{quote} + \begin{verbatim} + \noindent\hfil% + \TwoCubeSolvedWY% + \ShowCube{1.8cm}{0.7}{\DrawTwoCubeRU}% + \qquad$\longrightarrow$\qquad% + %--------------- + \TwoRotation{random,20} + %---------------- + \ShowCube{2.8cm}{0.7}{ + \DrawTwoCubeRU + \DrawTwoCubeSidebarFL{RU} % Front-Left edge sidebar + \DrawTwoCubeSidebarFD{RU} % Front-Down edge + \DrawTwoCubeSidebarBR{RU} % Back-Right edge + \DrawTwoCubeSidebarBU{RU} % Back-Up edge + }% + \qquad\ShowCube{5cm}{0.7}{\DrawTwoCubeSF}% + \hfil% + \end{verbatim} + \end{quote} + + + +%------------------- +\subsubsection*{A simple scramble} + +A simple scramble (from a solved position) which +makes each face have four different facelets is $\left\{\mbox{\tr{R}, +\tr{y}}\right\}$5 as follows (note that the optional \verb!\TwoRotation! +square bracket holds the repeat number~$5$): + +\bigskip + +\begin{minipage}{0.3\textwidth} +\centering +\TwoCubeSolvedWB% +\TwoRotation[5]{R,y}% +\ShowCube{5cm}{0.6}{\DrawTwoCubeF}% +\end{minipage} + \hspace{2cm} +\begin{minipage}{0.3\textwidth} +\begin{verbatim} +\TwoCubeSolvedWB% +\TwoRotation[5]{R,y}% +\ShowCube{5cm}{0.6}{\DrawTwoCubeF}% +\end{verbatim} + \end{minipage} + + +\pagebreak + +%------------------- +\subsection{Swap two corners} + +The following example is the header figure for the \textsc{rubiktwocube} +package documentation, and shows the `SwapTwoCorners' sequence often +necessary in the solution of a 2x2x2 cube. + + \bigskip + + \noindent\hfil% + %% set up the cube with corners swapped + \TwoCubeSolvedWY% + \TwoRotation{Rc2}% turn upside down (= Rc2) x2 + \TwoRotation{\swaptwocorners}% + %% + % now show the cube, before and after swapping the corners again + \ShowCube{1.6cm}{0.6}{\DrawTwoCubeRU}% + \quad\ShowCube{1.7cm}{0.5}{\DrawTwoFaceUS}% + \TwoRotation{\swaptwocorners}% + \quad\SequenceBraceA{SwapTwoCorners}{\ShowSequence{}{\Two}{\SequenceLong}}% + \quad$\longrightarrow$% + \quad\ShowCube{1.7cm}{0.5}{\DrawTwoFaceUS}% + \hfil% + + \bigskip% + + {\noindent}The code for the above figure is as follows: + \begin{verbatim} + \usepackage{tikz} + \usepackage{rubikcube,rubikrotation,rubikpatterns,rubiktwocube} + ... + \newcommand{\SwapTwoCorners}{[swaptwocorners],Rp,F,Rp,B2,R,Fp,Rp,B2,R2,Up} + \newcommand{\swaptwocorners}{\SwapTwoCorners} + ... + \noindent + \hfil% + %% set up the cube with corners swapped + \TwoCubeSolvedWY% + \TwoRotation{Rc2}% turn cube upside down about the R face + \TwoRotation{\swaptwocorners}% + %% now show the cube, before and after swapping the corners + \ShowCube{1.6cm}{0.6}{\DrawTwoCubeRU}% + \quad\ShowCube{1.7cm}{0.5}{\DrawTwoFaceUS}% + \TwoRotation{\swaptwocorners}% + \quad\SequenceBraceA{SwapTwoCorners}{\ShowSequence{}{\Two}{\SequenceLong}}% + \quad$\longrightarrow$% + \quad\ShowCube{1.7cm}{0.5}{\DrawTwoFaceUS}% + \hfil% + \end{verbatim} + +\pagebreak + +%------------------- +\subsection{OLL example} + +Here we illustrate an OLL algorithm which orientates the last layer +starting from a single yellow facelet in the UFL position. + +\bigskip + +\noindent\hfil% +\TwoCubeGreyAll% +\TwoFaceUp{X}{X}% + {Y}{X}% +\TwoFaceBack XY XX +\TwoFaceRight XY XX% +\TwoFaceFront XY XX% +\ShowCube{2cm}{0.7}{\NoSidebar{X}\DrawTwoFaceUS} + \SaveTwoState{cubeTWO.tex} %*** +\TwoRotation{\allyellow}% +\quad\SequenceBraceA{AllYellow}{\ShowSequence{}{\Two}{\SequenceLong}}\quad$\longrightarrow$\quad% +\ShowCube{1.5cm}{0.7}{\NoSidebar{X}\DrawTwoFaceUS} +\hfil% + +\bigskip + +The code is shown below. Note that we have used the \verb!\NoSidebar{X}! +command to disable the drawing of any grey sidebars by the \verb!\DrawTwoFaceUS! +command\footnote{Note that the \textbackslash\texttt{DrawTwoFaceUS} command is a short-hand +equivalent to the \textbackslash\texttt{DrawTwoFaceUpSide} command.} + and hence only yellow sidebars are drawn. Note that we have placed the +\verb!\NoSidebar{X}! command inside the \verb!\ShowCube! environment in order +to limit its action locally. + +\begin{quote} +\begin{verbatim} +\noindent\hfil% +\TwoCubeGreyAll% +\TwoFaceUp{X}{X}% + {Y}{X}% +\TwoFaceBack XY XX +\TwoFaceRight XY XX% +\TwoFaceFront XY XX% +\ShowCube{2cm}{0.7}{\NoSidebar{X}\DrawTwoFaceUS}% +\TwoRotation{\allyellow}% +\quad\SequenceBraceA{AllYellow}{\ShowSequence{}{\Two}{\SequenceLong}}% +\quad$\longrightarrow$\quad% +\ShowCube{1.5cm}{0.7}{\NoSidebar{X}\DrawTwoFaceUS}% +\hfil% +\end{verbatim} +\end{quote} + +\bigskip \begin{center} diff --git a/Master/texmf-dist/doc/latex/rubik/rubikpatterns.pdf b/Master/texmf-dist/doc/latex/rubik/rubikpatterns.pdf Binary files differindex 053ffaa6822..ffd3a312b3b 100644 --- a/Master/texmf-dist/doc/latex/rubik/rubikpatterns.pdf +++ b/Master/texmf-dist/doc/latex/rubik/rubikpatterns.pdf diff --git a/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.pdf b/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.pdf Binary files differindex f80c1f7344a..aad724979b4 100644 --- a/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.pdf +++ b/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.pdf diff --git a/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.sh b/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.sh index 8e101ad176d..4aa4a07ae4a 100644 --- a/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.sh +++ b/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.sh @@ -1,5 +1,6 @@ ## rubikpatternsLIST.sh +## rubik bundle v5.0, 2018 ## run twice to get hyperref-links correct pdflatex --shell-escape rubikpatternsLIST.tex diff --git a/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.tex b/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.tex index fc7a677b51d..56f6663ae97 100644 --- a/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.tex +++ b/Master/texmf-dist/doc/latex/rubik/rubikpatternsLIST.tex @@ -1,29 +1,19 @@ +%% %% rubikpatternsLIST.tex -%% part of the rubikpatterns package v 4.0 +%% part of the rubikpatterns package v5.0 %% authors: RWD Nickalls & A Syropoulos -%% 03 March 2017 +%% 25 February 2018 +%% Rubik bundle v5.0 %%------------------------ -%% this file uses the rubikrotation package +%% this file requires the rubikrotation and rubkpatterns packages %% 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{rubikcube,rubikrotation,rubikpatterns} + %-------------------------- \usepackage{url,ifpdf} %--------------------- @@ -38,12 +28,13 @@ pdfkeywords={Rubik cube LaTeX} } \fi -%%------------------- -%------------- +%%------------------ \pagestyle{myheadings} -\markright{\texttt{rubikpatternsLIST.pdf} \ \ -(Rubik bundle v4.0, March 03, 2017) } +\markright{\texttt{rubikpatternsLIST.pdf} \ (Rubik bundle v5.0) \ \texttt{www.ctan.org/pkg/rubik}} %------------------------------------- +%% need to use a negthinspace $\!$ before \ShowSequence +%% to adjust for the first [ char in the cs string +%% this makes the first line align correctly \newcommand{\ShowPattern}[1]{% \noindent% \RubikCubeSolvedWB @@ -51,13 +42,10 @@ \ShowCube{2.4cm}{0.6}{\DrawRubikCubeRU} \hspace{0.5cm}% was 1cm \begin{minipage}{9cm} -\noindent\ShowSequence{,\ }{\texttt}{\SequenceShort}, +\noindent$\!$\ShowSequence{,\ }{\texttt}{\SequenceShort}, \newline\noindent\texttt{\SequenceInfo}. \end{minipage} } -%------------------------- - - %====================== \begin{document} @@ -66,25 +54,23 @@ \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: +\footnote{This file is part of the Rubik bundle v5.0, 2018. +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)} +\date{25 February 2018 (Rubik bundle v5.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: - +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 @@ -98,7 +84,6 @@ a solved Rubik cube by the rotation sequence \texttt{U,Dp,R,Lp,F,Bp,U,Dp}, as \bigskip - \medskip {\noindent}The code for this image is as follows: @@ -120,16 +105,16 @@ a solved Rubik cube by the rotation sequence \texttt{U,Dp,R,Lp,F,Bp,U,Dp}, as \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 +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 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 @@ -139,12 +124,9 @@ The following image shows the WB cube form (set up using the command \bigskip \RubikCubeSolvedWB% - \ShowCube{2cm}{0.5}{\DrawRubikCubeSF}% - -\medskip -{\noindent}The code for this image is as follows: - -\begin{quote} + \ShowCube{5cm}{0.5}{\DrawRubikCubeSF}% +\hspace{3mm}% +\begin{minipage}{5cm} \begin{verbatim} \usepackage{tikz} \usepackage{rubikcube,rubikrotation} @@ -152,21 +134,23 @@ The following image shows the WB cube form (set up using the command \RubikCubeSolvedWB% \ShowCube{2cm}{0.5}{\DrawRubikCubeSF}% \end{verbatim} -\end{quote} - - - - +\end{minipage} +%==================== \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. +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. + +Note that since each sequence starts with a \verb![name],! we include +a negative thin space (\verb[$\![) just before the \verb!\ShowSequence! +command to adjust the position of the narrow initial \verb![! character + in order to align it correctly with the subsequent line. \begin{verbatim} %---------------------------------------- @@ -180,17 +164,16 @@ rotation sequence and metadata. \ShowCube{2.4cm}{0.6}{\DrawRubikCubeRU} \hspace{0.5cm}% \begin{minipage}{9cm} -\noindent\ShowSequence{,\ }{\texttt}{\SequenceShort}, +\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: +For example, the first pattern below (Pons Asinorum) is typeset +using the following command: \begin{verbatim} \bigskip\ShowPattern{\ponsasinorum} @@ -277,21 +260,16 @@ command: \section{References} \begin{itemize} -\item Fridrich website (Fridrich J). \ \ \url{http://www.ws.binghamton.edu/fridrich/} +\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} diff --git a/Master/texmf-dist/doc/latex/rubik/rubikrotation.1 b/Master/texmf-dist/doc/latex/rubik/rubikrotation.1 index c3c8c655b02..17a03ab2e01 100644 --- a/Master/texmf-dist/doc/latex/rubik/rubikrotation.1 +++ b/Master/texmf-dist/doc/latex/rubik/rubikrotation.1 @@ -1,12 +1,12 @@ -.\" copyright (c) 2014--2017 A Syropoulos and RWD Nickalls +.\" copyright (c) 2014--2018 A Syropoulos and RWD Nickalls .\" rubikrotation.1 .\" place this file in: /usr/share/man/man1/ .. .TH rubikrotation.1 .SH NAME -.B rubikrotation (v4.0) +.B rubikrotation (v5.0) .SH AUTHORS -A. Syropoulos and R.W.D. Nickalls (3rd March 2017) +A. Syropoulos and R.W.D. Nickalls (25 February 2018) dick[at]<nickalls><org> asyropoulos[at]<yahoo><com> @@ -14,11 +14,13 @@ A. Syropoulos and R.W.D. Nickalls (3rd March 2017) .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 +is a Perl script for processing Rubik cube rotations (3x3x3 and 2x2x2). It is part of the LaTeX rubikrotation package, and is typically CALLed by rubikrotation.sty, in response to the RubikRotation{} command: see the package manual (rubikrotation.pdf) for details. The rubikrotation package is part of the LaTeX Rubik `bundle'. The latest version can be downloaded from .PP 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). +rubikrotation reads Rubik state data and commands (sequence of rotations) from an input file, and writes the new state data to an output file. The input and output filenames can be specified as command-line arguments (see: command-line use). + +If a configuration file exists (rubikrotation.cfg) then it will be automatically be read by rubikrotation.sty. .SH COMMAND-LINE USE rubikrotation [-h|--help|-v|--version] [-o <outfile>] -i <infile> @@ -26,6 +28,9 @@ rubikrotation [-h|--help|-v|--version] [-o <outfile>] -i <infile> .B -h displays the help info and exits. +.B -v +displays the version info and exits. + .B -i defines the input filename. 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). @@ -43,6 +48,8 @@ To view rubikrotationPL.pdf, type: texdoc rubikrotationPL To view rubikcube.pdf, type: texdoc rubikcube +To view rubiktwocube.pdf, type: texdoc rubiktwocube + To view rubikexamples.pdf, type: texdoc rubikexamples To view rubikpatterns.pdf, type: texdoc rubikpatterns diff --git a/Master/texmf-dist/doc/latex/rubik/rubikrotation.pdf b/Master/texmf-dist/doc/latex/rubik/rubikrotation.pdf Binary files differindex 13274cb9571..f7fbd7db061 100644 --- a/Master/texmf-dist/doc/latex/rubik/rubikrotation.pdf +++ b/Master/texmf-dist/doc/latex/rubik/rubikrotation.pdf diff --git a/Master/texmf-dist/doc/latex/rubik/rubikrotationPL.pdf b/Master/texmf-dist/doc/latex/rubik/rubikrotationPL.pdf Binary files differindex 0065929b066..c94465bd1a7 100644 --- a/Master/texmf-dist/doc/latex/rubik/rubikrotationPL.pdf +++ b/Master/texmf-dist/doc/latex/rubik/rubikrotationPL.pdf diff --git a/Master/texmf-dist/doc/latex/rubik/rubiktwo-doc-figA.pdf b/Master/texmf-dist/doc/latex/rubik/rubiktwo-doc-figA.pdf Binary files differnew file mode 100644 index 00000000000..59f451f3497 --- /dev/null +++ b/Master/texmf-dist/doc/latex/rubik/rubiktwo-doc-figA.pdf diff --git a/Master/texmf-dist/doc/latex/rubik/rubiktwocube.pdf b/Master/texmf-dist/doc/latex/rubik/rubiktwocube.pdf Binary files differnew file mode 100644 index 00000000000..f00d979c2f0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/rubik/rubiktwocube.pdf diff --git a/Master/texmf-dist/scripts/rubik/rubikrotation.pl b/Master/texmf-dist/scripts/rubik/rubikrotation.pl index 05e69ef0049..d9b02d5a473 100755 --- a/Master/texmf-dist/scripts/rubik/rubikrotation.pl +++ b/Master/texmf-dist/scripts/rubik/rubikrotation.pl @@ -4,71 +4,119 @@ use Fatal; use warnings; ## - our $version = "v4.0 (03 March 2017)"; + our $version = "v5.0 (25 February 2018)"; ## ## rubikrotation.pl - ## VERSION 4.0 + ## VERSION 5.0 ## - ## Copyright 03 March 2017, + ## Copyright February 2018, ## RWD Nickalls (dick@nickalls.org) ## A Syropoulos (asyropoulos@yahoo.com) ## + ## HISTORY + ##------------------------------- + ## v5.0 (25 February 2018) ##------------------------------- - ## 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.2h (07 February 2018) + ## --- adjusted the no of leading dots for the gprint command + ## when writing the up, down,.. colour state to the log file + ## so as to make the array form a square block (ie easier to read) + ## (in MAIN) ## - ## 4) v3.2c: added new commands: - ## \RotationSequenceName{} - ## \RotationSequenceClean{} + ## 4.2g + ## --- 29 October 2017 added syntax checking for (( )) /inside/ squarebrackets + ## (in SUB checksyntax) + ## --- 24 October 2017 changed {};--> (), in SequenceNameNew (in SUB writestate) + ## this repairs these chars back to their original state. + ## --- 22 October 2017 minor adjustments to syntax checking (in SUB checksyntax) + ## to allow some extra chars in the [name] and <info> blocks. + ## Ideally, we want to be able to use /any/ chars inside these infoblocks. ## - ## 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 + ## 4.2f + ## --- 05 Oct 2017 bugfix: added a ShowSequence [\space] bug fix in SUB checksyntax + ## --- 04 Oct 2017 adjusted brackets < > error messages (lines 2643--2659) + ## + ## 4.2e: (29 Sept 2017) + ## --- added a ``Western'' notation filter (provisional \& works) + ## + ## 4.2d: (10 August 2017) + ## --- placed a checkstate() command inside the rotation keyword + ## and stopped TEX writing the keyword checkstate to the rubikstate.dat file + ## + ## 4.2c: (2 August 2017) + ## --- added new rubikkeyword "cubesize" to hold cube size (three or two) + ## so we can tell which sort of cube is being processed + ## We can use this to detect when using the TwoRotation command + ## (for the TWOcube) vs when using the RubikRotation command + ## (for the THREEcube); for eample with regard to random rotations + ## (see random SUB; see RubikTwoCube.sty) + ## + ## 4.2b: (1 Aug 2017) + ## --- Removed the random,0 option --> n=50 (random SUB) + ## a zero or missing integer now generates an error message. ## - ## 6) v3.2e:(25 Sept 2016) + ## 4.2a: (28 July 2017) + ## --- bugfix: error if spaces in RubikRotation{random,n} string from LaTeX. + ## Fixed to accommodate spaces, and uppercase random (lines 366 -- 388 approx) + ## + ##------------------------------- + ## v4.0 (3 March 2017) + ##------------------------------- + ## changes in v3.6 (January 2017) + ## --- included Jaap Rm and Rc notation + ## --- new sub for improved expansion of mod-4 multiples of rotations (Oct 2016) + ## --- restructured to facilitate processing arrays through the rotation sub + ## --- included option for an <info> block + ## --- included Randelshofer superset ENG 3x3 notation + ## --- implemented an `inverse' mode + ## --- improved syntax checking + ## --- used perltidy to polish the program layout + ## (but only when making the pdf documentation-- see file rubikrotationPL.pdf) + ## --- included a lot of new subroutines + ##-------------------------------- + ## changes in v3.2: + ## v3.2h: (2 Oct 2016) + ## improved the mod 4 routine using SUB rubikmod() + ## improved comments to log file re: rotation processing + ## + ## 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 + ## 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 ## + ## v3.2c: added new commands: + ## \RotationSequenceName{} + ## \RotationSequenceClean{} + ## + ## v3.2a: added a \RubikSeqNEW{...} output line in the output file + ## to facilitate typesetting the rotation sequence (works OK just now) + ## + ## v3.2: --- added leading ... to the comments written by the <writestate> sub + ## (the ... code indicates that comments are written by the Perl script) + ## --- changed the word program, prog --> script ##-------------------------------- - ## 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 v3.0: + ## --- accepts command-line arguments for input (mandatory) and output (optional) filenames + ## default output filename is: rubikOUT.txt + ## --- included the symbols [ and ] to denote a rotation-name label (ie as well as *) + ## --- 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.3: + ## --- accepts a single commandline argument (datafilename) + ## --- 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 + ## changes in v2.2: + ## --- changed licence --> LatexPP + ## --- included random n errors in ERROR messages (lines 492--495) + ## --- included version number in error message ##------------------------------ # # This file is part of the LaTeX rubikrotation package, and @@ -98,16 +146,16 @@ ## three associated with each XYZ axis. ##---------------------------------------------------------------------- - ##------------------ MAIN -------------------------- - + ##==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), + ## reads in the rubik state data file =rubikstate.dat (written by rubikrotation.sty), ## 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'') + ## Each line of the input file (rubikstate.dat) is a comma separated list of arguments. + ## The first argument in each line of the file rubikstate.dat is a rubikkeyword. + ## ##--------------- ## set autoflush for outputs ## $|=1; @@ -198,11 +246,12 @@ our $erroralert = ""; # error flag our $errornumber = 0; #set number of errors to zero - gprint ("...reading the current rubik state (from File: $source_file)"); + gprint ("...reading the current cube state (from File: $source_file)"); our $dataline = ""; our $newdataline =""; our $rubikkeyword = ""; + our $cubesize = ""; ## to hold the size, as three (Rubik) or two (twocube) our $rotationcommand = ""; our @data=(); @@ -215,6 +264,10 @@ our $SequenceLong=""; our $SequenceInfo=""; + + our $jrcode = 0; ## We initialise a loop counter for use in the rotation sub + ## (see line 624) + #---------inverse mode------------ # a keyword INVERSE or inverse in an infoblock <..> # FLAG is set (line 400) in response to detecting an infloblock. @@ -238,9 +291,10 @@ $dataline = $_; # grab the whole line as a string chomp $dataline; # remove the line-ending character - ## now we can clean whitespace + ## clean leading and trailing whitespace $dataline = cleanstring($dataline); - + + #check syntax of the string $rotationcommand=$dataline; ## needed for error messages CheckSyntax($dataline); @@ -252,24 +306,47 @@ #------------------------- ## we have 10 fields (0--9) - ## check for rubikkeyword= up,down,left,right,front,back,checkstate,rotation: + ## check for rubikkeyword= cubesize, up,down,left,right,front,back,checkstate,rotation: $rubikkeyword=$data[0]; - if ($rubikkeyword eq 'up') { gprint ("...$dataline"); + ##-------------------------------- + ## RWDN 2 August 2017 + ## introduced keyword cubesize so prog can distinguish + ## between a TWOcube and an THREEcube. + ## Here we check for the rubikkeyword `cubesize' + ## cubesize is currently only being used to change the array size in random SUB + if ($rubikkeyword eq 'cubesize') { + gprint ("..."); + $rotationcommand=$dataline; ## used in output message + gprint ("...command = $rotationcommand"); + $cubesize = RemoveAllSpaces($data[1]); + if ($cubesize eq "two") {gprint ("...cube = TWOcube")}; + if ($cubesize eq "three") {gprint ("...cube = THREEcube")}; + gprint ("..."); + next LINE ; + }; + ## ------------------------------------ + + ## RWDN 7 February 2018 + ## we vary the number of leading dots for the gprint command + ## so as to make the array of colour codes (X,W,Y, etc) form + ## a nice square when printed to the log file (the standard no is 3 dots) + + 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]; next LINE; }; - if ($rubikkeyword eq 'down') { gprint ("...$dataline"); + 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]; next LINE; }; - if ($rubikkeyword eq 'left') { gprint ("...$dataline"); + 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]; @@ -290,7 +367,7 @@ next LINE; }; - if ($rubikkeyword eq 'back') { gprint ("...$dataline"); + 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]; @@ -302,7 +379,7 @@ if ($rubikkeyword eq 'checkstate') { gprint ("..."); $rotationcommand=$dataline; ## used in output message - gprint ("...command=$rotationcommand"); + gprint ("...command = $rotationcommand"); checkstate(); next LINE ; }; @@ -314,18 +391,26 @@ ## ELSE it must be a rotation sequence --> send elements to rotation sub. - #------------------------ - if ($rubikkeyword eq 'rotation') - { - gprint ("..."); + if ($rubikkeyword eq 'rotation') + + { ## this IF runs down to near end of MAIN + + ##RWDN 10 Aug 2017 + ## moved checkstate to be inside rotation (so a next LINE will terminate prog) + gprint ("..."); + gprint ("...rotation keyword"); + checkstate(); + + + gprint ("..."); ## logfile marker for begining of `rotation/random' process # 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"); - + gprint ("...command = $rotationcommand"); + # need to check that a second argument exists (else --> ErrorMessage). # ---should be either `random', # ---or a macroname for a rotation sequence, @@ -341,30 +426,72 @@ - ##-----random----------------- - ## if second argument = random, + ##---------keyword = random----------------- + ## (command used for scrambling the cube) + ## if second argument in $dataline = 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/) { - ## 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 + ## if so send integer --> random sub. + + ##---------------------------- + ## (28 July 2017: RWDN) : bugfix: + ## better syntax checking required for the <random,n> command + ## as spaces before or after commas caused errors. + ##----------------------------- + + + ## allow upper and lowercase keyword random + if ( lc( $data[1] ) =~ m/random/ ) + { + ## the string contains the keyword random + + ## now check for missing comma after the keyword + if ( lc( RemoveAllSpaces($data[1]) ) ne "random" ) + {## error, ? missing comma + ErrorMessage("[$data[1]] --- missing comma after `random' "); + next LINE; + }; + + ## now check for the trailing integer + + if ( ( lc( RemoveAllSpaces($data[1]) ) eq "random") and ($data[2] eq "") ) + { + ## missing integer + ErrorMessage("[$data[2]] --- missing integer after `random,'"); + next LINE; + }; + + + if (RemoveAllSpaces($data[2]) =~ /\D/) + { + ## Note that the \D operator sees , 23, as a word not an integer. + ## so if true then cannot be a number (D matches word and space elements) + ErrorMessage("[$data[2]] --- this is not an integer"); next LINE; - } - else{ - ## the next argument is an integer (n), so we do n random rotations - random($data[2]); - next LINE; - }; - } ## end of IF - #--------------- + } + else {## string consists of one or more integers + ## check to see if more than one integer exists + ## by seeing if the string changes if we remove all the spaces + ## (note we have to use a string with the m operator) + my $RAS = RemoveAllSpaces($data[2]); + if ($data[2] =~ m/$RAS/ ) + { + ## OK so this must be a single integer + ## so we can now do n random rotations + ## by sending the integer to the random SUB + random($data[2]); + next LINE; + } + else {## there must be spaces separating several integers; + ErrorMessage("[$data[2]] --- only one integer allowed"); + next LINE; + }; + }; ## end of else + } ## end of IF + ##----------------------------------------------------------- else { - # -----rotation sequence--------- - # the line must be a rotation sequence line, so send the sequence + ## -----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 @@ -372,17 +499,36 @@ # 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 + #----<infoblocks>--------------------------- + + # infoblocks are strings bounded by angle brackets <..> + # and are designed for holding metadata. + # + # Multiple comma separated infoblocks are allowed (but NOT nested). + # All infoblocks are eventually concaternated into a colon separated string, and + # returned into the OUT file (= rubikstateNEW.dat) as the macro \SequenceInfo. + # + # We process and then remove any infoblocks which exist. + # infoblocks are chars delimited by <...> + # + # The SUB infoblockcolon replaces any commas with a colon (so as to + # facilitate string manipulation, and allows us to distinguish between + # a string and a data array), and returns a new string (= $newdataline). + # + # The RubikRotation argument allows <infoblocks> for carrying special + # keywords, eg <inverse> which can be used to influence the process. # If several infoblocks exist, then we collect the contents into # variable SequenceInfo, and separate them with a colon; + # + # The SUB cutinfoblock returns TWO strings: + # (1) the name of the new revised string = newdataline, (with infoblocks removed) + # (2) the contents of the infoblock = $SequenceInfo + infoblockcolon($dataline); + + ## rename the returned newdataline string to dataline + ## and reinitialise the string newdataline so it can be used again. $dataline=$newdataline; $newdataline=""; ## reset the variable @@ -393,28 +539,42 @@ ## 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; + cutinfoblock($dataline); + # best to use the whole word <inverse> to avoid errors + # best to force lowercase so users can type the word as they want + + if ( lc($SequenceInfo) =~ m/(inverse)/) { + ## set a FLAG + $directionflag=$inverse; print " FLAG set to = $inverse\n"; }; - # append each infoblock to an array - push @seq, $SequenceInfo; - $dataline = $newdataline; + # 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); + - #---------------------------------- + #--------repeat blocks-------------------------- + ## there are now no more infoblocks, so we now look for repeat-blocks. + ## these are embedded inside the rotation sequence - ## reformulate any repeat blocks (,) --> {;} if they exist + ## we first 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. + ## so we look for curved brackets ie indicating a repeat block, and + ## if we find a ( we then send the dataline to the SUB fixrepeatelement() + ## the SUB fixrepeatelement() then returns the new revised dataline string + ## containing the FIRST repeat block which has been expanded. + ## If there is another ( then we repeat the procedure until all + ## repeat blocks have been expanded, and incorporated into the mail rotation string. + while ( (index $dataline, '(') !=-1 ){ fixrepeatelement ($dataline); $dataline=$newdataline; @@ -422,7 +582,8 @@ }; ## rename remaining dataline string as SequenceShortBrace - ## since if there are any repeat blocks, they are now reformulated with braces + ## since if there are any repeat blocks, they are now reformulated with braces and semicolons + ## ie (,) --> {;} etc $SequenceShortBrace=$dataline; @@ -450,16 +611,18 @@ #-----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. + # since the `rotating' keyword has been removed from the string, + # we can replace (repair to original state) any braces or or semicolons + # around repeat strings (if exist) and then rename it as SequenceShort + # which we will output at the end (in SUB writestate). + if ( (index $SequenceShortBrace, '{') !=-1 ) { - print " repairing braces--> ()\n"; + print " repairing braces and semicolon--> ()\n"; ## swap: BBook p 138--139 - $SequenceShortBrace =~ tr/\{/(/; # swap , --> ; - $SequenceShortBrace =~ tr/\}/)/; # swap ( --> { - $SequenceShortBrace =~ tr/;/,/; # swap ) --> } + $SequenceShortBrace =~ tr/\{/(/; # swap { --> ( + $SequenceShortBrace =~ tr/\}/)/; # swap } --> ) + $SequenceShortBrace =~ tr/;/,/; # swap ; --> , }; #rename to SequenceShort @@ -474,12 +637,8 @@ 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. @@ -511,7 +670,7 @@ }; } # end of else - }; # end of IF (rotation keyword) + }; # end of IF ( re: rotation keyword) #---------------------------------------------- ## place any new keywords for processing here @@ -574,19 +733,27 @@ print " SUB rotation\n"; ## grab a copy of the element (char) for use if m Mod4=0 $originalrcode=$rcode; - - ## increment the loop counter (initialised in MAIN) + + + ## increment the LOOP counter + ## (initialised using <our> in MAIN = line 226) + ## for use in the rotation SUB. + ## This counter is used to identify the first element (rcode) + ## and used to grab [name] --> SequenceName. $jrcode=$jrcode+1; ## increment rotation element (char) counter - ## ---------------------------------- + ## -----check for [nameblocks]----------------------------- + ## ## 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 + ## 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? + ## BUT if trailing comma is missing, then (error as next rotation will be included + ## as part of the label) so need to trap this and + ## make the test: is first AND last char a sq bracket? + ## (strictly only need to look at /first/ char, as the early syntax check will have + ## detected any unbalanced brackets already) if ( (substr ($rcode,0,1) =~ /\[/) and (substr ($rcode,-1) ) =~ /\]/) { @@ -594,24 +761,28 @@ print " SUB rotation\n"; if ($directionflag eq $inverse) { # do nothing - } + } else{ - ## if this `label' is also the FIRST element, then label = name + ## if this `label' is also the FIRST element, then label = nameblock if ($jrcode ==1) {$SequenceName=$rcode}; }; # end of IF - ## now get next rotation element - next; - }; ## 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. + ##-------check for (repeatblocks)--------------------------------- + ## + ## we have already replaced any repeat chars (,) with {;} + ## so we now check for elements with leading { and then expand them + ## the appropriate number of times. + ## Note that the actual expansion is done by SUB repeat() ## Note that if there is NO comma before the {} of a {repeat block}, then ## the true repeat block will not be recognised by the @@ -743,6 +914,32 @@ print " SUB rotation\n"; ## ie will not be in the following list, and hence will be trapped as an error, eg R3) + +##----------------------- +## RWDN Sept29 2017 testing to fix WESTERN notation problem +## arrange for user to be able to include <western> in metadata etc +## -- as this will mean that one can store these algorithms as a macro + + if ( lc($SequenceInfo) =~ m/(western)/ ) { + + if ($rcode eq "l") {$rcode = "Lw"; gprint ("...WESTERN NOTATION: rotation l --> Lw, OK") }; + if ($rcode eq "lp") {$rcode = "Lwp"; gprint ("...WESTERN NOTATION: rotation lp --> Lwp, OK") }; + if ($rcode eq "r") {$rcode = "Rw"; gprint ("...WESTERN NOTATION: rotation r --> Rw, OK") }; + if ($rcode eq "rp") {$rcode = "Rwp"; gprint ("...WESTERN NOTATION: rotation rp --> Rwp, OK") }; + if ($rcode eq "f") {$rcode = "Fw"; gprint ("...WESTERN NOTATION: rotation f --> Fw, OK") }; + if ($rcode eq "fp") {$rcode = "Fwp"; gprint ("...WESTERN NOTATION: rotation fp --> Fwp, OK") }; + if ($rcode eq "b") {$rcode = "Bw"; gprint ("...WESTERN NOTATION: rotation b --> Bw, OK") }; + if ($rcode eq "bp") {$rcode = "Bwp"; gprint ("...WESTERN NOTATION: rotation bp --> Bwp, OK") }; + if ($rcode eq "u") {$rcode = "Uw"; gprint ("...WESTERN NOTATION: rotation u --> Uw, OK") }; + if ($rcode eq "up") {$rcode = "Uwp"; gprint ("...WESTERN NOTATION: rotation up --> Uwp, OK") }; + if ($rcode eq "d") {$rcode = "Dw"; gprint ("...WESTERN NOTATION: rotation d --> Dw, OK") }; + if ($rcode eq "dp") {$rcode = "Dwp"; gprint ("...WESTERN NOTATION: rotation dp --> Dwp, OK") }; + + }; +##----------------------- + + + 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}} @@ -889,17 +1086,17 @@ print " SUB rotation\n"; ## 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") + elsif ($rcode eq "X" or $rcode eq "x" or $rcode eq "r" or $rcode eq "lp") {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") + elsif ($rcode eq "Xp" or $rcode eq "xp" or $rcode eq "l" or $rcode eq "rp") {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") + elsif ($rcode eq "Y" or $rcode eq "y" or $rcode eq "u" or $rcode eq "dp") {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") + elsif ($rcode eq "Yp" or $rcode eq "yp" or $rcode eq "d" or $rcode eq "up") {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") + elsif ($rcode eq "Z" or $rcode eq "z" or $rcode eq "f" or $rcode eq "bp") {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") + elsif ($rcode eq "Zp" or $rcode eq "zp" or $rcode eq "b" or $rcode eq "fp") {for($j=1;$j<=$m;$j++) {gprint ("...rotation $rcode, OK (= zp = Fp + Sfp + B)");&rrFp;&rrSfp;&rrB}} ## more whole cube notation @@ -955,16 +1152,14 @@ print " SUB rotation\n"; 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"); + ## DO NOT --> (next LINE;) here as need to check /all/ the rotation codes in the string. } else{ gprint ("..*rotation $rcode ERROR -- code not known ? typo or missing comma"); ErrorMessage("$originalrcode -- code not known ? typo or missing comma"); + ## DO NOT --> (next LINE;) here as need to check /all/ the rotation codes in the string. }; - # missing comma after random is a common error - if ($originalrcode =~ m/random/i ) { - ErrorMessage("$originalrcode -- ? missing comma after random"); - }; #----------------------------- next; }; #end of else @@ -980,6 +1175,7 @@ print " SUB rotation\n"; 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 @@ -988,22 +1184,48 @@ print " SUB random\n"; ## 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. +## but here I have included all the slice (Xm) ones as well. + + + ## initialise the array for the random rotations + my @rrlist = (); -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"); + ## (RWDN 2 Aug 2017): + ## now check to see if TWOcube or Rubikcube being used + ## use cubesize as the filter + + if ($cubesize eq 'two') + { + ## using the TwoRotation command (from RubikTwoCube.sty) + ## no slice rotations + ## + @rrlist = ("U", "Up", + "D", "Dp", + "L", "Lp", + "R", "Rp", + "F", "Fp", + "B", "Bp"); + } + + else { + ## using the RubikRotation command (from RubikRotation.sty) + @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"; + gprint ("...random SUB: rrlistnumber (array size) = $rrlistnumber"); # these are numbered 0--$rrlistnumber, ## let default no of random rotations for scrambling = 50 -my $defaultn = 50; +my $defaultn = 50; ## RWDN (1 Aug 2017): not being used any more my $maxn = 200; ## grab the integer passed from the random() command in main @@ -1011,16 +1233,18 @@ my $maxn = 200; 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)")}; + ErrorMessage ("random: max n = 200 (n=200 was used)")} + elsif ($s == 0) {## $s = $defaultn; + gprint ("..*ERR: integer n = 0 (invalid)"); + ErrorMessage (" --- integer n = 0 (invalid)"); + next LINE; + }; my @rr; ## array to hold all the random rotations print " randomising the available rotations\n"; - ## set the seed for the randomisation (BlackBook p 235) + ## set the seed for the randomisation (Perl BlackBook p 235) srand; ## now select s numbers at random (with replacement) from range 0--listnumber+1 @@ -1040,7 +1264,7 @@ 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"); + gprint ("...scrambling cube using $s random rotations"); ## now send the array off to the rotation sub @@ -1061,7 +1285,7 @@ print " SUB writestate\n"; 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 "\\typeout{...writing new cube 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"); @@ -1109,7 +1333,16 @@ if ($numberofcharsinstring <= 2) $SequenceNameNew = substr($SequenceName,1,$nmiddlecharsinstring); }; - + ## RWDN 24 October 2017 + ## swap char changes back before writing output string + ## only swap the brackets + ## (do NOT swap ; --> , as ONLY use commas /outside/ infoblocks and between rotation sequences) + ## swap: BBook p 138--139 + + $SequenceNameNew =~ tr/\{/(/; # swap { --> ( + $SequenceNameNew =~ tr/\}/)/; # swap } --> ) + + print (TeX_OUT_FILE "\\renewcommand\\SequenceName\{$SequenceNameNew\}\%\n"); print (TeX_OUT_FILE "\\typeout{...SequenceName = $SequenceNameNew}\%\n"); @@ -1118,9 +1351,9 @@ 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 +## we need to preserve any {} structures in the info string (as used by Kociemba), +## so we have to change { } --> [ ] since otherwise they will disappear +## or cause an error when printed in LaTeX $SequenceInfo=~ tr/\{/\[/; ## swap { --> [ $SequenceInfo=~ tr/\}/\]/; ## swap } --> ] @@ -1142,7 +1375,7 @@ print (TeX_OUT_FILE "\\renewcommand\\SequenceShort\{$SequenceShort\}\%\n"); print (TeX_OUT_FILE "\\typeout{...SequenceShort = $SequenceShort}\%\n"); ##----------------------- - +##-----------SequenceLong------------------- ## 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 @@ -1274,27 +1507,34 @@ print " SUB checkstate\n"; if ($R >9){ ErrorMessage("red cubies > 9 (=$R)"); - gprint ("..*red cubies > 9 (=$R)") }; + gprint ("..*red cubies > 9 (=$R)"); + }; if ($O >9){ ErrorMessage("orange cubies > 9 (=$O)"); - gprint ("..*orange cubies > 9 (=$O)") }; + gprint ("..*orange cubies > 9 (=$O)"); + }; if ($Y >9){ ErrorMessage("yellow cubies > 9 (=$Y)"); - gprint ("..*yellow cubies > 9 (=$Y)") }; + gprint ("..*yellow cubies > 9 (=$Y)"); + # next LINE + }; if ($G >9){ ErrorMessage("green cubies > 9 (=$G)"); - gprint ("..*green cubies > 9 (=$G)") }; + gprint ("..*green cubies > 9 (=$G)"); + }; if ($B >9){ ErrorMessage("blue cubies > 9 (=$B)"); - gprint ("..*blue cubies > 9 (=$B)") }; + gprint ("..*blue cubies > 9 (=$B)"); + }; if ($W >9){ ErrorMessage("white cubies > 9 (=$W)"); - gprint ("..*white cubies > 9 (=$W)") }; + gprint ("..*white cubies > 9 (=$W)"); + }; if ($X == 54){ ErrorMessage("no colours allocated (X=54)"); @@ -1979,6 +2219,7 @@ print " SUB rubikmod\n"; sub cleanstring { # to clean leading and trailing whitespace from a string + # from Black Book page 147 my $line=""; @@ -2150,11 +2391,19 @@ print " SUB rubikmod\n"; sub repeat { - # to expand the repeating elements + print " SUB repeat\n"; + + ## this SUB expand the repeating elements + ## this SUB receives a repeat string in the form {L,R, }3 + ## The original () were converted (above) into {} so we can distinguish the brackets. + ## we than extract the code sequence and the terminal repeat number + ## Then we join n copies of the code string to form a long cs string. + ## then we insert this new long string into the main rotation sequence without the {} + ## Ultimately the fully expanded rotation sequence is fed into SUB rotation for processing. + -print " SUB repeat\n"; - ## pass the whole repeatstring = {...}n + ## grab the whole repeatstring = {...}n my $repeatstring = $_[0]; # the string ={code}n @@ -2184,6 +2433,8 @@ print " SUB repeat\n"; print " p = $p\n"; print " q = $q\n"; + ##----------------------- + ## now get the repeat number if ($lenrepeatcode == ($lenrepeatstring-2)) { print " there is no trailing number --> 1\n"; @@ -2206,9 +2457,10 @@ print " SUB repeat\n"; }; }; #end of else - + ##------------------- - ## make n copies of repeatcode + ## now make n copies of repeatcode and name the string = $insert + ## (which is then used by another part of the prog) ## we need commas only between elements (not at end) $insert=""; ## $insert = global @@ -2390,7 +2642,7 @@ print " SUB repeat\n"; sub RemoveAllSpaces { # remove all spaces in a string - # Black book page 143 + # from Black book page 143 my $string=$_[0]; @@ -2404,22 +2656,24 @@ print " SUB repeat\n"; 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 + ## this check is used at an early stage in the program, so we can terminate early + ## if necessary. We check that all () {} <> are matched (if any exist), + ## missing commas, illegal combinations of chars etc. + ## if any serious errors (eg brackets 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 + ## first clean out all spaces in a string + ## so we can then look for specific combinations of characters $dataline=RemoveAllSpaces($dataline); print " dataline = $dataline\n"; - - - + ##------------------------------------- + ## first we check for unbalanced brackets ## count brackets; Angle, Square, Curved my ($nleftA, $nrightA) = 0; my ($nleftS, $nrightS) = 0; @@ -2440,77 +2694,124 @@ sub CheckSyntax { 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 ) + ## Square brackets { - gprint ("..*brackets ERROR [ ] Left [$nleftS not equal to Right $nrightS]"); - ErrorMessage ("brackets [ ]: Left [$nleftS not equal to Right $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 ) + ## Curved brackets { - gprint ("..*brackets ERROR ( ) Left ($nleftC not equal to Right $nrightC)"); - ErrorMessage ("brackets ( ): Left ($nleftC not equal to Right $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 ) + ## Angle brackets { - gprint ("..*brackets ERROR < > Left <$nleftA not equal to Right $nrightA>"); - ErrorMessage ("brackets < >: Left <$nleftA not equal to Right $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 + ## check for other bad syntax, eg illegal pairings of characters + ## BlackBook p136 my ($char1, $char2, $charpair) = ""; my ($j, $lenstring) = 0; $lenstring= length $dataline; - print "lenstring = $lenstring\n"; + print " lenstring = $lenstring\n"; + + + ## we set up a system which allows us to know whether or not we are + ## inside a set of brackets. To do this we increment / decrement counters + ## each time we pass through a bracket. + ## If sum NOT equal to zero, then we are inside etc. + + ## first initialise each left and right variable. + ## seems important that these initialisations are done separately. + + my $angleNumLeft = 0; + my $angleNumRight = 0; + my $angleNumSum = 0; + + my $squareNumLeft = 0; + my $squareNumRight = 0; + my $squareNumSum = 0; + + my $curvedNumLeft = 0; + my $curvedNumRight = 0; + my $curvedNumSum = 0; + - # set initial state of inout-flag - my $angleflag = "outside"; - my $squareflag = "outside"; - my $curvedflag = "outside"; + ## look at each char, and each pair of chars + ## with brackets, we increment (right) and decrement (left) the count + ## so we can tell if we are inside or outside a set of nested brackets. + ## (we need to detect errors in the rotation sequence itself + ## and also inside squarebrackets] since these can occur anywhere, + ## but not in the angle infoblocks <..> where we want to be able to write anything) - # 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"}; + ## at top of FOR loop + if ($char1 eq '<'){ $angleNumLeft = $angleNumLeft+1}; + if ($char1 eq '>'){$angleNumRight = $angleNumRight-1}; + if ($char1 eq '['){$squareNumLeft = $squareNumLeft+1}; + if ($char1 eq ']'){$squareNumRight = $squareNumRight-1}; + + if ($char1 eq '('){$curvedNumLeft = $curvedNumLeft+1}; + if ($char1 eq ')'){$curvedNumRight = $curvedNumRight-1}; + + + $angleNumSum = $angleNumLeft + $angleNumRight; + $squareNumSum = $squareNumLeft + $squareNumRight; + $curvedNumSum = $curvedNumLeft + $curvedNumRight; - if ($angleflag eq "outside"){ - + ##RWDN 22 Oct 2017 + + ##------------ + ## need to trap nested (( )) inside squarebrackets + + if ($squareNumSum != 0) { + if ( $charpair =~ m/(\(\(|\)\))/ ) + { # nested curved brackets inside sq brackets + gprint ("..*syntax error: $charpair -- nested ((..)) in [ ]"); + ErrorMessage("$charpair -- syntax error: nested ((..)) not allowed in [ ]"); + $errorflag="SET"; + }; + }; + ##-------------- + + ## if outside angle brackets AND outside square brackets + ## then we are checking ONLY the rotation sequence codes + + if ( ($angleNumSum == 0) and ($squareNumSum == 0) ) { + ## A-Za-z< A-Za-z[ A-Za-z( )A-Za-z >A-Za-z ]A-Za-z ## ]< ][ ]( ]) ]< )< )[ )( >< >[ >( d( d[ d< @@ -2522,32 +2823,25 @@ sub CheckSyntax { next; }; - # trap nested curved brackets - if ( ($char2 eq "(" ) and ($curvedflag eq "inside" ) ) { + # trap nested curved brackets (= inside) + if ( ($char2 eq "(" ) and ($curvedNumSum != 0) ) { ## 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 - + #-----remove-------------------------------------- + # trap comma inside [ ] ( eq inside) + # if ($squareNumSum != 0){ + # 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}; @@ -2565,6 +2859,35 @@ sub CheckSyntax { gprint ("..*Quiting Perl program -- syntax error"); ErrorMessage ("QUITTING PERL PROGRAM -- syntax error"); + ##------bug fix----------------------- + ## RWDN 5 October 2017 + ## problem = since we are here checking syntax (ie before processing any + ## output SequenceXX strings) all four SequenceXX strings will be empty just now. + ## This then causes an error if the Rubik user code includes a ShowSequence command, + ## since the ForEachX macro used by ShowSequence macro cannot handle an empty string + ## when dealing with SequenceShort and SequenceLong. + ## So we heve to force these two strings to be just a [\space] before they are output + ## by the SUB writestate. + ## ie we set SequenceShort and SequenceLong strings to \space here before + ## CALLing the SUB quitprogram(). + ## (to avoid a Rubikcube ShowSequence{}{}{} error if argument is empty + ## or is an expandable macro) + ## This problem arises because the ShowSequence macro uses the ForEachX macro + ## to process each cs element in a string. + ## Also need to add at least one empty char or comma at end of SequenceLong string, + ## as final char (comma) is removed when writing to the out file in SUB writestate + ## (CALLed by SUB quitprogram) just prior to closing down. + ## NB: if there is no extra terminal char for SequenceLong string, + ## then \space --> \spac --> TEX error message + ## + ## This issue does not seem to be a problem for SequenceInfo and SequenceName, + ## as they are not returned as cs strings. + + $SequenceShort="\\space"; + $SequenceLong= "\\space,"; + + ##--------------------------- + print " closing down -- writing state........... OK\n"; quitprogram(); @@ -2599,4 +2922,5 @@ return $newE; } ##====================== +##EOF diff --git a/Master/texmf-dist/source/latex/rubik/rubikcube.dtx b/Master/texmf-dist/source/latex/rubik/rubikcube.dtx index 4f57d98a0ee..c9812ed4bad 100644 --- a/Master/texmf-dist/source/latex/rubik/rubikcube.dtx +++ b/Master/texmf-dist/source/latex/rubik/rubikcube.dtx @@ -1,9 +1,9 @@ % \iffalse meta-comment % rubikcube.dtx % -% version v4.0 (03 March 2017) +% version v5.0 (February 25, 2018) % -% Copyright 2017 +% Copyright 2018 % RWD Nickalls (dick@nickalls.org) and % A Syropoulos (asyropoulos@yahoo.com) % @@ -19,7 +19,7 @@ % This work consists of the files rubikcube.dtx and rubikcube.ins % and the derived file rubikcube.sty. % -%<*readme> +%<*readme> % % The rubikcube package provides a collection of LaTeX commands and macros % for the typesetting of Rubik cube configurations and rotation @@ -41,6 +41,8 @@ (Generate rubikcube.sty by (La)TeXing rubikcube.ins, and then^^J process rubikcube.dtx again)^^J}\stop }% +\pagestyle{myheadings} +\markright{\texttt{rubikcube} \ \ (Rubik bundle v5.0, 2018) \ \ \texttt{www.ctan.org/pkg/rubik}} \usepackage{ifpdf} \usepackage{url,path} %% for references \usepackage{supertabular} %% for Notation table @@ -62,7 +64,7 @@ % % % -%%% \CheckSum{5683} +%%% \CheckSum{6231} % %%% \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 @@ -118,33 +120,39 @@ % % 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, and relates only to the -% familiar 3x3x3 Rubik cube. +% and macros for typesetting Rubik cube (3x3x3) configurations using the +% PGF/TikZ graphic languages. % 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 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, +% The \rubikcube\ package is the `base' package of the bundle, and is required by all of +% the Rubik packages; it deals primarily with typesetting 3x3x3 cube (Rubik cube) +% configurations. +% The \textsc{rubikrotation} package processes rotation sequences and keeps track of +% the cube's configuration during rotations. +% The \textsc{rubikpatterns} package is a small database of 3x3x3 (Rubik) cube rotation +% sequences which generate well-known named cube configurations (patterns). +% The \textsc{rubiktwocube} package allows the typesetting of 2x2x2 cube (Two cube) +% configurations. +% +% Full 3x3x3 functionality requires the following packages to be loaded +% (TikZ first; \textsc{rubikcube} second), as follows: %\begin{verbatim} -% \usepackage{tikz,rubikcube,rubikrotation,rubikpatterns} +% \usepackage{tikz} +% \usepackage{rubikcube,rubikrotation,rubikpatterns} %\end{verbatim} +% Full 2x2x2 functionality requires the \textsc{rubiktwocube} package \textit{in addition} to the +% packages listed above. % 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 GNU-Linux platform (Debian 8.2.0 -% and {\TeX}Live 2016), and on a Solaris platform (OpenIndiana). +% and {\TeX}Live 2017), 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), Hofstadter (1981), Hutchings~(2011), +% Davis (2006), Fung website, 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 @@ -152,7 +160,10 @@ % 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). +% (see References for details). +% +% For historical and technical details regarding Rubik's cube see Sher (2014), +% and also the Wikipedia article \textit{Rubik's Cube}. % % % \subsection{Requirements} @@ -161,9 +172,8 @@ % 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. +% The \textsc{rubikrotation} package (see below) +% requires Perl to be installed. % % % \subsection[rubikrotation package]{Supporting tool---the @@ -186,19 +196,19 @@ % package requires (a)~Perl to be installed, % 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. +% to the \texttt{shellesc} package (this can always be downloaded from CTAN directly). % See the \textsc{rubikrotation} documentation for further details. +% See also the examples in the file \texttt{RubikExamples.pdf}. % % % -% \subsection[rubikpatterns]{Supporting database---\textsc{rubikpatterns.sty} } +% \subsection[rubikpatterns]{Supporting database---\textsc{rubikpatterns} package } % \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 +% is a small database of some well-known 3x3x3 cube (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*)>} @@ -213,15 +223,30 @@ % \usepackage{tikz,rubikcube,rubikrotation,rubikpatterns} % ... % \RubikCubeSolved -% \RubikRotation{\fourspot} +% \RubikRotation{\fourspot} % this runs the Perl program \texttt{rubikrotation.pl} % \ShowCube{2.4cm}{0.6}{\DrawRubikCubeRU} %\end{verbatim} +% The sequence itself can be readily typeset using the \cmd{\ShowSequence} command +% (see Section~\ref{sec:showsequence}). % See also the \textsc{rubikrotation} documentation---especially -% Section~5.1.1 \textit{Sequences as macros}. +% Section~5.1.1 \textit{Sequences as macros}. +% See also the examples in the file \texttt{RubikExamples.pdf}. +% % % +% \subsection[rubiktwocube]{Supporting 2x2x2 package---\textsc{rubiktwocube} package } +% \label{sec:patterns} +% +% The \textsc{rubiktwocube} package carries the macros and commands necessary +% for processing and displaying 2x2x2 cubes (TwoCubes). The 2x2x2 commands are isomorphic +% with the 3x3x3 commands---i.e.,~the word `\texttt{Two}' has replaced the +% word `\texttt{Rubik}' in commands. +% Consequently, users of this package will need to be familiar with the \textsc{rubikcube} package. +% There are lots of 2x2x2 examples in the file \texttt{RubikExamples.pdf}. +% +% % \subsection{Copyright} -% Copyright 2014--2017 RWD Nickalls and A Syropoulos. +% Copyright 2014--2018 RWD Nickalls and A Syropoulos. % % \medskip % {\noindent}This work may be distributed and/or modified under the @@ -233,9 +258,11 @@ % % \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. +% The Rubik bundle consists of the four packages \rubikcube, \textsc{rubikrotation}, +% \textsc{rubikpatterns} and \textsc{rubiktwocube}. Although installing the Rubik bundle +% will typically install everything automatically (eg.,~from the {\TeX}Live DVD), +% each package can be installed separately if necessary. +% Here we detail only the \rubikcube\ package. % % \subsection{Generating the \rubikcube\ files} % @@ -276,14 +303,23 @@ % 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{RubikExamples file} +% +% Note that the package includes a `rubikexamples' file (\texttt{rubikexamples.pdf}), +% as well as the source file (\texttt{rubikexamples.tex}), and +% associated \texttt{.sh} (Linux) and \texttt{.bat} (Microsoft) batch +% files, which can be used to facilitate processing the source \texttt{.tex} file. +% The file \texttt{rubikexamples.pdf} showcases both 3x3x3 (Rubik cube) +% and 2x2x2 (Two cube) examples. +% +% Note that should you need to generate the file \texttt{rubikexamples.pdf} +% from the source file (\texttt{rubikexamples.tex}) you will require +% the \textsc{rubikrotation}, \textsc{rubikpatterns} and +% \textsc{rubiktwocube} packages to be installed, +% and will also need to use the \verb!--shell-escape! command-line +% option (see Section~\ref{sec:rubikrotation} for details). +% % % \subsection{Placing the files} % @@ -308,32 +344,92 @@ % \begin{quote} %\begin{verbatim} % \usepackage{tikz} -% \usepackage{rubikcube,rubikrotation,rubikpatterns} +% \usepackage{rubikcube,rubikrotation,rubikpatterns,rubiktwocube} %\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} and \textsc{rubikpatterns} packages. -% % -% \DescribeMacro{\rubikcube} -% This command generates the logo \rubikcube. +% While \rubikcube\ is a stand-alone package, for full 3x3x3 functionality it is necessary +% to load the complementary packages \textsc{rubikrotation}, \textsc{rubikpatterns}. +% For full 2x2x2 functionality you need to load all four packages. % % +% \pagebreak % % \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). +% Since all cubes are displayed or `drawn' using the TikZ picture environment, +% it is useful (initially at least) to categorise commands with regard to this environment +% (and also with regard to the \cmd{\ShowCube..} command since this +% is simply a convenient wrapper for the TikZ picture environment). +% On~this basis, we can distingush three conceptually useful categories, as follows: +% +% \begin{enumerate} +% +% \item \cmd{\Draw..} commands +% (which must \textit{always} be used \textit{inside} a TikZ picture environment), +% +% \item `parameter-allocation' commands (which can be used either inside +% or outside a TikZ environment); for example, \cmd{\RubikFace..} (for allocating +% facelet colours), and +% +% \item commands which can be used in ordinary text; for example, |\rr{}| (for typesetting +% certain rotation codes). +% +% \end{enumerate} +% From a functional point of view, however, we can view the Rubik bundle commands as +% splitting into the following groups: +% \begin{enumerate} % +% \item those that allocate colour +% to faces, facelets etc., ---these commands all start with \cmd{\Rubik} (for 3x3x3 cubes) or \cmd{\Two} +% (for 2x2x2 cubes \footnote{Requires the \textsc{rubiktwocube} package}), +% +% \item those that % draw ---these commands all start with \cmd{\Draw}, +% +% \item those that typeset rotation codes or hieroglyphs; +% ---there are just four of these for 3x3x3 cubes (these commands +% start with \cmd{\rr}, \cmd{\rrh}, \cmd{\Rubik}, +% and \cmd{\textRubik}), and an equivalent four commands for 2x2x2 cubes +% (these start with \cmd{\tr}, \cmd{\trh}, \cmd{\Two}, and \cmd{\textTwo}). +% +% \end{enumerate} + +% \medskip +% +% \DescribeMacro{\rubikcube} +% {\noindent}This command generates the logo \rubikcube. +% +% +% +% \subsection[Keywords Rubik and Two]{The keywords Rubik and Two in commands} +% \label{sec:rubikandtwo} +% +% In order to try and keep commands intuitive\,\footnote{This is a tricky problem +% given the large number of commands, so any feedback or ideas on how to avoid ambiguity, +% including pruning or revising `bad' commands, is always welcome.} +% we adopt the convention that +% the word `Rubik' in a command reflects the fact that the command +% relates to a 3x3x3 cube (i.e.,~a `Rubik' cube). Similarly, commands which relate +% to a 2x2x2 cube (a `Two' cube) ---see the \textsc{rubiktwocube} package--- +% use instead the word `Two'. +% For~example, the commands for drawing a 3x3x3 cube and a 2x2x2 cube from a RU viewpoint +% are respectively \cmd{\DrawRubikCubeRU} and \cmd{\DrawTwoCubeRU}. +% +% Having packages now for both 3x3x3 and 2x2x2 cubes (v5) means we need to be more careful regarding +% command names, and try to make commands (a)~as intuitive as possible, and (b)~use the +% same command name format for equivalent 3x3x3 and 2x2x2 commands (as shown in the example above). +% +% In keeping with this approach, some commands have had to be renamed. +% For~example, in this new version we have therefore renamed the +% earlier \cmd{\DrawFace..} commands $\rightarrow$ \cmd{\DrawRubikFace..} +% (see Section~\ref{sec:deprecated}). +% % % \subsection{Environments} % @@ -355,8 +451,9 @@ % % Consequently users need to be mindful of the environments when % 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. +% \cmd{\RubikRotation}, \cmd{\RubikFace..}, \cmd{\RubikCubeSolved}, +% outside the environments keeps their effects global +% (an example of this problem is presented in the file \texttt{RubikExamples.pdf}). % % % \subsection{Capital letters} @@ -388,7 +485,7 @@ % ---see Figure~\ref{fig:notation}. % % 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 +% for~example, the \cmd{\RubikSolvedConfig} 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. @@ -419,7 +516,7 @@ % 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. +% more details 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. @@ -452,12 +549,12 @@ % \section{Rubik cube coordinates} % \label{sec:coordinates} % -% The coordinate origin of all 2D Rubik cube images is located +% The coordinate origin of all 2D 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). +% extent of this particular 2D rendering of the 3x3x3 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 @@ -474,12 +571,13 @@ % \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 +% of the \textsc{front} face as the origin, is a useful design +% feature which make it easy to figure-out the coordinates of any point on +% the image plane (either on the cube or outside the cube), and hence +% facilitates the use of 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} @@ -509,8 +607,8 @@ % (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{pgfmanual.pdf}, version 3.0.1a (2015) (1161 pages) +% \item \texttt{pgfplot.pdf}, version 1.14 (2016) (561 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 @@ -531,8 +629,8 @@ % 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). +% or of a circle centre, or of text position +% (see Sections~\ref{sec:drawrubikcubecommands} and \ref{sec:arrows} for examples). % \begin{quote} % \begin{verbatim} % \draw[->,thick,color=blue] (4.5, 2.5) -- (3.5,2.5); @@ -560,7 +658,7 @@ %% \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) +% a \% symbol after the \verb!\end{tikzpicture}! command % to avoid additional white space inadvertently being added by \LaTeX\ % (see Section~\ref{sec:trailingpercent}). % @@ -586,8 +684,8 @@ % % \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 +% is a convenient tool for placing one or more commands inside a +% tikzpicture environment which is also 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!) @@ -603,7 +701,7 @@ % 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}. +% semicolon (see Section~\ref{sec:tikz}). % % \medskip % @@ -632,7 +730,7 @@ % % \medskip % -% {\noindent}The convenience of the \cmd{\ShowCube} command is illustrated below; the +% {\noindent}The action 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). % $$ @@ -657,12 +755,12 @@ % % \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 +% an \texttt{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 +% Consequently, a temporary \texttt{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. @@ -680,23 +778,67 @@ % \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 +% {\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 +% the horizontal 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{Optimum strategy} +% \label{sec:optimumstrategy} +% +% +% We suggest that the most convenient (and intuitive) approach for drawing +% cubes or particular faces is to do it in stages, as follows +% (all these steps are well illustrated in the examples file +% \texttt{RubikExamples.pdf}): +%\begin{itemize} +% \item first, start by setting the colour state of the cube. This can be done using +% either (a)~a \cmd{\RubikCubeSolved..} or \cmd{\RubikCubeGrey..} command +% (for defining the whole cube), or (b)~using one or more \cmd{\RubikFace..} +% commands (for defining parts of faces), or (c)~by imputting a file containing +% a previously saved colour state\footnote{See the \textsc{rubikrotation} package documentation +% for details of the \cmd{\SaveRubikState} command; see also the `SaveRubikState' example in the +% file \texttt{RubikExamples.pdf}.}. +% +% \item second, use the \cmd{\RubikRotation}\ command to process a sequence of rotations +% (remembering that this requires use of the \verb!--shell-escape! command-line option). +% The \textsc{rubikpatterns} package is a small library of named rotation sequences. +% +% \item third, draw the image(s) using \cmd{\DrawRubikCube..} or +% \cmd{\DrawRubikFace..} commands, plus any TikZ commands +% (e.g.,~\cmd{\draw} and/or \cmd{\node}) in conjunction with the \cmd{\ShowCube} command. +% Use the \cmd{\ShowCube} scale factor to adjust the size, and use the \cmd{\ShowCubeF} +% command to reveal the extent of any \texttt{minipage} whitespace. +% +% \item fourth, spacing between graphic elements can be influenced by adjusting either +% (a)~horizontal whitespace as set by the \cmd{\ShowCube} command, or (b)~using standard +% \TeX\ spacing commands, e.g.,~\cmd{\quad}, \cmd{\qquad}, \cmd{\hspace..} etc. +% +% \item finally, give some thought to using a trailing \verb!%! in commands which are +% broken across multiple lines (see Section~\ref{sec:trailingpercent}). +% +%\end{itemize} +% With this approach the internal colour state +% will be updated and processed correctly by all subsequent +% \cmd{\Draw..} or \cmd{\RubikRotation}\ commands. +% Note that exchanging the word `\texttt{Rubik}' for the word `\texttt{Two}' in a command will +% generate the equivalent TwoCube version of the command (see Section~\ref{sec:rubikandtwo}). +% +% +% % \section{Colour commands} % \label{sec:colours} % -% The \rubikcube\ package uses seven colours which are defined as follows: +% The Rubik bundle of packages uses seven colours which are defined as follows: % 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.} @@ -735,13 +877,26 @@ % White {HTML}{FFFFFF} %\end{verbatim} % \end{quote} -% However, we have optimised these prescribed colours very slightly +% +% {\noindent}The following RGB specifications are given by Sher (2014): +% \begin{quote} +%\begin{verbatim} +% White {RGB}{255,255,255} +% Red {RGB}{137,18,20} +% Blue {RGB}{13,72,172} +% Orange {RGB}{255,85,37} +% Green {RGB}{25,155,76} +% Yellow {RGB}{254,213,47} +%\end{verbatim} +% \end{quote} +% +% {\noindent}However, we have tried to optimise these prescribed colours very slightly % for screen \& print use (for~example, the yellow was made very % slightly brighter), and so the actual colours implemented by -% the \rubikcube\ package are as follows:\,\footnote{Although the Pantone +% 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 \texttt{https://en.wikipedia.org/wiki/Pantone}).} % (see Section~\ref{sec:codecolours}): % % \begin{quote} @@ -770,50 +925,62 @@ % \subsection{Colour state of the cube} % \label{sec:colourstate} % +% A given cubie facelet on a given face is denoted using an ordered sequence +% of three letters, as follows: first the face code (U,D,L,R,F,B), +% second the X-position of the column (l,m,r), +% and third the Y-position of the row (t,m,b). +% For example, the `right-bottom' facelet of the \textsc{front} face is denoted as +% \texttt{Frb}, and consequently the curent colour-code (R,O,Y,G,B,W,X) of this facelet +% is held as the variable \cmd{\Frb} etc.\ +% (see Section~\ref{sec:rubikfacecode} for details and code). +% % -% \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 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 +% Until a facelet is allocated one of the six cube colours (using a suitable command) +% it will be rendered as grey by a \cmd{\Draw...} command, since these commands % simply implement the current colour state of the cube (e.g.,~\cmd{\DrawRubikCubeRU}). +% Facelets retain their colour allocation even if they are moved using +% the \cmd{\RubikRotation} command (see \textsc{rubikrotation} package), unless they are +% overwritten by a subsequent colour allocation command. % -% 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 +% \DescribeMacro{\RubikFace..} +% \DescribeMacro{\RubikSlice..} +% \DescribeMacro{\RubikCubeSolved..} +% \DescribeMacro{\RubikCubeGrey..} +% \DescribeMacro{\RubikCubeGreyAll} +% Colours are allocated to facelets using using \cmd{\Rubik..} commands. +% For example, the commands \cmd{\RubikCubeSolvedWY} and \cmd{\RubikCubeSolvedWB} +% allocate prescribed colour states for the whole `solved' cube, and are +% a very useful starting point (configuration) for subsequent rotations. +% The commands \cmd{\RubikCubeGreyWY} 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. +% Colours can also be allocated to subsets of facelets (eg faces, slices etc); +% for example, using the +% commands \cmd{\RubikFace...} and \cmd{\RubikSlice...} +% commands (see Sections~\ref{sec:rubikfacecommands} and \ref{sec:slicecommands}). +% +% To visualise the current state of the cube one has to use a \cmd{\Draw...} command. +% \cmd{\Draw..} commands never influence the internal colour state of the +% cube.\footnote{That said, the now deprecated \cmd{\DrawRubikLayerFace...} +% and \cmd{\DrawRubikLayerSice...} commands +% (see Section~\ref{sec:deprecated}) did, confusingly, allow you to specify colours +% as arguments, but they only `painted' colours onto facelet positions +% (on the page, so to speak), and for this reason they are now deprecated, +% and will be phased out in due course.} +% +% The current colour state / configuration of a cube can also be saved and +% written to a named file, which can then be \cmd{\input} and processed later when required, +% using the \cmd{\SaveRubikState} command (3x3x3 cube) +% or \cmd{\SaveTwoState} command (2x2x2 cube). +% % -% 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} +% \label{sec:rubikfacecommands} % % \DescribeMacro{\RubikFaceUp} % \DescribeMacro{\RubikFaceDown} @@ -821,8 +988,9 @@ % \DescribeMacro{\RubikFaceRight} % \DescribeMacro{\RubikFaceFront} % \DescribeMacro{\RubikFaceBack} -% These commands take nine colour arguments and allocate colours to the -% individual cubies of a Rubik cube face. +% These commands allocate colours to the +% individual cubies of a 3x3x3 cube face; they take nine colour arguments +% (see Section~\ref{sec:rubikfacecode} for the code). % 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: @@ -838,10 +1006,9 @@ % } % \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 +% (e.g.,~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. +% allows the command to be written in several visually intuitive ways, as follows: % % \begin{quote} % \begin{minipage}{8cm} @@ -855,6 +1022,9 @@ %\end{verbatim} % \end{minipage} % \end{quote} +% 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) when it is rendered. % % \DescribeMacro{\RubikFaceUpAll} % \DescribeMacro{\RubikFaceDownAll} @@ -865,19 +1035,16 @@ % 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). +% For example, if you want the \textsc{right} face to be all orange, then +% use the command \cmd{\RubikFaceRightAll\{O\}}. +% Use of these commands is shown in the following example. % -% 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. % % \bigskip % % \begin{minipage}{2.8cm} -% \RubikFaceUpAll{X} -% \RubikFaceRightAll{R} +% \RubikCubeGreyAll +% \RubikFaceRightAll{O} % \RubikFaceFront{W}{Y}{G} % {W}{Y}{G} % {W}{Y}{G} @@ -888,30 +1055,50 @@ % \hspace{5mm} % \begin{minipage}{0.6\textwidth} %\begin{verbatim} -% \RubikFaceUpAll{X} -% \RubikFaceRightAll{R} +% \RubikCubeGreyAll +% \RubikFaceRightAll{O} % \RubikFaceFront{W}{Y}{G} % {W}{Y}{G} % {W}{Y}{G} % \ShowCube{3cm}{0.7}{\DrawRubikCubeRU} % \end{verbatim} % \end{minipage} -% % -% \subsection{Solved Configuration} -% \label{sec:solvedconfig} +% \bigskip +% +% +% Note that instead of using \cmd{\RubikCubeGreyAll} we could have used the +% command \verb!\RubikFaceUpAll{X}! to allocate grey to the whole of the +% \textsc{up} face. However, the \cmd{\RubikCubeGreyAll} command can be a useful +% starting point when dealing with a new cube, +% since it resets all the faces to their initial default colour. % -% \DescribeMacro{\SolvedConfig} +% Finally, it is important to bear in mind that when allocating colours using +% the \cmd{\RubikFace..} commands it is very +% easy to inadvertently create a non-valid cube (ie a cube with either the wrong number +% of facelets with particular colours, or one which has a non-sovable configuration). +% However, some basic error checking of this sort is done whenever the +% \cmd{\RubikRotation} command is used +% (see the \textsc{rubikrotation} package documentation). + +% +% +% \subsection{RubikSolvedConfig command} +% \label{sec:rubiksolvedconfig} +% +% \DescribeMacro{\RubikSolvedConfig} % 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}\textsc{usage}:\ \verb!\RubikSolvedConfig{G}{B}{W}{Y}{O}{R}! % {\newline}Examples of its use are shown in the next section. % % -% \subsection{RubikCubeSolved command} +% +% +% \subsection{RubikCubeSolved commands} % \label{sec:rubikcubesolved} % % \DescribeMacro{\RubikCubeSolved} @@ -919,9 +1106,9 @@ % 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: +% by invoking the above \cmd{\RubikSolvedConfig} command, as follows: %\begin{verbatim} -%\newcommand{\RubikCubeSolved}{\SolvedConfig{G}{B}{W}{Y}{O}{R}} +%\newcommand{\RubikCubeSolved}{\RubikSolvedConfig{G}{B}{W}{Y}{O}{R}} %\end{verbatim} % Note that this is in fact just a convenient short-hand for the following: %\begin{verbatim} @@ -958,17 +1145,17 @@ % % \bigskip % -% Note that the width of the minipage used in \cmd{\ShowCube} command above +% Note that the width of the minipage used in the \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). +% the TikZ scale factor is set to 0.5 (as in the above example) then the minimum minipage +% width = $10 \times 0.5 = 5$cm (see Section~\ref{sec:coordinates} for details). % % % \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 +% For~example, we could make a command to show the above solved cube upside-down % and rotated slightly, as follows: %\begin{verbatim} %\newcommand{\CubeUpSideDown}{\RubikCubeSolved\RubikRotation{x2,y}} @@ -1014,44 +1201,46 @@ % 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}! +% and green opposite yellow), was created using \verb!\RubikSolvedConfig{R}{O}{W}{B}{G}{Y}! % (for the code see \ref{sec:codesolvedconfig}). % % -% \subsection{RubikCubeGrey command} +% +% +% \subsection{RubikCubeGrey.. commands} % \label{sec:rubikcubegrey} % -% \DescribeMacro{\RubikCubeGrey} +% \DescribeMacro{\RubikCubeGreyWY} +% \DescribeMacro{\RubikCubeGreyWB} % \DescribeMacro{\RubikCubeGreyAll} -% The command \cmd{\RubikCubeGrey} generates a 3x3x3 cube with no colours allocated +% The command \cmd{\RubikCubeGreyWY} 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. +% configuration as defined for the \cmd{\RubikCubeSolvedWY} 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). +% completely grey; this is useful as it can be used to reset all the facelets to +% the initial default state. +% 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 +% These 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, +% the \cmd{\RubikCubeGreyWY} command by viewing the cube in a semi-flat (SF) format, % as follows: % % \bigskip % -% \RubikCubeGrey +% \RubikCubeGreyWY % \ShowCube{4.5cm}{0.45}{\DrawRubikCubeSF} % \hspace{3mm} % \begin{minipage}{0.6\textwidth} %\begin{verbatim} -% \RubikCubeGrey +% \RubikCubeGreyWY % \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. +% Users can of course set up their own alternative face/colour configuration +% by creating a new `variant' command altogether. % % % @@ -1106,77 +1295,6 @@ % % % -% \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} @@ -1194,7 +1312,7 @@ % \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 +% 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 @@ -1205,13 +1323,14 @@ % 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. +% 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 +% for typesetting 3x3x3 cubes\,\footnote{See the \textsc{rubiktwocube} package documentation +% for 2x2x2 cube commands.} 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 @@ -1225,10 +1344,9 @@ % in the form of the rotation-code in a square; for~example, \rrhBw, \rrhFm. % % -% \pagebreak % -% \subsection{Overview} -% \label{sec:overview} +% \subsection{Typesetting} +% \label{sec:typesetting} % % We now describe the four commands used for typesetting the various rotation-codes. % @@ -1315,7 +1433,7 @@ % \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. +% \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 @@ -1340,7 +1458,7 @@ % 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. +% formed by appending a `p'. The \texttt{M} must be in upper case. % % % \bigskip\bigskip @@ -1354,9 +1472,9 @@ % \DescribeMacro{Ep} % \DescribeMacro{Sp} % 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). +% 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), and the Roux method (Giles Roux). % \begin{itemize} % \item[\rr{M}] \ (\textsc{middle} \rrh{M}, between the \textsc{left} % and \textsc{right} faces; direction follows \rr{L}), @@ -1377,7 +1495,8 @@ % \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 +% 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\}}. @@ -1386,7 +1505,7 @@ % % \subsection{Outer-slice rotations} % -% \subsubsection*{Slice notation} +% \subsubsection*{The `s' (slice) notation} % % \DescribeMacro{Us} % \DescribeMacro{Ds} @@ -1427,7 +1546,7 @@ % % -% \subsubsection*{Anti-slice notation} +% \subsubsection*{The `a' (anti-slice) notation} % % \DescribeMacro{Ua} % \DescribeMacro{Da} @@ -1443,16 +1562,20 @@ % % \bigskip\bigskip % +% % \subsection{Wide rotations} % +% \subsubsection*{The `w' notation} +% \label{sec:wnotation} +% % \DescribeMacro{Uw} % \DescribeMacro{Dw} % \DescribeMacro{Lw} % \DescribeMacro{Rw} % \DescribeMacro{Fw} % \DescribeMacro{Bw} -% The clockwise \textit{combined} rotation of an outer face AND its inner-slice -% (officially known as a `double outer slice' rotation, or a `double block' move) +% The clockwise \textit{combined} rotation of an outer face AND its adjacent inner-slice +% (officially known as a `double block', or `double outer slice' 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}!) @@ -1478,8 +1601,12 @@ % % \bigskip\bigskip % +% % \subsection{Axis rotations} % +% \subsubsection*{The x, y, z notation} +% \label{sec:xyznotation} +% % \DescribeMacro{x} % \DescribeMacro{y} % \DescribeMacro{z} @@ -1489,10 +1616,10 @@ % 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 lower-case; +% Note that since \rr{x}, \rr{y}, \rr{z}\ rotations are always expressed in lower case; % this practice is also extended to the commands. % -% For example, 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. @@ -1513,33 +1640,31 @@ % % \subsubsection*{The u, d, l, r, f, b notation} % +% % \DescribeMacro{u} % \DescribeMacro{d} % \DescribeMacro{l} % \DescribeMacro{r} % \DescribeMacro{f} % \DescribeMacro{b} -% A commonly used alternative for the \rr{x}, \rr{y}, \rr{z}\ notation -% (and endorsed by the WCA) uses these -% lower-case face letter to denote a 90~degree whole-cube rotation in the same -% directional sense as that of the standard face rotations. +% These are a commonly used alternative for the \rr{x}, \rr{y}, \rr{z}\ notation +% (and also endorsed by the WCA), and denote a 90~degree whole-cube rotation in the same +% directional sense as that of the associated face rotation. % % {\noindent}Thus -% \rr{u}\ $\equiv$ \rr{y}, \ \rr{d}\ $\equiv$ \rr{yp}, \ -% \rr{l}\ $\equiv$ \rr{xp}, \ \rr{r}\ $\equiv$ \rr{x}, \ -% \rr{f}\ $\equiv$ \rr{z}, \ \rr{b}\ $\equiv$ \rr{zp}, -% -% {\noindent}For~example, \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}. +% \rr{d}\ $\equiv$ \rr{up} $\equiv$ \rr{yp} etc. +% For~example, \rr{d}\ and \rr{dp}\ are generated by the commands \cmd{\rr\{d\}} +% and \cmd{\rr\{dp\}} respectively. +% Note that \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}, etc. % % 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\}}. % % +% \pagebreak +% % \subsubsection*{The `c' notation} % \label{sec:cnotation} % @@ -1602,7 +1727,7 @@ % {\noindent}\rr{U}\rr{U}\rr{R}\rr{R}\ is generated by % \cmd{\rr\{U\}}\cmd{\rr\{U\}}\cmd{\rr\{R\}}\cmd{\rr\{R\}} % -% \bigskip +% \medskip % % {\noindent}\Rubik{F}\Rubik{U}\Rubik{y}\Rubik{Rp}\Rubik{Lwp}\ % \ \ \verb!\Rubik{F}\Rubik{U}\Rubik{y}\Rubik{Rp}\Rubik{Lwp}! @@ -1612,28 +1737,31 @@ % {\noindent}\textRubik{F}\ \textRubik{U}\ \ \ \ % \verb!\textRubik{F}\ \textRubik{U}! % -% \bigskip +% \medskip % % {\noindent}Commas can be important in avoiding ambiguity; for~example, % -% \bigskip +% \medskip % % {\noindent}\rr{D},\rr{U}2,\rr{F}2,\rr{Ds}2,\rr{B}, \ \ \ \ \verb!\rr{U}2,\rr{F}2,\rr{Ds}2,\rr{B},! % -% \bigskip +% \medskip % -% {\noindent}\rrh{U}2,\,\rrh{F}2,\,\rrh{Ds}2,\, \ \ \ \ \verb!\rrh{U}2,\,\rrh{F}2,\,\rrh{Ds}2,! +% {\noindent}\rrh{U}2,\,\rrh{F}2,\,\rrh{Ds}2,\, \ \ \ \ \verb!\rrh{U}2,\,\rrh{F}2,\,\rrh{Ds}2! % -% \bigskip +% \medskip +% +% {\noindent}Finally, if each rotation element uses the \textit{same} font or encoding, for~example +% +% \medskip % % {\noindent}\rrh{F}\rrh{U}\rrh{y}\rrh{Rp}\rrh{Lwp} \ \ \ \ % \verb!\rrh{F}\rrh{U}\rrh{y}\rrh{Rp}\rrh{Lwp}! % -% \bigskip +% \medskip % -% 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 +% {\noindent}then typesetting such 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 @@ -1650,9 +1778,7 @@ % 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} @@ -2004,21 +2130,44 @@ % \dnstrut\rr{u}\dns\cmd{\rr\{u\}} % & \rrh{u}\dns\cmd{\rrh\{u\}} % & \Rubik{u}\dns\cmd{\Rubik\{u\}} \nonumber\\ +% \dnstrut\rr{up}\dns\cmd{\rr\{up\}} +% & \rrh{up}\dns\cmd{\rrh\{up\}} +% & \Rubik{up}\dns\cmd{\Rubik\{up\}} \nonumber\\ +% % \dnstrut\rr{d}\dns\cmd{\rr\{d\}} % & \rrh{d}\dns\cmd{\rrh\{d\}} % & \Rubik{d}\dns\cmd{\Rubik\{d\}} \nonumber\\ +% \dnstrut\rr{dp}\dns\cmd{\rr\{dp\}} +% & \rrh{dp}\dns\cmd{\rrh\{dp\}} +% & \Rubik{dp}\dns\cmd{\Rubik\{dp\}} \nonumber\\ +% % \dnstrut\rr{l}\dns\cmd{\rr\{l\}} % & \rrh{l}\dns\cmd{\rrh\{l\}} % & \Rubik{l}\dns\cmd{\Rubik\{l\}} \nonumber\\ +% \dnstrut\rr{lp}\dns\cmd{\rr\{lp\}} +% & \rrh{lp}\dns\cmd{\rrh\{lp\}} +% & \Rubik{lp}\dns\cmd{\Rubik\{lp\}} \nonumber\\ +% % \dnstrut\rr{r}\dns\cmd{\rr\{r\}} % & \rrh{r}\dns\cmd{\rrh\{r\}} -% & \Rubik{r}\dns\cmd{\Rubik\{r\}} \nonumber\\ +% & \Rubik{r}\dns\cmd{\Rubik\{r\}} \nonumber\\ +% \dnstrut\rr{rp}\dns\cmd{\rr\{rp\}} +% & \rrh{rp}\dns\cmd{\rrh\{rp\}} +% & \Rubik{rp}\dns\cmd{\Rubik\{rp\}} \nonumber\\ +% % \dnstrut\rr{f}\dns\cmd{\rr\{f\}} % & \rrh{f}\dns\cmd{\rrh\{f\}} -% & \Rubik{f}\dns\cmd{\Rubik\{f\}} \nonumber\\ +% & \Rubik{f}\dns\cmd{\Rubik\{f\}} \nonumber\\ +% \dnstrut\rr{fp}\dns\cmd{\rr\{fp\}} +% & \rrh{fp}\dns\cmd{\rrh\{fp\}} +% & \Rubik{fp}\dns\cmd{\Rubik\{fp\}} \nonumber\\ +% % \dnstrut\rr{b}\dns\cmd{\rr\{b\}} % & \rrh{b}\dns\cmd{\rrh\{b\}} % & \Rubik{b}\dns\cmd{\Rubik\{b\}} \nonumber\\ +% \dnstrut\rr{bp}\dns\cmd{\rr\{bp\}} +% & \rrh{bp}\dns\cmd{\rrh\{bp\}} +% & \Rubik{bp}\dns\cmd{\Rubik\{bp\}} \nonumber\\ % \end{supertabular} % % @@ -2104,10 +2253,10 @@ % % 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) +% letters (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 +% 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 @@ -2135,19 +2284,30 @@ % % \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. +% A \cmd{\Draw..} command typesets either a cubie, cube or face +% using parameters set or defined via +% previous parameter-allocation commands (e.g.,~colours, dimensions etc). % % It is important to distinguish between the \rubikcube\ package \cmd{\Draw..} commands -% and TikZ \cmd{\draw..} commands. \cmd{\Draw..} commands are implemented by the +% (with an upper-case~D) and TikZ \cmd{\draw..} commands (with a lowercase~d). +% Rubik \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.. +% See also Section~\ref{sec:drawerrormessage} below. % +% There are six types of \cmd{\Draw..} commands, as follows: +% \begin{quote} +% \noindent\cmd{\DrawCubie..} +% \newline\noindent\cmd{\DrawRubikCube..} +% \newline\noindent\cmd{\DrawRubikCubeSidebar..} +% \newline\noindent\cmd{\DrawRubikFace..} +% \newline\noindent\cmd{\DrawRubikFlat..} +% \newline\noindent\cmd{\DrawNCube..} +% \end{quote} +% Note that the former \cmd{\DrawRubikLayer..}, \cmd{\DrawCube..}, \cmd{\DrawFace..} +% commands are now deprecated, since they have +% been superseded by more versatile and intuitive commands (see Section~\ref{sec:deprecated}). % % % \subsection[Error message]{\cmd{\Draw} error message} @@ -2169,62 +2329,23 @@ % then something similar to the following error message will be generated. %\begin{verbatim} %! Undefined control sequence. -%\DrawFlatUp ... }{#1}\pgfmathsetmacro {\uy }{#2}\draw +%\DrawRubikFlatUp ... }{#1}\pgfmathsetmacro {\uy }{#2}\draw % [line join=round,... %l.56 \DrawRubikCubeF %\end{verbatim} % % % +% \subsection{DrawCubie commands} +% \label{sec:drawcubie} % -% \subsection{DrawRubikCube commands} -% -% \DescribeMacro{\DrawRubikCubeXY} -% \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} -% will draw a Rubik cube as viewed from the RightUp direction (RU), as -% shown in the following figure. -% -% \bigskip -% -% \begin{minipage}{2.8cm} -% \begin{tikzpicture}[scale=0.7] -% \DrawRubikCubeRU -% \end{tikzpicture}% -% \end{minipage} -% \hspace{5mm} -% \begin{minipage}{0.6\textwidth} -%\begin{verbatim} -% \RubikCubeSolved -% \begin{tikzpicture}[scale=0.7] -% \DrawRubikCubeRU -% \end{tikzpicture}% -%\end{verbatim} -% Note that the above commands are equivalent to: -%\begin{verbatim} -% \RubikCubeSolved -% \ShowCube{3cm}{0.7}{\DrawRubikCubeRU} -%\end{verbatim} -% \end{minipage} -% -% \bigskip -% -% -% \DescribeMacro{\DrawCubieXYxyz} +% \DescribeMacro{\DrawCubieXY} % This command draws a single cubie in one of four % orientations as denoted by the terminal XY viewing-direction % codes. -% Since a single cubie has only three visible faces we can include -% colour parameters in \cmd{\DrawCubie} commands. Consequently \cmd{\DrawCubie} -% commands have the format +% Since a single cubie has only three visible faces this command takes three +% xyz-ordered colour parameter arguments. Consequently the \cmd{\DrawCubie} +% command has the format % \begin{quote} % \cmd{\DrawCubieXY\{x\}\{y\}\{z\}} % \end{quote} @@ -2259,13 +2380,13 @@ % \else % \includegraphics[height=4cm]{rubik-doc-figC.eps} % \fi -% \vspace{-5mm}\caption{\label{fig:cubiedydx}Cubie dy dx parameters} +% \vspace{-5mm}\caption{\label{fig:cubiedydx}Cubiedy and Cubiedx parameters} % \end{figure} % % \DescribeMacro{\Cubiedy} % \DescribeMacro{\Cubiedx} % Minor cubie configuration changes can be effected -% by adjusting the dy and dx values ($> 0$; no units) +% by adjusting the Cubiedy and Cubiedx values ($> 0$; no units) % shown in Figure~\ref{fig:cubiedydx} via the two commands % \begin{quote} % \cmd{\Cubiedy\{\}} \\ @@ -2296,9 +2417,11 @@ % {\noindent}Note that the \textsc{front} face of the cubie is a unit square, % and the graphic origin of the cubie image is at the bottom left corner of the % \textsc{front} face (see also the section on Arrows: Section~\ref{sec:arrows}). -% The default values of dy and dx are 0.4. +% The default values of \cmd{\Cubiedy} and \cmd{\Cubiedx} are 0.4. +% % -% \medskip +% +% \subsection{textCubie commands} % % \DescribeMacro{\textCubieRU} % \DescribeMacro{\textCubieRD} @@ -2325,67 +2448,40 @@ % \cmd{\Cubiedy}, \cmd{\Cubiedx} commands as their size is pre-set for text use. % % -% -% \subsection{Flat commands} -% \label{sec:flatcommands} -% -% \DescribeMacro{\DrawFlatUp} -% \DescribeMacro{\DrawFlatDown} -% \DescribeMacro{\DrawFlatLeft} -% \DescribeMacro{\DrawFlatRight} -% \DescribeMacro{\DrawFlatFront} -% \DescribeMacro{\DrawFlatBack} -% These commands \cmd{\DrawFlat..}\marg{x}\marg{y} draw a `flat' (square) -% representation of 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. -% -% 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: +% \subsection{DrawRubikCube commands} +% \label{sec:drawrubikcubecommands} % -% \bigskip -% -% \begin{minipage}{0.4\textwidth} -% \centering -% \RubikCubeSolved -% \begin{tikzpicture}[scale=0.4] -% \DrawRubikCubeRU -% \DrawFlatBack{4}{1} -% \end{tikzpicture}% -% \end{minipage} -% \begin{minipage}{5cm} +% \DescribeMacro{\DrawRubikCubeXY} +% \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} +% will draw a Rubik cube as viewed from the RightUp direction (RU), as +% shown in the following figure. +% +% \bigskip +% +% \begin{minipage}{2.8cm} +% \begin{tikzpicture}[scale=0.7] +% \RubikCubeSolvedWY +% \DrawRubikCubeRU +% \end{tikzpicture}% +% \end{minipage} +% \hspace{5mm} +% \begin{minipage}{0.6\textwidth} %\begin{verbatim} -% \RubikCubeSolved -% \ShowCube{3cm}{0.4}{% -% \DrawRubikCubeRU -% \DrawFlatBack{4}{1} -% } +% \RubikCubeSolvedWY +% \ShowCube{3cm}{0.7}{\DrawRubikCubeRU} %\end{verbatim} -% \end{minipage} -% +% \end{minipage} +% % \bigskip % % \DescribeMacro{\DrawRubikCubeF} @@ -2396,7 +2492,7 @@ % \begin{minipage}{0.4\textwidth} % \centering % \begin{tikzpicture}[scale=0.4] -% \RubikCubeSolved +% \RubikCubeSolvedWY % \DrawRubikCubeF % \node (U) at (1.5, 4.5) [black]{\small\textsf{U}}; % \node (D) at (1.5, -1.5) [black]{\small\textsf{D}}; @@ -2408,7 +2504,7 @@ % \end{minipage} % \begin{minipage}{5cm} %\begin{verbatim} -% \RubikCubeSolved +% \RubikCubeSolvedWY % \ShowCube{5cm}{0.4}{\DrawRubikCubeF} %\end{verbatim} % \end{minipage} @@ -2419,7 +2515,8 @@ % 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. +% TikZ picture environment +% (remember TikZ commands require a terminal semi-colon~;). % %\begin{verbatim} % \RubikCubeSolved @@ -2431,7 +2528,7 @@ % \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{\DrawRubikCubeSF} @@ -2444,19 +2541,19 @@ % % \begin{minipage}{5cm} % \begin{tikzpicture}[scale=0.5] -% \RubikCubeSolved +% \RubikCubeSolvedWY % \DrawRubikCubeSF % \node (B) at (5.5, 2.5) [white]{\small\textsf{B}}; % \end{tikzpicture}% % \end{minipage} % \begin{minipage}{5cm} %\begin{verbatim} -% \RubikCubeSolved +% \RubikCubeSolvedWY % \ShowCube{5cm}{0.5}{% % \DrawRubikCubeSF % \node (B) at (5.5, 2.5) % [white]{\small\textsf{B}}; -% } +% } %\end{verbatim} % \end{minipage} % @@ -2468,352 +2565,139 @@ % 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 +% corner of the \textsc{front} face (the orange face here), the ($x,y$) coordinates % of the centre of the red \textsc{back} face are easily determined to be (5.5, 2.5). % % -% \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}. % -% 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. +% \subsection{DrawRubikFace.. commands} +% \label{sec:drawrubikfacecommands} % -% \bigskip -% -% \begin{minipage}{0.4\textwidth} -% \centering -% \RubikCubeSolved -% \begin{tikzpicture}[scale=0.4] -% \DrawFaceUpSide -% \end{tikzpicture}% -% \end{minipage} -% \begin{minipage}{5cm} -%\begin{verbatim} -% \RubikCubeSolved -% \ShowCube{1.6cm}{0.4}{% -% \DrawFaceUpSide -% } -%\end{verbatim} -% \end{minipage} % -% \vspace{1cm} +% \DescribeMacro{\DrawRubikFaceUp} +% \DescribeMacro{\DrawRubikFaceDown} +% \DescribeMacro{\DrawRubikFaceLeft} +% \DescribeMacro{\DrawRubikFaceRight} +% \DescribeMacro{\DrawRubikFaceFront} +% \DescribeMacro{\DrawRubikFaceBack} +% \DescribeMacro{\DrawRubikFaceUpSide} +% \DescribeMacro{\DrawRubikFaceDownSide} +% \DescribeMacro{\DrawRubikFaceLeftSide} +% \DescribeMacro{\DrawRubikFaceRightSide} +% \DescribeMacro{\DrawRubikFaceFrontSide} +% \DescribeMacro{\DrawRubikFaceBackSide} +% These commands draw the current state of a specified face +% (e.g.,~\cmd{\DrawRubikFaceUp}), or the face and all the associated sidebars +% (e.g.,~\cmd{\DrawRubikFaceUpSide}). These commands do \textsc{not} take any +% arguments---for code see Section~\ref{sec:drawrubikfacecode}. % +% \textsc{Note}: These commands replace the earlier +% \cmd{\DrawFace...} commands (see Section~\ref{sec:deprecated}). % -% \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). +% For example, a simple way to show the yellow-cross configuration in +% the \textsc{up}~face would be to first define the colours using +% the \cmd{\RubikFaceUp} command, and then draw the \textsc{up} face +% using the \cmd{\DrawRubikFaceUp} command, as follows: % % \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} +% \RubikFaceUp{X}{Y}{X} +% {Y}{Y}{Y} +% {X}{Y}{X} +% \ShowCube{2.1cm}{0.7}{\DrawRubikFaceUp} +% \hspace{1cm} +% \begin{minipage}{0.6\textwidth} %\begin{verbatim} -% \ShowCube{3.5cm}{0.5}{\DrawNCubeAll{5}{O}{Y}{G}} +% \RubikFaceUp{X}{Y}{X} +% {Y}{Y}{Y} +% {X}{Y}{X} +% \ShowCube{2.1cm}{0.7}{\DrawRubikFaceUp} %\end{verbatim} % \end{minipage} % % % +% \subsection[Drawing Sidebars (Face)]{Sidebars \& DrawRubikFaceXSide commands} +% \label{sec:sidebars} % % -% \subsection{LayerFace} -% \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. -% -% 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}). -% +% In the next example we use the \cmd{\DrawRubikFaceUpSide} command to +% draw the \textsc{up}~face and all its sidebars in a cube having +% a `solved' WY (White opposite Yellow) configuration. % -% \DescribeMacro{\DrawRubikLayerFace} -% \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 -% -% \ShowCube{2.1cm}{0.7}{% -% \DrawRubikLayerFace{X}{Y}{X} -% {Y}{Y}{Y} -% {X}{Y}{X} -% }% -% \hspace{1cm} +% +% \RubikCubeSolvedWY +% \ShowCube{1.6cm}{0.5}{\DrawRubikFaceUpSide} +% \hspace{1cm} % \begin{minipage}{0.6\textwidth} %\begin{verbatim} -% \ShowCube{2.1cm}{0.7}{% -% \DrawRubikLayerFace{X}{Y}{X} -% {Y}{Y}{Y} -% {X}{Y}{X} -% } +% \RubikCubeSolvedWY +% \ShowCube{1.6cm}{0.5}{\DrawRubikFaceUpSide} %\end{verbatim} % \end{minipage} % % \bigskip +% +% \noindent\textbf{Short-hand versions}: For convenience each of these commands +% has an equivalent short-hand version generated by using just the first letter of the +% face name and (where appropriate) the first letter of the word Side. For~example, +% \newline\cmd{\DrawRubikFaceR} $\equiv$ \cmd{\DrawRubikFaceRight}, +% \newline \cmd{\DrawRubikFaceRS} $\equiv$ \cmd{\DrawRubikFaceRightSide}, etc. % -% {\noindent}The \cmd{\DrawRubikLayerFaceAll} command takes a single colour argument, and paints -% the whole face the same colour. % -% \medskip % -% \subsection{LayerSide (sidebars)} -% \label{sec:layerside} \label{sec:sidebars} -% -% \DescribeMacro{\DrawRubikLayerSideXYp} -% LayerSide commands draw the associated side colours of -% 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, -% as depicted in Figure~\ref{fig:facenotation}. % -% \begin{figure}[hbt] -% \centering -% \ifpdf -% \includegraphics[height=3cm]{rubik-doc-figD.pdf} -% \else -% \includegraphics[height=3cm]{rubik-doc-figD.eps} -% \fi -% \vspace{-5mm}\caption{\label{fig:facenotation}LayerSide rotation-codes } -% \end{figure} -% -% Since corner cubies have two side faces, the `p' parameter -% (p:[x\verb!|!y]) is required to denote the directional `position' of -% the cubie side-face relative to the cubicle XY position -% (x indicates adjacent along the x-axis, and y indicates adjacent along the y-axis). -% Since edge cubies have only one side face, the `p' parameter is optional -% (for consistency), since it is not strictly necessary. -% -% \medskip\noindent\textbf{Commands}: \ -% Various different LayerSide commands are available: those for -% drawing a single colour side bar, and others for facilitating -% drawing all 12 side bars. -% For~example, \textit{either} of the following commands % -% \begin{quote} -%\begin{verbatim} -% \DrawRubikLayerSideLM{G} -% \DrawRubikLayerSideLMx{G} -%\end{verbatim} -% \end{quote} -% draws a single small vertical green rectangle -% \begin{tikzpicture}[scale=0.5] -% \DrawRubikLayerSideLMx{G} -% \end{tikzpicture}% -% just to the left of the Left Middle (LM) square of the 9-face. -% The following commands draw all three side bars of a given side (Top, Bottom, Left, Right) -% \begin{quote} -%\begin{verbatim} -% \DrawRubikLayerSideT{}{}{} -% \DrawRubikLayerSideB{}{}{} -% \DrawRubikLayerSideL{}{}{} -% \DrawRubikLayerSideR{}{}{} -%\end{verbatim} -% \end{quote} -% where the T and B forms require the colour parameters to be in left-right -% horizontal order (e.g.,~left, middle, right), -% while the L and R forms require the colour parameters to be in top-down -% 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} -%\begin{verbatim} -% \DrawRubikLayerSideL{} -% {} -% {} -%\end{verbatim} -% \end{quote} -% Extending this idea, the L and R forms are combined in the LR command, -% which takes six colour arguments ordered in left-right pairs, -% \begin{quote} -%\begin{verbatim} -% \DrawRubikLayerSideLR{}{} {}{} {}{} -%\end{verbatim} -% \end{quote} -% so that they can also be written vertically as left-right pairs. -% Use of these commands is shown in the following two examples. -% -% \bigskip -% -% \begin{minipage}{2.5cm} -% \centering -% \begin{tikzpicture}[scale=0.7] -% -% -% \DrawRubikLayerFace{X}{Y}{X} -% {Y}{Y}{Y} -% {X}{Y}{X} -% -% \DrawRubikLayerSideLTy{B} -% \DrawRubikLayerSideLTx{O} -% \DrawRubikLayerSideLM{G} -% \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}}; -% \end{tikzpicture}% -% \end{minipage} -% \hspace{1cm} -% \begin{minipage}{0.6\textwidth} -%\begin{verbatim} -% \ShowCube{3cm}{0.7}{% -% \DrawRubikLayerFace{X}{Y}{X} -% {Y}{Y}{Y} -% {X}{Y}{X} -% -% \DrawRubikLayerSideLTy{B} -% \DrawRubikLayerSideLTx{O} -% \DrawRubikLayerSideLM{G} -% -% \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}}; -% } -%\end{verbatim} -% \end{minipage} -% -% \bigskip -% -% \begin{minipage}{2.5cm} -% \centering -% \begin{tikzpicture}[scale=0.7] -% -% \DrawRubikLayerFace{G}{Y}{R} -% {Y}{Y}{Y} -% {B}{Y}{Y} -% -% \DrawRubikLayerSideT {Y}{B}{B} -% \DrawRubikLayerSideLR{R} {Y} -% {R} {O} -% {Y} {O} -% \DrawRubikLayerSideB {O}{G}{G} -% -% \end{tikzpicture}% -% \end{minipage} -% \hspace{1cm} -% \begin{minipage}{0.6\textwidth} -%\begin{verbatim} -% \ShowCube{3cm}{0.7}{% -% \DrawRubikLayerFace{G}{Y}{R} -% {Y}{Y}{Y} -% {B}{Y}{Y} -% -% \DrawRubikLayerSideT {Y}{B}{B} -% \DrawRubikLayerSideLR{R} {Y} -% {R} {O} -% {Y} {O} -% \DrawRubikLayerSideB {O}{G}{G} -% } -%\end{verbatim} -% \end{minipage} -% -% \bigskip -% -% \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{\DrawFaceUpSide} command, -% as described in Section~\ref{sec:facecommands}. -% -% \bigskip +% \subsection{Sidebar parameters} +% \label{sec:sidebarparameters} % -% \DescribeMacro{\RubikSideBarWidth} -% \DescribeMacro{\RubikSideBarLength} -% \DescribeMacro{\RubikSideBarSep} +% \DescribeMacro{\RubikSidebarWidth} +% \DescribeMacro{\RubikSidebarLength} +% \DescribeMacro{\RubikSidebarSep} % The default values (size) of the sidebars are as follows: -% width (0.3), length(1) and separation from the square face (0.3). +% width (0.3), length(1) and separation from the square face (0.3) +% ---see Section~\ref{sec:sidebarcode} for the code. % Note that the default value of the length of a cubie side is 1. % These sidebar values (decimal values $\geq 0$; no units) can be % changed from their default values using the three commands. % \begin{quote} -% \cmd{\RubikSideBarWidth\{\}}\hspace{35.751pt}(default = 0.3)\\ -% \cmd{\RubikSideBarLength\{\}}\hspace{30pt}(default = 1.0)\\ -% \cmd{\RubikSideBarSep\{\}}\hspace{46.251pt}(default = 0.3) +% \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 in position MTy using the command -% \verb!\DrawRubikLayerSideMTy{G}! (for the MTy code see Figure~\ref{fig:facenotation}). +% particular environment. Alternatively, one can keep the effect local +% using braces (see below). +% +% In the following example, we show the effect +% on the \textsc{up} face and sidebars of a normally solved (WY) cube +% after dramatically changing the sidebar width, length and separation +% from the default values---compare with the previous image. +% For~convenience, we have used a pair of braces +% to keep the effect local to this example. % % \bigskip % -% \begin{minipage}{2.5cm} -% \centering -% \begin{tikzpicture}[scale=0.7] -% -% -% \DrawRubikLayerFace{X}{Y}{X} -% {Y}{Y}{Y} -% {X}{Y}{X} -% -% \RubikSideBarWidth{0.7} -% \RubikSideBarLength{0.7} -% \DrawRubikLayerSideMTy{G} -% \end{tikzpicture}% -% \end{minipage} -% \hspace{1cm} +% { +% \RubikCubeSolvedWY +% \RubikSidebarWidth{0.8} +% \RubikSidebarLength{0.5} +% \RubikSidebarSep{0.7} +% \ShowCube{2cm}{0.5}{\DrawRubikFaceUpSide} +% } +% \hspace{2cm} % \begin{minipage}{0.6\textwidth} %\begin{verbatim} -% \ShowCube{3cm}{0.7}{% -% \DrawRubikLayerFace{X}{Y}{X} -% {Y}{Y}{Y} -% {X}{Y}{X} -% \RubikSideBarWidth{0.7} -% \RubikSideBarLength{0.7} -% \DrawRubikLayerSideMTy{G} -% } +% { +% \RubikCubeSolvedWY +% \RubikSidebarWidth{0.8} +% \RubikSidebarLength{0.5} +% \RubikSidebarSep{0.7} +% \ShowCube{2cm}{0.5}{\DrawRubikFaceUpSide} +% } %\end{verbatim} % \end{minipage} % @@ -2824,70 +2708,248 @@ % to visualise this) and may therefore require some fine-tuning of the % minipage width setting in order to optimise appearance. % -% Since the \textsc{front} face drawn using the \cmd{\DrawRubikCube} command is -% identical with that drawn using the \cmd{\DrawLayerFace} command it -% follows that LayerSide commands can also be used in conjunction with -% the \textsc{front} face drawn using \cmd{\DrawRubikCube} command. 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$). -% +% +% +% +% \subsection[NoSidebar command]{\cmd{\NoSidebar} command} +% \label{sec:nosidebar} +% +% \DescribeMacro{\NoSidebar} +% The \cmd{\NoSidebar}\marg{colour-code} command +% (which takes a single colour code argument) +% allows the user to disable the drawing of sidebars having a particular colour +% (for code see Section~\ref{sec:nosidebarcode}). +% Its action can be localised by placing the command inside an environment +% (e.g.,~inside the \verb!\ShowCube! environment). +% Alternatively, the action of this command can be disabled simply by writing it with an empty +% argument, e.g.,~\verb!\NoSidebar{}!. +% +% This command is designed to facilitate the drawing of so-called +% OLL (Orientate Last Layer) configurations, +% which are typically rendered using the yellow face. +% +% For~example, the following figure uses the \verb!\DrawRubikFaceUpSide! command to +% draw the commonly encountered OLL configuration known as the `yellow cross' +% (the remaining four yellow facelets associated with this layer are shown as sidebars). +% In this example, we first define the colours for the whole cube (grey), and then +% redefine the colours for the \textsc{up}~face and its four adjacent faces. +% Finally we draw the \textsc{up}~face and sidebars; we also show an alternative +% way of writing the facelet colour codes (ie without using the curly brackets). +% +% \bigskip +% +% \begin{minipage}{3cm} +% \RubikCubeGreyAll +% \RubikFaceUp XYX +% YYY +% XYX +% \RubikFaceFront YXY XXXXXX +% \RubikFaceRight XXY XXXXXX +% \RubikFaceBack XXX XXXXXX +% \RubikFaceLeft YXX XXXXXX +% \ShowCube{2.6cm}{0.6}{\DrawRubikFaceUpSide} +% \end{minipage} +% \hspace{4mm} +% \begin{minipage}{5cm} +% \begin{verbatim} +% \RubikCubeGreyAll +% \RubikFaceUp XYX +% YYY +% XYX +% \RubikFaceFront YXY XXXXXX +% \RubikFaceRight XXY XXXXXX +% \RubikFaceBack XXX XXXXXX +% \RubikFaceLeft YXX XXXXXX +% \ShowCube{2.6cm}{0.6}{\DrawRubikFaceUpSide} +% \end{verbatim} +% \end{minipage} +% \bigskip +% +% {\noindent}However, we can greatly improve the OLL image by +% disabling the drawing of all the grey (X) sidebars by using the +% \verb!\NoSidebar{X}! command as follows (here we have placed the +% \verb!\NoSidebar{X}! command inside the \verb!\ShowCube! environment +% in order to limit its action locally). Note also that this time we +% have used the short-hand US (UpSide) version of the +% \cmd{\DrawRubikFaceUpSide} command. +% +% \bigskip +% +% \begin{minipage}{3cm} +% \RubikCubeGreyAll +% \RubikFaceUp XYX +% YYY +% XYX +% \RubikFaceFront YXY XXXXXX +% \RubikFaceRight XXY XXXXXX +% \RubikFaceBack XXX XXXXXX +% \RubikFaceLeft YXX XXXXXX +% \ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUS} +% \end{minipage} +% \hspace{4mm} +% \begin{minipage}{5cm} +% \begin{verbatim} +% \RubikCubeGreyAll +% ... +% ... +% \ShowCube{2.6cm}{0.6}{\NoSidebar{X}% +% \DrawRubikFaceUS% +% } +% \end{verbatim} +% \end{minipage} +% +% \bigskip +% +% +% +% \subsection[Drawing Sidebars (Cube)]{Cube sidebars \& DrawRubikCubeSidebar commands} +% \label{sec:sidebarscube} +% +% +% +% +% Cube sidebars are drawn adjacent to cube edges which are +% defined by the two faces forming the edge. +% Thus the BR (Back-Right) sidebar is placed adjacent to the +% edge formed by the \textsc{back} and \textsc{right} faces. +% +% Since the cube orientation (view direction; RU, RD, LU, LD) +% determines which sidebars are visible, the command for drawing +% the sidebar (\texttt{DrawRubikCubeSidebar..}) also needs to +% incorporate the view direction. The command takes +% two mandatory arguments: the first is the pair of face codes defining the edge (XX); +% the second is the view direction, as follows: +% \begin{quote} +% \cmd{\DrawRubikCubeSidebarXX}\marg{view direction} +% +% \textsc{example:} \verb!\DrawRubikCubeSidebarRB{LD}! +% \end{quote} +% Note that the pair of face codes are order \textit{independent}, +% and hence can be written in any order, which makes remembering the commands very easy. +% +% Note also that at present commands are only available for the +% eight sidebars which are parallel to X,Y axes, as these seem +% to be the most useful. +% +% In the following example, we input a previously saved cube state +% (in the file \texttt{cubestate-A.tex}) and draw the cube and the +% four main sidebars (BR, BD, FL, FU) visible from the RD view direction. +% +% \bigskip +% +% \RubikFaceUp{O}{G}{Y}{B}{B}{O}{R}{B}{G}% +% \RubikFaceDown{Y}{R}{B}{R}{W}{O}{W}{Y}{R}% +% \RubikFaceLeft{Y}{G}{W}{W}{Y}{R}{O}{W}{B}% +% \RubikFaceRight{B}{B}{B}{W}{G}{O}{R}{G}{W}% +% \RubikFaceFront{G}{R}{O}{Y}{R}{O}{R}{G}{G}% +% \RubikFaceBack{O}{W}{W}{Y}{O}{Y}{Y}{B}{G}% +% \ShowCube{4cm}{0.6}{ +% \DrawRubikCubeRD +% \DrawRubikCubeSidebarBR{RD} +% \DrawRubikCubeSidebarBD{RD} +% \DrawRubikCubeSidebarFL{RD} +% \DrawRubikCubeSidebarFU{RD} +% } +% \begin{minipage}{5cm} +%\begin{verbatim} +% \input{cubestate-A.tex} +% \ShowCube{3cm}{0.6}{ +% \DrawRubikCubeRD +% \DrawRubikCubeSidebarBR{RD} +% \DrawRubikCubeSidebarBD{RD} +% \DrawRubikCubeSidebarFL{RD} +% \DrawRubikCubeSidebarFU{RD} +% } +%\end{verbatim} +% \end{minipage} +% +%\bigskip +% +% +% +% +% \subsection{DrawRubikFlat commands} +% \label{sec:drawrubikflatcommands} +% +% \DescribeMacro{\DrawRubikFlatUp} +% \DescribeMacro{\DrawRubikFlatDown} +% \DescribeMacro{\DrawRubikFlatLeft} +% \DescribeMacro{\DrawRubikFlatRight} +% \DescribeMacro{\DrawRubikFlatFront} +% \DescribeMacro{\DrawRubikFlatBack} +% The \cmd{\DrawRubikFlat..}\marg{x}\marg{y} commands draw a `flat' square +% representation of a specified face, located such that its +% bottom left corner is positioned at ($x,y$). +% Each command (except \cmd{\DrawRubikFlatFront}) 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 (see Section~\ref{sec:codedrawrubikflatcommands} for the code). +% +% These commands are designed to supplement the \cmd{\DrawRubikCube...} commands and +% allow hidden faces to be represented. +% +% Note also that the \cmd{\DrawRubikFlatFront} 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}:\ The following example uses the command \verb!\DrawRubikFlatBack{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!\DrawRubikFlatBack{4}{1}! as follows: +% % \bigskip % -% \begin{minipage}{4cm} +% \begin{minipage}{0.4\textwidth} % \centering -% \RubikFaceUp {X}{W}{X}% -% {W}{W}{W}% -% {X}{W}{X}% -% -% \RubikFaceFront{O}{O}{X}% -% {O}{O}{X}% -% {X}{X}{W}% -% -% \RubikFaceRight{X}{G}{G}% -% {X}{G}{G}% -% {G}{X}{X}% -% \ShowCubeF{3.5cm}{0.7}{% -% \DrawRubikCubeRU -% \DrawRubikLayerSideL{G}{B}{R} -% \DrawRubikLayerSideB{R}{G}{O} -% } +% \RubikCubeSolvedWY +% \begin{tikzpicture}[scale=0.5] +% \DrawRubikCubeRU +% \DrawRubikFlatBack{4}{1} +% \end{tikzpicture}% % \end{minipage} -% \hspace{1cm} -% \begin{minipage}{0.6\textwidth} +% \begin{minipage}{5cm} %\begin{verbatim} -% \RubikFaceUp {X}{W}{X}% -% {W}{W}{W}% -% {X}{W}{X}% -% -% \RubikFaceFront{O}{O}{X}% -% {O}{O}{X}% -% {X}{X}{W}% -% -% \RubikFaceRight{X}{G}{G}% -% {X}{G}{G}% -% {G}{X}{X}% -% \ShowCubeF{3.5cm}{0.7}{% -% \DrawRubikCubeRU -% \DrawRubikLayerSideL{G}{B}{R} -% \DrawRubikLayerSideB{R}{G}{O} -% } +% \RubikCubeSolvedWY +% \ShowCube{3cm}{0.5}{% +% \DrawRubikCubeRU +% \DrawRubikFlatBack{4}{1} +% } %\end{verbatim} % \end{minipage} +% +% +% \subsection[DrawNCube]{DrawNCube (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 % -% 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. +% \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} % % % @@ -2901,10 +2963,10 @@ % 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 +% Appending an `F' to the command-name (\cmd{\ShowSequenceF}) results in an fbox around % 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). +% Appending a lower-case `f' to the command-name (\cmd{\ShowSequencef}) generates fboxs around +% \textit{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!), @@ -2953,17 +3015,21 @@ % \medskip\noindent\verb!\ShowSequence{,\ }{\textRubik}{\myseq}! \ $\longrightarrow$ \ \textRubik{U},\ \textRubik{D},\ % \textRubik{Lp},\ \textRubik{R} % +% +% % -% \subsection*{Trailing digits} +% \subsection{Trailing digits} % -% Note that the fonts denoted by \verb!\rr!, \verb!\rrh!, \verb!\Rubik! +% Note that the commands \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. +% commas (i.e.,~it does not \textit{interpret} strings like R2 $\rightarrow$ R,R etc.). +% However, if you just want to `see' the text, then the standard \LaTeX\ typewriter command +% \verb!\texttt! will typeset the text correctly, as you would expect +% (but using the \texttt{tt} font of course). % -% An effective `work-around' for this limitation is provided by the \verb!\RubikRotation{}! +% A useful `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 @@ -2974,17 +3040,19 @@ % % 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: +% In~this case D2,L3, and the name `seqA' fail to be typeset when using +% the \verb!\rr! font with the \verb!\ShowSequence! command +% (notice there are lots of commas with nothing between them), +% while \cmd{\texttt} does work, 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{,}{\rr}{\seqA}! \ $\longrightarrow$ \ \ShowSequence{,}{\rr}{\seqA} +% % \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 @@ -3053,7 +3121,7 @@ % \bigskip % %\noindent% -%\RubikCubeSolved% +%\RubikCubeSolvedWY% %\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% @@ -3073,7 +3141,7 @@ %\begin{verbatim} %\newcommand{\fourspot}{[fourspot],F2,B2,U,Dp,R2,L2,U,Dp}% %\noindent% -%\RubikCubeSolved% +%\RubikCubeSolvedWY% %\ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}% %\RubikRotation{\fourspot}% %\quad\SequenceBraceA{\SequenceName}{% @@ -3099,7 +3167,7 @@ % 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 +% \cmd{\DrawRubikFace..} or \cmd{\DrawRubikFlat..} commands etc.) and also Sidebars, 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. @@ -3108,8 +3176,6 @@ % \centering % \ifpdf % \includegraphics[height=3cm]{rubik-doc-figE.pdf} -% \else -% \includegraphics[height=3cm]{rubik-doc-figE.eps} % \fi % % \parbox{9cm}{% @@ -3121,18 +3187,17 @@ % \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, remembering that TikZ -% commands require a terminal semicolon. +% arrow drawn from the centre of the lower-left cubie $(0.5, 0.5)$ to the centre of +% middle cubie $(1.5, 1.5)$. +% To do this we just include the following TikZ command (remember that TikZ +% commands require a terminal semicolon): % \begin{quote} %\begin{verbatim} % \draw[->,color=green] (0.5,0.5) -- (1.5, 1.5); %\end{verbatim} % \end{quote} % -% The following example shows the cubie changes in the \textsc{up} face +% The following example shows the cubie movement in the \textsc{up} face % generated by the rotation sequence \rrF\rrR\rrU\rrRp\rrUp\rrFp. % The magenta arrows indicate movement \textit{with} cubie rotations, % while the black arrow indicates movement \textit{without} rotation. @@ -3141,8 +3206,9 @@ % % \bigskip % \noindent +% \RubikCubeSolvedWY % \ShowCube{2.5cm}{0.7}{% -% \DrawRubikLayerFaceAll{W} +% \DrawRubikFaceUp % \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); @@ -3151,8 +3217,9 @@ % } % \begin{minipage}{0.6\textwidth} %\begin{verbatim} +% \RubikCubeSolvedWY % \ShowCube{2.5cm}{0.7}{% -% \DrawRubikLayerFaceAll{W} +% \DrawRubikFaceUp % \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); @@ -3165,41 +3232,32 @@ % \bigskip % Since the coordinates shown in Figure~\ref{fig:facegraph} extend % outwards in all directions, they can also be used as a guide for drawing -% arrows (or other structures) outside this 3x3 `face' square. This approach -% is shown in the following example, where we have changed the \texttt{tikzpicture} scale -% factor to~0.4 in order to generate a small figure in order to facilitate placing the -% figure and the code side-by-side. -% -% \bigskip +% arrows (or other structures) outside this 3x3 `face' square. +% The origin is at lower left corner of the face. +% +% In the following example, we input a Rubik cube configuration +% (previously saved as the file \texttt{CubeFour.tex} +% (see the \textsc{rubikrotation} package documentation for details)\footnote{See also +% the `SaveRubikState' example in the file \texttt{RubikExamples.pdf}.}, and +% draw an arrow to highlight a yellow side facelet. % +% \bigskip % \noindent -% \ShowCube{1.8cm}{0.4}{% -% \DrawRubikLayerFace{G}{Y}{R}% -% {Y}{Y}{Y}% -% {B}{Y}{Y}% -% % -% \DrawRubikLayerSideT {Y}{B}{B} -% \DrawRubikLayerSideLR{R} {Y} -% {R} {O} -% {Y} {O} -% \DrawRubikLayerSideB {O}{G}{G} -% \draw[->,ultra thick,color=green] (0.5,5) -- (0.5, 4); -% } +% \RubikCubeGreyAll +% \RubikFaceUp OYG YYY BYY +% \RubikFaceFront YRR XXXXXX +% \RubikFaceRight GOO XXXXXX +% \RubikFaceBack YBB XXXXXX +% \RubikFaceLeft YGR XXXXXX +% \ShowCube{2.2cm}{0.5}{\DrawRubikFaceUpSide% +% \draw[->,ultra thick,color=green] (2.5,5) -- (2.5, 4); +% } % \begin{minipage}{0.6\textwidth} %\begin{verbatim} -% \noindent -% \ShowCube{1.8cm}{0.4}{% -% \DrawRubikLayerFace{G}{Y}{R}% -% {Y}{Y}{Y}% -% {B}{Y}{Y}% -% % -% \DrawRubikLayerSideT {Y}{B}{B} -% \DrawRubikLayerSideLR{R} {Y} -% {R} {O} -% {Y} {O} -% \DrawRubikLayerSideB {O}{G}{G} -% \draw[->,ultra thick,color=green] (0.5,5) -- (0.5, 4); -% } +% \input{CubeFour.tex} +% \ShowCube{2.2cm}{0.5}{\DrawRubikFaceUpSide% +% \draw[->,ultra thick,color=green] (2.5,5) -- (2.5, 4); +% } %\end{verbatim} % \end{minipage} % @@ -3256,35 +3314,39 @@ % % \bigskip % -% In the following example we use a blue circle to highlight the cubie -% to be rotated into the top layer. +% In the following example we use a blue circle to highlight a corner cubie +% to be rotated into the top layer. Note we also use the command +% \verb!\DrawRubikCubeSidebarFD{RU}! to draw the sidebar along +% the FD (Front-Down) edge, and show the colour of the hidden facelet +% of the corner-cubie. % % \bigskip % % \noindent% -% \RubikCubeGrey +% \RubikCubeGreyWY % \RubikFaceUp{X}{W}{X}% % {W}{W}{W}% % {W}{W}{X}% +% \RubikFaceDown{X}{X}{O}{X}{X}{X}{X}{X}{X}% % \RubikSliceBottomR{X}{X}{W}{G}{X}{X}% % \ShowCube{2.5cm}{0.5}{% % \DrawRubikCubeRU -% \DrawRubikLayerSideRBy{O} +% \DrawRubikCubeSidebarFD{RU} % \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 +% \RubikCubeGreyWY % \RubikFaceUp{X}{W}{X} % {W}{W}{W} % {W}{W}{X} +% \RubikFaceDown{X}{X}{O}{X}{Y}{X}{X}{X}{X}% % \RubikSliceBottomR{X}{X}{W}{G}{X}{X} % \ShowCube{2.5cm}{0.5}{% % \DrawRubikCubeRU -% \DrawRubikLayerSideRBy{O} +% \DrawRubikCubeSidebarFD{RU} % \draw[ultra thick,->,color=blue] % (2.5,0.5) -- (2.5, 2.5); % \draw [color=blue, thick] (2.7, 0.3) circle (1.3); @@ -3293,6 +3355,9 @@ % \end{minipage} % % +% +% +% % \section{Final example} % % We now present, as a final example, the code used to draw the front page @@ -3308,10 +3373,10 @@ % \bigskip % % \noindent\hfil% -% \RubikCubeSolved% +% \RubikCubeSolvedWY% % \ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}% % \quad\ShowCube{1.6cm}{0.4}{% -% \DrawFlatUpSide +% \DrawRubikFaceUpSide % \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); @@ -3320,26 +3385,23 @@ % }% % \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} -% \DrawRubikLayerSideT {G}{G}{R} -% \DrawRubikLayerSideLR{R} {W} -% {B} {W} -% {O} {W} -% \DrawRubikLayerSideB {G}{W}{O} -% } -% \hfil +% \RubikFaceUp WWB WWOWRB% +% \RubikFaceBack RGG XXXXXX% +% \RubikFaceLeft RBO XXXXXX% +% \RubikFaceFront GWO XXXXXX% +% \RubikFaceRight WWW XXXXXX% +% \quad\ShowCube{1.6cm}{0.4}{\DrawRubikFaceUpSide} +% \hfil% % -% \bigskip +% +% \bigskip % %\begin{verbatim} % \noindent\hfil% -% \RubikCubeSolved% +% \RubikCubeSolvedWY% % \ShowCube{1.6cm}{0.4}{\DrawRubikCubeRU}% % \quad\ShowCube{1.6cm}{0.4}{% -% \DrawFlatUpSide% +% \DrawRubikFaceUpSide% % \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); @@ -3348,7 +3410,7 @@ % }% % \RubikRotation{F,R,U,Rp,Up,Fp}% % \quad\ShowSequence{}{\Rubik}{\SequenceLong}\quad$\longrightarrow$% -% \ShowCube{1.6cm}{0.4}{\DrawFlatUpSide}% +% \ShowCube{1.6cm}{0.4}{\DrawRubikFaceUpSide}% % \hfil %\end{verbatim} % @@ -3363,29 +3425,65 @@ %\begin{verbatim} % \RubikRotation{F,R,U,Rp,Up,Fp} % \ShowSequence{,}{\Rubik}{\SequenceLong} \ \ \ $\longrightarrow$ -% \ShowCube{2cm}{0.4}{\DrawFlatUpSide} +% \ShowCube{2cm}{0.4}{\DrawRubikFaceUpSide} %\end{verbatim} % 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} -% {W}{R}{B} -% \DrawRubikLayerSideT {G}{G}{R} -% \DrawRubikLayerSideLR{R} {W} -% {B} {W} -% {O} {W} -% \DrawRubikLayerSideB {G}{W}{O} -% } +% \RubikFaceUp WWB WWOWRB +% \RubikFaceBack RGG XXXXXX +% \RubikFaceLeft RBO XXXXXX +% \RubikFaceFront GWO XXXXXX +% \RubikFaceRight WWW XXXXXX +% \quad\ShowCube{1.6cm}{0.4}{\DrawRubikFaceUpSide} +% \hfil %\end{verbatim} % % % % % +% \section{Deprecated commands} +% \label{sec:deprecated} +% +% +% The \cmd{\DrawRubikLayerFace..} and \cmd{\DrawRubikLayerSide..} +% are now deprecated; they were found to be +% confusing since (a)~they both drew faces \textit{and} took colour arguments +% for facelets, and (b)~they did not update the internal colour state of a +% cube or face---i.e.,~their colouring was simply a local `painting' action +% without memory. +% They have both been superseded by the more versatile +% \cmd{\DrawRubikFace..}\ commands (see Section~\ref{sec:drawrubikfacecommands}). +% +% The \cmd{\RubikSide..} commands are also deprecated, since they duplicated +% some of the function of the \cmd{\RubikFace..}\ commands. +% +% The earlier \cmd{\DrawFace..}\ (v4) and \cmd{\DrawFlat..}\ (v3) commands +% are also deprecated since they lacked the Rubik or Two keyword +% (see Sections~\ref{sec:rubikandtwo} and \ref{sec:drawrubikfacecommands}). +% +% \medskip +% +% {\noindent}Summary of all deprecated commands (and their current versions) since v3. +% +% \smallskip +% +% \begin{supertabular}[ll]{p{4cm} p{6cm}} +% \verb!\DrawRubikCubeFlat! & $\rightarrow$ \hspace{0.5cm} \verb!\DrawRubikCubeSF! \ (Semi-Flat) \\ +% \verb!\DrawRubikFlat! & $\rightarrow$ \hspace{0.5cm} \verb!\DrawRubikCubeF! \ \ (Flat) \\ +% \verb!\DrawFace..! & $\rightarrow$ \hspace{0.5cm} \verb!\DrawRubikFace..! \\ +% \verb!\DrawFlat..! & $\rightarrow$ \hspace{0.5cm} \verb!\DrawRubikFlat..! \\ +% \verb!\DrawFlat..Side! & $\rightarrow$ \hspace{0.5cm} \verb!\DrawRubikFace..Side! \\ +% \verb!\DrawRubikLayerFace..! & $\rightarrow$ \hspace{0.5cm} \verb!\DrawRubikFace..! \\ +% \verb!\DrawRubikLayerSide..! & $\rightarrow$ \hspace{0.5cm} \verb!\DrawRubikFace..! \\ +% \end{supertabular} +% +% +% +% % \section{Known limitations} % % Please contact the authors regarding any ideas for improvement, errors, @@ -3405,42 +3503,45 @@ % \end{itemize} % % -% \section{Future packages} -% -% Since Rubik-type cubes currently exist in a variety of sizes (from 2x2x2 to 11x11x11) -% 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, 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.\\ -% $$ -% % % % \section{Change history} % % \begin{itemize} % +% \item Version 5 (February 2018) +% +% -- Removed some now unnecessary commands (see Section~\ref{sec:deprecated}) +% and made some of the internal code a bit more efficient. +% +% ---Added two new `grey' commands: \cmd{\RubikCubeGreyWY} and \cmd{\RubikCubeGreyWB} +% (so as to complement the related \cmd{\RubikCubeSolvedXX} commands). +% +% ---Bugfix: added a pair of containing braces around the \cmd{\ifthenelse..} command +% used by the \cmd{\ShowSequence} command (for code see Section~\ref{sec:codeshowsequence}). +% This fixed an occasional problem of a font not being contained. +% +% +% ---Added missing lowercase cube `prime' versions of whole cube rotation notation +% (\rr{up}, \rr{dp}, \rr{lp}, \rr{rp}, \rr{fp}, \rr{bp}); see Section~\ref{sec:xyznotation}. +% +% +% ---New \cmd{\NoSidebar} command for disabling the drawing of sidebars of a particular colour +% (see Section~\ref{sec:nosidebar}). +% +% +% ---Implemented the terminal $x,y$ position parameters for +% the \cmd{\DrawRubikFlatLeft} and \cmd{\DrawRubikFlatRight} +% commands; all the \cmd{\DrawRubikFlat..} commands work correctly now +% (see Section~\ref{sec:codedrawrubikflatcommands}) +% +% +% % \item Version 4.0 (March 2017) % % ---Improved documentation. % -% ---Improved inter-hieroglyph spacing and vertical position. The Computer Moderm sans bold font +% ---Improved inter-hieroglyph spacing and vertical position. The Computer Modern sans bold font % (10/12pt) is used for the hieroglyphs and rotation codes (see Section~\ref{sec:coderubikfont} % for details). % @@ -3457,14 +3558,6 @@ % (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 @@ -3482,9 +3575,9 @@ % \end{quote} % % ---A new command for setting up or allocating a `solved' colour configuration. -% (see Section~\ref{sec:solvedconfig}): +% (see Section~\ref{sec:rubiksolvedconfig}): % \begin{quote} -% \cmd{\SolvedConfig} +% \cmd{\RubikSolvedConfig} % \end{quote} % % ---A new command for setting up a `starter cube' for which the \textit{whole} cube @@ -3524,8 +3617,8 @@ % % ---Fixed typos and minor errors in the documentation. % -% ---Added the following commands to facilitate typesetting a face, -% as described in Section~\ref{sec:flatcommands}. +% ---Added the following commands to facilitate typesetting a face +% (but see Section~\ref{sec:deprecated}). %\begin{quote} %\begin{verbatim} %\DrawFlatUp @@ -3565,15 +3658,15 @@ % % \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 +% We 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\{\}\{\}} +% We also 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. -% -% +% (see Section~\ref{sec:codeshowsequence}), Herbert Kociemba for helpful comments, +% and Robert Ma\v{r}\'{\i}k for suggesting the \cmd{\NoSidebar\{\}} command +% (see Section~\ref{sec:nosidebar}). % % % \section{References} @@ -3594,11 +3687,7 @@ % \item Demaine ED, Demaine ML, Eisenstat S, Lubiw A and Winslow A (2011). % Algorithms for solving Rubik's cubes. % \url{http://www.arxiv.org/abs/1106.5736/} -% -% \item Garfath-Cox, A (1981). \textit{The cube}, (Bolden Publishing Co., -% East Molesey, Surrey) pp.32. [copy in British Library] -% -% +% % \item Duvoid T (2010). % M\'{e}thode simple pour remonter le Rubik's cube. % \newline\url{http://duvoid.fr/rubik/rubik-debutant-couleurs.pdf} @@ -3614,23 +3703,35 @@ % 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 website (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 Fung website (Fung A). Solving the Rubik's cube systematically. +% \url{http://alexfung.info/favorite/cube/cube.htm} +% +% \item Garfath-Cox, A (1981). \textit{The cube}, (Bolden Publishing Co., +% East Molesey, Surrey) pp.32. [copy in British Library] +% % \item Golomb SW (1981). Rubik's cube and a model of quark confinement. % \textit{Am.\ J.\ Phys.}; vol~49, pp~1030--1031. % % \item Golomb SW (1982). Rubik's cube and quarks: twists on the eight corner cells % of Rubik's cube provide a model for many aspects of quark behaviour. -% \textit{American Scientist}; -% \underline{70}, pp.~257--259. \url{http://www.jstor.org/stable/27851433} +% \textit{American Scientist}; \underline{70}, No~3 (May--June 1982), +% pp.~257--259. \url{http://www.jstor.org/stable/27851433} % % \item Gymrek M (2009). The mathematics of the Rubik's cube. % \newline\url{http://web.mit.edu/sp.268/www/rubik.pdf} +% +% \item Harris D (2008). Speedsolving the cube. +% (Sterling Publishing Co.\ Inc., New York, USA.) pp.~166. +% [covers 2x2x2, 3x3x3, 4x4x4, 5x5x5 cubes] +% +% \item Harris website (Harris D). \url{http://www.cubestation.co.uk} % % \item Heise website (Heise R). Rubik's cube theory. \url{http://www.ryanheise.com/cube/theory.html} % @@ -3659,7 +3760,7 @@ % \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) @@ -3674,19 +3775,31 @@ % Rubik's cube is twenty. \textit{SIAM.\ J.\ Discrete Math.}, \underline{27}, 1082--1105. % (\url{http://tomas.rokicki.com/rubik20.pdf}) % +% \item Roux website (Roux G). \ \ \url{http://www.grroux.free.fr} +% % \item Rubik's cube. See Section on notation. % \newline\url{http://en.wikipedia.org/wiki/Rubik's_Cube} % -% \item RuWix website (Ferenec D) \ \ \url{http://www.ruwix.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 Sher S.\ T-H.\ (2014). The new durable Rubik's cube (technical description). +% \url{http://www.scf.usc.edu/~tsher/files/Rubiks_Cube.pdf} [includes RGB colour specification] +% +% % \item Singmaster D (1981). \textit{Notes on Rubik's magic cube} (Harmondsworth, Eng., Penguin Books) % % \item Speedsolving website. \url{http://www.speedsolving.com/} +% +% +% \item Storer website (Storer JA). \url{http://www.cs.brandeis.edu/~storer/JimPuzzles/} +% {\newline} For Rubik cube, see: \url{http://www.cs.brandeis.edu/~storer/JimPuzzles/RUBIK/Rubik3x3x3.pdf} +% {\newline} For puzzle book, see: \url{http://www.cs.brandeis.edu/~storer/zzzJimPuzzles/JimPuzzlesBook.pdf} % +% % \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} % @@ -3696,7 +3809,7 @@ % [cited from \textit{Wikipedia} (Rubik's cube)] % % -% \item Vandenbergh website (Vandenbergh L.) \ \ \textsc{cubezone} \url{http://www.cubezone.be} +% \item Vandenbergh website (Vandenbergh L). \ \ \textsc{cubezone} \url{http://www.cubezone.be} % % \item WCA (2016). World Cube Association Regulations. See \S\,12 for notation. % \url{http://www.worldcubeassociation.org/regulations.htm} @@ -3725,8 +3838,8 @@ % % \begin{macrocode} %<*rubikcube> -\def\RCfileversion{4.0}% -\def\RCfiledate{2017/03/03}% +\def\RCfileversion{5.0}% +\def\RCfiledate{2018/02/25}% February 25, 2018 \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{rubikcube}[\RCfiledate\space (v\RCfileversion)] % \end{macrocode} @@ -3767,9 +3880,8 @@ % \subsection{\hspace{3mm}Colours} % \label{sec:codecolours} % -% 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}. +% We have adopted the following colour allocations---see Section~\ref{sec:colours} +% for details. % % \begin{macrocode} \definecolor{R}{HTML}{C41E33}% @@ -3798,7 +3910,7 @@ % 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 +% 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} @@ -3892,37 +4004,61 @@ \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. +% \noindent\textsc{example usage:} |\ForEachX{;}{\texttt{\x}}{L;R;U;D}| % -% 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. +% An important feature of the |\ForEachX| command is that it expands its third argument +% (the list of elements), since this allows the list of elements to be presented as +% a macro, which is extremely convenient for the user. % -% 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. +% The \cmd{\ShowSequence} command typesets a sequence of elements (|#3|), and places +% an optional separator (|#1|) between them. +% For each element (|\x|, see above) of the sequence |#3| this command forms the +% construction |#2{element of #3}|. +% For~example, if |#2 = \rr|, and D is an element of |#3|, then it will form the +% command |\rr{D}| etc. +% +% Note that it is not straightforward to place the separator (|#1|) \textit{only between} +% the derived elements (i.e.,~without the separator being either before the first element, +% or following the last element) using only the |ForEachX| command. This is because +% the |ForEachX| command processes each element in exactly the +% same way---i.e.,~a comma after the first element (good) means there will be a comma after +% the final element (bad). +% +% We solve this problem by using the |\ifthenelse| command to allow the first element +% to be processed differently from all the remaining elements. This is because it is easy +% for \TeX\ to identify the first element of a sequence, but very difficult for it to +% identify the final element since we generally don't know the number of elements beforehand. +% Consequently we identify the first element (using the |\xcount|) variable (see above), +% and then process this first element \textit{without} any comma; +% we then place a comma in front of each of the remaining elements. +% +% We also create two fbox versions of the command: the `F' version places an fbox about the +% whole output; the `f' version places an fbox about each element in the output +% (these two versions can be helpful when checking white space). +% +% Note: bugfix 22 October 2017 (RWDN): if the user implemented tt output using \cmd{\tt} +% instead of the standard \cmd{\texttt} as the \verb!#2! argument, then the action would +% not of course remain local, and consequently we have added a leading brace and +% complementary trailing brace around the the \cmd{\ifthenelse...} command in each of +% the following three macros to limit the action. % % \noindent\textsc{usage}: |\ShowSequence{,}{\rr}{R,L,Up,Dp.....}| % % \begin{macrocode} \newcommand{\ShowSequence}[3]{% \ForEachX{,}{% - \ifthenelse{\xcount=1}{#2{\x}}{#1#2{\x}}% + {\ifthenelse{\xcount=1}{#2{\x}}{#1#2{\x}}}% }{#3}% }% \newcommand{\ShowSequenceF}[3]{% \fbox{% \ForEachX{,}{% - \ifthenelse{\xcount=1}{#2{\x}}{#1#2{\x}}% + {\ifthenelse{\xcount=1}{#2{\x}}{#1#2{\x}}}% }{#3}% }}% \newcommand{\ShowSequencef}[3]{% \ForEachX{,}{% - \ifthenelse{\xcount=1}{\fbox{#2{\x}}}{#1{\fbox{#2{\x}}}}% + {\ifthenelse{\xcount=1}{\fbox{#2{\x}}}{#1{\fbox{#2{\x}}}}}% }{#3}% }% % \end{macrocode} @@ -3934,7 +4070,7 @@ % 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 +% 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,...). % @@ -3987,18 +4123,26 @@ % \end{macro} % % -% \subsection{\hspace{3mm}Face commands} +% \subsection{\hspace{3mm}RubikFace commands} +% \label{sec:rubikfacecode} % % Cube face notation: U, D, L, R, F, B (Singmaster) -% {\newline}Cubie-square notation: t, m, b, l, m, r = top, middle, +% {\newline}Cubie-facelet notation: t, m, b, l, m, r = top, middle, % bottom, left, middle, right. -% 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}bottom row (7,8,9) = bl, bm, br +% We use this lower case notation in XY-pairs to denote individual cubie facelets +% on a given face (to avoid confusion with cube Face notation), as follows: +% {\newline}\strut\hspace{1cm}top row \ \ \ \ \ (1,2,3) = lt, \ \, mt, \ rt +% {\newline}\strut\hspace{1cm}middle row\, (4,5,6) = lm, mm, rm +% {\newline}\strut\hspace{1cm}bottom row (7,8,9) = lb, \ mb, \ rb +% {\newline}For example, the current colour of the \textbf{r}ight \textbf{b}ottom facelet +% on the \textsc{front} face is held as the variable \cmd{\Frb} etc. +% +% The cubie-facelets (squares) on a face are also parameterized numerically +% \verb!#1!--\verb!#9! reading from left-to-right, starting top-left \& +% ending bottom-right, when used as arguments for specifying particular colours +% (as in the \cmd{\RubikFace..} commands---see below). + +% % % \begin{macro}{\RubikFaceUp} % \begin{macro}{\RubikFaceDown} @@ -4018,10 +4162,10 @@ % Each letter is an initial letter of the words Up, Down, Left, Right, Front, Back, % left, middle, right, top, middle, bottom. % -% For~example, in the command \cmd{\Urt\{\#1\}} -% the U stands for the Up face of the cube, while the \texttt{rt} stands -% for the ``right-top'' facelet on this face. Note that the order -% of the two lower-case letters (in this case \texttt{rt}) are always written +% For~example, in the command \verb!\def\Urt{#1}! +% the U denotes the Up face of the cube, while the \texttt{rt} denotes +% the ``right-top'' facelet on this face. Note that the order +% of the two lower-case letters (\texttt{rt}) is % 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 @@ -4128,42 +4272,59 @@ % \end{macrocode} % % - +% % % \subsection{\hspace{3mm}RubikCubeGrey command} % \label{sec:codegrey} % % \begin{macro}{\RubikCubeGrey} +% \begin{macro}{\RubikCubeGreyWY} +% \begin{macro}{\RubikCubeGreyWB} % 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. % 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). +% We also make WY and WB versions, and implement equivalent `gray' versions +% (to be consistent with TikZ). % \begin{macrocode} \newcommand{\RubikCubeGrey}{% -\RubikFaceUp {X}{X}{X}{X}{W}{X}{X}{X}{X}% -\RubikFaceDown {X}{X}{X}{X}{Y}{X}{X}{X}{X}% -\RubikFaceLeft {X}{X}{X}{X}{B}{X}{X}{X}{X}% -\RubikFaceRight{X}{X}{X}{X}{G}{X}{X}{X}{X}% -\RubikFaceFront{X}{X}{X}{X}{O}{X}{X}{X}{X}% -\RubikFaceBack {X}{X}{X}{X}{R}{X}{X}{X}{X}% + \RubikFaceRight{X}{X}{X}{X}{G}{X}{X}{X}{X}% + \RubikFaceLeft {X}{X}{X}{X}{B}{X}{X}{X}{X}% + \RubikFaceUp {X}{X}{X}{X}{W}{X}{X}{X}{X}% + \RubikFaceDown {X}{X}{X}{X}{Y}{X}{X}{X}{X}% + \RubikFaceFront{X}{X}{X}{X}{O}{X}{X}{X}{X}% + \RubikFaceBack {X}{X}{X}{X}{R}{X}{X}{X}{X}% } \newcommand{\RubikCubeGray}{\RubikCubeGrey} +\newcommand{\RubikCubeGreyWY}{\RubikCubeGrey} +\newcommand{\RubikCubeGrayWY}{\RubikCubeGreyWY} +%% +\newcommand{\RubikCubeGreyWB}{% + \RubikFaceRight{X}{X}{X}{X}{R}{X}{X}{X}{X}% + \RubikFaceLeft {X}{X}{X}{X}{O}{X}{X}{X}{X}% + \RubikFaceUp {X}{X}{X}{X}{W}{X}{X}{X}{X}% + \RubikFaceDown {X}{X}{X}{X}{B}{X}{X}{X}{X}% + \RubikFaceFront{X}{X}{X}{X}{G}{X}{X}{X}{X}% + \RubikFaceBack {X}{X}{X}{X}{Y}{X}{X}{X}{X}% +} +\newcommand{\RubikCubeGrayWB}{\RubikCubeGreyWB} % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} % % % % % \subsection{\hspace{3mm}SolvedConfig command} % -% \begin{macro}{\SolvedConfig} +% \begin{macro}{\RubikSolvedConfig} % This command sets the face/colour configuration (state) of a typical % 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{\SolvedConfig}[6]{% +\newcommand{\RubikSolvedConfig}[6]{% \RubikFaceRightAll{#1}% \RubikFaceLeftAll{#2}% \RubikFaceUpAll{#3}% @@ -4184,10 +4345,10 @@ % 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). +% appear grey. We implement it using the \cmd{\RubikSolvedConfig} 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{\RubikCubeGreyAll}{\RubikSolvedConfig{X}{X}{X}{X}{X}{X}}% \newcommand{\RubikCubeGrayAll}{\RubikCubeGreyAll} % \end{macrocode} % \end{macro} @@ -4206,9 +4367,9 @@ % \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{\RubikCubeSolved}{\RubikSolvedConfig{G}{B}{W}{Y}{O}{R}}% \newcommand{\RubikCubeSolvedWY}{\RubikCubeSolved}% -\newcommand{\RubikCubeSolvedWB}{\SolvedConfig{R}{O}{W}{B}{G}{Y}}% +\newcommand{\RubikCubeSolvedWB}{\RubikSolvedConfig{R}{O}{W}{B}{G}{Y}}% % \end{macrocode} % \end{macro} % \end{macro} @@ -4348,7 +4509,6 @@ % exactly 1-unit, and so makes it easy to determine the 2D~(x,y) coordinates % of any position, and hence facilitates typesetting text onto the image of % the cube using TikZ commands. - % \end{macro} % \begin{macrocode} \newcommand{\DrawRubikCubeRU}{% @@ -4574,110 +4734,36 @@ } % \end{macrocode} % +% RWDN19D removed DrawRubikLayerFace commands Feb 19 2018 % -% \subsection{\hspace{3mm}LayerFace commands} -% -% \begin{macro}{\DrawRubikLayerFace} -% \begin{macro}{\DrawRubikLayerFaceAll} -% 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 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 -% \cmd{\DrawRubikCubeFrontFace} -% which is used for drawing the front face of a Rubik cube. -% \end{macro} -% \end{macro} -% \begin{macrocode} -\newcommand{\DrawRubikLayerFace}[9]{% -%%-----------FRONT face--------- -%%---top row -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(0,2) -- (0, 3) -- (1,3) -- (1,2) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#2]% -(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#3]% -(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle; -%%-----middle row -\draw[line join=round,line cap=round,ultra thick,fill=#4]% -(0,1) -- (0, 2) -- (1,2) -- (1,1) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#5]% -(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#6]% -(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle; -%%----bottom row -\draw[line join=round,line cap=round,ultra thick,fill=#7]% -(0,0) -- (0, 1) -- (1,1) -- (1,0) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#8]% -(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#9]% -(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle; -} -\newcommand{\DrawRubikLayerFaceAll}[1]{% -%%----------FRONT face----------- -%%---top row -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(0,2) -- (0, 3) -- (1,3) -- (1,2) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle; -%%-----middle row -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(0,1) -- (0, 2) -- (1,2) -- (1,1) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle; -%%----bottom row -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(0,0) -- (0, 1) -- (1,1) -- (1,0) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle; -} -% \end{macrocode} % % -% \subsection{\hspace{3mm}DrawFlatX commands} -% \label{sec:drawflatxcommands} +% \subsection{\hspace{3mm}DrawRubikFlatX commands} +% \label{sec:codedrawrubikflatcommands} % -% [\textsc{note}: These new commands (version 3.0) were modified from the +% [\textsc{Background}: These commands (new in 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 so as to make this +% renamed 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} -% \begin{macro}{\DrawFlatLeft} -% \begin{macro}{\DrawFlatRight} -% \begin{macro}{\DrawFlatFront} -% \begin{macro}{\DrawFlatBack} -% Each of these commands draws a separate (flat) face (9~facelets) -% (see Section~\ref{sec:flatcommands}). -% Each command (except \cmd{\DrawFlatFront}) takes two arguments, +% Note also that the \cmd{\DrawRubikFace..} commands are essentially +% these same commands but with their two coordinate arguments X,Y +% set to $x=0$, $y=0$---see Section~\ref{sec:drawrubikfacecode}] +% +% \begin{macro}{\DrawRubikFlatUp} +% \begin{macro}{\DrawRubikFlatDown} +% \begin{macro}{\DrawRubikFlatLeft} +% \begin{macro}{\DrawRubikFlatRight} +% \begin{macro}{\DrawRubikFlatFront} +% \begin{macro}{\DrawRubikFlatBack} +% Each of these commands draws a separate (flat) face (9~facelets). +% Each command (except \cmd{\DrawRubikFlatFront}) 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 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 -% with the \cmd{\DrawFlatUp}, \cmd{\DrawFlatDown} and \cmd{\DrawFlatBack} -% commands, since all the other faces currently only require Y=0 -% (this will be made more flexible in a later version). -% -% Note also that the \cmd{\DrawFlatFront} command takes no arguments, +% Note also that the \cmd{\DrawRubikFlatFront} command takes no arguments, % since by definition the bottom left corner of this face is at (0,0), % and there seems to be no reason (just now) for this face to have the % facility to be positioned otherwise. @@ -4685,15 +4771,15 @@ % \textsc{example}: The following command positions the Up face so % that its bottom left corner is located at (0,3): % \begin{quote} -% \cmd{\DrawFlatUp\{0\}\{3\}} +% \cmd{\DrawRubikFlatUp\{0\}\{3\}} % \end{quote} -% These new commands are also used by the commands \cmd{\DrawRubikFlat} and -% \cmd{\DrawRubikCubeFlat} to draw various `flat' representations +% These new commands are also used by the commands \cmd{\DrawRubikCubeF} and +% \cmd{\DrawRubikCubeSF} to draw various `flat' representations % of a Rubik cube. % % The (x,y) variables are here encoded as (\cmd{\ux}, \cmd{\uy}) where the % `u' stands for Up etc. However, since we are unable to use a `dx, dy' notation -% with the \cmd{\DrawFlatDown} command (since dx and dy are already used by the +% with the \cmd{\DrawRubikFlatDown} 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} @@ -4703,7 +4789,7 @@ % \end{macro} % \end{macro} % \begin{macrocode} -\newcommand{\DrawFlatUp}[2]{% +\newcommand{\DrawRubikFlatUp}[2]{% \pgfmathsetmacro{\ux}{#1}% \pgfmathsetmacro{\uy}{#2}% %%---top row @@ -4738,7 +4824,7 @@ -- (\ux + 3,\uy + 0) -- cycle; } %%------------------------- -\newcommand{\DrawFlatDown}[2]{% +\newcommand{\DrawRubikFlatDown}[2]{% \pgfmathsetmacro{\ddx}{#1}% \pgfmathsetmacro{\ddy}{#2}% %%---top row @@ -4773,61 +4859,77 @@ -- (\ddx + 3,\ddy + 0) -- cycle; } %%------------------------- -\newcommand{\DrawFlatLeft}[2]{% +\newcommand{\DrawRubikFlatLeft}[2]{% \pgfmathsetmacro{\lx}{#1}% \pgfmathsetmacro{\ly}{#2}% -%% NOTE: y variable coord not yet implemented %%---top row \draw[line join=round,line cap=round,ultra thick,fill=\Llt]% -(\lx + 0,2) -- (\lx + 0, 3) -- (\lx + 1,3) -- (\lx + 1,2) -- cycle; +(\lx + 0, \ly + 2) -- (\lx + 0, \ly + 3) -- (\lx + 1, \ly + 3)% + -- (\lx + 1, \ly + 2) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Lmt]% -(\lx + 1,2) -- (\lx + 1, 3) -- (\lx + 2,3) -- (\lx + 2,2) -- cycle; +(\lx + 1, \ly + 2) -- (\lx + 1, \ly + 3) -- (\lx + 2, \ly + 3)% + -- (\lx + 2, \ly + 2) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Lrt]% -(\lx + 2,2) -- (\lx + 2, 3) -- (\lx + 3,3) -- (\lx + 3,2) -- cycle; +(\lx + 2, \ly + 2) -- (\lx + 2, \ly + 3) -- (\lx + 3, \ly + 3)% + -- (\lx + 3, \ly + 2) -- cycle; %%-----middle row \draw[line join=round,line cap=round,ultra thick,fill=\Llm]% -(\lx + 0,1) -- (\lx + 0, 2) -- (\lx + 1,2) -- (\lx + 1,1) -- cycle; +(\lx + 0, \ly + 1) -- (\lx + 0, \ly + 2) -- (\lx + 1, \ly + 2)% + -- (\lx + 1, \ly + 1) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Lmm]% -(\lx + 1,1) -- (\lx + 1, 2) -- (\lx + 2,2) -- (\lx + 2,1) -- cycle; +(\lx + 1, \ly + 1) -- (\lx + 1, \ly + 2) -- (\lx + 2, \ly + 2)% + -- (\lx + 2, \ly + 1) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Lrm]% -(\lx + 2,1) -- (\lx + 2, 2) -- (\lx + 3,2) -- (\lx + 3,1) -- cycle; +(\lx + 2, \ly + 1) -- (\lx + 2, \ly + 2) -- (\lx + 3, \ly + 2)% + -- (\lx + 3, \ly + 1) -- cycle; %%----bottom row \draw[line join=round,line cap=round,ultra thick,fill=\Llb]% -(\lx + 0,0) -- (\lx + 0, 1) -- (\lx + 1,1) -- (\lx + 1,0) -- cycle; +(\lx + 0, \ly + 0) -- (\lx + 0, \ly + 1) -- (\lx + 1, \ly + 1)% + -- (\lx + 1, \ly + 0) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Lmb]% -(\lx + 1,0) -- (\lx + 1, 1) -- (\lx + 2,1) -- (\lx + 2,0) -- cycle; +(\lx + 1, \ly + 0) -- (\lx + 1, \ly + 1) -- (\lx + 2, \ly + 1)% + -- (\lx + 2, \ly + 0) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Lrb]% -(\lx + 2,0) -- (\lx + 2, 1) -- (\lx + 3,1) -- (\lx + 3,0) -- cycle; +(\lx + 2, \ly + 0) -- (\lx + 2, \ly + 1) -- (\lx + 3, \ly + 1)% + -- (\lx + 3, \ly + 0) -- cycle; } %%-------------------------- -\newcommand{\DrawFlatRight}[2]{% -\pgfmathsetmacro{\rx}{#1}% %3 -\pgfmathsetmacro{\ry}{#2}% %0 -%% NOTE: y variable coord not yet implemented +\newcommand{\DrawRubikFlatRight}[2]{% +\pgfmathsetmacro{\rx}{#1}% +\pgfmathsetmacro{\ry}{#2}% %%---top row \draw[line join=round,line cap=round,ultra thick,fill=\Rlt]% -(\rx + 0,2) -- (\rx + 0, 3) -- (\rx + 1,3) -- (\rx + 1,2) -- cycle; +(\rx + 0, \ry + 2) -- (\rx + 0, \ry + 3) -- (\rx + 1, \ry + 3)% + -- (\rx + 1, \ry + 2) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Rmt]% -(\rx + 1,2) -- (\rx + 1, 3) -- (\rx + 2,3) -- (\rx + 2,2) -- cycle; +(\rx + 1, \ry + 2) -- (\rx + 1, \ry + 3) -- (\rx + 2, \ry + 3)% + -- (\rx + 2, \ry + 2) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Rrt]% -(\rx + 2,2) -- (\rx + 2, 3) -- (\rx + 3,3) -- (\rx + 3,2) -- cycle; +(\rx + 2, \ry + 2) -- (\rx + 2, \ry + 3) -- (\rx + 3, \ry + 3)% + -- (\rx + 3, \ry + 2) -- cycle; %%-----middle row \draw[line join=round,line cap=round,ultra thick,fill=\Rlm]% -(\rx + 0,1) -- (\rx + 0, 2) -- (\rx + 1,2) -- (\rx + 1,1) -- cycle; +(\rx + 0, \ry + 1) -- (\rx + 0, \ry + 2) -- (\rx + 1, \ry + 2)% + -- (\rx + 1, \ry + 1) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Rmm]% -(\rx + 1,1) -- (\rx + 1, 2) -- (\rx + 2,2) -- (\rx + 2,1) -- cycle; +(\rx + 1, \ry + 1) -- (\rx + 1, \ry + 2) -- (\rx + 2, \ry + 2)% + -- (\rx + 2, \ry + 1) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Rrm]% -(\rx + 2,1) -- (\rx + 2, 2) -- (\rx + 3,2) -- (\rx + 3,1) -- cycle; +(\rx + 2, \ry + 1) -- (\rx + 2, \ry + 2) -- (\rx + 3, \ry + 2)% + -- (\rx + 3, \ry + 1) -- cycle; %%----bottom row \draw[line join=round,line cap=round,ultra thick,fill=\Rlb]% -(\rx + 0,0) -- (\rx + 0, 1) -- (\rx + 1,1) -- (\rx + 1,0) -- cycle; +(\rx + 0, \ry + 0) -- (\rx + 0, \ry + 1) -- (\rx + 1, \ry + 1)% + -- (\rx + 1, \ry + 0) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Rmb]% -(\rx + 1,0) -- (\rx + 1, 1) -- (\rx + 2,1) -- (\rx + 2,0) -- cycle; +(\rx + 1, \ry + 0) -- (\rx + 1, \ry + 1) -- (\rx + 2, \ry + 1)% + -- (\rx + 2, \ry + 0) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Rrb]% -(\rx + 2,0) -- (\rx + 2, 1) -- (\rx + 3,1) -- (\rx + 3,0) -- cycle; +(\rx + 2, \ry + 0) -- (\rx + 2, \ry + 1) -- (\rx + 3, \ry + 1)% + -- (\rx + 3, \ry + 0) -- cycle; } %%----------------------- -\newcommand{\DrawFlatFront}{% +\newcommand{\DrawRubikFlatFront}{% %% This command is used /only/ by the \cmd{\DrawRubikCubeF} command. %% NOTE: x, y variables not implemented as not required here %%---top row @@ -4859,7 +4961,7 @@ (2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle; } %%------------------------- -\newcommand{\DrawFlatBack}[2]{% +\newcommand{\DrawRubikFlatBack}[2]{% \pgfmathsetmacro{\bx}{#1}% \pgfmathsetmacro{\by}{#2}% %%---top row @@ -4897,16 +4999,16 @@ % % \begin{macro}{\DrawRubikCubeF} % Draws a standard flat (F) representation of the Rubik -% cube (colours only). Note that \cmd{\DrawFlatFront} (below) +% cube (colours only). Note that \cmd{\DrawRubikFlatFront} (below) % does not take any arguments (x,y). % \begin{macrocode} \newcommand{\DrawRubikCubeF}{% - \DrawFlatUp{0}{3}% - \DrawFlatDown{0}{-3}% - \DrawFlatLeft{-3}{0}% - \DrawFlatFront% - \DrawFlatRight{3}{0}% - \DrawFlatBack{6}{0}% + \DrawRubikFlatUp{0}{3}% + \DrawRubikFlatDown{0}{-3}% + \DrawRubikFlatLeft{-3}{0}% + \DrawRubikFlatFront% + \DrawRubikFlatRight{3}{0}% + \DrawRubikFlatBack{6}{0}% } % \end{macrocode} % \end{macro} @@ -4918,157 +5020,246 @@ % arguments (below) are for the bottom-left corner of the face. % \begin{macrocode} \newcommand{\DrawRubikCubeSF}{% - \DrawRubikCube% - \DrawFlatDown{0}{-3}% - \DrawFlatLeft{-3}{0}% - \DrawFlatBack{4}{1}% + \DrawRubikCubeRU% + \DrawRubikFlatDown{0}{-3}% + \DrawRubikFlatLeft{-3}{0}% + \DrawRubikFlatBack{4}{1}% } % \end{macrocode} % \end{macro} % % % -% \subsubsection{DrawFlatXSide commands} -% \label{sec:drawflatxsidecode} +% \subsubsection{DrawRubikFaceXSide commands} +% \label{sec:drawrubikflatxsidecode} % % These six commands draw a face together with all four sidebars -% (colours only). We use the \cmd{\DrawFlatX} commands to draw the face. -% We use the \cmd{\DrawRubikLayerSideX} commands to draw the sidebars. -% The parameter orders for the \cmd{\DrawRubikLayerSideX} -% commands are as follows: -% Top (T) and Bottom (B) = left to right; +% (colours only). They use the \cmd{\DrawRubikFlatX} commands to draw the face, +% and the \cmd{\side@bar..} commands to draw the sidebars. Since each +% of the four sides of a face has three small (side) bars, we use a total +% of 12 side@bar commands for each command. +% +% The parameter codes for the \cmd{\side@bar..} +% commands are as follows (see Section~\ref{sec:side@barcode} for full details). +% 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}). % +% Note that since these commands are quite long, thay all have a +% slightly more convenient short-hand version whereby the terminal two words +% are contracted to their two initial letters (see Section~\ref{sec:drawrubikfacecode}). +% RWDN19B % -% \begin{macro}{\DrawFlatUpSide} -% Draws the \textsc{up} face together with all four sidebars -% (colours only). +% \begin{macro}{\DrawRubikFaceUpSide} +% Draws the \textsc{up} face together with all four sidebars. % \begin{macrocode} -\newcommand{\DrawFlatUpSide}{% -\DrawFlatUp{0}{0}% -\DrawRubikLayerSideT{\Brt}{\Bmt}{\Blt}% -\DrawRubikLayerSideL{\Llt}{\Lmt}{\Lrt}% -\DrawRubikLayerSideR{\Rrt}{\Rmt}{\Rlt}% -\DrawRubikLayerSideB{\Flt}{\Fmt}{\Frt}% +\newcommand{\DrawRubikFaceUpSide}{% +\DrawRubikFlatUp{0}{0}% +%Top is a horizontal sidebar, so 1 = r, 3=l +\side@barT{1}{\Brt} +\side@barT{2}{\Bmt} +\side@barT{3}{\Blt} +%Left is a vertical sidebar, so 1 = r, 3=l +\side@barL{1}{\Lrt} +\side@barL{2}{\Lmt} +\side@barL{3}{\Llt} +%Right is a vertical sidebar, so 1 = l, 3=r +\side@barR{1}{\Rlt} +\side@barR{2}{\Rmt} +\side@barR{3}{\Rrt} +%Bottom is a horizontal sidebar, so 1 = l, 3=r +\side@barB{1}{\Flt} +\side@barB{2}{\Fmt} +\side@barB{3}{\Frt} } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\DrawFlatFrontSide} -% Draws the \textsc{front} face together with all four sidebars -% (colours only). +% \begin{macro}{\DrawRubikFaceFrontSide} +% Draws the \textsc{front} face together with all four sidebars. % \begin{macrocode} -\newcommand{\DrawFlatFrontSide}{% -\DrawFlatFront{0}{0}% -\DrawRubikLayerSideT{\Ulb}{\Umb}{\Urb}% -\DrawRubikLayerSideL{\Lrt}{\Lrm}{\Lrb}% -\DrawRubikLayerSideR{\Rlt}{\Rlm}{\Rlb}% -\DrawRubikLayerSideB{\Dlt}{\Dmt}{\Drt}% +\newcommand{\DrawRubikFaceFrontSide}{% +\DrawRubikFlatFront{0}{0}% +%Top +\side@barT{1}{\Ulb} +\side@barT{2}{\Umb} +\side@barT{3}{\Urb} +%Left +\side@barL{1}{\Lrb} +\side@barL{2}{\Lrm} +\side@barL{3}{\Lrt} +%Right +\side@barR{1}{\Rlb} +\side@barR{2}{\Rlm} +\side@barR{3}{\Rlt} +%Bottom +\side@barB{1}{\Dlt} +\side@barB{2}{\Dmt} +\side@barB{3}{\Drt} } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\DrawFlatRightSide} -% Draws the \textsc{right} face together with all four sidebars -% (colours only). +% \begin{macro}{\DrawRubikFaceRightSide} +% Draws the \textsc{right} face together with all four sidebars. % \begin{macrocode} -\newcommand{\DrawFlatRightSide}{% -\DrawFlatRight{0}{0}% -\DrawRubikLayerSideT{\Urb}{\Urm}{\Urt}% -\DrawRubikLayerSideL{\Frt}{\Frm}{\Frb}% -\DrawRubikLayerSideR{\Blt}{\Blm}{\Blb}% -\DrawRubikLayerSideB{\Drt}{\Drm}{\Drb}% +\newcommand{\DrawRubikFaceRightSide}{% +\DrawRubikFlatRight{0}{0}% +%Top +\side@barT{1}{\Urb} +\side@barT{2}{\Urm} +\side@barT{3}{\Urt} +%Left +\side@barL{1}{\Frb} +\side@barL{2}{\Frm} +\side@barL{3}{\Frt} +%Right +\side@barR{1}{\Blb} +\side@barR{2}{\Blm} +\side@barR{3}{\Blt} +%Bottom +\side@barB{1}{\Drt} +\side@barB{2}{\Drm} +\side@barB{3}{\Drb} } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\DrawFlatLeftSide} -% Draws the \textsc{left} face together with all four sidebars -% (colours only). +% \begin{macro}{\DrawRubikFaceLeftSide} +% Draws the \textsc{left} face together with all four sidebars. % \begin{macrocode} -\newcommand{\DrawFlatLeftSide}{% -\DrawFlatLeft{0}{0}% -\DrawRubikLayerSideT{\Ult}{\Ulm}{\Ulb}% -\DrawRubikLayerSideL{\Brt}{\Brm}{\Brb}% -\DrawRubikLayerSideR{\Flt}{\Flm}{\Flb}% -\DrawRubikLayerSideB{\Dlb}{\Dlm}{\Dlt}% +\newcommand{\DrawRubikFaceLeftSide}{% +\DrawRubikFlatLeft{0}{0}% +%Top +\side@barT{1}{\Ult} +\side@barT{2}{\Ulm} +\side@barT{3}{\Ulb} +%Left +\side@barL{1}{\Brb} +\side@barL{2}{\Brm} +\side@barL{3}{\Brt} +%Right +\side@barR{1}{\Flb} +\side@barR{2}{\Flm} +\side@barR{3}{\Flt} +%Bottom +\side@barB{1}{\Dlb} +\side@barB{2}{\Dlm} +\side@barB{3}{\Dlt} } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\DrawFlatBackSide} -% Draws the \textsc{back} face together with all four sidebars -% (colours only). +% \begin{macro}{\DrawRubikFaceBackSide} +% Draws the \textsc{back} face together with all four sidebars. % \begin{macrocode} -\newcommand{\DrawFlatBackSide}{% -\DrawFlatBack{0}{0}% -\DrawRubikLayerSideT{\Urt}{\Umt}{\Ult}% -\DrawRubikLayerSideL{\Rrt}{\Rrm}{\Rrb}% -\DrawRubikLayerSideR{\Llt}{\Llm}{\Llb}% -\DrawRubikLayerSideB{\Drb}{\Dmb}{\Dlb}% +\newcommand{\DrawRubikFaceBackSide}{% +\DrawRubikFlatBack{0}{0}% +%Top +\side@barT{1}{\Urt} +\side@barT{2}{\Umt} +\side@barT{3}{\Ult} +%Left +\side@barL{1}{\Rrb} +\side@barL{2}{\Rrm} +\side@barL{3}{\Rrt} +%Right +\side@barR{1}{\Llb} +\side@barR{2}{\Llm} +\side@barR{3}{\Llt} +%Bottom +\side@barB{1}{\Drb} +\side@barB{2}{\Dmb} +\side@barB{3}{\Dlb} } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\DrawFlatDownSide} -% Draws the \textsc{down} face together with all four sidebars -% (colours only). +% \begin{macro}{\DrawRubikFaceDownSide} +% Draws the \textsc{down} face together with all four sidebars. % \begin{macrocode} -\newcommand{\DrawFlatDownSide}{% -\DrawFlatDown{0}{0}% -\DrawRubikLayerSideT{\Flb}{\Fmb}{\Frb}% -\DrawRubikLayerSideL{\Lrb}{\Lmb}{\Llb}% -\DrawRubikLayerSideR{\Rlb}{\Rmb}{\Rrb}% -\DrawRubikLayerSideB{\Brb}{\Bmb}{\Blb}% +\newcommand{\DrawRubikFaceDownSide}{% +\DrawRubikFlatDown{0}{0}% +%Top +\side@barT{1}{\Flb} +\side@barT{2}{\Fmb} +\side@barT{3}{\Frb} +%Left +\side@barL{1}{\Llb} +\side@barL{2}{\Lmb} +\side@barL{3}{\Lrb} +%Right +\side@barR{1}{\Rrb} +\side@barR{2}{\Rmb} +\side@barR{3}{\Rlb} +%Bottom +\side@barB{1}{\Brb} +\side@barB{2}{\Bmb} +\side@barB{3}{\Blb} } % \end{macrocode} % \end{macro} % % % -% \subsection{\hspace{3mm}DrawFace commands} -% \label{sec:drawfacecode} +% \subsection{\hspace{3mm}DrawRubikFace commands} +% \label{sec:drawrubikfacecode} +% +% \textsc{Background}: \ The above \cmd{\DrawRubikFlat..} commands were originally just +% \cmd{\DrawFlat..} commands. They were subsequently copied \& renamed +% (here) as the more intuitive \cmd{\DrawFace..} commands, since most of +% the time the user wants just to draw a particular face with or +% without sidebars. % -% 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. +% In v5 it was necessary to rename them as \cmd{\DrawRubikFace...} commands +% since they relate to a 3x3x3 cube. At the same time we also included +% their more convenient short-hand versions +% (eg \cmd{\DrawRubikFaceUpSide} $\rightarrow$ \cmd{\DrawRubikFaceUS} etc), +% as the commands were getting a bit too long. +% +% We therefore now deprecate the use of the earlier +% \cmd{\DrawFace...} commands, although they will be maintained for the +% moment at least. +% \begin{macrocode} +\newcommand{\DrawRubikFaceUp}{\DrawRubikFlatUp{0}{0}} +\newcommand{\DrawRubikFaceDown}{\DrawRubikFlatDown{0}{0}} +\newcommand{\DrawRubikFaceLeft}{\DrawRubikFlatLeft{0}{0}} +\newcommand{\DrawRubikFaceRight}{\DrawRubikFlatRight{0}{0}} +\newcommand{\DrawRubikFaceFront}{\DrawRubikFlatFront{0}{0}} +\newcommand{\DrawRubikFaceBack}{\DrawRubikFlatBack{0}{0}} +% \end{macrocode} +%% RWDN19A Finally, we create the short-hand versions. % \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} +\newcommand{\DrawRubikFaceU}{\DrawRubikFaceUp} +\newcommand{\DrawRubikFaceD}{\DrawRubikFaceDown} +\newcommand{\DrawRubikFaceL}{\DrawRubikFaceLeft} +\newcommand{\DrawRubikFaceR}{\DrawRubikFaceRight} +\newcommand{\DrawRubikFaceF}{\DrawRubikFaceFront} +\newcommand{\DrawRubikFaceB}{\DrawRubikFaceBack} +\newcommand{\DrawRubikFaceUS}{\DrawRubikFaceUpSide} +\newcommand{\DrawRubikFaceDS}{\DrawRubikFaceDownSide} +\newcommand{\DrawRubikFaceLS}{\DrawRubikFaceLeftSide} +\newcommand{\DrawRubikFaceRS}{\DrawRubikFaceRightSide} +\newcommand{\DrawRubikFaceFS}{\DrawRubikFaceFrontSide} +\newcommand{\DrawRubikFaceBS}{\DrawRubikFaceBackSide} % \end{macrocode} % % -% \subsection{\hspace{3mm}SideBar commands} +% \subsection{Sidebars (Face)} +% \label{sec:sidebarcode} % -% SideBar commands draw narrow bars of colour indicating the +% Sidebar commands draw narrow bars of colour indicating the % side colours of each of the facelets forming the side of -% a given layer (face). Each SideBar is the length of a single facelet. +% a given layer (face). Each Sidebar is the length of a +% single facelet (see Section~\ref{sec:sidebars}). % -% \begin{macro}{\RubikSideBarWidth} -% \begin{macro}{\RubikSideBarLength} -% \begin{macro}{\RubikSideBarSep} +% \begin{macro}{\RubikSidebarWidth} +% \begin{macro}{\RubikSidebarLength} +% \begin{macro}{\RubikSidebarSep} % These three commands allow the user to set the Width, Length % and Separation parameters for the sidebar (in decimal values, % where 1~is equivalent to the length of the side of a facelet). @@ -5076,267 +5267,670 @@ % \end{macro} % \end{macro} % \begin{macrocode} -\newcommand{\RubikSideBarWidth}[1]{\pgfmathsetmacro{\bw}{#1}} -\newcommand{\RubikSideBarLength}[1]{\pgfmathsetmacro{\bl}{#1}} -\newcommand{\RubikSideBarSep}[1]{\pgfmathsetmacro{\bs}{#1}} +\newcommand{\RubikSidebarWidth}[1]{\pgfmathsetmacro{\bw}{#1}} +\newcommand{\RubikSidebarLength}[1]{\pgfmathsetmacro{\bl}{#1}} +\newcommand{\RubikSidebarSep}[1]{\pgfmathsetmacro{\bs}{#1}} % \end{macrocode} % We first set some default values % \begin{macrocode} -\RubikSideBarWidth{0.3}% -\RubikSideBarLength{1}% -\RubikSideBarSep{0.3}% +\RubikSidebarWidth{0.3}% +\RubikSidebarLength{1}% +\RubikSidebarSep{0.3}% +% \end{macrocode} +% In order to avoid conflicting nomenclature (between bar and Bar) we recommend +% using the lowercase `bar' and deprecate the use of `Bar' in commands. +% For backwards compatibility, however, we will retain the three original `Bar' +% commands (for the moment at least), as follows: +% \begin{macrocode} +\newcommand{\RubikSideBarWidth}[1]{\pgfmathsetmacro{\bw}{#1}} +\newcommand{\RubikSideBarLength}[1]{\pgfmathsetmacro{\bl}{#1}} +\newcommand{\RubikSideBarSep}[1]{\pgfmathsetmacro{\bs}{#1}} % \end{macrocode} % % -% \subsubsection{\hspace{3mm}Allocating a colour to a single facelet sidebar} +% +% +% \subsubsection{\hspace{3mm}Drawing and allocating a colour to a single facelet sidebar} +% \label{sec:side@barcode} +% +% +% Full length face sidebars are really multiple instances of +% small single facelet bars, each of which is drawn using one of the internal sidebar +% commands. +% +% +% \begin{figure}[hbt] +% \centering +% \ifpdf +% \includegraphics[height=3cm]{rubik-doc-figD.pdf} +% \fi +% \vspace{-5mm} +% \caption{\label{fig:facenotation}Face-edge and facelet-position codes +% (see text) } +% \end{figure} % +% % \begin{macro}{\side@barT} % \begin{macro}{\side@barB} % \begin{macro}{\side@barL} % \begin{macro}{\side@barR} -% Internal commands. -% Full length face SideBars are really multiple instances of -% single facelet bars, -% each of which is drawn using one of four internal SideBar -% commands---one for each of the sides which we shall -% call Top, Bottom, Left, Right. -% Each SideBar command takes two arguments: one for facelet position -% \marg{$ 1 \mid 2 \mid 3$} and one for -% the colour-code \marg{$ R \mid O \mid Y \mid G \mid B \mid W \mid X $}. -% -% \textsc{example}: the following command allocates a colour to a single -% facelet sidebar on the Left of a Rubik face: +% There are four \cmd{\side@barX} commands, each with a trailing letter code X, which indicates the +% position of the sidebar relative to the square face displayed, +% namely either T (Top), B (Bottom), L (Left) or R (Right) +% ---see Figure~\ref{fig:facenotation}. + +% \cmd{\side@barL}\marg{position-number}\marg{facelet location-code}. +% Each \cmd{\side@barX} command takes two arguments: +% The first argument is a number (distance) \marg{$ 1 \mid 2 \mid 3$} +% from the relevant axis depending on whether it is a vertical or horizontal sidebar +% (e.g.,~1 = first bar (nearest the origin); 2 = second bar, +% 3 = third bar). +% +% The second argument is the facelet location-code expressed as a command +% (e.g.,~\cmd{\Lrt}, \cmd{\Dlb} etc. Note that the facelet location +% uses a three letter code: the first (capital) letter (U, D, L, R, F, B) denotes the \textsc{face}; +% the second (lower-case) letter (l,m,r) is the `x' position in the 3x3 matrix; +% the third (lower-case) letter (t,m,b) is the `y' position ---see Figure~\ref{fig:facenotation}. +% +% \textsc{example}: the following command draws a small single Right sidebar, +% in the middle position (no.~2), with the colour +% allocated to the Rlt facelet (left top facelet in the \textsc{right} face. % \begin{quote} -% \cmd{\side@barL}\marg{facelet-position}\marg{colour-code} +% \verb!\side@barR{2}{\Rlt}! % \end{quote} -% There are three facelet positions on each of the four sides -% of a face, and these -% are numbered 1 to 3 starting from the bottom left corner (1,1). -% The SideBar command also implements the set (or default) -% Length (\cmd{\bl}), Width (\cmd{\bw}) and Separation (\cmd{\bs}) +% Notice that we use the command \cmd{\Rlt} as the argument; this is because +% the command is defined as: \verb!\def{\Rlt}{#1}!, and hence the command gets replaced by the +% colour-code currently allocated to this particular facelet. +% +% There are three small rectangular sidebars on each of the four sides +% of a 3x3 square face, and these are embedded in a coordinate system with origin +% at the bottom left corner (0,0) of the square face (see Figure~\ref{fig:facenotation}). +% +% The \cmd{\side@bar..} command also implements the set (or default) +% RubikSidebarLength \cmd{\bl}, RubikSidebarWidth \cmd{\bw} +% and RubikSidebarSep \cmd{\bs} (separation) % values mentioned above. \cmd{\blh} = Half \cmd{\bl} = \cmd{\bl}/2. % Note that the TikZ \cmd{\pgfmathsetmacro} commands (which do the maths) -% must be inside the TeX sidebar command in order to work. -% The start point of the TikZ \cmd{\draw} command for each bar rectangle -% is bottom Left corner of the bar =(\cmd{\dx},\cmd{\dy}) +% must be inside the \cmd{\side@bar..} command in order to work. +% The start point of the TikZ \cmd{\draw} command for each rectangular sidebar +% is the bottom Left corner of the sidebar = (\cmd{\dx},\cmd{\dy}). % \end{macro} % \end{macro} % \end{macro} % \end{macro} % +% +% \label{sec:nosidebarcode} +% \begin{macro}{\no@sidebar} +% The \cmd{\NoSidebar}\marg{colour code} command defines a (single) colour for which +% sidebars should \textit{not} be drawn (particularly useful when drawing OLL configurations). +% This idea was suggested by Robert Ma\v{r}\'{\i}k (May 2017) ---see Section~\ref{sec:nosidebar}. +% {\newline}The principle is that we let the command \cmd{\NoSidebar} define a face colour, +% and then we use the \verb!\ifthenelse{\equal{#2}{\no@sidebar}}{}{...}! structure +% inside the \cmd{\side@bar..} commands (see below) +% to either (a)~draw all sidebars as usual (if \cmd{\NoSidebar} is undefined), +% or (b)~draw all sidebars \textit{except} +% those having the \cmd{\NoSidebar} colour (if \cmd{\NoSidebar} colour = \verb!#2!). +% \newline\textsc{usage}: \verb!\NoSidebar{X}! \ If this command in \textit{not} +% inside an environment, then its action will continue until it is disabled +% (undefined) as follows: \verb!\NoSidebar{}!. +% \begin{macrocode} +\def\no@sidebar{}% +\newcommand{\NoSidebar}[1]{\def\no@sidebar{#1}} +% \end{macrocode} +% \end{macro} +% +% % \begin{macrocode} \newcommand{\side@barL}[2]{% -%% #1 = cubie possn no, #2 = colour -\pgfmathsetmacro{\blh}{\bl*(0.5)}% -\pgfmathsetmacro{\dx}{0 - \bs - \bw}% -\pgfmathsetmacro{\dy}{#1-1+0.5-\blh}% -\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{0 - \bs - \bw}% + \pgfmathsetmacro{\dy}{#1-1+0.5-\blh}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; -} +}} \newcommand{\side@barR}[2]{% -%% #1 = cubie possn no, #2 = colour -\pgfmathsetmacro{\blh}{\bl*(0.5)}% -\pgfmathsetmacro{\dx}{3 + \bs}% -\pgfmathsetmacro{\dy}{#1 -1+0.5-\blh}% -\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{3 + \bs}% + \pgfmathsetmacro{\dy}{#1 -1+0.5-\blh}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; -} +}} \newcommand{\side@barT}[2]{% -%% #1 = cubie possn no, #2 = colour -\pgfmathsetmacro{\blh}{\bl*(0.5)}% -\pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}% -\pgfmathsetmacro{\dy}{3 +\bs}% -\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}% + \pgfmathsetmacro{\dy}{3 +\bs}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; -} +}} \newcommand{\side@barB}[2]{% -%% #1 = cubie possn no, #2 = colour -\pgfmathsetmacro{\blh}{\bl*(0.5)}% -\pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}% -\pgfmathsetmacro{\dy}{0 -\bs-\bw}% -\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}% + \pgfmathsetmacro{\dy}{0 -\bs-\bw}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; -} +}} % \end{macrocode} % +% RWDN19C removed 20:17:2 and 20:17:3 19 Feb 2018 % -% \subsubsection{\hspace{3mm}Drawing a single facelet sidebar} -% -% \begin{macro}{\DrawRubikLayerSideX$_1$X$_2$X$_3$} -% This command draws a single facelet sidebar using the above \cmd{\sidebar} command. -% The X$_1$X$_2$X$_3$ parameters refer to the options Left, Middle, -% Right, Top, Middle, Bottom, x, y, as follows: -% \begin{quote} -% X$_1$ is an $x$ parameter: either $\langle L\mid M \mid R\rangle$ -% {\newline}X$_2$ is 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 possible in these cases. -% \end{quote} -% For~example, the following command -% \begin{quote} -% \cmd{\DrawRubikLayerSideLTy\{G\}} -% \end{quote} -% draws a Green sidebar above the Top Left cubie. -% \end{macro} -% -% \begin{macrocode} -%%---Left side -\newcommand{\DrawRubikLayerSideLTx}[1]{\side@barL{3}{#1}} -\newcommand{\DrawRubikLayerSideLMx}[1]{\side@barL{2}{#1}} -\newcommand{\DrawRubikLayerSideLM}[1]{\side@barL{2}{#1}} -\newcommand{\DrawRubikLayerSideLBx}[1]{\side@barL{1}{#1}} -%---Right side -\newcommand{\DrawRubikLayerSideRTx}[1]{\side@barR{3}{#1}} -\newcommand{\DrawRubikLayerSideRMx}[1]{\side@barR{2}{#1}} -\newcommand{\DrawRubikLayerSideRM}[1]{\side@barR{2}{#1}} -\newcommand{\DrawRubikLayerSideRBx}[1]{\side@barR{1}{#1}} -%---Top side -\newcommand{\DrawRubikLayerSideLTy}[1]{\side@barT{1}{#1}} -\newcommand{\DrawRubikLayerSideMTy}[1]{\side@barT{2}{#1}} -\newcommand{\DrawRubikLayerSideMT}[1]{\side@barT{2}{#1}} -\newcommand{\DrawRubikLayerSideRTy}[1]{\side@barT{3}{#1}} -%---Bottom side -\newcommand{\DrawRubikLayerSideLBy}[1]{\side@barB{1}{#1}} -\newcommand{\DrawRubikLayerSideMBy}[1]{\side@barB{2}{#1}} -\newcommand{\DrawRubikLayerSideMB}[1]{\side@barB{2}{#1}} -\newcommand{\DrawRubikLayerSideRBy}[1]{\side@barB{3}{#1}} -% \end{macrocode} -% -% -% \subsubsection{\hspace{3mm}Drawing multiple cubie sidebars} -% -% \begin{macro}{\DrawRubikLayerSideT} -% \begin{macro}{\DrawRubikLayerSideB} -% \begin{macro}{\DrawRubikLayerSideL} -% \begin{macro}{\DrawRubikLayerSideR} -% These commands allow the drawing of 3 small sidebars along -% one particular side (Top, Bottom, Left, Right), as indicated -% by the appended T, B, L, R letter code. -% Each command takes three ordered colour arguments, which are ordered -% either from left to right (the T and B forms), or from top to bottom -% (the L and R forms) -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \begin{macrocode} -%%--Top side--- -\newcommand{\DrawRubikLayerSideT}[3]{% - \DrawRubikLayerSideLTy{#1}% - \DrawRubikLayerSideMTy{#2}% - \DrawRubikLayerSideRTy{#3}% -} -%%--Bottom side--- -\newcommand{\DrawRubikLayerSideB}[3]{% - \DrawRubikLayerSideLBy{#1}% - \DrawRubikLayerSideMBy{#2}% - \DrawRubikLayerSideRBy{#3}% +% +% +% +% +% +% \subsection{Sidebars (Cube)} +% \label{sec:sidebarscubecode} +% +% +% In order to position sidebars adjacent to a Rubik Cube (ie in 3D) +% requires that we first make some new \cmd{\side@bar..} +% commands for drawing sidebars adjacent to the \textsc{back} face of the cube +% (we have already made the macros for the front +% face sidebars---see Section~\ref{sec:sidebarcode}). +% Furthermore, these new macros need to be tailored to each of the +% four standard cube viewing directions RU, LU, RD, LD. +% +% Finally, the USER commands for drawing these sidebars need +% to accommodate (a)~some code for identifying each set of sidebars, +% and (b)~the viewing direction. So, for example, a USER command for +% drawing the sidebars associated with the cube edge formed +% by the \textsc{right} face and the \textsc{back} face +% (lets define this as the RB sidebar) as viewed from the RU direction, +% might be something like \cmd{\DrawRubikCubeSidebarRBRU}. +% Since this is not particularly user-friendly, +% we can improve on this slightly for the USER by +% (a)~defining the sidebar as \texttt{SidebarRB}, and +% (b)~appending the view direction in a curly bracket, say as \verb!{RU}!. +% This allows a more intuitive command structure for the USER, +% as follows: \verb!\DrawRubikCubeSidebarRB{RU}!. +% We then use the \cmd{\@join} command to append the string \verb!RU! to the string +% \verb!DrawRubicCubeSidebarRB! forming the (internal) +% command \cmd{\DrawRubicCubeSidebarRBRU}. +% +% In the following we will group the code according to to the view +% direction (RU, LU, RD, LD). +% +% +% +% \subsubsection{Sidebars: RU view} +% +% \subsubsection*{Right-Back vert sidebar (RU view)} +% +% +% Need to write a new command for this position +% modified from \cmd{\side@barR} (in Section 20.16.1) +% draws only a single small bar +% each of the three small bars has a numbered position (1,2,3); +% (dx,dy) = bottom Left corner of single facelet bar +% \begin{macrocode} +\newcommand{\side@barRubikRbackRU}[2]{% + %% #1 = cubie possn no, #2 = colour + %% dx --> dx+1 + %% dy --> dy+1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{3 + \bs +1}% + \pgfmathsetmacro{\dy}{#1 -1+0.5-\blh +1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; +}} +% \end{macrocode} +% Make the RB (RightBack) version; +% bar 1 is at the bottom +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarRBRU}{% +\side@barRubikRbackRU{3}{\Blt}% +\side@barRubikRbackRU{2}{\Blm}% +\side@barRubikRbackRU{1}{\Blb}% } -%%--Left side-------- -%% colours run vertically DOWN -\newcommand{\DrawRubikLayerSideL}[3]{% - \DrawRubikLayerSideLTx{#1}% - \DrawRubikLayerSideLMx{#2}% - \DrawRubikLayerSideLBx{#3}% +% \end{macrocode} +% Now do the reverse (BR) = RB +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarBRRU}{\DrawRubikCubeSidebarRBRU} +% \end{macrocode} +% Make the join commands +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarRB}[1]{\@join{\DrawRubikCubeSidebarRB}{#1}} +\newcommand{\DrawRubikCubeSidebarBR}[1]{\@join{\DrawRubikCubeSidebarBR}{#1}} +% \end{macrocode} +% +% +% \medskip +% +% \subsubsection*{Up-Back horiz sidebar (RU view)} +% +% +% Need to write a new command for this position +% modified from \cmd{\side@barT} (in Section 20.16.1) +% draws only a single small bar +% each of the three small bars has a numbered position (1,2,3); +% (dx,dy) = bottom Left corner of single facelet bar +% \begin{macrocode} +\newcommand{\side@barRubikTbackRU}[2]{% + %% #1 = cubie possn no; #2 = colour + %% dx --> dx+1 + %% dy --> dy+1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{#1 -1+0.5-\blh +1}% + \pgfmathsetmacro{\dy}{3 +\bs +1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; +}} +% \end{macrocode} +% Make the UB (Up-Back) version; +% bar 1 is at the left, 3 on the rhs (as we look at the image) +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarUBRU}{% +\side@barRubikTbackRU{1}{\Brt}% +\side@barRubikTbackRU{2}{\Bmt}% +\side@barRubikTbackRU{3}{\Blt}% } -%%--Right side-------- -%% colours run vertically DOWN -\newcommand{\DrawRubikLayerSideR}[3]{% - \DrawRubikLayerSideRTx{#1}% - \DrawRubikLayerSideRMx{#2}% - \DrawRubikLayerSideRBx{#3}% +% \end{macrocode} +% Now do the reverse (BU) = UB +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarBURU}{\DrawRubikCubeSidebarUBRU} +% \end{macrocode} +% Make the join commands +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarUB}[1]{\@join{\DrawRubikCubeSidebarUB}{#1}} +\newcommand{\DrawRubikCubeSidebarBU}[1]{\@join{\DrawRubikCubeSidebarBU}{#1}} +% \end{macrocode} +% +% +% \medskip +% +% \subsubsection*{Front-Left vert sidebar (RU view)} +% +% For the front face we can use the regular \cmd{side@barL} commands +% since it is the same as for an ordinary face sidebar +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarFLRU}{% +\side@barL{3}{\Lrt}% +\side@barL{2}{\Lrm}% +\side@barL{1}{\Lrb}% } % \end{macrocode} +% Now do the reverse (LF) +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarLFRU}{\DrawRubikCubeSidebarFLRU} +% \end{macrocode} +% Now do the two join commands +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarFL}[1]{\@join{\DrawRubikCubeSidebarFL}{#1}} +\newcommand{\DrawRubikCubeSidebarLF}[1]{\@join{\DrawRubikCubeSidebarLF}{#1}} +% \end{macrocode} % -% \begin{macro}{\DrawRubikLayerSideLR} -% This command draws six cubie sidebars, three on each side, drawn in (L, R) -% pairs. The command takes six colour arguments, ordered in pairs, -% as shown in the following example. -% \begin{quote} -%\begin{verbatim} -% \DrawRubikLayerSideLR{G} {G} -% {R} {B} -% {Y} {B} -%\end{verbatim} -% \end{quote} -% \begin{macrocode} -\newcommand{\DrawRubikLayerSideLR}[6]{% - \DrawRubikLayerSideLTx{#1}% - \DrawRubikLayerSideRTx{#2}% - \DrawRubikLayerSideLMx{#3}% - \DrawRubikLayerSideRMx{#4}% - \DrawRubikLayerSideLBx{#5}% - \DrawRubikLayerSideRBx{#6}% +% +% \medskip +% +% \subsubsection*{Front-Down horizontal sidebar (RU view)} +% +% Horiz sidebar, so 1 at the left, 2=middle, 3= rhs) +% here we have to use the B for bottom (of front face) and the +% facelets of the top row of the Down face +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarFDRU}{% +\side@barB{1}{\Dlt}% +\side@barB{2}{\Dmt}% +\side@barB{3}{\Drt}% } % \end{macrocode} -% \end{macro} +% Now do the reverse (DF) = FD +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarDFRU}{\DrawRubikCubeSidebarFDRU} +% \end{macrocode} +% Now do the two join commands +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarFD}[1]{\@join{\DrawRubikCubeSidebarFD}{#1}} +\newcommand{\DrawRubikCubeSidebarDF}[1]{\@join{\DrawRubikCubeSidebarDF}{#1}} +% \end{macrocode} +% But FD-LU is the same as FD-RU, so need to make copies of each +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarDFLU}{\DrawRubikCubeSidebarDFRU} +\newcommand{\DrawRubikCubeSidebarFDLU}{\DrawRubikCubeSidebarFDRU} +% \end{macrocode} +% +% +% \medskip +% +% \subsubsection{Sidebars: LU view} % % -% \subsection{\hspace{3mm}RubikSide commands} -% \label{sec:rubiksidecode} +% \subsubsection*{Left-Back vert sidebar (LU view)} % -% \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. +% Need to write a new command for this position +% modified from \cmd{\side@barL} (in Section 20.16.1) +% draws only a single small bar +% each of the three small bars has a numbered position (1,2,3); +% (dx,dy) = bottom Left corner of single facelet bar % \begin{macrocode} -\newcommand{\RubikSideFront}[3]{% -\def\Flt{#1}\def\Fmt{#2}\def\Frt{#3}% +\newcommand{\side@barRubikLbackLU}[2]{% + %% #1 = cubie possn no, #2 = colour + %% dx --> dx-1 + %% dy --> dy+1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{0 - \bs -\bw -1}% + \pgfmathsetmacro{\dy}{#1 -1+0.5-\blh +1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; +}} +% \end{macrocode} +% Make the LB (LeftBack) version; +% bar 1 is at the bottom +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarLBLU}{% +\side@barRubikLbackLU{3}{\Brt}% +\side@barRubikLbackLU{2}{\Brm}% +\side@barRubikLbackLU{1}{\Brb}% } -\newcommand{\RubikSideRight}[3]{% -\def\Rlt{#1}\def\Rmt{#2}\def\Rrt{#3}% +% \end{macrocode} +% Now do the reverse (BL) = LB +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarBLLU}{\DrawRubikCubeSidebarLBLU} +% \end{macrocode} +% Make the join commands +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarLB}[1]{\@join{\DrawRubikCubeSidebarLB}{#1}} +\newcommand{\DrawRubikCubeSidebarBL}[1]{\@join{\DrawRubikCubeSidebarBL}{#1}} +% \end{macrocode} +% +% +% \medskip +% +% \subsubsection*{Up-Back horizontal sidebar (LU view)} +% +% Modified from \cmd{\side@barT} (in Section 20.16.1) +% draws only a single small bar +% each of the three small bars has a numbered position (1,2,3); +% (dx,dy) = bottom Left corner of single facelet bar +% \begin{macrocode} +\newcommand{\side@barRubikTbackLU}[2]{% + %% #1 = cubie possn no; #2 = colour + %% dx --> dx-1 + %% dy --> dy+1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{#1 -1+0.5-\blh -1}% + \pgfmathsetmacro{\dy}{3 +\bs +1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; +}} +% \end{macrocode} +% Make the UB (Up-Back) version; +% bar 1 is at the left, 3 on the rhs (as we look at the image) +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarUBLU}{% +\side@barRubikTbackLU{1}{\Brt}% +\side@barRubikTbackLU{2}{\Bmt}% +\side@barRubikTbackLU{3}{\Blt}% } -\newcommand{\RubikSideLeft}[3]{% -\def\Llt{#1}\def\Lmt{#2}\def\Lrt{#3}% +% \end{macrocode} +% Now do the reverse (BU) = UB +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarBULU}{\DrawRubikCubeSidebarUBLU} +% \end{macrocode} +% Do not need to make the join commands +% as the USER commands for BU and UB are the same as for the RU. +% +% +% \medskip +% +% \subsubsection*{Front-Right vertical sidebar (LU view)} +% +% Only needed for the LU view and LD. +% for the front face we can use the regular side@barR commands +% since it is the same as for an ordinary face sidebar RHS +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarFRLU}{% +\side@barR{3}{\Rlt}% +\side@barR{2}{\Rlm}% +\side@barR{1}{\Rlb}% } -\newcommand{\RubikSideBack}[3]{% -\def\Blt{#1}\def\Bmt{#2}\def\Brt{#3}% +% \end{macrocode} +% Now do the reverse (RF) +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarRFLU}{\DrawRubikCubeSidebarFRLU} +% \end{macrocode} +% Now do the two join commands +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarFR}[1]{\@join{\DrawRubikCubeSidebarFR}{#1}} +\newcommand{\DrawRubikCubeSidebarRF}[1]{\@join{\DrawRubikCubeSidebarRF}{#1}} +% \end{macrocode} +% +% +% +% +% \subsubsection{Sidebars: RD view} +% +% \medskip +% +% \subsubsection*{Front-Up horizontal sidebar (RD view)} +% +% Horiz sidebar, so 1 at the left, 2=middle, 3= rhs +% here we have to use the T for bottom (of front face) and the +% facelets of the top row of the Down face +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarFURD}{% +\side@barT{1}{\Ulb}% +\side@barT{2}{\Umb}% +\side@barT{3}{\Urb}% } % \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} +% Now do the reverse (UF) = FU +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarUFRD}{\DrawRubikCubeSidebarFURD} +% \end{macrocode} +% Now do the two join commands +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarFU}[1]{\@join{\DrawRubikCubeSidebarFU}{#1}} +\newcommand{\DrawRubikCubeSidebarUF}[1]{\@join{\DrawRubikCubeSidebarUF}{#1}} +% \end{macrocode} +% +% \medskip % +% \subsubsection*{Front-Left vertical sidebar (RD view)} % -% \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\}} +% +% Front LEFT (RD view = same as for RU) % \begin{macrocode} -\newcommand{\RubikSideFrontAll}[1]{% -\def\Flt{#1}\def\Fmt{#1}\def\Frt{#1}% +\newcommand{\DrawRubikCubeSidebarFLRD}{\DrawRubikCubeSidebarFLRU} +\newcommand{\DrawRubikCubeSidebarLFRD}{\DrawRubikCubeSidebarLFRU} +% \end{macrocode} +% +% +% \medskip +% +% \subsubsection*{Right-Back vertical sidebar (RD view)} +% +% Modified from \cmd{\side@barR} (in Section 20.16.1) +% draws only a single small bar +% each of the three small bars has a numbered position (1,2,3); +% (dx,dy) = bottom Left corner of single facelet bar +% \begin{macrocode} +\newcommand{\side@barRubikRbackRD}[2]{% + %% #1 = cubie possn no, #2 = colour + %% dx --> dx+1 + %% dy --> dy-1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{3 + \bs +1}% + \pgfmathsetmacro{\dy}{#1 -1+0.5-\blh -1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; +}} +% \end{macrocode} +% Make the RB (RightBack) version; +% bar 1 is at the bottom +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarRBRD}{% +\side@barRubikRbackRD{3}{\Blt}% +\side@barRubikRbackRD{2}{\Blm}% +\side@barRubikRbackRD{1}{\Blb}% } -\newcommand{\RubikSideRightAll}[1]{% -\def\Rlt{#1}\def\Rmt{#1}\def\Rrt{#1}% +% \end{macrocode} +% Now do the reverse (BR) = RB +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarBRRD}{\DrawRubikCubeSidebarRBRD} +% \end{macrocode} +% Do NOT need to make the join commands (same as for the RU view) +% +% +% \medskip +% +% \subsubsection*{Down-Back horizotal sidebar (RD view)} +% +% Modified from \cmd{\side@barB} (in Section 20.16.1) +% draws only a single small bar +% each of the three small bars has a numbered position (1,2,3); +% (dx,dy) = bottom Left corner of single facelet bar +% \begin{macrocode} +\newcommand{\side@barRubikBbackRD}[2]{% + %% #1 = cubie possn no; #2 = colour + %% dx --> dx+1 + %% dy --> dy-1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{#1 -1+0.5-\blh +1}% + \pgfmathsetmacro{\dy}{0 -\bs - \bw -1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; +}} +% \end{macrocode} +% Make the DB (Down-Back) version; +% bar 1 is at the left, 3 on the rhs (as we look at the image) +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarDBRD}{% +\side@barRubikBbackRD{1}{\Brb}% +\side@barRubikBbackRD{2}{\Bmb}% +\side@barRubikBbackRD{3}{\Blb}% } -\newcommand{\RubikSideLeftAll}[1]{% -\def\Llt{#1}\def\Lmt{#1}\def\Lrt{#1}% +% \end{macrocode} +% Now do the reverse (BD) = DB +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarBDRD}{\DrawRubikCubeSidebarDBRD} +% \end{macrocode} +% Make the join commands +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarDB}[1]{\@join{\DrawRubikCubeSidebarDB}{#1}} +\newcommand{\DrawRubikCubeSidebarBD}[1]{\@join{\DrawRubikCubeSidebarBD}{#1}} +% \end{macrocode} +% +% +% +% \subsubsection{Sidebars: LD view} +% +% +% \medskip +% +% \subsubsection*{Front-Up horizontal sidebar (LD view)} +% +% But FR (LD view) is the same as for (RU view), (see above) +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarFULD}{\DrawRubikCubeSidebarFURD} +\newcommand{\DrawRubikCubeSidebarUFLD}{\DrawRubikCubeSidebarUFRD} +% \end{macrocode} +% +% \medskip +% +% \subsubsection*{Front-Right vertical sidebar (LD view)} +% +% Front Right (LDview) = same as for (LU view), (see above) +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarFRLD}{\DrawRubikCubeSidebarFRLU} +\newcommand{\DrawRubikCubeSidebarRFLD}{\DrawRubikCubeSidebarRFLU} +% \end{macrocode} +% +% +% \medskip +% +% \subsubsection*{Left-Back vertical sidebar (LD view)} +% +% Modified from \cmd{\side@barL} (in Section 20.16.1) +% draws only a single small bar +% each of the three small bars has a numbered position (1,2,3); +% (dx,dy) = bottom Left corner of single facelet bar +% \begin{macrocode} +\newcommand{\side@barRubikLbackLD}[2]{% + %% #1 = cubie possn no, #2 = colour + %% dx --> dx-1 + %% dy --> dy-1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{0 - \bs -\bw -1}% + \pgfmathsetmacro{\dy}{#1 -1+0.5-\blh -1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; +}} +% \end{macrocode} +% Make the LB (LeftBack) version; +% bar 1 is at the bottom +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarLBLD}{% +\side@barRubikLbackLD{3}{\Brt}% +\side@barRubikLbackLD{2}{\Brm}% +\side@barRubikLbackLD{1}{\Brb}% } -\newcommand{\RubikSideBackAll}[1]{% -\def\Blt{#1}\def\Bmt{#1}\def\Brt{#1}% +% \end{macrocode} +% Now do the reverse (BL) = LB +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarBLLD}{\DrawRubikCubeSidebarLBLD} +% \end{macrocode} +% Do NOT need to make the join commands (same as for the LU view) +% +% +% \medskip +% +% \subsubsection*{Down-Back horizontal sidebar (LD view)} +% +% +% Modified from \cmd{\side@barB} (in Section 20.16.1) +% draws only a single small bar +% each of the three small bars has a numbered position (1,2,3); +% (dx,dy) = bottom Left corner of single facelet bar +% \begin{macrocode} +\newcommand{\side@barRubikBbackLD}[2]{% + %% #1 = cubie possn no; #2 = colour + %% dx --> dx-1 + %% dy --> dy-1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{#1 -1+0.5-\blh -1}% + \pgfmathsetmacro{\dy}{0 -\bs - \bw -1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; +}} +% \end{macrocode} +% Make the DB (Down-Back) version; +% bar 1 is at the left, 3 on the rhs (as we look at the image) +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarDBLD}{% +\side@barRubikBbackLD{1}{\Brb}% +\side@barRubikBbackLD{2}{\Bmb}% +\side@barRubikBbackLD{3}{\Blb}% } % \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} +% Now do the reverse (BD) = DB +% \begin{macrocode} +\newcommand{\DrawRubikCubeSidebarBDLD}{\DrawRubikCubeSidebarDBLD} +% \end{macrocode} +% Do NOT need to make the join commands (same as for the RD view +% % % % -% \subsection{\hspace{3mm}NCube command} +% \subsection{\hspace{3mm}DrawNCube command} % % \textsc{history}: The essence of this command was originally developed by Peter Bartal % as his command \cmd{\rubikcube} (see Bartal, @@ -5585,7 +6179,7 @@ % % % \subsection{\hspace{3mm}Rotation commands} -% \label{sec:rotationcommands} +% \label{sec:rotationcommandscode} % % % \subsubsection{\hspace{3mm}Introduction} @@ -5603,13 +6197,13 @@ % 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). +% For~example, \verb!\rrh{D}! $\rightarrow$ join(\verb!\rrh! + \verb!D!) $\rightarrow$ \verb!\rrhD! +% (see Section~\ref{sec:cmdsusingjoin} for details). % % 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 +% types are designed to have the same height so they sit nicely when arranged side-by-side. +% A lot of special macros for 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 @@ -5623,12 +6217,12 @@ % (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}). +% have the same vertical position as their `arrow' cousins. A typical example +% is the form \rrh{Bw}\ which is detailed in 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, +% were originally checked for using the \texttt{ltugboat.cls}, and all fixed mainly +% by setting their associated small minipages $\rightarrow$ width = 0.6cm, % and using TikZ scale=0.5. % % @@ -5641,7 +6235,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 +% \textsc{todo}: ? make this a proper internal command % using \verb!@! sometime. % % \begin{macrocode} @@ -5652,14 +6246,14 @@ % \end{macro} % % We now define a number of points and line-segments inside the square -% (e.g.,~\cmd{\@sd}, \cmd{\@sh} \ldots\ etc.) which will be required +% `notationbox' (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 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 +% \textsc{todo}: make a small diagram to illustrate the position of these % parameters and make things a bit clearer sometime. % %\begin{macrocode} @@ -5697,25 +6291,31 @@ % \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 +% rotation commands. They attach a letter or a prime to the associated argument; +% for~example, the command \verb!\@rrwp{B}! appends a `w' and a prime (p) to the +% argument `B', i.e.~$\rightarrow$ \rr{Bwp} (see Section~\ref{sec:coderotationBwp}). +% Users are then able to access this glyph by typing the command \verb!\rrBwp!, or, +% more intuitively, \verb!\rr{Bwp}! +% (see also \verb!\@join! detailed in Section~\ref{sec:cmdsusingjoin}). +% +% 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 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 \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). +% Note that the TikZ `thick' line code = 0.8pt (used in \cmd{\@SquareLetter}). % 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}} @@ -5742,14 +6342,22 @@ \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{\@xyzhp}[1]{[{\@rubikfont #1\raisebox{-0.6pt}{\@rubikprime}}]} +\newcommand{\@xyzRubik}[1]% + {\raisebox{3.45pt}{[{\@rubikfont #1}]}} +\newcommand{\@xyzRubikp}[1]% + {\raisebox{3.45pt}{[{\@rubikfont #1\raisebox{-0.6pt}{\@rubikprime}}]}} +\newcommand{\@xyzhbdfl}[1]% + {[\raisebox{-0.6pt}{{\@rubikfont #1}}]} +\newcommand{\@xyzhbdflp}[1]% + {[\raisebox{-0.6pt}{{\@rubikfont #1\@rubikprime}}]} +\newcommand{\@xyzbdflRubik}[1]% + {\raisebox{3.45pt}{[\raisebox{-0.6pt}{{\@rubikfont #1}}]}} +\newcommand{\@xyzbdflRubikp}[1]% + {\raisebox{3.45pt}{[\raisebox{-0.6pt}{{\@rubikfont #1\@rubikprime}}]}} \newcommand{\@SquareLetter}[1]{\setlength{\fboxsep}{2.5pt}% - \setlength{\fboxrule}{0.8pt}% - \fbox{\rule[-1pt]{0pt}{8.5pt}\raisebox{-0.5pt}{#1}}} + \setlength{\fboxrule}{0.8pt}% + \fbox{\rule[-1pt]{0pt}{8.5pt}\raisebox{-0.5pt}{#1}}} \newlength\@hRubik% \setlength{\@hRubik}{0.185cm}% % \end{macrocode} @@ -5787,33 +6395,35 @@ % % % +% +% \subsubsection{\hspace{3mm}Using {\textbackslash}\texttt{@join}} +% \label{sec:cmdsusingjoin} +% +% % \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}. +% a rotation-code, say U, into a macro (say, \cmd{\rrhU}) which typesets it in some form. % 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}). +% the intuitive command |\rrh{U}| is equivalent to \cmd{\rrhU}. % {\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} +% The following section shows how this command is used in practice. % \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 (e.g.,~U) is -% the argument (see Section~\ref{sec:overview}). As an example, the format for +% The following four commands typeset a single rotation, where a rotation-code (e.g.,~U) is +% the argument (see Section~\ref{sec:typesetting}). 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 @@ -5821,9 +6431,9 @@ % rotation hieroglyph for the rotation~U, etc. % % These four commands, which use the -% internal \cmd{\@join} command (see Section~\ref{sec:usefulinternalcommands}), are +% internal \cmd{\@join} command (see above), are % especially useful when typesetting a list of rotation-codes. -% Furthermore, it seems more intuitive to specify a rotation command +% Furthermore, it is more intuitive for the user to specify a rotation command % using the rotation-code as an argument. % \begin{macrocode} \newcommand*{\Rubik}[1]{\@join{\Rubik}{#1}} @@ -5918,6 +6528,7 @@ % % % \subsubsection{\hspace{3mm}Rotation Bwp} +% \label{sec:coderotationBwp} % % \begin{macro}{\rrBwp} % \begin{macro}{\SquareBwp} @@ -8112,11 +8723,14 @@ % \begin{macro}{\rru} % \begin{macro}{\rrhu} % \begin{macro}{\Rubiku} -% These commands all draw forms which denote the u rotation. +% These commands all draw forms which denote the u and up cube rotation. % \begin{macrocode} \newcommand{\rru}{\@rr{u}} -\newcommand{\Rubiku}{\@xyzRubik{u}} +\newcommand{\rrup}{\@rrp{u}} \newcommand{\rrhu}{\@xyzh{u}} +\newcommand{\rrhup}{\@xyzhp{u}} +\newcommand{\Rubiku}{\@xyzRubik{u}} +\newcommand{\Rubikup}{\@xyzRubikp{u}} % \end{macrocode} % \end{macro} % \end{macro} @@ -8124,11 +8738,14 @@ % \begin{macro}{\rrd} % \begin{macro}{\rrhd} % \begin{macro}{\Rubikd} -% These commands all draw forms which denote the d rotation. +% These commands all draw forms which denote the d and dp cube rotation. % \begin{macrocode} \newcommand{\rrd}{\@rr{d}} +\newcommand{\rrdp}{\@rrp{d}} \newcommand{\rrhd}{\@xyzhbdfl{d}} +\newcommand{\rrhdp}{\@xyzhbdflp{d}} \newcommand{\Rubikd}{\@xyzbdflRubik{d}} +\newcommand{\Rubikdp}{\@xyzbdflRubikp{d}} % \end{macrocode} % \end{macro} % \end{macro} @@ -8140,11 +8757,14 @@ % \begin{macro}{\rrl} % \begin{macro}{\rrhl} % \begin{macro}{\Rubikl} -% These commands all draw forms which denote the l rotation. +% These commands all draw forms which denote the l and lp cube rotation. % \begin{macrocode} \newcommand{\rrl}{\@rr{l}} +\newcommand{\rrlp}{\@rrp{l}} \newcommand{\rrhl}{\@xyzhbdfl{l}} +\newcommand{\rrhlp}{\@xyzhbdflp{l}} \newcommand{\Rubikl}{\@xyzbdflRubik{l}} +\newcommand{\Rubiklp}{\@xyzbdflRubikp{l}} % \end{macrocode} % \end{macro} % \end{macro} @@ -8152,11 +8772,14 @@ % \begin{macro}{\rrr} % \begin{macro}{\rrhr} % \begin{macro}{\Rubikr} -% These commands all draw forms which denote the r rotation. +% These commands all draw forms which denote the r and rp cube rotation. % \begin{macrocode} \newcommand{\rrr}{\@rr{r}} -\newcommand{\Rubikr}{\@xyzRubik{r}} +\newcommand{\rrrp}{\@rrp{r}} \newcommand{\rrhr}{\@xyzh{r}} +\newcommand{\rrhrp}{\@xyzhp{r}} +\newcommand{\Rubikr}{\@xyzRubik{r}} +\newcommand{\Rubikrp}{\@xyzRubikp{r}} % \end{macrocode} % \end{macro} % \end{macro} @@ -8168,11 +8791,14 @@ % \begin{macro}{\rrf} % \begin{macro}{\rrhf} % \begin{macro}{\Rubikf} -% These commands all draw forms which denote the f rotation. +% These commands all draw forms which denote the f and fp cube rotation. % \begin{macrocode} \newcommand{\rrf}{\@rr{f}} +\newcommand{\rrfp}{\@rrp{f}} \newcommand{\rrhf}{\@xyzhbdfl{f}} +\newcommand{\rrhfp}{\@xyzhbdflp{f}} \newcommand{\Rubikf}{\@xyzbdflRubik{f}} +\newcommand{\Rubikfp}{\@xyzbdflRubikp{f}} % \end{macrocode} % \end{macro} % \end{macro} @@ -8180,11 +8806,14 @@ % \begin{macro}{\rrb} % \begin{macro}{\rrhb} % \begin{macro}{\Rubikb} -% These commands all draw forms which denote the b rotation. +% These commands all draw forms which denote the b and bp cube rotation. % \begin{macrocode} \newcommand{\rrb}{\@rr{b}} +\newcommand{\rrbp}{\@rrp{b}} \newcommand{\rrhb}{\@xyzhbdfl{b}} +\newcommand{\rrhbp}{\@xyzhbdflp{b}} \newcommand{\Rubikb}{\@xyzbdflRubik{b}} +\newcommand{\Rubikbp}{\@xyzbdflRubikp{b}} % \end{macrocode} % \end{macro} % \end{macro} @@ -8740,7 +9369,7 @@ % 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 +% 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). % @@ -9846,11 +10475,17 @@ \newcommand{\textRubikz}{\rrhz} \newcommand{\textRubikzp}{\rrhzp} \newcommand{\textRubikl}{\rrhl} +\newcommand{\textRubiklp}{\rrhlp} \newcommand{\textRubikr}{\rrhr} +\newcommand{\textRubikrp}{\rrhrp} \newcommand{\textRubiku}{\rrhu} +\newcommand{\textRubikup}{\rrhup} \newcommand{\textRubikd}{\rrhd} +\newcommand{\textRubikdp}{\rrhdp} \newcommand{\textRubikf}{\rrhf} +\newcommand{\textRubikfp}{\rrhfp} \newcommand{\textRubikb}{\rrhb} +\newcommand{\textRubikbp}{\rrhbp} \newcommand{\textRubikLc}{\rrhLc} \newcommand{\textRubikLcp}{\rrhLcp} \newcommand{\textRubikRc}{\rrhRc} diff --git a/Master/texmf-dist/source/latex/rubik/rubikcube.ins b/Master/texmf-dist/source/latex/rubik/rubikcube.ins index 80a62849b26..fd52994a6ad 100644 --- a/Master/texmf-dist/source/latex/rubik/rubikcube.ins +++ b/Master/texmf-dist/source/latex/rubik/rubikcube.ins @@ -17,9 +17,9 @@ Authors: RWD Nickalls (dick@nickalls.org) and Apostolos Syropoulos (asyropoulos@yahoo.com) - Copyright 03 March 2017 RWD Nickalls and A Syropoulos + Copyright February 25, 2018 RWD Nickalls and A Syropoulos - VERSION 4.0 + VERSION 5.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/rubikpatterns.dtx b/Master/texmf-dist/source/latex/rubik/rubikpatterns.dtx index a6711d471ea..26995cce27e 100644 --- a/Master/texmf-dist/source/latex/rubik/rubikpatterns.dtx +++ b/Master/texmf-dist/source/latex/rubik/rubikpatterns.dtx @@ -2,12 +2,12 @@ % % rubikpatterns.dtx % -% version 4.0 +% version 5.0 % % Authors: RWD Nickalls (dick@nickalls.org) % and Apostolos Syropoulos (asyropoulos@yahoo.com) % -% Copyright 03 March 2017 RWD Nickalls + A Syropoulos +% Copyright 25 February 2018 RWD Nickalls + A Syropoulos % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -38,7 +38,8 @@ (Generate rubikpatterns.sty by (La)TeXing rubikpatterns.ins, and then^^J process rubikpatterns.dtx again)^^J}\stop }% -% +\pagestyle{myheadings} +\markright{\texttt{rubikpatterns} \ \ (Rubik bundle v5.0, 2018) \ \ \texttt{www.ctan.org/pkg/rubik}} \usepackage{ifpdf} \usepackage{url,path} %% for references and paths \usepackage{graphicx} %% for the two pdf figs @@ -95,8 +96,7 @@ % \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'. +% with the other Rubik `bundle' packages. % \end{abstract} % % @@ -106,25 +106,41 @@ % % \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 +% The \textsc{rubikpatterns} package is a small a data-base of well-known Rubik +% rotation sequences for use in conjunction with the Rubik bundle packages. +% These rotation 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} +% \section{Requirements} +% +% The \textsc{rubikpatterns} package requires (a)~the TikZ package, since it makes +% use of the TikZ picture environment, (b)~the \textsc{rubikcube} package, and +% (c)~the \textsc{rubikrotation} package, since it uses +% the Perl program \texttt{rubikrotation.pl}. +% The \verb!TikZ! package must be loaded \textit{before} the \textsc{rubikcube} package. +% The \textsc{rubikrotation} package requires Perl to be installed. +% +% +% +% \section{Installation} +% +% +% The Rubik bundle consists of the four packages \textsc{rubikcube}, \textsc{rubikrotation}, +% \textsc{rubikpatterns} and \textsc{rubiktwocube}. % -% Place the file \texttt{rubikpatterns.zip} into a temporary directory, and unzip it. -% This will generate the following files: +% Here we describe only the installation of the \textsc{rubikpatterns} package, +% which consists of the following files: %\begin{quote} % \begin{verbatim} % rubikpatterns.ins % rubikpatterns.dtx -% rubikpatterns.pdf --this document +% rubikpatterns.pdf --this document % rubikpatternsLIST.tex -% rubikpatternsLIST.pdf +% rubikpatternsLIST.pdf --a graphic list of all patterns in this package +% rubikpatterns-doc-figA.pdf %\end{verbatim} %\end{quote} % The package documentation is the file \texttt{rubikpatterns.pdf}. @@ -153,7 +169,7 @@ % % % -% \subsubsection{Placing the files} +% \subsection{Placing the files} % \label{sec:placingfiles} % % Place the files either in a working directory, or where your system @@ -171,6 +187,25 @@ % \TeX\ file database. % For example, on a Linux platform this is achieved using the \texttt{texhash} command. % +% +% \subsection{The rubikpatternsLIST file} +% + +% Note that the package includes a `rubikpatternsLIST' file (\texttt{rubikpatternsLIST.pdf}), +% as well as the source file (\texttt{rubikpatternsLIST.tex}), and +% associated \texttt{.sh} (Linux) and \texttt{.bat} (Microsoft) batch +% files, which can be used to facilitate processing the source \texttt{.tex} file. +% The file \texttt{rubikpatternsLIST.pdf} showcases the Rubik cube +% patterns made available in this package. +% +% Note that should you need to generate the file \texttt{rubikpatternsLIST.pdf} +% from the source file (\texttt{rubikpatternsLIST.tex}) you will require +% the \textsc{rubikcube} and \textsc{rubikrotation} packages to be installed, +% and will also need to use the \verb!--shell-escape! command-line +% option (see Section~\ref{sec:rubikrotation} for details). +% +% +% % % % \subsection{Usage} @@ -261,7 +296,7 @@ % % \subsection{List of macros} % -% The following is a list of the macro names of all the Rubik patterrns supplied by +% The following is a list of the macro names of all the Rubik patterns 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 @@ -395,8 +430,8 @@ % % \begin{macrocode} %<*rubikpatterns> -\def\RPfileversion{4.0}% -\def\RPfiledate{2017/03/03}% +\def\RPfileversion{5.0}% +\def\RPfiledate{2018/02/25}% 25 February 2018 \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{rubikpatterns}[\RPfiledate\space (v\RPfileversion)] % \end{macrocode} @@ -431,93 +466,127 @@ U2,Lp,F2,Rp,U2,Rp,Up,<(20f*)>}% % % 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],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>}% + {[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>}% + {[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],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],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)>}% + {[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{\ChristmasCross}{[ChristmasCross],U,F,Bp,L2,U2,L2,Fp,B,U2,L2,U,% + <(16q*, 11f*)>}% +\newcommand{\christmascross}{\ChristmasCross}% \newcommand{\PlummersCross}% -{[PlummersCross],R2,Lp,D,F2,Rp,Dp,Rp,L,Up,D,R,D,B2,Rp,U,D2,<(20q*, 16f*)>}% + {[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],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],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],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],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*)>}% + {[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*)>}% + {[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],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],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],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],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*)>}% + {[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],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],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)>}% + {[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)>}% + {[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*)>}% + {[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*)>}% + {[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*)>}% + {[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)>}% + {[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*)>}% + {[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>}% + {[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>}% + {[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*)>}% + {[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)>}% + {[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*)>}% + {[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*)>}% + {[ExchangedDuckFeet],U,F,R2,Fp,Dp,R,U,B2,U2,Fp,R2,F,D,B2,R,Bp,% + <(21q*, 16f*)>}% \newcommand{\exchangedduckfeet}{\ExchangedDuckFeet}% % \end{macrocode} % -------------------------- diff --git a/Master/texmf-dist/source/latex/rubik/rubikpatterns.ins b/Master/texmf-dist/source/latex/rubik/rubikpatterns.ins index 9260827909b..d5ebcf3e602 100644 --- a/Master/texmf-dist/source/latex/rubik/rubikpatterns.ins +++ b/Master/texmf-dist/source/latex/rubik/rubikpatterns.ins @@ -1,6 +1,5 @@ %% rubikpatterns.ins %% -%% version 4.0 %% %% --- automatic overwriting of .sty is disabled------- %% ========================================================= @@ -16,9 +15,9 @@ Authors: RWD Nickalls (dick@nickalls.org) and Apostolos Syropoulos (asyropoulos@yahoo.com) - Copyright March 03, 2017 RWD Nickalls and A Syropoulos + Copyright February 25, 2018 RWD Nickalls and A Syropoulos - VERSION 4.0 + VERSION 5.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/rubikrotation.dtx b/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx index 2b554ef7128..33103cfc54b 100644 --- a/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx +++ b/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx @@ -1,12 +1,13 @@ % \iffalse meta-comment % rubikrotation.dtx % -% version 4.0 +% version 5.0 +% % % Authors: RWD Nickalls (dick@nickalls.org) % and Apostolos Syropoulos (asyropoulos@yahoo.com) - -% Copyright 03 March 2017 RWD Nickalls + A Syropoulos +% +% Copyright 25 February 2018 RWD Nickalls + A Syropoulos % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -37,6 +38,8 @@ (Generate rubikrotation.sty by (La)TeXing rubikrotation.ins, and then^^J process rubikrotation.dtx again)^^J}\stop }% +\pagestyle{myheadings} +\markright{\texttt{rubikrotation} \ \ (Rubik bundle v5.0, 2018) \ \ \texttt{www.ctan.org/pkg/rubik}} \usepackage{ifpdf} \usepackage{url,path} %% for references and paths \usepackage{graphicx} %% for the two pdf figs @@ -58,7 +61,7 @@ % % % -%%% \CheckSum{322} +%%% \CheckSum{332} % %%% \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 @@ -98,7 +101,7 @@ % \texttt{rubikrotation.pl}), and returns the new Rubik cube state (configuration). % The \rubikrotation\ package also provides commands for saving the cube state % to a file (\cmd{\SaveRubikState}), and for displaying any -% errors (\cmd{\ShowRubikErrors}). +% errors (\cmd{\ShowErrors}). % \end{abstract} % % @@ -119,7 +122,8 @@ % % \section{Introduction} % -% The \rubikrotation\ package is a dynamic extension to the \textsc{rubikcube} package. +% The \rubikrotation\ package is a dynamic extension to the \textsc{rubikcube} +% and \textsc{rubiktwocube} packages. % It consists of a style option (\texttt{rubikrotation.sty}), a % Perl script (\texttt{rubikrotation.pl}). % @@ -135,22 +139,23 @@ % (\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 (Debian v8.2.0, -% {\TeX}Live 2016, and Perl v5.20.2), and on a Solaris platform (OpenIndiana). +% {\TeX}Live 2017, and Perl v5.20.2), and on a Solaris platform (OpenIndiana). % % The following commands are made available by \texttt{rubikrotation.sty}: % \begin{quote} % \begin{verbatim} % \RubikRotation[]{} % \SaveRubikState -% \CheckRubikState -% \ShowRubikErrors +% \CheckState +% \ShowErrors % \SequenceName % \SequenceInfo % \SequenceShort % \SequenceLong %\end{verbatim} % \end{quote} -% +% Note that the \textsc{rubiktwocube} package makes available the (equivalent) +% \verb!\TwoRotation[]{}! and \verb!\SaveTwoState! commands. % % \section{Requirements} % @@ -209,8 +214,9 @@ % \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: +% will find them, e.g.,~in the `\textsc{path}'. The \texttt{/texmf-local/} directory tree +% is often a good place; 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/} @@ -222,8 +228,8 @@ %{\noindent}\textsc{perl script}:\ \ Make the perl script executable % (\texttt{chmod +x rubikrotation.pl}), and then % rename the file as `rubikrotation' (i.e.,~with no file extension), and then place -% the executable script into your current TeXLive binary directory, -% e.g.,~\path!/user/local/texlive/YYYY/bin/i386-linux!. +% the executable script in the `\textsc{path}', or possibly, directly into your +% {\TeX}Live binary directory, e.g.,~\path!/user/local/texlive/YYYY/bin/i386-linux!. % % Sometimes the setting up of a simple one or two-line plain-text % configuration-file may be useful or even necessary, depending on your system @@ -232,14 +238,17 @@ % file is named \texttt{rubikrotation.cfg}. % %\medskip -%{\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!. +%{\noindent}\textsc{the `man' file}:\ \ On a Linux platform the manual file +% (\texttt{rubikrotation.1}) is typically located in +% either \verb!/usr/local/man/man1! or \verb!/usr/local/share/man/man1!. +% \TeX{Live} typically places such files in the directory +% \verb!/texmf-dist/doc/man/man1!. % %\medskip %{\noindent}\textsc{file database}:\ \ Finally, (depending on your system) update the % \TeX\ file database. -% For example, on a Linux platform this is achieved using the \texttt{texhash} command. +% For example, on a Linux platform this is achieved using the \texttt{texhash} command, +% or by using the {\TeX}Live Manager (\texttt{tlmgr}). % %\medskip %{\noindent}\textsc{quick test}:\ \ To test that your system can now run the perl @@ -251,12 +260,13 @@ %\end{quote} % which should generate something like the following: % \begin{verbatim} -% This is rubikrotation version 4.0 +% This is rubikrotation version ... % Usage: rubikrotation [-h] -i <input file> [-o <out file>] % where, -% [-h] gives this help listing -% [-i] creates specified input file -% [-o] creates specified output file +% [-h|--help] gives this help listing +% [-v|--version] gives version +% [-i] creates specified input file +% [-o] creates specified output file % For documentation see: rubikrotation.pdf, % rubikrotationPL.pdf and rubikcube.pdf %\end{verbatim} @@ -265,13 +275,15 @@ % \section{Usage} % \label{sec:usage} % Load the packages \texttt{rubikcube.sty}, -% \texttt{rubikrotation.sty} and \texttt{rubikpatterns.sty} in the \TeX\ file +% \texttt{rubikrotation.sty}, \texttt{rubikpatterns.sty} +% and \texttt{rubiktwocube.sty} in the \TeX\ file % preamble \textit{after} loading the TikZ package (all the Rubik packages -% require the TikZ package); for example, as follows: +% require the TikZ package). Load the \texttt{rubikcube.sty} \textit{before} the other +% Rubik bundle packages; for example, as follows: %\begin{quote} % \begin{verbatim} % \usepackage{tikz} -% \usepackage{rubikcube,rubikrotation,rubikpatterns} +% \usepackage{rubikcube,rubikrotation,rubikpatterns,rubiktwocube} %\end{verbatim} %\end{quote} % and run (pdf)\LaTeX\ using the \texttt{--shell-escape} command-line option @@ -319,6 +331,26 @@ % \subsection{Configuration-file} % \label{sec:configfile} % +% It is important to realise that the default action of \texttt{rubikrotation.sty} is to +% access the Perl script as an executable file. This is because the~default definitions +% in \texttt{rubikrotation.sty} are as follows: (they are detailed in +% Section~\ref{sec:usefulcommands}) +%\begin{quote} +%\begin{verbatim} +% \newcommand{\rubikperlname}{rubikrotation} +% \newcommand{\rubikperlcmd}{\rubikperlname\space% +% -i rubikstate.dat -o rubikstateNEW.dat} +%\end{verbatim} +%\end{quote} +% Note the need here (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. +% +% If the Perl script has not been made executable, or if you wish to alter how +% the \textsc{rubikrotation} package accesses the Perl script, +% then you need to create a plain-text configuration file in order to redefine one +% or both of the above commands, as described below. +% % A plain-text configuration-file with the name \texttt{rubikrotation.cfg} % (if one exists) will automatically be read by \texttt{rubikrotation.sty}. % The \rubikrotation\ package's facility to use a configuration-file allows the @@ -332,37 +364,24 @@ % Such~a configuration-file can also facilitate testing a new Perl script having % a different name and location. % -% % \DescribeMacro{\rubikperlname} % \DescribeMacro{\rubikperlcmd} % The configuration-file is essentially a convenient software vehicle for feeding % additional \LaTeX\ code to the style option \texttt{rubikrotation.sty}, and hence % allows the contents of some commands to be easily adjusted and/or fine-tuned. -% For~the \rubikrotation\ package there are two particular macros we may wish to adjust. +% For~the \rubikrotation\ package there are two particular macros we may wish to adjust +% (see above). % 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 -% Section~\ref{sec:usefulcommands}) -%\begin{quote} -%\begin{verbatim} -% \newcommand{\rubikperlname}{rubikrotation} -% \newcommand{\rubikperlcmd}{\rubikperlname\space% -% -i rubikstate.dat -o rubikstateNEW.dat} -%\end{verbatim} -%\end{quote} -% Note the need here (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. +% The following examples illustrate how the configuration-file may be used. % % \medskip % {\noindent}\textsc{example~1}:\ \ Suppose we wish to test out % a slightly modified Perl script % with the working (executable) name \texttt{rubikrotationR77}. In this case we % simply create, in the local working directory, a plain-text configuration-file -% (it \textit{must} be named exactly \texttt{rubikrotation.cfg}) and contains just +% (it \textit{must} be named exactly \texttt{rubikrotation.cfg}) containing just % the following line: %\begin{quote} %\begin{verbatim} @@ -387,7 +406,7 @@ %\end{quote} %{\noindent}Remember to make sure the PATH associated with the command is also correct. % -% +% \medskip %{\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/} @@ -410,8 +429,8 @@ % the \textsc{rubikcube} package), although most commands can be placed % inside a TikZ environment if you wish. % -% However, using commands which influence the Rubik colour state -% (e.g.,~the \cmd{\RubikRotation} command) outside the \texttt{tikzpicture}, +% Using commands which influence the Rubik colour state +% (e.g.,~\cmd{\RubikFace..}, \cmd{\RubikCubeSolvedWY} etc.) outside the \texttt{tikzpicture}, % \texttt{minipage} or \texttt{figure} environments % generally offers maximum flexibility, since the effects of such commands when % used inside these environments remain `local' to the environment, and are not @@ -419,7 +438,7 @@ % (see also Section~4.1 in the \textsc{rubikcube} documentation). % % Conversely, the only \rubikrotation\ command which should \textit{not} -% be used inside a TikZ environment is the \cmd{\ShowRubikErrors} command +% be used inside a TikZ environment is the \cmd{\ShowErrors} command % (see the notes on this command below). % % @@ -432,7 +451,9 @@ % 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). +% implemented (see \textbf{Inverse} below). Note that the equivalent \cmd{\TwoRotation} +% command (see the \textsc{rubiktwocube} package) behaves in the same way as the +% \cmd{\RubikRotation} command in all respects. % % % The first (optional) argument \oarg{integer} of the \cmd{\RubikRotation} command is the number @@ -646,7 +667,7 @@ % \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}\,]. +% on writing (Eijkhout 1992, \S\,30.2.3, p.\,238)[\,see references 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. Note that @@ -656,7 +677,7 @@ % 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}\,]. The `sixspot' sequence is +% Reid website)[\,see references Section~\ref{sec:references}\,]. The `sixspot' sequence is % defined as follows: %\begin{quote} % \begin{verbatim} @@ -790,10 +811,9 @@ % % The \cmd{\RubikRotation} command can also be used to scramble the % cube using a random sequence of rotations. If the first argument -% is the lower-case word `random' \textsc{and} the second argument +% is the 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). +% of $n$ rotations will be performed. % 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 @@ -887,46 +907,54 @@ %\end{quote} % % -% \subsection[CheckRubikState]{\cmd{\CheckRubikState} command} +% \subsection[CheckState]{\cmd{\CheckState} command} +% \label{sec:checkstate} % -% \DescribeMacro{\CheckRubikState} +% \DescribeMacro{\CheckState} % Since it is easy to inadvertently define an invalid Rubik cube % (e.g.,~enter an invalid number of, say, yellow facelets), this command % 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 -% the graphic if the \cmd{\ShowRubikErrors} command is used. +% An ERROR: code is issued if the number of facelets having a given colour +% exceeds~9 for a 3x3x3 cube (Rubik cube), or exceeds 4 for a 2x2x2 cube (Two cube). +% The results are written to the the \texttt{.log} file, and displayed at the point +% the \cmd{\ShowErrors} command is used (for code see Section~\ref{sec:checkstatecode}). % % One can check the current Rubik state (for errors) by issuing the command %\begin{quote} %\begin{verbatim} -% \CheckRubikState% +% \CheckState% %\end{verbatim} %\end{quote} -% 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 +% Note (1)~that such a check is implemented automatically with each \cmd{\RubikRotation} and +% \cmd{\TwoRotation} command, and (2)~and makes only a very superficial check---simply counting the number % of cubies of each colour. % +% Note that the \cmd{\CheckState} command replaces the earlier \cmd{\CheckRubikState}, but +% we retain the old command for backwards compatibility (for the moment). % % +% \subsection[ShowErrors]{\cmd{\ShowErrors} command} +% \label{sec:showerrors} % -% \subsection[ShowRubikErrors]{\cmd{\ShowRubikErrors} command} % -% \DescribeMacro{\ShowRubikErrors} +% \DescribeMacro{\ShowErrors} % Any errors which arise can be made visible using the -% command \cmd{\ShowRubikErrors}. +% command \cmd{\ShowErrors}. % This command places a copy of the `error' file (\texttt{rubikstateERRORS.dat}) -% underneath the graphic image so you can see any errors if there are any---all this -% detail can also be found in the \texttt{.log} file. +% underneath the graphic image so you can see any errors if there are any (note that +% details of all errors are are written by default to the \texttt{.log} file) +% (for code see Section~\ref{sec:showerrorscode}). % -% Consequently, this command must be placed \textit{after} a TikZ picture +% Consequently, the \cmd{\ShowErrors} command must be placed \textit{after} a TikZ picture % environment---it cannot be used inside a TikZ environment. In fact this command -% is probably best placed at the end of the document (if there are several such -% environments), where it will reveal all rotation errors generated while -% processing the whole document. +% is probably best placed at the end of the document where it will reveal all +% rotation errors generated while processing the whole document. % Once the document is free of errors this command can be removed or just commented out. -% Run the test file \texttt{example-rot.tex} to see an example of the use of this command. +% The file \texttt{rubikexamples.pdf} shows an example of the use of this command. +% +% Note that the \cmd{\ShowErrors} command replaces the original \cmd{\ShowRubikErrors} command, +% which will be retained for backward compatibility. % % % \section{Files generated} @@ -945,7 +973,7 @@ % \item The Perl script \texttt{rubikrotation.pl} also writes error data % to the file \texttt{rubikstateERRORS.dat}. A copy of this file is displayed % under the graphic image when the command -% \cmd{\ShowRubikErrors} is used after the TikZ picture environment. +% \cmd{\ShowErrors} is used after the TikZ picture environment. % % \end{itemize} % @@ -954,7 +982,7 @@ % \label{generaloverview} % % When \LaTeX\ processes \texttt{rubikrotation.sty} the following steps -% are implemented. +% are implemented (see Section~\ref{sec:thecode}): % \begin{itemize} % % \item[1.] A check is made to see if \texttt{fancyvrb.sty} is loaded: if not @@ -974,7 +1002,8 @@ % \end{itemize} % % -% When a \cmd{\RubikRotation} command is processed it first writes the current +% When a \cmd{\RubikRotation} command is processed +% (see Section~\ref{sec:rubikrotationcode}, line~102), it first writes the current % colour configuration of each face (the `rubik state') to the temporary file % \texttt{rubikstate.dat} (this will be read by the Perl script \texttt{rubikrotation.pl}). % The \cmd{\RubikRotation} command also appends the keyword `\texttt{checkrubik}' @@ -987,6 +1016,7 @@ %\begin{quote} % \begin{verbatim} % % filename: rubikstate.dat +% cubesize,three % 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 @@ -1007,6 +1037,7 @@ %\begin{quote} % \begin{verbatim} % % filename: rubikstate.dat +% cubesize,three % 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 @@ -1017,13 +1048,13 @@ % rotation,random,45 %\end{verbatim} %\end{quote} -% A \cmd{\CheckRubikState} command triggers the same sequence of events except +% A \cmd{\CheckState} command triggers the same sequence of events except % 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 +% When control passes from \LaTeX\ 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}'), and performing % a syntax check---significant syntax errors at this stage @@ -1036,21 +1067,29 @@ % then the Perl script performs a sequence of $n$ random rotations. % Finally, the Perl script writes the final rubikstate to the text file % \texttt{rubikstateNEW.dat}. All error messages are written to the -% text file \texttt{rubikstateERRORS.dat} and also to the \LaTeX\ log-file. +% text file \texttt{rubikstateERRORS.dat} and also to the \LaTeX\ log-file. +% The Perl script now closes all open files and terminates. % -% Control then reverts to \LaTeX\ which then inputs the file +% Control then passes back to \LaTeX\ (still in \texttt{rubikrotation.sty} processing +% the \cmd{\RubikRotation} command---see Section~\ref{sec:rubikrotationcode}, line~115); +% its next action is to input the file % \texttt{rubikstateNEW.dat}. If there are more \cmd{\RubikRotation} commands % (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, +% If the TikZ picture environment is followed by a \cmd{\ShowErrors} command, % then a `verbatim' copy of the \texttt{rubikstateERRORS.dat} file is displayed % immediately under the graphic. Once the graphic is error-free, then the -% \cmd{\ShowRubikErrors} command can be removed or commented out. +% \cmd{\ShowErrors} command can be removed or commented out. +% +% Alternatively, when processing a long document, it can be useful to place +% a \cmd{\ShowErrors} command at the end of the document, where it will list +% all errors which occurred. Once any errors have been fixed, this command can be +% removed or commented out. % % Note that if a \textsc{bash} file is used to coordinate the process then it is often -% convenient to use the linux \texttt{grep} utility to alert the user to any run-time errors, +% convenient to use the Linux \texttt{grep} utility to alert the user to any run-time errors, % by using \texttt{grep} to scan the \texttt{rubikstateERRORS.dat} file at the end of % the run; for example, as follows: %\begin{quote} @@ -1062,53 +1101,37 @@ %\end{quote} % % -% \section{References} -% \label{sec:references} -% -%\begin{itemize} -% -% \item Abrahams PW, Berry K and Hargreaves KA (1990). \textit{\TeX\ for the impatient} -% (Addison-Wesley Publishing Company), page~292. -% {\newline}Available from: \url{http://www.ctan.org/pkg/impatient} -% {\newline}[\,re:~\cmd{\rubikpercentchar} and \cmd{\@comment} in Section~\ref{sec:abrahams}\,] -% -% -% \item Eijkhout V (1992). \textit{\TeX\ by topic: a {\TeX}nician's reference}. -% (Addison-Wesley Publishing Company), pages~232 \&~238. -% {\newline}Available from: \url{https://bitbucket.org/VictorEijkhout/tex-by-topic/} -% [\,re:~\cmd{\string} in Section~\ref{sec:eijkhout}\,] -% [\,re:~\cmd{\write} in Section~\ref{sec:seq-as-macros}\,] % % -% \item Feuers\"{a}nger C (2015). Notes on programming in \TeX. -% {\newline}(revision: 1.12.1-32-gc90572c; 2015/07/29) -% \newline\url{http://pgfplots.sourceforge.net/TeX-programming-notes.pdf} -% {\newline}[\,re:~loop macros in Section~\ref{sec:feuersanger}\,] -% -% \item Kociemba website (Kociemba H). \url{http://www.kociemba.org/cube.htm} -% -% \item Nickalls RWD and Syropoulos A (2015). The \textsc{rubikcube} package, v3.0. -% \newline\url{http://www.ctan.org/pkg/rubik}, -% -% -% \item Randelshofer website (Randelshofer W). \url{http://www.randelshofer.ch/rubik/} -% \ [\,re:~sequences and supersetENG notation\,] -% +% \section{Change history} % -% \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}\,] +% \begin{itemize} % +% \item Version 5.0 (February 2018) % -% \item Tellechea C and Segletes SB (2016). The \textsf{listofitems} package, v1.2 -% \newline\url{http://www.ctan.org/pkg/listofitems} -%\end{itemize} +% --- minor bugfixes and better syntax checking in the Perl program. +% The cube size being processed (ie 3x3x3 or 2x2x2) is now detected by the program. +% +% --- the command \cmd{\CheckState} replaces the earlier +% \cmd{\CheckRubikState} command in order +% to avoid confusion, now that we are able to process both the 3x3x3 cube (Rubik cube) +% and also the 2x2x2 cube (Two cube) +% (see Sections~\ref{sec:checkstate} and \ref{sec:checkstatecode} (code)). +% The original command is retained (for now) for backward compatibility. +% \verb!\CheckRubikState! $\rightarrow$ \verb!\CheckState! +% +% --- the command \cmd{\ShowErrors} replaces the earlier +% \cmd{\ShowRubikErrors} command in order +% to avoid confusion now, that we are able to process both the 3x3x3 cube (Rubik cube) +% and also the 2x2x2 cube (Two cube) +% (see Sections~\ref{sec:showerrors} and \ref{sec:showerrorscode} (code)). +% The original command is retained (for now) for +% backward compatibility. \verb!\ShowRubikErrors! $\rightarrow$ \verb!\ShowErrors! +% +% % % % -% \section{Change history} -% -% \begin{itemize} -% % \item Version 4.0 (March 2017) % % --- The \cmd{\RubikRotation} command has been enhanced to allow its argument to include @@ -1147,7 +1170,7 @@ % --- 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 +% --- The Perl script \texttt{rubikrotation.pl} now uses as input and output file-names % those specified in the command-line of the CALLing program. This now allows the % script \texttt{rubikrotation.pl} to be used as a stand-alone tool (see the % \texttt{rubikrotation} `man' file for details). @@ -1164,12 +1187,63 @@ % % \end{itemize} % +% +% +% +% +% \section{References} +% \label{sec:references} +% +%\begin{itemize} +% +% \item Abrahams PW, Berry K and Hargreaves KA (1990). \textit{\TeX\ for the impatient} +% (Addison-Wesley Publishing Company), page~292. +% {\newline}Available from: \url{http://www.ctan.org/pkg/impatient} +% {\newline}[\,re:~\cmd{\rubikpercentchar} and \cmd{\@comment} in Section~\ref{sec:abrahams}\,] +% +% +% \item Eijkhout V (1992). \textit{\TeX\ by topic: a {\TeX}nician's reference}. +% (Addison-Wesley Publishing Company), pages~232 \&~238. +% {\newline}Available from: \url{https://bitbucket.org/VictorEijkhout/tex-by-topic/} +% [\,re:~\cmd{\string} in Section~\ref{sec:eijkhout}\,] +% [\,re:~\cmd{\write} in Section~\ref{sec:seq-as-macros}\,] +% +% +% \item Feuers\"{a}nger C (2015). Notes on programming in \TeX. +% {\newline}(revision: 1.12.1-32-gc90572c; 2015/07/29) +% \newline\url{http://pgfplots.sourceforge.net/TeX-programming-notes.pdf} +% {\newline}[\,re:~loop macros in Section~\ref{sec:feuersanger}\,] +% +% \item Kociemba website (Kociemba H). \url{http://www.kociemba.org/cube.htm} +% +% \item Nickalls RWD and Syropoulos A (2015). The \textsc{rubikcube} package, v3.0. +% \newline\url{http://www.ctan.org/pkg/rubik}, +% +% +% \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} +% +% +% +% +% % ^^A ================================================== % \StopEventually{\PrintIndex} % -% +% % % \section[The code]{The code (\texttt{rubikrotation.sty})} +% \label{sec:thecode} % % {\noindent}In the following, the term `Perl script' denotes the script % \texttt{rubikrotation.pl}. Useful information regarding the @@ -1182,8 +1256,8 @@ % % \begin{macrocode} %<*rubikrotation> -\def\RRfileversion{4.0}% -\def\RRfiledate{2017/03/03}% +\def\RRfileversion{5.0}% +\def\RRfiledate{2018/02/25}% 25 February 2018 \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{rubikrotation}[\RRfiledate\space (v\RRfileversion)] % \end{macrocode} @@ -1202,7 +1276,7 @@ % % {\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}). +% the error file (see Section~\ref{sec:showerrors}). % \begin{macrocode} \@ifpackageloaded{fancyvrb}{}{% \typeout{---rubikrotation requires the fancyvrb package% @@ -1348,7 +1422,7 @@ % {\noindent}We first open the file \texttt{rubikstateERRORS.dat} which is used % by the Perl script \texttt{rubikrotation.pl} for writing its error-messages to. % This file is displayed by the command -% \cmd{\ShowRubikErrors}. +% \cmd{\ShowErrors}. % % \textsc{important note}: this file is created fresh each time LaTeX is run, % and hence the Perl script only appends data to it during the \LaTeX\ run, @@ -1362,8 +1436,8 @@ \typeout{---creating file rubikstateERRORS.dat}% \newwrite\outfile% \immediate\openout\outfile=rubikstateERRORS.dat% -\@print{\@comment rubikstateERRORS.dat}% -\@print{\@comment --------------------}% +\@print{\@comment ShowErrors (rubikstateERRORS.dat)}% +\@print{\@comment ---------------------------------}% \immediate\closeout\outfile% % \end{macrocode} % @@ -1372,7 +1446,7 @@ % % Having set up all the primary files, we now need to set up a newwrite for % all subsequent file openings (e.g.,~for \texttt{rubikstate.dat} and saving -% to arbitrary filenames by the \cmd{\SaveRubikState} command). Otherwise, we +% to arbitrary file-names by the \cmd{\SaveRubikState} command). Otherwise, we % can easily exceed the LaTeX limit of 15. From here-on \TeX\ will use % \texttt{openout7} when opening and writing to files. We will implement new % openings using the command \verb!\@openstatefile! (see below). @@ -1404,23 +1478,23 @@ % (see Sections~\ref{saverubikstate} and \ref{generaloverview}). % The file \texttt{rubikstate.dat} is read by the Perl script, and represents % the state on which the new \cmd{\RubikRotation} command acts. -% Note that we append the key-word \texttt{checkstate} to the end of the file -% in order to trigger the Perl script to implement its \texttt{checkstate} subroutine. +% Note that we include the line \texttt{cubesize,three} to inform the Perl script +% that the cube is a 3x3x3 cube (this is used in the `random' subroutine). % -% The actual state is simply an ordered sequence of the faces and the colours +% The actual state (colour state) is simply an ordered sequence of the faces and the colours % 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. % \begin{macrocode} \newcommand{\@printrubikstate}{% + \@print{cubesize,three}% \@print{up,\Ult,\Umt,\Urt,\Ulm,\Umm,\Urm,\Ulb,\Umb,\Urb}% \@print{down,\Dlt,\Dmt,\Drt,\Dlm,\Dmm,\Drm,\Dlb,\Dmb,\Drb}% \@print{left,\Llt,\Lmt,\Lrt,\Llm,\Lmm,\Lrm,\Llb,\Lmb,\Lrb}% \@print{right,\Rlt,\Rmt,\Rrt,\Rlm,\Rmm,\Rrm,\Rlb,\Rmb,\Rrb}% \@print{front,\Flt,\Fmt,\Frt,\Flm,\Fmm,\Frm,\Flb,\Fmb,\Frb}% \@print{back,\Blt,\Bmt,\Brt,\Blm,\Bmm,\Brm,\Blb,\Bmb,\Brb}% - \@print{checkstate}% } % \end{macrocode} % \end{macro} @@ -1440,8 +1514,8 @@ % Note that this macro uses the internal commands \cmd{\@comment} (`\%\%'), % \cmd{\@commentone} (`\%') and \cmd{\@print}. \#1 is the output filename. % We use several \cmd{\typeout} commands to write to the log file. -% An example of the line of code we are trying to output to the -%\texttt{rubikstateNEW.dat} file is as follows: +% An example of one of the lines of code we are trying to output to the +%\texttt{rubikstateNEW.dat} file is as follows: % {\newline}\verb!\RubikFaceUp{W}{W}{G}{W}{W}{G}{B}{B}{Y}%! % \begin{macrocode} \newcommand{\SaveRubikState}[1]{% @@ -1512,10 +1586,11 @@ % 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{---TeX process---------------------------}% + \typeout{---script = rubikrotation.sty v\RRfileversion\space (\RRfiledate)}% + \typeout{---NEW rotation command}% \typeout{---command = RubikRotation[#1]{#2}}% - \typeout{---writing current Rubik state to file rubikstate.dat}% + \typeout{---writing current cube state to file rubikstate.dat}% \@openstatefile% open data file \@print{\@comment filename: rubikstate.dat}% \@print{\@comment written by rubikrotation.sty% @@ -1542,38 +1617,54 @@ % % % -% \subsection{ShowRubikErrors command} -% \label{sec:showrubikerrors} +% \subsection{ShowErrors command} +% \label{sec:showerrorscode} % -% \begin{macro}{\ShowRubikErrors} -% This command inputs the file \texttt{rubikstateERRORS.dat}. -% Also made a more convenient synonym = \cmd{\ShowErrors}. +% \begin{macro}{\ShowErrors} +% This command inputs the file \texttt{rubikstateERRORS.dat} +% (output by the Perl program). % \begin{macrocode} -\newcommand{\ShowRubikErrors}{% - \typeout{---ShowRubikErrors: inputting file rubikstateERRORS.dat}% +\newcommand{\ShowErrors}{% + \typeout{---ShowErrors: inputting file rubikstateERRORS.dat}% \VerbatimInput{rubikstateERRORS.dat}% } -\newcommand{\ShowErrors}{\ShowRubikErrors} +% \end{macrocode} +% Since this command replaces the original command = \cmd{\ShowRubikErrors}, we will +% retain the original command for backward compatibility (for the moment at least). +% \begin{macrocode} +\newcommand{\ShowRubikErrors}{\ShowErrors} % \end{macrocode} % \end{macro} % % -% \subsection{CheckRubikState command} +% \subsection{CheckState command} +% \label{sec:checkstatecode} % -% \begin{macro}{\CheckRubikState} +% \begin{macro}{\CheckState} % This command triggers the Perl script to implement % some simple error checking of the Rubik configuration (state). % This command (a)~writes the current Rubik state to the file -% \texttt{rubikstate.dat}, and then (b)~CALLs the Perl script. -% It also writes comments to the data file and also to the log file.. +% \texttt{rubikstate.dat}, (b)~writes the keyword `checkstate' to the +% same file, and then (c)~CALLs the Perl script. +% It also writes comments to the data file and also to the log file. +% +% Note (1)~that the command \cmd{\@printrubikstate} actually writes the +% current state to the file \texttt{rubikstate.dat}, (2)~the keyword `checkstate' +% triggers the Perl program to do a simple numerical check on the number +% of facelets with each colour. +% +% Note also that the \cmd{\CheckState} command replaces the earlier +% \cmd{\CheckRubikState}, but we retain the old command for backwards +% compatibility (for the moment). % \begin{macrocode} -\newcommand{\CheckRubikState}{% +\newcommand{\CheckState}{% \typeout{---NEW check command------------------}% - \typeout{---command = CheckRubikState}% - \typeout{---writing current Rubik state to file rubikstate.dat}% + \typeout{---command = CheckState}% + \typeout{---writing current cube state to file rubikstate.dat}% \@openstatefile% opens data file \@print{\@comment filename: rubikstate.dat}% \@printrubikstate% + \immediate\write\outfile{checkstate}% \@closestatefile% close data file \typeout{---running Perl script (rubikrotation.pl)}% \immediate\write18{\rubikperlcmd}% @@ -1581,6 +1672,7 @@ \input{rubikstateNEW.dat}% \typeout{-----------------------------------------}% } +\newcommand{\CheckRubikState}{\CheckState} % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/rubik/rubikrotation.ins b/Master/texmf-dist/source/latex/rubik/rubikrotation.ins index 0c2aed56982..655f68e31ae 100644 --- a/Master/texmf-dist/source/latex/rubik/rubikrotation.ins +++ b/Master/texmf-dist/source/latex/rubik/rubikrotation.ins @@ -1,6 +1,6 @@ %% rubikrotation.ins %% -%% version 4.0 +%% %% %% --- automatic overwriting of .sty is disabled------- %% ========================================================= @@ -16,9 +16,9 @@ Authors: RWD Nickalls (dick@nickalls.org) and Apostolos Syropoulos (asyropoulos@yahoo.com) - Copyright 03 March 2017 RWD Nickalls and A Syropoulos + Copyright February 25, 2018 RWD Nickalls and A Syropoulos - VERSION 4.0 + VERSION 5.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/rubiktwocube.dtx b/Master/texmf-dist/source/latex/rubik/rubiktwocube.dtx new file mode 100644 index 00000000000..3e243cd8029 --- /dev/null +++ b/Master/texmf-dist/source/latex/rubik/rubiktwocube.dtx @@ -0,0 +1,2478 @@ +% \iffalse meta-comment +% rubiktwocube.dtx +% +% version v5.0 +% February 25, 2018 +% +% +% Copyright 2018 +% RWD Nickalls (dick@nickalls.org) and +% A Syropoulos (asyropoulos@yahoo.com) +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% +% This work consists of the files rubiktwocube.dtx and rubiktwocube.ins +% and the derived file rubiktwocube.sty. +% +%<*readme> +% +% The rubikcube package provides a collection of LaTeX commands and macros +% for the typesetting of Rubik cube configurations and rotation +% sequences using the TikZ graphic language. +% +% Please report errors or suggestions for improvement to +% +% Dick Nickalls or Apostolos Syropoulos +% +% This package requires the basic TikZ package to be loaded already +%</readme> +% +%<*driver> +\listfiles +\documentclass{ltxdoc} +\IfFileExists{rubiktwocube.sty}{\usepackage{rubiktwocube}}{% + \GenericWarning{rubiktwocube.dtx}{Package file rubiktwocube.sty not found. + Documentation will be messed up!^^J + (Generate rubiktwocube.sty by (La)TeXing rubiktwocube.ins, and then^^J + process rubiktwocube.dtx again)^^J}\stop +}% +\pagestyle{myheadings} +\markright{\texttt{rubiktwocube} \ \ (Rubik bundle v5.0, 2018) \ \ \texttt{www.ctan.org/pkg/rubik}} +\usepackage{rubikcube} %% we require macros @join and rubikfont +\usepackage{ifpdf} +\usepackage{url,path} %% for references +\usepackage{supertabular} %% for Notation table +\usepackage{hypdoc} %% for hyperref documenting of LaTeX packages +%%\OnlyDescription +\EnableCrossrefs +\PageIndex +\CodelineIndex +\CodelineNumbered +\RecordChanges +\setcounter{StandardModuleDepth}{1} +\begin{document} + \DocInput{rubiktwocube.dtx} + \PrintChanges + \PrintIndex +\end{document} +%</driver> +% \fi +% +% +% +%%% \CheckSum{2308} +% +%%% \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 \rubiktwocube\ package} +% +% \author{ +% RWD Nickalls (dick@nickalls.org) \\ +% A Syropoulos (asyropoulos@yahoo.com) +% } +% \date{This file describes version \RTCfileversion\ (\RTCfiledate)\\ +% \texttt{www.ctan.org/pkg/rubik}} +% \maketitle +% +% \begin{abstract} +% The \rubiktwocube\ package provides LaTeX commands and macros +% for typesetting TwoCube (2x2x2) notation, configurations, and +% rotation sequences using the TikZ graphic language. It is part of the +% Rubik `bundle'. +% \end{abstract} +% +% +% \begin{minipage}{12cm} +% \centering +% \ifpdf +% \strut\hspace{5mm}\includegraphics[width=12cm]{rubiktwo-doc-figA.pdf} +% \else +% \fi +% \end{minipage} +% +% +% \tableofcontents +% +% \pagebreak +% +% \section{Introduction} +% +% The \rubiktwocube\ package (part of the \textsc{rubik} `bundle') provides a +% collection of \LaTeX\ commands +% and macros for typesetting Rubik 2x2x2 cube configurations using the +% PGF/TikZ graphic languages. +% This package is a minor extension of the \textsc{rubikcube} package, and users are +% therefore assumed to be familiar with both the \textsc{rubikcube} and \textsc{rubikrotation} +% packages. For examples of use see the file \texttt{rubikexamples.pdf}. +% +% +% \subsection{Requirements} +% +% The \rubiktwocube\ package requires the TikZ package (since it makes +% use of the TikZ picture environment), and also the +% \textsc{rubikcube} package. +% +% For full functionality the complementary packages \textsc{rubikrotation} and +% \textsc{rubikpatterns} also need to be loaded. +% Note that the \textsc{rubikrotation} package requires Perl to be installed. +% See the `Installation' section in the \textsc{rubikcube} package documentation +% (\texttt{rubikcube.pdf}) for more details. + +% +% +% +% \subsection{Copyright} +% Copyright 2014--2018 RWD Nickalls and A Syropoulos. +% +% \medskip +% {\noindent}This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3c of this license or any +% later version. The latest version of this licence is in +% |www.latex-project.org/lppl.txt| +% +% +% \section{Installation} +% +% The Rubik bundle consists of the four packages \textsc{rubikcube}, \textsc{rubikrotation}, +% \textsc{rubikpatterns} and \textsc{rubiktwocube}. +% +% Here we describe only the installation of the \textsc{rubiktwocube} package, +% which consists of the following files: +%\begin{verbatim} +% rubiktwocube.ins +% rubiktwocube.dtx +% rubiktwocube.pdf --documentation of the rubiktwocube package +% rubiktwo-doc-figA.pdf +%\end{verbatim} +% Before installing the \textsc{rubiktwocube} package make sure the following packages +% are already installed (TikZ graphics system and the \textsc{rubikcube} package). +% +% +% \subsection{\texttt{rubiktwocube.sty}} +% +% The style option \texttt{rubiktwocube.sty} is generated by running (pdf)\LaTeX\ on +% the file \texttt{rubiktwocube.ins} as follows: +%\begin{verbatim} +% pdflatex rubiktwocube.ins +%\end{verbatim} +% +% +% \subsection{\texttt{rubiktwocube.pdf}} +% +% The documentation file (\texttt{rubiktwocube.pdf}) is then generated using the following +% 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 rubiktwocube.dtx +% pdflatex rubiktwocube.dtx +% makeindex -s gind.ist rubiktwocube +% makeindex -s gglo.ist -o rubiktwocube.gls rubiktwocube.glo +% pdflatex rubiktwocube.dtx +% pdflatex rubiktwocube.dtx +%\end{verbatim} +% +% +% \subsection{Placing the files} +% +% Place the files either in the local working directory, or where your system +% will find them. For a Linux system with a standard \TeX\ Directory Structure (TDS), then: +% +%\medskip +%{\noindent}*.sty $\rightarrow$ +% \texttt{/usr/local/texlive/texmf-local/tex/latex/rubik/} +%{\newline}*.pdf $\rightarrow$ \texttt{/usr/local/texlive/texmf-local/doc/rubik/} +% +% \medskip +% {\noindent}Finally, (depending on your system) update the \TeX\ file database. +% For~example, on a Linux system one uses the \texttt{texhash} command. +% +% +% \subsection{Usage} +% +% Load the package by using the command \cmd{\usepackage\{rubiktwocube\}}. +% Note that the \rubiktwocube\ package requires the TikZ package, and so always load TikZ +% before \rubiktwocube\ as follows: +% \begin{quote} +%\begin{verbatim} +% \usepackage{tikz} +% \usepackage{rubikcube,rubikrotation,rubikpatterns,rubiktwocube} +%\end{verbatim} +% \end{quote} +% +% +% +% \subsection{\texttt{rubikexamples.pdf}} +% +% The Rubik bundle includes a `RubikExamples' file (\texttt{rubikexamples.pdf}) +% as well as associated \texttt{.sh} (Linux) and \texttt{.bat} (Microsoft) batch +% files which can be used to facilitate processing the source file (\texttt{rubikexamples.tex}). +% See the `Installation' section in the \textsc{rubikcube} package documentation +% (\texttt{rubikcube.pdf}) for details regarding processing the examples source file. +% +% +% +% \pagebreak +% +% \section{Command conventions} +% \label{sec:conventions} +% +% The examples given in the file \texttt{rubikexamples.pdf} present a good overview of +% the commands and how to use them. +% +% +% +% \subsection[Keywords Two and Rubik]{The keywords Two and Rubik in commands} +% +% In order to try and keep commands intuitive\,\footnote{This is a tricky problem +% given the large number of commands, so any feedback or ideas on how to avoid ambiguity, +% including pruning or revising `bad' commands, is always welcome.} +% we adopt the convention that the word `Two' in a command reflects the fact that +% the command relates to a 2x2x2 cube (a `Two' cube). Similarly, commands which relate +% to a 3x3x3 cube (a `Rubik' cube) ---see the \textsc{rubikcube} package--- +% use instead the word `Rubik'. +% +% +% +% It is assumed that users are familiar with the \textsc{rubikcube} +% and \textsc{rubikrotation} packages, since virtually all \rubiktwocube\ +% commands mirror the Rubik (3x3x3) cube commands, such that the word `Rubik' +% is replaced by the word `Two' (exceptions are highlighted). +% For example, the commands for drawing a 2x2x2 cube and a 3x3x3 cube from a RU viewpoint +% are respectively \cmd{\DrawTwoCubeRU} and \cmd{\DrawRubikCubeRU}. +% The examples given in the file \texttt{rubikexamples.pdf} present a good overview of +% the commands and how to use them. +% +% For more detailed information see (a)~the `code' section (Section~\ref{sec:thecode}), +% or (b)~see the equivalent 3x3x3 commands in the \textsc{rubikcube} package. +% +% +% +% +% +% \section{Colour commands} +% \label{sec:listofcolourcommands} +% +% The following list shows the \rubiktwocube\ colour commands paired +% (for convenience) with the equivalent 3x3x3 version from the +% \textsc{rubikcube} package. The \texttt{..} indicates that mandatory arguments are required. +% +% +%\begin{verbatim} +% RubikCube TwoCube +% 3x3x3 2x2x2 +% +% \RubikCubeSolved \TwoCubeSolved +% \RubikCubeSolvedWY \TwoCubeSolvedWY +% \RubikCubeSolvedWB \TwoCubeSolvedWB +% \RubikCubeGrey \TwoCubeGrey +% \RubikCubeGray \TwoCubeGray +% \RubikCubeGreyWY +% \RubikCubeGrayWY +% \RubikCubeGreyWB +% \RubikCubeGrayWB +% \RubikCubeGreyAll \TwoCubeGreyAll +% \RubikCubeGrayAll \TwoCubeGrayAll +% \RubikSolvedConfig.. \TwoSolvedConfig.. +% +% \RubikFaceUp.. \TwoFaceUp.. +% \RubikFaceDown.. \TwoFaceDown.. +% \RubikFaceLeft.. \TwoFaceLeft.. +% \RubikFaceRight.. \TwoFaceRight.. +% \RubikFaceFront.. \TwoFaceFront.. +% \RubikFaceBack.. \TwoFaceBack.. +% \RubikFaceUpAll.. \TwoFaceUpAll.. +% \RubikFaceDownAll.. \TwoFaceDownAll.. +% \RubikFaceLeftAll.. \TwoFaceLeftAll.. +% \RubikFaceRightAl.. \TwoFaceRightAll.. +% \RubikFaceFrontAl.. \TwoFaceFrontAll.. +% \RubikFaceBackAll.. \TwoFaceBackAll.. +% +% \RubikSidebarWidth.. \TwoSidebarWidth.. +% \RubikSidebarLength.. \TwoSidebarLength.. +% \RubikSidebarSep.. \TwoSidebarSep.. +% +% \RubikSliceTopL.. \TwoSliceTopL.. +% \RubikSliceTopR.. \TwoSliceTopR.. +% \RubikSliceBottomL.. \TwoSliceBottomL.. +% \RubikSliceBottomR.. \TwoSliceBottomR.. +%\end{verbatim} +% +% +% +% \section{Draw commands} +% \label{sec:listofdrawcommands} +% +% The following list shows the \rubiktwocube\ Draw commands paired +% (for convenience) with the equivalent 3x3x3 version from the +% \textsc{rubikcube} package. Commands in round brackets show short-hand +% equivalents. +% +% +%\begin{verbatim} +% RubikCube TwoCube +% 3x3x3 2x2x2 +% +% \DrawRubikCubeRU \DrawTwoCubeRU +% \DrawRubikCubeRD \DrawTwoCubeRD +% \DrawRubikCubeLU \DrawTwoCubeLU +% \DrawRubikCubeLD \DrawTwoCubeLD +% \DrawRubikCubeF \DrawTwoCubeF +% \DrawRubikCubeSF \DrawTwoCubeSF +% +% \DrawRubikCubeSidebarFL.. \DrawTwoCubeSidebarFL.. +% \DrawRubikCubeSidebarFR.. \DrawTwoCubeSidebarFR.. +% \DrawRubikCubeSidebarFU.. \DrawTwoCubeSidebarFU.. +% \DrawRubikCubeSidebarFD.. \DrawTwoCubeSidebarFD.. +% \DrawRubikCubeSidebarBL.. \DrawTwoCubeSidebarBL.. +% \DrawRubikCubeSidebarBR.. \DrawTwoCubeSidebarBR.. +% \DrawRubikCubeSidebarBU.. \DrawTwoCubeSidebarBU.. +% \DrawRubikCubeSidebarBD.. \DrawTwoCubeSidebarBD.. +% +% \DrawRubikFaceUp \DrawTwoFaceUp (= \DrawTwoFaceU ) +% \DrawRubikFaceDown \DrawTwoFaceDown (= \DrawTwoFaceD ) +% \DrawRubikFaceLeft \DrawTwoFaceLeft (= \DrawTwoFaceL ) +% \DrawRubikFaceRight \DrawTwoFaceRight (= \DrawTwoFaceR ) +% \DrawRubikFaceFront \DrawTwoFaceFront (= \DrawTwoFaceF ) +% \DrawRubikFaceBack \DrawTwoFaceBack (= \DrawTwoFaceB ) +% +% \DrawRubikFaceUpSide \DrawTwoFaceUpSide (= \DrawTwoFaceUS ) +% \DrawRubikFaceDownSide \DrawTwoFaceDownSide (= \DrawTwoFaceDS ) +% \DrawRubikFaceLeftSide \DrawTwoFaceLeftSide (= \DrawTwoFaceLS ) +% \DrawRubikFaceRightSide \DrawTwoFaceRightSide (= \DrawTwoFaceRS ) +% \DrawRubikFaceFrontSide \DrawTwoFaceFrontSide (= \DrawTwoFaceFS ) +% \DrawRubikFaceBackSide \DrawTwoFaceBackSide (= \DrawTwoFaceBS ) +% +% \DrawRubikFlatUp.. \DrawTwoFlatUp.. +% \DrawRubikFlatDown.. \DrawTwoFlatDown.. +% \DrawRubikFlatLeft.. \DrawTwoFlatLeft.. +% \DrawRubikFlatRight.. \DrawTwoFlatRight.. +% \DrawRubikFlatFront.. \DrawTwoFlatFront.. +% \DrawRubikFlatBack.. \DrawTwoFlatBack.. +% +%\end{verbatim} +% +% +% +% +% \section{Rotation commands} +% \label{sec:rotationcommands} +% +% \bigskip +% +% +%\begin{verbatim} +% RubikCube TwoCube +% 3x3x3 2x2x2 +% +% \RubikRotation.. \TwoRotation.. +% \SaveRubikState.. \SaveTwoState.. +% \ShowErrors \ShowErrors +% \CheckState \CheckState +%\end{verbatim} +% +% +% \subsection{List of rotation commands} +% \label{sec:listofrotationcommands} +% +% +% All the commands presented here also have a \cmd{\Two\{\}} equivalent form which +% typesets both the hieroglyph and its lettercode in a vertical format. +% These have been omitted here owing to the difficulty of including this form easily +% in the following table. +% +% 2x2x2 \textsc{changes}: Note that all these command names mirror their 3x3x3 equivalents in +% the \textsc{rubikcube} package; the changes in the command prefixes +% are as follows: +% +% \cmd{\tr} $\leftarrow$ \cmd{\rr} +% +% \cmd{\trh} $\leftarrow$ \cmd{\rrh} +% +% \cmd{\Two} $\leftarrow$ \cmd{\Rubik} +% +% \cmd{\textTwo} $\leftarrow$ \cmd{\textRubik} +% +% \pagebreak +% +% \subsubsection{Face rotations} +% \label{sec:facerotations} +% +% +% \newcommand{\dnstrut}{\rule{0pt}{17pt}} +% \newcommand{\dns}{\hspace{2mm}} +% \newcommand{\dnsp}{\hspace{2mm}} +% +% \newcommand{\dnTwo}[1]{% +% \dnstrut\tr{#1}\dns\cmd{\tr\{#1\}}% +% & \trh{#1}\dns\cmd{\trh\{#1\}}% +% & \Two{#1}\dns\cmd{\Two\{#1\}} \nonumber\\% +% }% +% +% \newcommand{\dntextTwo}[1]{% +% \dnstrut\tr{#1}\dns\cmd{\tr\{#1\}}% +% & \trh{#1}\dns\cmd{\trh\{#1\}}% +% & \textTwo{#1}\dns\cmd{\textTwo\{#1\}} \nonumber\\% +% }% +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}} +% \dntextTwo{U} +% \dntextTwo{Up} +% \dntextTwo{D} +% \dntextTwo{Dp} +% \dntextTwo{L} +% \dntextTwo{Lp} +% \dntextTwo{R} +% \dntextTwo{Rp} +% \dntextTwo{F} +% \dntextTwo{Fp} +% \dntextTwo{B} +% \dntextTwo{Bp} +% \end{supertabular} +% +% +% +% \subsubsection{Axis rotations} +% \label{sec:listofaxisrotations} +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}} +% \dnTwo{x} +% \dnTwo{xp} +% \dnTwo{y} +% \dnTwo{yp} +% \dnTwo{z} +% \dnTwo{zp} +% \end{supertabular} +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}} +% \dnTwo{u} +% \dnTwo{up} +% \dnTwo{d} +% \dnTwo{dp} +% \dnTwo{l} +% \dnTwo{lp} +% \dnTwo{r} +% \dnTwo{rp} +% \dnTwo{f} +% \dnTwo{fp} +% \dnTwo{b} +% \dnTwo{bp} +% \end{supertabular} +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}} +% \dnTwo{Uc} +% \dnTwo{Ucp} +% \dnTwo{Dc} +% \dnTwo{Dcp} +% \dnTwo{Lc} +% \dnTwo{Lcp} +% \dnTwo{Rc} +% \dnTwo{Rcp} +% \dnTwo{Fc} +% \dnTwo{Fcp} +% \dnTwo{Bc} +% \dnTwo{Bcp} +% \end{supertabular} +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}} +% \dnTwo{CR} +% \dnTwo{CRp} +% \dnTwo{CL} +% \dnTwo{CLp} +% \dnTwo{CU} +% \dnTwo{CUp} +% \dnTwo{CD} +% \dnTwo{CDp} +% \dnTwo{CF} +% \dnTwo{CFp} +% \dnTwo{CB} +% \dnTwo{CBp} +% \end{supertabular} +% +% +% +% \section{References} +% +% See the \textsc{rubikcube} package documentation for a full list of references. +% +% +% \section{Change history} +% +% \begin{itemize} +% +% \item Version 5.0 (February 2018) +% +% ---First release. +% +% \end{itemize} +% +% +% +% +% ^^A ======================= +% \StopEventually{\PrintIndex} +% +% \bigskip\bigskip\bigskip\bigskip +% +% \section{The code} +% \label{sec:thecode} +% +% All the 2x2x2 code here is essentially a cut-down version of the +% 3x3x3 code (\textsc{rubikcube} package); i.e.,~we have mostly just +% removed the 3x3x3 code relating to middle columns and rows, exchanged the +% word `Rubik' for the word `Two' in command names, and refashioned some of the commands +% involved in writing the temporary file \texttt{rubikstate.dat}. +% We assume that users are familiar with the \textsc{rubikcube} and +% \textsc{rubikrotation} package documentation. +% +% In order to avoid much repetition, we describe here only the +% essential details for understanding the relatively minor changes made in order to +% transform the earlier 3x3x3 \textsc{rubikcube} package code into +% working 2x2x2 code. In the following, the various instances of the +% heading `\textsc{changes:}' imply that more extensive details will be found +% with the equivalent `Rubik' commands in the \textsc{rubikcube} or \textsc{rubikrotation} +% package documentation. +% +% Relatively few 2x2x2 square hieroglyphs are required; some needed +% reformulating from their 3x3x3 cousins, ie those associated +% with \texttt{L,\,Lp,\,R,\,Rp,\,U,\,Up,\,D,\,Dp}. +% The axis rotations and the rotations \texttt{F,\,Fp,\,B,\,Bp} simply required +% renaming; for~example, as a `TwoRotationHieroglyph' (\cmd{\trh..}) instead of +% the 3x3x3 `RubikRotationHieroglyph (\cmd{\rrh..}). +% +% +% +% +% \subsection{Package heading} +% +% The `RTC' in the following refers to the package name RubikTwoCube. +% +% \begin{macrocode} +%<*rubiktwocube> +\def\RTCfileversion{5.0}% +\def\RTCfiledate{2018/02/25}% February 25, 2018 +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{rubiktwocube}[\RTCfiledate\space (v\RTCfileversion)] +% \end{macrocode} +% The package requires TikZ (we use the pgfmathsetmacro command) +% ---so we load it if not already loaded. +% \begin{macrocode} +\@ifpackageloaded{tikz}{}{% + \typeout{---rubiktwocube requires the TikZ package.}% + \RequirePackage{tikz}}% +% \end{macrocode} +% +% +% +% {\noindent}The package requires \texttt{rubikcube.sty}. However \texttt{rubikcube.sty} +% is not automatically loaded (for the moment at least) since this makes it difficult +% to errorcheck new versions, so we just write a message. +% \begin{macrocode} +\@ifpackageloaded{rubikcube}{}{% + \typeout{---rubiktwocube requires the rubikcube package.}% + }% +\@ifpackageloaded{rubikrotation}{}{% + \typeout{---rubiktwocube requires the rubikrotation package.}% + }% +% \end{macrocode} +% +% \begin{macro}{\rubiktwocube} +% First we create a suitable logo +% \begin{macrocode} +\newcommand{\rubiktwocube}{\textsc{rubiktwocube}}% +% \end{macrocode} +% \end{macro} +% +% +% +% +% \subsection{Saving the Two-cube state} +% \label{sec:codesavingtwostate} +% +% Note that this package writes this state data to the same `output' file +% (\texttt{rubikstate.dat}) as used by the 3x3x3 \textsc{rubikrotation} package, +% since there is no need to change this (since the TwoCube corners will be processed in +% exactly the same way as for 3x3x3 cube corners). +% +% \begin{macro}{\@printTWOstate} +% This internal command writes the TwoCube state data to +% the `output' file \texttt{rubikstate.dat}, and is used by the \cmd{\TwoRotation} command +% (see also \textsc{rubikrotation} package documentation Sections on \textit{save rubikstate} +% and \textit{general overview} for further details). +% The file \texttt{rubikstate.dat} is read by the Perl script, and represents +% the state on which the \cmd{\TwoRotation} command acts. +% +% \textsc{changes}: Since this is a TwoCube all the non-corner facelets +% (ie those in middle rows \& columns) are filled with X (grey). +% We have also introduced a new line in the output file (\texttt{rubikstate.dat}) +% namely \texttt{cubesize,two} which is used to inform the Perl program that we +% are dealing with a TwoCube. +% \begin{macrocode} +\newcommand{\@printTWOstate}{% + \@print{cubesize,two}% + \@print{\space \space up,\Ult,\Umt,\Urt,\Ulm,\Umm,\Urm,\Ulb,\Umb,\Urb}% + \@print{down,\Dlt,\Dmt,\Drt,\Dlm,\Dmm,\Drm,\Dlb,\Dmb,\Drb}% + \@print{left,\Llt,\Lmt,\Lrt,\Llm,\Lmm,\Lrm,\Llb,\Lmb,\Lrb}% + \@print{right,\Rlt,\Rmt,\Rrt,\Rlm,\Rmm,\Rrm,\Rlb,\Rmb,\Rrb}% + \@print{front,\Flt,\Fmt,\Frt,\Flm,\Fmm,\Frm,\Flb,\Fmb,\Frb}% + \@print{back,\Blt,\Bmt,\Brt,\Blm,\Bmm,\Brm,\Blb,\Bmb,\Brb}% +} +% \end{macrocode} +% \end{macro} +% +% +% +% +% \subsection{SaveTwoState command} +% \label{sec:codesavetwostate} +% +% \begin{macro}{\SaveTwoState} +% We create a TwoCube version of the existing \cmd{\SaveRubikState} command +% (\textsc{rubikrotation} package), simply for symmetry and convenience. +% This command is identical to the `Rubik' version, and will require +% the \textsc{rubikrotation} package to be loaded already (as does the following +% \cmd{\TwoRotation} command. +% \begin{macrocode} +\newcommand{\SaveTwoState}{\SaveRubikState} +% \end{macrocode} +% \end{macro} +% +% +% +% +% \subsection{TwoRotation command} +% \label{sec:codetworotation} +% +% Note that this command writes the data to the same file +% (\texttt{rubikstate.dat}) as that output by the equivalent 3x3x3 +% \cmd{\RubikRotation} command, since there is no need to change this. +% +% Note that although the system works perfectly well even if we just continue to use the +% 3x3x3 \cmd{\RubikRotation} command, it was felt appropriate to implement a special +% TwoCube version of this command, since this allows the Perl script to be aware +% (via the \texttt{cubesize,two} line written to the \texttt{rubikstate.dat} file) +% which sort of cube it is dealing with, and hence allows the option for the program to +% adjust its action accordingly (for example, with regard to the randomisation procedure +% which is different for different cubes). +% +% +% \begin{macro}{\TwoRotation} +% The \cmd{\TwoRotation}\oarg{integer}\marg{comma separated sequence} +% command (a)~writes the current TwoCube state to the file \texttt{rubikstate.dat}, +% (b)~writes the rotation sequence (either once or multiple times depending +% on the value of the optional integer argument), and then (c)~CALLs the +% Perl script \texttt{rubikrotation.pl}. It~also writes comments to the +% data file and also to the log file. +% +% 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{\TwoRotation} +% command to allow a square-bracket optional +% argument (a non-negative integer) to specify the number of such repeats. +% +% \textsc{2x2x2 changes}: (1)~We have replaced `Rubik' by `Two' in the command-name +% (2)~we use the command \cmd{\@printTWOstate} (see above) to write the current state data, +% (3)~the \texttt{RTC} in the fileversion and filedate names denotes `RubikTwoCube'. +% \begin{macrocode} +\newcommand{\TwoRotation}[2][1]{% + \typeout{---TeX process}% + \typeout{---script = TwoRotation cmd (rubiktwocube.sty)% + v\RTCfileversion\space (\RTCfiledate)}% + \typeout{---NEW rotation command}% + \typeout{---command = TwoRotation[#1]{#2}}% + \typeout{---writing current TWOcube state to file rubikstate.dat}% + \@openstatefile% open data file + \@print{\@comment filename: rubikstate.dat}% + \@print{\@comment written by TwoRotation cmd (rubiktwocube.sty)% + v\RTCfileversion\space (\RTCfiledate)}% + \@printTWOstate% + %% countingloop code from Feuersaenger (2015) + \newcount\ourRRcounter% + \@countingloop{\ourRRcounter} in 1:{#1}{% + \immediate\write\outfile{rotation,#2}}% + \@closestatefile% close data file + \typeout{---CALLing Perl script (rubikrotation.pl)}% + \immediate\write18{\rubikperlcmd}% + \typeout{---inputting NEW datafile (data written by Perl script)}% + \input{rubikstateNEW.dat}% + \typeout{-----------------------------------------}% + } +% \end{macrocode} +% \end{macro} +% As usual we require the \texttt{--shell-escape} command-line option to be used. +% This is provided by the \textsf{shellesc} package, and is equivalent +% to \cmd{\immediate}\cmd{\write18}. +% In the future we may need to replace the \verb!\immediate\write18! with \verb!\ShellEscape! +% ---see the \textsf{shellesc} package documentation. +% +% +% +% +% \subsection{TwoFaceX macros} +% \label{sec:codetwoface} +% +% Allocate the four facelet colours to each face +% (only four facelets now). +% \begin{macrocode} +\newcommand{\TwoFaceUp}[4]{% + \def\Ult{#1}\def\Urt{#2}\def\Ulb{#3}\def\Urb{#4}} +\newcommand{\TwoFaceFront}[4]{% + \def\Flt{#1}\def\Frt{#2}\def\Flb{#3}\def\Frb{#4}} +\newcommand{\TwoFaceRight}[4]{% + \def\Rlt{#1}\def\Rrt{#2}\def\Rlb{#3}\def\Rrb{#4}} +\newcommand{\TwoFaceDown}[4]{% + \def\Dlt{#1}\def\Drt{#2}\def\Dlb{#3}\def\Drb{#4}} +\newcommand{\TwoFaceLeft}[4]{% + \def\Llt{#1}\def\Lrt{#2}\def\Llb{#3}\def\Lrb{#4}} +\newcommand{\TwoFaceBack}[4]{% + \def\Blt{#1}\def\Brt{#2}\def\Blb{#3}\def\Brb{#4}} +\newcommand{\TwoFaceUpAll}[1]{% + \def\Ult{#1}\def\Urt{#1}\def\Ulb{#1}\def\Urb{#1}} +\newcommand{\TwoFaceFrontAll}[1]{% + \def\Flt{#1}\def\Frt{#1}\def\Flb{#1}\def\Frb{#1}} +\newcommand{\TwoFaceRightAll}[1]{% + \def\Rlt{#1}\def\Rrt{#1}\def\Rlb{#1}\def\Rrb{#1}} +\newcommand{\TwoFaceLeftAll}[1]{% + \def\Llt{#1}\def\Lrt{#1}\def\Llb{#1}\def\Lrb{#1}} +\newcommand{\TwoFaceDownAll}[1]{% + \def\Dlt{#1}\def\Drt{#1}\def\Dlb{#1}\def\Drb{#1}} +\newcommand{\TwoFaceBackAll}[1]{% + \def\Blt{#1}\def\Brt{#1}\def\Blb{#1}\def\Brb{#1}} +% \end{macrocode} +% +%% set the default colour = grey = X +% \begin{macrocode} +\TwoFaceUpAll{X}% +\TwoFaceDownAll{X}% +\TwoFaceLeftAll{X}% +\TwoFaceRightAll{X}% +\TwoFaceFrontAll{X}% +\TwoFaceBackAll{X}% +% \end{macrocode} +% +% +% \begin{macrocode} +\newcommand{\TwoSolvedConfig}[6]{% + \TwoFaceRightAll{#1}% + \TwoFaceLeftAll{#2}% + \TwoFaceUpAll{#3}% + \TwoFaceDownAll{#4}% + \TwoFaceFrontAll{#5}% + \TwoFaceBackAll{#6}% +} +% \end{macrocode} +% +% +% +% +% \subsection{Grey cube} +% \label{sec:greycube} +% +% +% \begin{macro}{\TwoCubeGrey} +% \begin{macro}{\TwoCubeGreyAll} +% This command sets up an all-grey Twocube. We accommodate both spellings +% `grey' and `gray' (as used by TikZ). We include \cmd{\TwoCubeGreyAll} +% (exactly the same) to complement the 3x3x3 version just for convenience. +% +% Note that we include the \cmd{\RubikCubeGreyAll} command immediately before +% the \cmd{\TwoSolvedConfig} in order to first initialise all facelets to grey (X), +% (since the \cmd{..Config..} command only sets the corner cubies) +% \begin{macrocode} +\newcommand{\TwoCubeGrey}{\RubikCubeGreyAll\TwoSolvedConfig{X}{X}{X}{X}{X}{X}}% +\newcommand{\TwoCubeGreyAll}{\TwoCubeGrey} +\newcommand{\TwoCubeGray}{\TwoCubeGrey} +\newcommand{\TwoCubeGrayAll}{\TwoCubeGrey} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% Note that we include the \cmd{\RubikCubeGreyAll} command immediately before +% the \cmd{\TwoSolvedConfig} in order to first initialise all facelets to grey (X), +% (since the \cmd{..Config..} command only sets the corner cubies) +% \begin{macrocode} +\newcommand{\TwoCubeSolvedWY}{\RubikCubeGreyAll\TwoSolvedConfig{G}{B}{W}{Y}{O}{R}}% +\newcommand{\TwoCubeSolved}{\TwoCubeSolvedWY}% +\newcommand{\TwoCubeSolvedWB}{\RubikCubeGreyAll\TwoSolvedConfig{R}{O}{W}{B}{G}{Y}}% +% \end{macrocode} +% +% +% +% \subsection{Slice macros} +% \label{sec:slice} +% +% +% +% Only top and bottom horizontal slices, +% as viewed from TopR, TopL,BottomR,BottomL. +% \begin{macrocode} +\newcommand{\TwoSliceTopR}[4]{% + \def\Flt{#1}\def\Frt{#2}\def\Rlt{#3}\def\Rrt{#4}} +\newcommand{\TwoSliceTopL}[4]{% + \def\Llt{#1}\def\Lrt{#2}\def\Flt{#3}\def\Frt{#4}} +\newcommand{\TwoSliceBottomR}[4]{% + \def\Flb{#1}\def\Frb{#2}\def\Rlb{#3}\def\Rrb{#4}} +\newcommand{\TwoSliceBottomL}[4]{% + \def\Llb{#1}\def\Lrb{#2}\def\Flb{#3}\def\Frb{#4}} +%%--------------------- +\newcommand{\DrawTwoCubeFrontFace}{% +\draw[line join=round,line cap=round,ultra thick,fill=\Flt]% +(0,1) -- (0, 2) -- (1,2) -- (1,1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Frt]% +(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle; +%% +\draw[line join=round,line cap=round,ultra thick,fill=\Flb]% +(0,0) -- (0, 1) -- (1,1) -- (1,0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Frb]% +(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle; +} +% \end{macrocode} +% +% +% +% +% \subsection{DrawTwoCube.. macros} +% \label{sec:drawtwocube} +% +% +% +% \begin{macrocode} +\newcommand{\DrawTwoCubeRU}{% +%%-----------Front face---------- +\DrawTwoCubeFrontFace %% frontface +%%-----------Up face---------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Ult]% +(0.33,2.33) -- (0.66,2.66) -- (1.66,2.66) -- (1.33,2.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urt]% +(1.33,2.33) -- (1.66,2.66) -- (2.66,2.66) -- (2.33,2.33) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]% +(0,2) -- (0.33,2.33) -- (1.33,2.33) -- (1,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urb]% +(1,2) -- (1.33,2.33) -- (2.33,2.33) -- (2,2) -- cycle; +%%-----------Right face---------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]% +(2,1) -- (2, 2) -- (2.33,2.33) -- (2.33,1.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]% +(2.33,1.33) -- (2.33, 2.33) -- (2.66,2.66) -- (2.66,1.66) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]% +(2,0) -- (2, 1) -- (2.33,1.33) -- (2.33,0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]% +(2.33,0.33) -- (2.33, 1.33) -- (2.66,1.66) -- (2.66,0.66) -- cycle; +} +%% +\newcommand{\DrawTwoCube}{\DrawTwoCubeRU} +%% +\newcommand{\DrawTwoCubeRD}{% +\DrawTwoCubeFrontFace %% frontface +%%----------Right face-------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]% +(2,1) -- (2, 2) -- (2.33,1.66) -- (2.33,0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]% +(2.33,0.66) -- (2.33, 1.66) -- (2.66,1.33) -- (2.66,0.33) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]% +(2,0) -- (2, 1) -- (2.33,0.66) -- (2.33,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]% +(2.33,-0.33) -- (2.33, 0.66) -- (2.66,0.33) -- (2.66,-0.66) -- cycle; +%%-----------Down face--------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]% +(0.33,-0.33) -- (0, 0) -- (1,0) -- (1.33,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drt]% +(1.33,-0.33) -- (1, 0) -- (2,0) -- (2.33,-0.33) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]% +(0.66,-0.66) -- (0.33, -0.33) -- (1.33,-0.33) -- (1.66,-0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drb]% +(1.66,-0.66) -- (1.33, -0.33) -- (2.33,-0.33) -- (2.66,-0.66) -- cycle; +} +%% +\newcommand{\DrawTwoCubeLD}{% +\DrawTwoCubeFrontFace %% frontface +%%------------Left face-------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Llt]% +(-0.66,0.33) -- (-0.66, 1.33) -- (-0.33,1.66) -- (-0.33,0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]% +(-0.33,0.66) -- (-0.33, 1.66) -- (0,2) -- (0,1) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Llb]% +(-0.66,-0.66) -- (-0.66, 0.33) -- (-0.33,0.66) -- (-0.33,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]% +(-0.33,-0.33) -- (-0.33, 0.66) -- (0,1) -- (0,0) -- cycle; +%%------------Down face---------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]% +(-0.33,-0.33) -- (0, 0) -- (1,0) -- (0.66,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drt]% +(0.66,-0.33) -- (1, 0) -- (2,0) -- (1.66,-0.33) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]% +(-0.66,-0.66) -- (-0.33, -0.33) -- (0.66,-0.33) -- (0.33,-0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drb]% +(0.33,-0.66) -- (0.66, -0.33) -- (1.66,-0.33) -- (1.33,-0.66) -- cycle; +} +%% +\newcommand{\DrawTwoCubeLU}{% +\DrawTwoCubeFrontFace %% frontface +%%-----------Left face----------- +%%------top row +\draw[line join=round,line cap=round,ultra thick,fill=\Llt]% +(-0.66,1.66) -- (-0.66, 2.66) -- (-0.33,2.33) -- (-0.33,1.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]% +(-0.33,1.33) -- (-0.33, 2.33) -- (0,2) -- (0,1) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Llb]% +(-0.66,0.66) -- (-0.66, 1.66) -- (-0.33,1.33) -- (-0.33,0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]% +(-0.33,0.33) -- (-0.33, 1.33) -- (0,1) -- (0,0) -- cycle; +%%-----------Up face--------- +\draw[line join=round,line cap=round,ultra thick,fill=\Ult]% +(-0.33,2.33) -- (-0.66, 2.66) -- (0.33,2.66) -- (0.66,2.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urt]% +(0.66,2.33) -- (0.33, 2.66) -- (1.33,2.66) -- (1.66,2.33) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]% +(0,2) -- (-0.33, 2.33) -- (0.66,2.33) -- (1,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urb]% +(1,2) -- (0.66, 2.33) -- (1.66,2.33) -- (2,2) -- cycle; +} +% \end{macrocode} +% +% +% \subsection{DrawTwoFlat.. macros} +% \label{sec:drawtwoflat} +% +% These `Flat' macros draw a specified face with its origin +% (left bottom corner of the face) at a specified $(x,y)$ coordinate. +% They allow USERS to place the image of a face at a specific location. +% +% +% \begin{macrocode} +%%---------------------- +\newcommand{\DrawTwoFlatUp}[2]{% +\pgfmathsetmacro{\ux}{#1}% +\pgfmathsetmacro{\uy}{#2}% +%%-----top row +\draw[line join=round,line cap=round,ultra thick,fill=\Ult]% +(\ux + 0,\uy + 1) -- (\ux + 0,\uy + 2) -- (\ux + 1,\uy + 2)% + -- (\ux + 1,\uy + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urt]% +(\ux + 1,\uy + 1) -- (\ux + 1,\uy + 2) -- (\ux + 2,\uy + 2)% + -- (\ux + 2,\uy + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]% +(\ux + 0,\uy + 0) -- (\ux + 0,\uy + 1) -- (\ux + 1,\uy + 1)% + -- (\ux + 1,\uy + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urb]% +(\ux + 1,\uy + 0) -- (\ux + 1,\uy + 1) -- (\ux + 2,\uy + 1)% + -- (\ux + 2,\uy + 0) -- cycle; +} +%%------------------------- +\newcommand{\DrawTwoFlatDown}[2]{% +\pgfmathsetmacro{\ddx}{#1}% +\pgfmathsetmacro{\ddy}{#2}% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]% +(\ddx + 0,\ddy + 1) -- (\ddx + 0,\ddy + 2) -- (\ddx + 1,\ddy + 2)% + -- (\ddx + 1,\ddy + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drt]% +(\ddx + 1,\ddy + 1) -- (\ddx + 1,\ddy + 2) -- (\ddx + 2,\ddy + 2)% + -- (\ddx + 2,\ddy + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]% +(\ddx + 0,\ddy + 0) -- (\ddx + 0,\ddy + 1) -- (\ddx + 1,\ddy + 1)% + -- (\ddx + 1,\ddy + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drb]% +(\ddx + 1,\ddy + 0) -- (\ddx + 1,\ddy + 1) -- (\ddx + 2,\ddy + 1)% + -- (\ddx + 2,\ddy + 0) -- cycle; +} +%%------------------------- +\newcommand{\DrawTwoFlatLeft}[2]{% +\pgfmathsetmacro{\lx}{#1}% +\pgfmathsetmacro{\ly}{#2}% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Llt]% +(\lx + 0, \ly + 1) -- (\lx + 0, \ly + 2) -- (\lx + 1, \ly + 2)% + -- (\lx + 1, \ly + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]% +(\lx + 1, \ly + 1) -- (\lx + 1, \ly + 2) -- (\lx + 2, \ly + 2)% + -- (\lx + 2, \ly + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Llb]% +(\lx + 0, \ly + 0) -- (\lx + 0, \ly + 1) -- (\lx + 1, \ly + 1)% + -- (\lx + 1, \ly + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]% +(\lx + 1, \ly + 0) -- (\lx + 1, \ly + 1) -- (\lx + 2, \ly + 1)% + -- (\lx + 2, \ly + 0) -- cycle; +} +%%-------------------------- +\newcommand{\DrawTwoFlatRight}[2]{% +\pgfmathsetmacro{\rx}{#1}% +\pgfmathsetmacro{\ry}{#2}% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]% +(\rx + 0, \ry + 1) -- (\rx + 0, \ry + 2) -- (\rx + 1, \ry + 2)% + -- (\rx + 1, \ry + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]% +(\rx + 1, \ry + 1) -- (\rx + 1, \ry + 2) -- (\rx + 2, \ry + 2)% + -- (\rx + 2, \ry + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]% +(\rx + 0, \ry + 0) -- (\rx + 0, \ry + 1) -- (\rx + 1, \ry + 1)% + -- (\rx + 1, \ry + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]% +(\rx + 1, \ry + 0) -- (\rx + 1, \ry + 1) -- (\rx + 2, \ry + 1)% + -- (\rx + 2, \ry + 0) -- cycle; +} +%%-------------- +\newcommand{\DrawTwoFlatFront}{% +%% This command is used /only/ by the \cmd{\DrawRubikFlat} command. +%% NOTE: x, y variables not implemented as not required here +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Flt]% +(0,1) -- (0, 2) -- (1,2) -- (1,1) -- cycle; +%% +\draw[line join=round,line cap=round,ultra thick,fill=\Frt]% +(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Flb]% +(0,0) -- (0, 1) -- (1,1) -- (1,0) -- cycle; +%% +\draw[line join=round,line cap=round,ultra thick,fill=\Frb]% +(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle; +} +%%-------------------------- +\newcommand{\DrawTwoFlatBack}[2]{% +\pgfmathsetmacro{\bx}{#1}% +\pgfmathsetmacro{\by}{#2}% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Blt]% +(\bx + 0,\by + 1) -- (\bx + 0,\by + 2) -- (\bx + 1,\by + 2)% + -- (\bx + 1,\by + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Brt]% +(\bx + 1,\by + 1) -- (\bx + 1,\by + 2) -- (\bx + 2,\by + 2)% + -- (\bx + 2,\by + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Blb]% +(\bx + 0,\by + 0) -- (\bx + 0,\by + 1) -- (\bx + 1,\by + 1)% + -- (\bx + 1,\by + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Brb]% +(\bx + 1,\by + 0) -- (\bx + 1,\by + 1) -- (\bx + 2,\by + 1)% + -- (\bx + 2,\by + 0) -- cycle; +} +%%------------------------------ +\newcommand{\DrawTwoCubeF}{% + \DrawTwoFlatUp{0}{2}% + \DrawTwoFlatDown{0}{-2}% + \DrawTwoFlatLeft{-2}{0}% + \DrawTwoFlatFront% + \DrawTwoFlatRight{2}{0}% + \DrawTwoFlatBack{4}{0}% +} +%% +\newcommand{\DrawTwoCubeSF}{% + \DrawTwoCubeRU% RU + \DrawTwoFlatDown{0}{-2}% + \DrawTwoFlatLeft{-2}{0}% + \DrawTwoFlatBack{2.666}{0.66}% +} +% \end{macrocode} +% +% +% +% +% +% +% \subsection{Sidebars (Face)} +% \label{sec:sidebarsfacecode} +% +% +% Making sidebar macros for a TwoCube (converting the 3x3x3x versions +% to the 2x2x2 versions). +% {\newline} (1) change name $\rightarrow$ \verb!TWOside@barX! +% {\newline} (2) change the value \verb!(3 + \bs)! $\rightarrow$ \verb!(2 + \tbs)! +% (as only two squares on a side). +% {\newline} (3) change the Sidebar length parameter names by adding a \cmd{\t} prefix +% to distinguish the TwoCube parameters from those of the RubikCube. Thus we change +% the Rubik names (\cmd{\dx}, \cmd{\dy}, \cmd{\bw}, \cmd{\bl}, \cmd{\blh}, \cmd{\bs}) +% to their equivalent Two names (\cmd{\tdx}, \cmd{\tdy}, \cmd{\tbw}, \cmd{\tbl}, +% \cmd{\tblh}, \cmd{\tbs}). +% +% The coordinates of the bottom left corner of a TwoSidebar are (\cmd{\tdx}, \cmd{\tdy}). +% The other parameters are width (\cmd{\tbw}), length (\cmd{\tbl}), +% half length (\cmd{\tblh}), separation (\cmd{\tbs}). +% +% \begin{macro}{\TwoSidebarWidth} +% \begin{macro}{\TwoSidebarLength} +% \begin{macro}{\TwoSidebarSep} +% These commands set the width, length and separation of the Sidebars. +% Each takes a single scalar argument (no units). +% \newline\textsc{usage}: \cmd{\TwoSidebarWidth}\marg{0.5} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +\newcommand{\TwoSidebarWidth}[1]{\pgfmathsetmacro{\tbw}{#1}} +\newcommand{\TwoSidebarLength}[1]{\pgfmathsetmacro{\tbl}{#1}} +\newcommand{\TwoSidebarSep}[1]{\pgfmathsetmacro{\tbs}{#1}} +% \end{macrocode} +% We first set some default values. We have set the Sidebar +% width and separation to 2/3 those of the Rubik 3x3x3 values +% (so that when a 3x3x3 cube and a 2x2x2 cube +% are scaled to be the same size, then the Sidebar width and sep will be the same) +% These also seem to look good generally as well. +% Of course, users can adjust these as they wish anyway. Any new values will +% will of course act globally unless constrained (either by using curley brackets, or +% by writing them into a \TeX\ environment). +% \begin{macrocode} +\TwoSidebarWidth{0.2} +\TwoSidebarLength{1.0} +\TwoSidebarSep{0.2} +% \end{macrocode} +% +% +% \begin{macro}{\NoSidebar} +% This command \cmd{\NoSidebar}\marg{colour code} (defined in the \textsc{rubikcube} package) +% defines the colour for which sidebars should \textit{not} be drawn +% (particularly useful when drawing OLL configurations). +% This idea was suggested by Robert Ma\v{r}\'{\i}k (May 2017). +% {\newline}The principle is that we let the command \cmd{\NoSidebar} define a face colour, +% and then we use the \verb!\ifthenelse{\equal{#2}{\no@sidebar}}{}{...}! structure to either +% (a)~draw all sidebars as usual (if \cmd{\NoSidebar} is undefined), +% or (b)~draw all sidebars \textit{except} those having the \cmd{\NoSidebar} colour +% (if \cmd{\NoSidebar} colour = \verb!#2!). +% \newline\textsc{usage}: \verb!\NoSidebar{X}! \ If this command in \textit{not} inside +% an environment, then its action will continue until it is cancelled (undefined) +% as follows: \verb!\NoSidebar{}!. +% \end{macro} +% +% \medskip +% +% \begin{macro}{\TWOside@barL} +% \begin{macro}{\TWOside@barR} +% \begin{macro}{\TWOside@barT} +% \begin{macro}{\TWOside@barB} + +% These commands \cmd{\TWOside@barX}\marg{position no}\marg{facelet location} (where +% X is one of L~(Left), R~(Right), T~(Top), B~(Bottom), which denote the side of the +% 2x2 square representing a face), draw a single small bar in a position (1, or 2), +% having the colour of a specified facelet. The integers 1, 2 denote the facelet number +% (measured from the grid origin = bottom left corner of the face) +% adjacent to which the bar is positioned. +% +% These macros are used in the various `Sidebar' commands which draw pairs of +% these small bars adjacent to specified faces. +% \newline\textsc{changes}: Rubik $\rightarrow$ Two, \cmd{\bw} $\rightarrow$ \cmd{\tbw}, +% \cmd{\bl} $\rightarrow$ \cmd{\tbl}, \cmd{\bs} $\rightarrow$ \cmd{\tbs}, +% \cmd{\dx} $\rightarrow$ \cmd{\tdx}, \cmd{\dy} $\rightarrow$ \cmd{\tdy} +% (see Section~\ref{sec:sidebarscode} for details of these variables). +% \newline\textsc{usage}: \verb!\TWOside@barL{2}{\Lrt}! +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +\newcommand{\TWOside@barL}[2]{% + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{0 - \tbs - \tbw}% + \pgfmathsetmacro{\tdy}{#1-1+0.5-\tblh}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbl) + -- (\tdx+\tbw,\tdy+\tbl) -- (\tdx+\tbw,\tdy) -- cycle; +}} +%% changed Rubik value (3 + \bs) --> (2 + \tbs) (as only TWO squares) +\newcommand{\TWOside@barR}[2]{% + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{2 + \tbs}% + \pgfmathsetmacro{\tdy}{#1 -1+0.5-\tblh}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbl) + -- (\tdx+\tbw,\tdy+\tbl) -- (\tdx+\tbw,\tdy) -- cycle; +}} +%% changed Rubik value (3 + \bs) --> (2 + \tbs) (as only TWO squares) +\newcommand{\TWOside@barT}[2]{% + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{#1 -1+0.5-\tblh}% + \pgfmathsetmacro{\tdy}{2 +\tbs}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbw) + -- (\tdx+\tbl,\tdy+\tbw) -- (\tdx+\tbl,\tdy) -- cycle; +}} +\newcommand{\TWOside@barB}[2]{% + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{#1 -1+0.5-\tblh}% + \pgfmathsetmacro{\tdy}{0 -\tbs-\tbw}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbw) + -- (\tdx+\tbl,\tdy+\tbw) -- (\tdx+\tbl,\tdy) -- cycle; +}} +% \end{macrocode} +% + + +% +% \subsubsection{DrawTwoFaceXSide macros} +% \label{sec:drawtwofacexside} +% +% Only 2 bars on each side for a TwoCube. +% Change from 3x3x3: we remove the middle cols \& row sections +% change name DrawRubikLayerSide --> DrawTwoLayerSide +% +% RWDN 16 Feb 2018 +% v5: removed many (duplicated and unnecessary) macros, and replaced them +% with these TwoFace.. macros using just the basic \cmd{\TWOside@bar..} macros +% for drawing small single bars. +% +% These new macros draw a specified face (using the ..Flat.. commands) +% as well as all the associated sidebars. +% Note we continue to use the key-word `Side' here to indicate we are +% drawing all the sidebars, since we are drawing a face. +% (only for 3D cubes do we use the word `SidebarXX' for denoting a particular +% Sidebar to be drawn etc.) +% +% \begin{macrocode} +\newcommand{\DrawTwoFaceUpSide}{% + \DrawTwoFlatUp{0}{0}% + \TWOside@barT{1}{\Brt}% + \TWOside@barT{2}{\Blt}% + \TWOside@barL{2}{\Llt}% + \TWOside@barL{1}{\Lrt}% + \TWOside@barR{2}{\Rrt}% + \TWOside@barR{1}{\Rlt}% + \TWOside@barB{1}{\Flt}% + \TWOside@barB{2}{\Frt}% +} +\newcommand{\DrawTwoFaceFrontSide}{% + \DrawTwoFlatFront{0}{0}% + \TWOside@barT{1}{\Ulb}% + \TWOside@barT{2}{\Urb}% + \TWOside@barL{2}{\Lrt}% + \TWOside@barL{1}{\Lrb}% + \TWOside@barR{2}{\Rlt}% + \TWOside@barR{1}{\Rlb}% + \TWOside@barB{1}{\Dlt}% + \TWOside@barB{2}{\Drt}% +} +\newcommand{\DrawTwoFaceRightSide}{% + \DrawTwoFlatRight{0}{0}% + \TWOside@barT{1}{\Urb}% + \TWOside@barT{2}{\Urt}% + \TWOside@barL{2}{\Frt}% + \TWOside@barL{1}{\Frb}% + \TWOside@barR{2}{\Blt}% + \TWOside@barR{1}{\Blb}% + \TWOside@barB{1}{\Drt}% + \TWOside@barB{2}{\Drb}% +} +\newcommand{\DrawTwoFaceLeftSide}{% + \DrawTwoFlatLeft{0}{0}% + \TWOside@barT{1}{\Ult}% + \TWOside@barT{2}{\Ulb}% + \TWOside@barL{2}{\Brt}% + \TWOside@barL{1}{\Brb}% + \TWOside@barR{2}{\Flt}% + \TWOside@barR{1}{\Flb}% + \TWOside@barB{1}{\Dlb}% + \TWOside@barB{2}{\Dlt}% +} +\newcommand{\DrawTwoFaceBackSide}{% + \DrawTwoFlatBack{0}{0}% + \TWOside@barT{1}{\Urt}% + \TWOside@barT{2}{\Ult}% + \TWOside@barL{2}{\Rrt}% + \TWOside@barL{1}{\Rrb}% + \TWOside@barR{2}{\Llt}% + \TWOside@barR{1}{\Llb}% + \TWOside@barB{1}{\Drb}% + \TWOside@barB{2}{\Dlb}% +} +\newcommand{\DrawTwoFaceDownSide}{% + \DrawTwoFlatDown{0}{0}% + \TWOside@barT{1}{\Flb}% + \TWOside@barT{2}{\Frb}% + \TWOside@barL{2}{\Lrb}% + \TWOside@barL{1}{\Llb}% + \TWOside@barR{2}{\Rlb}% + \TWOside@barR{1}{\Rrb}% + \TWOside@barB{1}{\Brb}% + \TWOside@barB{2}{\Blb}% +} +%% +%% v5: made Face versions (for USER) without the (x,y) coordinates +\newcommand{\DrawTwoFaceUp}{\DrawTwoFlatUp{0}{0}} +\newcommand{\DrawTwoFaceDown}{\DrawTwoFlatDown{0}{0}} +\newcommand{\DrawTwoFaceLeft}{\DrawTwoFlatLeft{0}{0}} +\newcommand{\DrawTwoFaceRight}{\DrawTwoFlatRight{0}{0}} +\newcommand{\DrawTwoFaceFront}{\DrawTwoFlatFront{0}{0}} +\newcommand{\DrawTwoFaceBack}{\DrawTwoFlatBack{0}{0}} +%% +%% v5: made short forms --> abbreviations +\newcommand{\DrawTwoFaceU}{\DrawTwoFlatUp{0}{0}} +\newcommand{\DrawTwoFaceD}{\DrawTwoFlatDown{0}{0}} +\newcommand{\DrawTwoFaceL}{\DrawTwoFlatLeft{0}{0}} +\newcommand{\DrawTwoFaceR}{\DrawTwoFlatRight{0}{0}} +\newcommand{\DrawTwoFaceF}{\DrawTwoFlatFront{0}{0}} +\newcommand{\DrawTwoFaceB}{\DrawTwoFlatBack{0}{0}} +%% +%% v5: made short forms --> abbreviations +\newcommand{\DrawTwoFaceUS}{\DrawTwoFaceUpSide} +\newcommand{\DrawTwoFaceDS}{\DrawTwoFaceDownSide} +\newcommand{\DrawTwoFaceLS}{\DrawTwoFaceLeftSide} +\newcommand{\DrawTwoFaceRS}{\DrawTwoFaceRightSide} +\newcommand{\DrawTwoFaceFS}{\DrawTwoFaceFrontSide} +\newcommand{\DrawTwoFaceBS}{\DrawTwoFaceBackSide} +% \end{macrocode} +% +% +% +% +% +% \subsection{Sidebars (Cube)} +% \label{sec:sidebarscubecode} +% +% +% In order to position sidebars adjacent to a TwoCube (ie in 3D) +% requires that we first make some new \cmd{\TWOside@bar..} +% commands which draw sidebars adjacent to the \textsc{back} face +% (we have already made the macros for the front +% face sidebars---see Section~\ref{sec:sidebarsfacecode}). +% Furthermore, these new macros need to be tailored to each of the +% four standard cube viewing directions RU, LU, RD, LD. +% +% Finally, the USER commands for drawing these sidebars need +% to accommodate (a)~some code for identifying each set of sidebars, +% and (b)~the viewing direction. So, for example, a USER command for +% drawing the sidebars associated with the cube edge formed +% by the \textsc{right} face and the \textsc{back} face +% (lets define this as the RB sidebar) as viewed from the RU direction, +% might be something like \cmd{\DrawTwoCubeSidebarRBRU}. +% Since this is not particularly user-friendly, +% we can improve on this slightly for the USER by +% (a)~defining the sidebar as \texttt{SidebarRB}, and +% (b)~appending the view direction in a curly bracket, say as \verb!{RU}!. +% This allows a more intuitive command structure for the USER, +% as follows: \verb!\DrawTwoCubeSidebarRB{RU}!. +% We then use the \cmd{\@join} command to append the string \verb!RU! to the string +% \verb!DrawTwoCubeSidebarRB! forming the (internal) +% command \cmd{\DrawTwoCubeSidebarRBRU}. +% +% In the following we will group the development according to to the view direction. +% +% +% +% \subsubsection{Sidebars: RU view} +% +% \subsubsection*{Right-Back vert sidebar (RU view)} +% +% Need to write a new \cmd{\TWOside@barR..} command +% (see Section~\ref{sec:sidebarsfacecode}). +% This draws only a single small bar. +% Each of the two small bars has a numbered position (1,2); +% (dx,dy) = bottom Left corner of single bar +% +% \begin{macrocode} +\newcommand{\TWOside@barRbackRU}[2]{% + %% #1 = cubie possn no, #2 = colour + %% tdx --> tdx + (2/3) + %% tdy --> tdy + (2/3) + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{2 + \tbs +0.666}% + \pgfmathsetmacro{\tdy}{#1 -1+0.5-\tblh +0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbl) + -- (\tdx+\tbw,\tdy+\tbl) -- (\tdx+\tbw,\tdy) -- cycle;% +}} +% \end{macrocode} +% Now make the RB (RightBack) vertical sidebar command; +% ie bar~1 is at the bottom; bar~2 is at the top. +% +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarRBRU}{% + \TWOside@barRbackRU{2}{\Blt}% + \TWOside@barRbackRU{1}{\Blb}% +} +% \end{macrocode} +% Now make the reverse command (BR) = RB +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarBRRU}{\DrawTwoCubeSidebarRBRU} +% \end{macrocode} +% Finally, make the join commands +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarRB}[1]{\@join{\DrawTwoCubeSidebarRB}{#1}} +\newcommand{\DrawTwoCubeSidebarBR}[1]{\@join{\DrawTwoCubeSidebarBR}{#1}} +% \end{macrocode} +% +% +% +% \medskip +% +% \subsubsection*{Up-Back horiz sidebar (RU view)} +% +% +% \begin{macrocode} +\newcommand{\TWOside@barTbackRU}[2]{% + %% #1 = cubie possn no; #2 = colour + %% tdx --> tdx + (2/3) + %% tdy --> tdy + (2/3) + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{#1 -1+0.5-\tblh +0.666}% + \pgfmathsetmacro{\tdy}{2 +\tbs +0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbw) + -- (\tdx+\tbl,\tdy+\tbw) -- (\tdx+\tbl,\tdy) -- cycle; +}} +% \end{macrocode} +% Now make the UB (Up-Back) horizontal sidebar command; +% ie bar~1 is on the left, bar~2 is on the right (as we look at the cube). +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarUBRU}{% + \TWOside@barTbackRU{1}{\Brt}% + \TWOside@barTbackRU{2}{\Blt}% +} +% \end{macrocode} +% Now make the reverse command (BU) = UB +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarBURU}{\DrawTwoCubeSidebarUBRU} +% \end{macrocode} +% Now make the join commands +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarUB}[1]{\@join{\DrawTwoCubeSidebarUB}{#1}} +\newcommand{\DrawTwoCubeSidebarBU}[1]{\@join{\DrawTwoCubeSidebarBU}{#1}} +% \end{macrocode} +% +% +% +% \medskip +% +% \subsubsection*{Front-Left vert sidebar (RU view)} +% +% Since this is a front-face sidebar we can use the regular +% \cmd{TWOside@barL..} command. +% Now make the FL (Front-Left) vertical sidebar command; +% ie bar~1 is at the bottom; bar~2 is at the top. +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarFLRU}{% + \TWOside@barL{2}{\Lrt}% + \TWOside@barL{1}{\Lrb}% +} +% \end{macrocode} +% Now do the reverse (LF) +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarLFRU}{\DrawTwoCubeSidebarFLRU} +% \end{macrocode} +% Now do the two join commands +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarFL}[1]{\@join{\DrawTwoCubeSidebarFL}{#1}} +\newcommand{\DrawTwoCubeSidebarLF}[1]{\@join{\DrawTwoCubeSidebarLF}{#1}} +% \end{macrocode} +% +% +% +% \medskip +% +% \subsubsection*{Front-Down horiz sidebar (RU view)} +% +% Since this is a front face sidebar we can use the regular +% \cmd{TWOside@barL..} command. +% +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarFDRU}{% + \TWOside@barB{1}{\Dlt}% + \TWOside@barB{2}{\Drt}% +} +% \end{macrocode} +% Now do the reverse (DF) = FD +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarDFRU}{\DrawTwoCubeSidebarFDRU} +% \end{macrocode} +% Now do the two join commands +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarFD}[1]{\@join{\DrawTwoCubeSidebarFD}{#1}} +\newcommand{\DrawTwoCubeSidebarDF}[1]{\@join{\DrawTwoCubeSidebarDF}{#1}} +% \end{macrocode} +% But FD-LU is the same as FD-RU, so we need to make copies of each. +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarDFLU}{\DrawTwoCubeSidebarDFRU} +\newcommand{\DrawTwoCubeSidebarFDLU}{\DrawTwoCubeSidebarFDRU} +% \end{macrocode} +% +% +% +% \medskip +% +% \subsubsection{Sidebars: LU view} +% +% +% \subsubsection*{Left-Back vert sidebar (LU view)} +% +% \begin{macrocode} +\newcommand{\TWOside@barLbackLU}[2]{% + %% #1 = cubie possn no, #2 = colour + %% tdx --> tdx - 2/3 + %% tdy --> tdy + 2/3 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{0 - \tbs -\tbw -0.666}% + \pgfmathsetmacro{\tdy}{#1 -1+0.5-\tblh +0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbl) + -- (\tdx+\tbw,\tdy+\tbl) -- (\tdx+\tbw,\tdy) -- cycle; +}} +% \end{macrocode} +% Now make the LB (LeftBack) vertical sidebar command; +% bar~1 is at the bottom +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarLBLU}{% + \TWOside@barLbackLU{2}{\Brt}% + \TWOside@barLbackLU{1}{\Brb}% +} +% \end{macrocode} +% Now do the reverse (BL) = LB +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarBLLU}{\DrawTwoCubeSidebarLBLU} +% \end{macrocode} +% Now make the join commands +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarLB}[1]{\@join{\DrawTwoCubeSidebarLB}{#1}} +\newcommand{\DrawTwoCubeSidebarBL}[1]{\@join{\DrawTwoCubeSidebarBL}{#1}} +% \end{macrocode} +% +% +% \medskip +% +% \subsubsection*{Up-Back horizontal sidebar (LU view)} +% +% \begin{macrocode} +\newcommand{\TWOside@barTbackLU}[2]{% + %% #1 = cubie possn no; #2 = colour + %% tdx --> tdx-2/3 + %% tdy --> tdy+2/3 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{#1 -1+0.5-\tblh -0.666}% + \pgfmathsetmacro{\tdy}{2 +\tbs +0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbw) + -- (\tdx+\tbl,\tdy+\tbw) -- (\tdx+\tbl,\tdy) -- cycle; +}} +% \end{macrocode} +% Now make the UB (Up-Back) version +% bar~1 is at the left, 2 on the right. +% +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarUBLU}{% + \TWOside@barTbackLU{1}{\Brt}% + \TWOside@barTbackLU{2}{\Blt}% +} +% \end{macrocode} +% Now do the reverse (BU) = UB +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarBULU}{\DrawTwoCubeSidebarUBLU} +% \end{macrocode} +% We do NOT need to make the join commands here +% as the USER commands for BU and UB are the same as for the RU +% +% +% +% \medskip +% +% \subsubsection*{Front-Right vertical sidebar (LU view)} +% +% +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarFRLU}{% + \TWOside@barR{2}{\Rlt}% + \TWOside@barR{1}{\Rlb}% +} +% \end{macrocode} +% Now do the reverse (RF) +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarRFLU}{\DrawTwoCubeSidebarFRLU} +% \end{macrocode} +% Now do the two join commands +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarFR}[1]{\@join{\DrawTwoCubeSidebarFR}{#1}} +\newcommand{\DrawTwoCubeSidebarRF}[1]{\@join{\DrawTwoCubeSidebarRF}{#1}} +% \end{macrocode} +% +% +% \subsubsection{Sidebars: RD view} +% +% \medskip +% +% \subsubsection*{Front-Up horizontal sidebar (RD view)} +% +% +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarFURD}{% + \TWOside@barT{1}{\Ulb}% + \TWOside@barT{2}{\Urb}% +} +% \end{macrocode} +% Now do the reverse (UF) = FU +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarUFRD}{\DrawTwoCubeSidebarFURD} +% \end{macrocode} +% Now do the two join commands +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarFU}[1]{\@join{\DrawTwoCubeSidebarFU}{#1}} +\newcommand{\DrawTwoCubeSidebarUF}[1]{\@join{\DrawTwoCubeSidebarUF}{#1}} +% \end{macrocode} +% +% +% \medskip +% +% \subsubsection*{Front-Left vertical sidebar (RD view)} +% +% +% Only need to copy an earlier command here since FL, RD view = same as for RU view. +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarFLRD}{\DrawTwoCubeSidebarFLRU} +\newcommand{\DrawTwoCubeSidebarLFRD}{\DrawTwoCubeSidebarLFRU} +% \end{macrocode} +% +% +% +% +% \medskip +% +% \subsubsection*{Right-Back vertical sidebar (RD view)} +% +% +% \begin{macrocode} +\newcommand{\TWOside@barRbackRD}[2]{% + %% #1 = cubie possn no, #2 = colour + %% tdx --> tdx + (2/3) + %% tdy --> tdy - (2/3) + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{2 + \tbs +0.666}% + \pgfmathsetmacro{\tdy}{#1 -1+0.5-\tblh -0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbl) + -- (\tdx+\tbw,\tdy+\tbl) -- (\tdx+\tbw,\tdy) -- cycle; +}} +% \end{macrocode} +% Now make the RB (RightBack) version +% bar~1 is at the bottom +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarRBRD}{% +\TWOside@barRbackRD{2}{\Blt}% +\TWOside@barRbackRD{1}{\Blb}% +} +% \end{macrocode} +% now do the reverse (BR) = RB +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarBRRD}{\DrawTwoCubeSidebarRBRD} +% \end{macrocode} +% Do NOT need to make the join commands (as same as for the RU view) +% +% +% +% +% \medskip +% +% \subsubsection*{Down-Back horizotal sidebar (RD view)} +% +% +% \begin{macrocode} +\newcommand{\TWOside@barBbackRD}[2]{% + %% #1 = cubie possn no; #2 = colour + %% tdx --> tdx+2/3 + %% tdy --> tdy-2/3 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{#1 -1+0.5-\tblh +0.666}% + \pgfmathsetmacro{\tdy}{0 -\tbs - \tbw -0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbw) + -- (\tdx+\tbl,\tdy+\tbw) -- (\tdx+\tbl,\tdy) -- cycle; +}} +% \end{macrocode} +% Now make the DB (Down-Back) version +% bar~1 is at the left, 2 on the right (as we look at the cube) +% +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarDBRD}{% + \TWOside@barBbackRD{1}{\Brb}% + \TWOside@barBbackRD{2}{\Blb}% +} +% \end{macrocode} +% Now do the reverse (BD) = DB +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarBDRD}{\DrawTwoCubeSidebarDBRD} +% \end{macrocode} +%% Now make the join commands +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarDB}[1]{\@join{\DrawTwoCubeSidebarDB}{#1}} +\newcommand{\DrawTwoCubeSidebarBD}[1]{\@join{\DrawTwoCubeSidebarBD}{#1}} +% \end{macrocode} +% +% +% \subsubsection{Sidebars: LD view} +% +% +% \medskip +% +% \subsubsection*{Front-Up horizotal sidebar (LD view)} +% +% But FU (LD view) is the same as for (RU view), (see above) +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarFULD}{\DrawTwoCubeSidebarFURD} +\newcommand{\DrawTwoCubeSidebarUFLD}{\DrawTwoCubeSidebarUFRD} +% \end{macrocode} +% +% \medskip +% +% \subsubsection*{Front-Right vertical sidebar (LD view)} +% +% But FR (LDview) is the same as for (LU view), (see above) +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarFRLD}{\DrawTwoCubeSidebarFRLU} +\newcommand{\DrawTwoCubeSidebarRFLD}{\DrawTwoCubeSidebarRFLU} +% \end{macrocode} +% +% +% +% \medskip +% +% \subsubsection*{Left-Back vertical sidebar (LD view)} +% +% \begin{macrocode} +\newcommand{\TWOside@barLbackLD}[2]{% + %% #1 = cubie possn no, #2 = colour + %% tdx --> tdx-2/3 + %% tdy --> tdy-2/3 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{0 - \tbs -\tbw -0.666}% + \pgfmathsetmacro{\tdy}{#1 -1+0.5-\tblh -0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbl) + -- (\tdx+\tbw,\tdy+\tbl) -- (\tdx+\tbw,\tdy) -- cycle; +}} +% \end{macrocode} +% Now make the LB (LeftBack) version +% bar~1 is at the bottom +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarLBLD}{% + \TWOside@barLbackLD{2}{\Brt}% + \TWOside@barLbackLD{1}{\Brb}% +} +% \end{macrocode} +% Now do the reverse (BL) = LB +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarBLLD}{\DrawTwoCubeSidebarLBLD} +% \end{macrocode} +% Do NOT need to make the join commands (same as for the LU view) +% +% +% +% \medskip +% +% \subsubsection*{Down-Back horizontal sidebar (LD view)} +% +% +% +% \begin{macrocode} +\newcommand{\TWOside@barBbackLD}[2]{% + %% #1 = cubie possn no; #2 = colour + %% tdx --> tdx-2/3 + %% tdy --> tdy-2/3 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{#1 -1+0.5-\tblh -0.666}% + \pgfmathsetmacro{\tdy}{0 -\tbs - \tbw -0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbw) + -- (\tdx+\tbl,\tdy+\tbw) -- (\tdx+\tbl,\tdy) -- cycle; +}} +% \end{macrocode} +% Now make the DB (Down-Back) version +% bar~1 is at the left, 2 on the right (as we look at the cube) +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarDBLD}{% +\TWOside@barBbackLD{1}{\Brb}% +\TWOside@barBbackLD{2}{\Blb}% +} +% \end{macrocode} +% Now do the reverse (BD) = DB +% \begin{macrocode} +\newcommand{\DrawTwoCubeSidebarBDLD}{\DrawTwoCubeSidebarDBLD} +% \end{macrocode} +% Do NOT need to make any join commands (same as for the RD view) +% +% +% +% +% \subsection{\hspace{3mm}Hieroglyphs} +% \label{sec:codehieroglyphs} +% +% Not many changes to make (from rubikcube sty). In general we try to +% keep things fairly intuitive by changing Rubik $\rightarrow$ Two, +% and changing r $\rightarrow$ t. +% Note that since this package uses a lot of commands defined in the +% \texttt{rubikcube} package, eg the `join' utility and the rubikfont, +% consequently rubikcube sty needs to be loaded when running this package. +% +% We only need to make significant changes to the +% following hieroglyphs: L,R,U,D,Lp,Rp,Up,Dp. +% +% Unchanged are: axis rotations (eg Rc) and letter rotations (eg B), +% so these hieroglyphs just need newdefs making for them; +% eg trF $\leftarrow$ rrF, etc +% +% We need to rename some of the `square' furniture associated with the L,R,U,D etc face +% rotation hieroglyphs: for example, the D heiroglyph requires the following: +%{\newline} change rr $\rightarrow$ tr +%{\newline} change SquareD $\rightarrow$ SquaretD +%{\newline} change RubikD $\rightarrow$ TwoD +%{\newline} change textRubikD $\rightarrow$ textTwoD +% +% For a TWOcube we only need to make two lines in a square; +% ie we want to shift the top line down/sideways +% and shift the bottom line up/sideways by +% an amount which makes the final position = 1/3 of the square. +% Since the top and bottom lines (and also the left and right lines) +% are at 0.25 unit, +% then the extra distance = 0.25/3 = 0.0833; +% so for horiz lines we add/subtract @ty, and +% for vertical lines we add/subtract @tx. +% +% \begin{macro}{\@tx} +% \begin{macro}{\@ty} +%\begin{macrocode} +\pgfmathsetmacro{\@tx}{0.0833} +\pgfmathsetmacro{\@ty}{0.0833} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% We continue to use the rubikfont. +% +% \begin{macro}{\@tr} +% \begin{macro}{\@trp} +% \begin{macrocode} +\newcommand{\@tr}[1]{{\@rubikfont #1}} +\newcommand{\@trp}[1]{{\@rubikfont #1\@rubikprime}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% We need to rename the basic `join' commands: ie change Rubik $\rightarrow$ Two, and +% change r $\rightarrow$ t, as follows: +% +% \begin{macro}{\tr} +% \begin{macro}{\trh} +% \begin{macro}{\Two} +% \begin{macro}{\textTwo} +% \begin{macrocode} +\newcommand*{\tr}[1]{\@join{\tr}{#1}} +\newcommand*{\trh}[1]{\@join{\trh}{#1}} +\newcommand*{\Two}[1]{\@join{\Two}{#1}} +\newcommand*{\textTwo}[1]{\@join{\textTwo}{#1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% +% \subsubsection{\hspace{3mm}Rotation B} +% \label{sec:coderotationB} +% +% \begin{macro}{\trB} +% \begin{macro}{\trhB} +% \begin{macro}{\TwoB} +% \begin{macro}{\textTwoB} +% \begin{macrocode} +\newcommand{\trB}{\rrB} +\newcommand{\trBp}{\rrBp} +\newcommand{\trhB}{\rrhB} +\newcommand{\trhBp}{\rrhBp} +\newcommand{\TwoB}{\RubikB} +\newcommand{\TwoBp}{\RubikBp} +\newcommand{\textTwoB}{\textRubikB} +\newcommand{\textTwoBp}{\textRubikBp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% +% \subsubsection{\hspace{3mm}Rotation D} +% \label{sec:coderotationD} +% +% We need to rename some of the items as follows: +%{\newline} change rr $\rightarrow$ tr +%{\newline} change SquareD $\rightarrow$ SquaretD +%{\newline} change RubikD $\rightarrow$ TwoD +%{\newline} change textRubikD $\rightarrow$ textTwoD +% +% \begin{macro}{\trD} +% \begin{macro}{\SquaretD} +% \begin{macro}{\trhD} +% \begin{macro}{\TwoD} +% \begin{macro}{\textTwoD} +% These commands all draw forms which denote the D rotation. +% +% Feb 2017 (RWDN): \ added the \cmd{\@tlen} length to the \cmd{\trhD} 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{\trD}{\@tr{D}} +%% +\newcommand{\SquaretD}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\@sb,\@sddd - \@ty) -- (\@sbh, \@sddd - \@ty); +\draw [thick, ->] (\@sb,\@sd + \@ty) -- (\@sbh, \@sd + \@ty); +\end{tikzpicture}% +} +\newcommand{\trhD}{\raisebox{-0.333\height}{\@tlen\SquaretD\@tlen}} +%% +\newcommand{\TwoD}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretD\\ +\trD% +\end{minipage}% +}} +\newcommand{\textTwoD}{\trD\,\trhD} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{\hspace{3mm}Rotation Dp} +% +% \begin{macro}{\trDp} +% \begin{macro}{\SquaretDp} +% \begin{macro}{\trhDp} +% \begin{macro}{\TwoDp} +% \begin{macro}{\textTwoDp} +% These commands all draw forms which denote the Dp rotation. +% \begin{macrocode} +\newcommand{\trDp}{\@trp{D}} +%% +\newcommand{\SquaretDp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\@sb,\@sddd - \@ty) -- (\@sbh, \@sddd - \@ty); +\draw [thick, <-] (\@sb,\@sd + \@ty) -- (\@sbh, \@sd + \@ty); +\end{tikzpicture}% +} +\newcommand{\trhDp}{\raisebox{-0.333\height}{\@tlen\SquaretDp\@tlen}} +%% +\newcommand{\TwoDp}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretDp\\ +\trDp% +\end{minipage}% +}} +\newcommand{\textTwoDp}{\trDp\,\trhDp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsubsection{\hspace{3mm}Rotation F} +% +% \begin{macro}{\trF} +% \begin{macro}{\trhF} +% \begin{macro}{\TwoF} +% \begin{macro}{\textTwoF} +% \begin{macrocode} +\newcommand{\trF}{\rrF} +\newcommand{\trFp}{\rrFp} +\newcommand{\trhF}{\rrhF} +\newcommand{\trhFp}{\rrhFp} +\newcommand{\TwoF}{\RubikF} +\newcommand{\TwoFp}{\RubikFp} +\newcommand{\textTwoF}{\textRubikF} +\newcommand{\textTwoFp}{\textRubikFp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{\hspace{3mm}Rotation L} +% +% \begin{macro}{\trL} +% \begin{macro}{\SquaretL} +% \begin{macro}{\trhL} +% \begin{macro}{\TwoL} +% \begin{macro}{\textTwoL} +% These commands all draw forms which denote the L rotation. +% \begin{macrocode} +\newcommand{\trL}{\@tr{L}} +%% +\newcommand{\SquaretL}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\@sd + \@tx, \@sb) -- (\@sd + \@tx, \@sbh); +\draw [thick] (\@sddd - \@tx, \@sb) -- (\@sddd - \@tx, \@sbh); +\end{tikzpicture}% +} +\newcommand{\trhL}{\raisebox{-0.333\height}{\@tlen\SquaretL\@tlen}} +%% +\newcommand{\TwoL}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretL\\ +\trL% +\end{minipage}% +}} +\newcommand{\textTwoL}{\trL\,\trhL} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{\hspace{3mm}Rotation Lp} +% +% \begin{macro}{\trLp} +% \begin{macro}{\SquaretLp} +% \begin{macro}{\trhLp} +% \begin{macro}{\TwoLp} +% \begin{macro}{\textTwoLp} +% These commands all draw forms which denote the Lp rotation. +% \begin{macrocode} +\newcommand{\trLp}{\@trp{L}} +%% +\newcommand{\SquaretLp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick,->] (\@sd + \@tx, \@sb) -- (\@sd + \@tx, \@sbh); +\draw [thick] (\@sddd - \@tx, \@sb) -- (\@sddd - \@tx, \@sbh); +\end{tikzpicture}% +} +\newcommand{\trhLp}{\raisebox{-0.333\height}{\@tlen\SquaretLp\@tlen}} +%% +\newcommand{\TwoLp}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretLp\\ +\trLp% +\end{minipage}% +}} +\newcommand{\textTwoLp}{\trLp\,\trhLp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% +% \subsubsection{\hspace{3mm}Rotation R} +% +% \begin{macro}{\trR} +% \begin{macro}{\SquaretR} +% \begin{macro}{\trhR} +% \begin{macro}{\TwoR} +% \begin{macro}{\textTwoR} +% These commands all draw forms which denote the R rotation. +% \begin{macrocode} +\newcommand{\trR}{\@tr{R}} +%% +\newcommand{\SquaretR}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +%% draw three lines in the square, one with an arrow +\draw [thick] (\@sd + \@tx, \@sb) -- (\@sd + \@tx, \@sbh); +\draw [thick, ->] (\@sddd - \@tx, \@sb) -- (\@sddd - \@tx, \@sbh); +\end{tikzpicture}% +} +\newcommand{\trhR}{\raisebox{-0.333\height}{\@tlen\SquaretR\@tlen}} +%% +\newcommand{\TwoR}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretR\\ +\trR% +\end{minipage}% +}} +\newcommand{\textTwoR}{\trR\,\trhR} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{\hspace{3mm}Rotation Rp} +% +% \begin{macro}{\trRp} +% \begin{macro}{\SquaretRp} +% \begin{macro}{\trhRp} +% \begin{macro}{\TwoRp} +% \begin{macro}{\textTwoRp} +% These commands all draw forms which denote the Rp rotation. +% \begin{macrocode} +\newcommand{\trRp}{\@trp{R}} +%% +\newcommand{\SquaretRp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\@sd + \@tx, \@sb) -- (\@sd + \@tx, \@sbh); +\draw [thick, <-] (\@sddd - \@tx, \@sb) -- (\@sddd - \@tx, \@sbh); +\end{tikzpicture}% +} +\newcommand{\trhRp}{\raisebox{-0.333\height}{\@tlen\SquaretRp\@tlen}} +%% +\newcommand{\TwoRp}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretRp\\ +\trRp% +\end{minipage}% +}} +\newcommand{\textTwoRp}{\trRp\,\trhRp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{\hspace{3mm}Rotation U} +% +% \begin{macro}{\trU} +% \begin{macro}{\SquaretU} +% \begin{macro}{\trhU} +% \begin{macro}{\TwoU} +% \begin{macro}{\textTwoU} +% These commands all draw forms which denote the U rotation. +% \begin{macrocode} +\newcommand{\trU}{\@tr{U}} +%% +\newcommand{\SquaretU}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\@sb,\@sddd - \@ty) -- (\@sbh, \@sddd - \@ty); +\draw [thick] (\@sb,\@sd + \@ty) -- (\@sbh, \@sd + \@ty); +\end{tikzpicture}% +} +\newcommand{\trhU}{\raisebox{-0.333\height}{\@tlen\SquaretU\@tlen}} +%% +\newcommand{\TwoU}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretU\\ +\trU% +\end{minipage}%% +}} +\newcommand{\textTwoU}{\trU\,\trhU} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% +% \subsubsection{\hspace{3mm}Rotation Up} +% +% \begin{macro}{\trUp} +% \begin{macro}{\SquaretUp} +% \begin{macro}{\trhUp} +% \begin{macro}{\TwoUp} +% \begin{macro}{\textTwoUp} +% These commands all draw forms which denote the Up rotation. +% \begin{macrocode} +\newcommand{\trUp}{\@trp{U}} +%% +\newcommand{\SquaretUp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, ->] (\@sb,\@sddd - \@ty) -- (\@sbh, \@sddd - \@ty); +\draw [thick] (\@sb,\@sd + \@ty) -- (\@sbh, \@sd + \@ty); +\end{tikzpicture}% +} +\newcommand{\trhUp}{\raisebox{-0.333\height}{\@tlen\SquaretUp\@tlen}} +%% +\newcommand{\TwoUp}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretUp\\ +\trUp% +\end{minipage}%% +}} +\newcommand{\textTwoUp}{\trUp\,\trhUp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsection{\hspace{3mm}Axis rotations} +% \label{sec:codeaxisversions} +% +% For completeness we include a \cmd{\textTwo} 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{\textTwo} font argument. +% +% +% \begin{macrocode} +\newcommand{\trx}{\rrx} +\newcommand{\trxp}{\rrxp} +\newcommand{\try}{\rry} +\newcommand{\tryp}{\rryp} +\newcommand{\trz}{\rrz} +\newcommand{\trzp}{\rrzp} +\newcommand{\trl}{\rrl} + \newcommand{\trlp}{\rrlp} %%new +\newcommand{\trr}{\rrr} + \newcommand{\trrp}{\rrrp} %%new +\newcommand{\tru}{\rru} + \newcommand{\trup}{\rrup} %%new +\newcommand{\trd}{\rrd} + \newcommand{\trdp}{\rrdp} %%new +\newcommand{\trf}{\rrf} + \newcommand{\trfp}{\rrfp} %%new +\newcommand{\trb}{\rrb} + \newcommand{\trbp}{\rrbp} %%new +% +\newcommand{\trLc}{\rrLc} +\newcommand{\trLcp}{\rrLcp} +\newcommand{\trRc}{\rrRc} +\newcommand{\trRcp}{\rrRcp} +\newcommand{\trUc}{\rrUc} +\newcommand{\trUcp}{\rrUcp} +\newcommand{\trDc}{\rrDc} +\newcommand{\trDcp}{\rrDcp} +\newcommand{\trFc}{\rrFc} +\newcommand{\trFcp}{\rrFcp} +\newcommand{\trBc}{\rrBc} +\newcommand{\trBcp}{\rrBcp} +\newcommand{\trCL}{\rrCL} +\newcommand{\trCLp}{\rrCLp} +\newcommand{\trCR}{\rrCR} +\newcommand{\trCRp}{\rrCRp} +\newcommand{\trCU}{\rrCU} +\newcommand{\trCUp}{\rrCUp} +\newcommand{\trCD}{\rrCD} +\newcommand{\trCDp}{\rrCDp} +\newcommand{\trCF}{\rrCF} +\newcommand{\trCFp}{\rrCFp} +\newcommand{\trCB}{\rrCB} +\newcommand{\trCBp}{\rrCBp} +% \end{macrocode} +% +% +% \begin{macrocode} +\newcommand{\trhx}{\rrhx} +\newcommand{\trhxp}{\rrhxp} +\newcommand{\trhy}{\rrhy} +\newcommand{\trhyp}{\rrhyp} +\newcommand{\trhz}{\rrhz} +\newcommand{\trhzp}{\rrhzp} +\newcommand{\trhl}{\rrhl} + \newcommand{\trhlp}{\rrhlp} % new +\newcommand{\trhr}{\rrhr} + \newcommand{\trhrp}{\rrhrp} % new +\newcommand{\trhu}{\rrhu} + \newcommand{\trhup}{\rrhup} % new +\newcommand{\trhd}{\rrhd} + \newcommand{\trhdp}{\rrhdp} % new +\newcommand{\trhf}{\rrhf} + \newcommand{\trhfp}{\rrhfp} % new +\newcommand{\trhb}{\rrhb} + \newcommand{\trhbp}{\rrhbp} % new +\newcommand{\trhLc}{\rrhLc} +\newcommand{\trhLcp}{\rrhLcp} +\newcommand{\trhRc}{\rrhRc} +\newcommand{\trhRcp}{\rrhRcp} +\newcommand{\trhUc}{\rrhUc} +\newcommand{\trhUcp}{\rrhUcp} +\newcommand{\trhDc}{\rrhDc} +\newcommand{\trhDcp}{\rrhDcp} +\newcommand{\trhFc}{\rrhFc} +\newcommand{\trhFcp}{\rrhFcp} +\newcommand{\trhBc}{\rrhBc} +\newcommand{\trhBcp}{\rrhBcp} +\newcommand{\trhCL}{\rrhCL} +\newcommand{\trhCLp}{\rrhCLp} +\newcommand{\trhCR}{\rrhCR} +\newcommand{\trhCRp}{\rrhCRp} +\newcommand{\trhCU}{\rrhCU} +\newcommand{\trhCUp}{\rrhCUp} +\newcommand{\trhCD}{\rrhCD} +\newcommand{\trhCDp}{\rrhCDp} +\newcommand{\trhCF}{\rrhCF} +\newcommand{\trhCFp}{\rrhCFp} +\newcommand{\trhCB}{\rrhCB} +\newcommand{\trhCBp}{\rrhCBp} +% \end{macrocode} +% +% +% \begin{macrocode} +\newcommand{\Twox}{\Rubikx} +\newcommand{\Twoxp}{\Rubikxp} +\newcommand{\Twoy}{\Rubiky} +\newcommand{\Twoyp}{\Rubikyp} +\newcommand{\Twoz}{\Rubikz} +\newcommand{\Twozp}{\Rubikzp} +\newcommand{\Twol}{\Rubikl} + \newcommand{\Twolp}{\Rubiklp} % new +\newcommand{\Twor}{\Rubikr} + \newcommand{\Tworp}{\Rubikrp} % new +\newcommand{\Twou}{\Rubiku} + \newcommand{\Twoup}{\Rubikup} % new +\newcommand{\Twod}{\Rubikd} + \newcommand{\Twodp}{\Rubikdp} % new +\newcommand{\Twof}{\Rubikf} + \newcommand{\Twofp}{\Rubikfp} % new +\newcommand{\Twob}{\Rubikb} + \newcommand{\Twobp}{\Rubikbp} % new +\newcommand{\TwoLc}{\RubikLc} +\newcommand{\TwoLcp}{\RubikLcp} +\newcommand{\TwoRc}{\RubikRc} +\newcommand{\TwoRcp}{\RubikRcp} +\newcommand{\TwoUc}{\RubikUc} +\newcommand{\TwoUcp}{\RubikUcp} +\newcommand{\TwoDc}{\RubikDc} +\newcommand{\TwoDcp}{\RubikDcp} +\newcommand{\TwoFc}{\RubikFc} +\newcommand{\TwoFcp}{\RubikFcp} +\newcommand{\TwoBc}{\RubikBc} +\newcommand{\TwoBcp}{\RubikBcp} +\newcommand{\TwoCL}{\RubikCL} +\newcommand{\TwoCLp}{\RubikCLp} +\newcommand{\TwoCR}{\RubikCR} +\newcommand{\TwoCRp}{\RubikCRp} +\newcommand{\TwoCU}{\RubikCU} +\newcommand{\TwoCUp}{\RubikCUp} +\newcommand{\TwoCD}{\RubikCD} +\newcommand{\TwoCDp}{\RubikCDp} +\newcommand{\TwoCF}{\RubikCF} +\newcommand{\TwoCFp}{\RubikCFp} +\newcommand{\TwoCB}{\RubikCB} +\newcommand{\TwoCBp}{\RubikCBp} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand{\textTwox}{\rrhx} +\newcommand{\textTwoxp}{\rrhxp} +\newcommand{\textTwoy}{\rrhy} +\newcommand{\textTwoyp}{\rrhyp} +\newcommand{\textTwoz}{\rrhz} +\newcommand{\textTwozp}{\rrhzp} +\newcommand{\textTwol}{\rrhl} + \newcommand{\textTwolp}{\rrhlp} %new +\newcommand{\textTwor}{\rrhr} + \newcommand{\textTworp}{\rrhrp} %new +\newcommand{\textTwou}{\rrhu} + \newcommand{\textTwoup}{\rrhup} %new +\newcommand{\textTwod}{\rrhd} + \newcommand{\textTwodp}{\rrhdp} %new +\newcommand{\textTwof}{\rrhf} + \newcommand{\textTwofp}{\rrhfp} %new +\newcommand{\textTwob}{\rrhb} + \newcommand{\textTwobp}{\rrhbp} %new +\newcommand{\textTwoLc}{\rrhLc} +\newcommand{\textTwoLcp}{\rrhLcp} +\newcommand{\textTwoRc}{\rrhRc} +\newcommand{\textTwoRcp}{\rrhRcp} +\newcommand{\textTwoUc}{\rrhUc} +\newcommand{\textTwoUcp}{\rrhUcp} +\newcommand{\textTwoDc}{\rrhDc} +\newcommand{\textTwoDcp}{\rrhDcp} +\newcommand{\textTwoFc}{\rrhFc} +\newcommand{\textTwoFcp}{\rrhFcp} +\newcommand{\textTwoBc}{\rrhBc} +\newcommand{\textTwoBcp}{\rrhBcp} +\newcommand{\textTwoCL}{\rrhCL} +\newcommand{\textTwoCLp}{\rrhCLp} +\newcommand{\textTwoCR}{\rrhCR} +\newcommand{\textTwoCRp}{\rrhCRp} +\newcommand{\textTwoCU}{\rrhCU} +\newcommand{\textTwoCUp}{\rrhCUp} +\newcommand{\textTwoCD}{\rrhCD} +\newcommand{\textTwoCDp}{\rrhCDp} +\newcommand{\textTwoCF}{\rrhCF} +\newcommand{\textTwoCFp}{\rrhCFp} +\newcommand{\textTwoCB}{\rrhCB} +\newcommand{\textTwoCBp}{\rrhCBp} +% \end{macrocode} +% +% -------------------------- +% End of this package +% -------------------------- +% \begin{macrocode} +%</rubiktwocube> +% \end{macrocode} +% +% +% \Finale +% +\endinput diff --git a/Master/texmf-dist/source/latex/rubik/rubiktwocube.ins b/Master/texmf-dist/source/latex/rubik/rubiktwocube.ins new file mode 100644 index 00000000000..650d81b8164 --- /dev/null +++ b/Master/texmf-dist/source/latex/rubik/rubiktwocube.ins @@ -0,0 +1,66 @@ +%% rubiktwocube.ins +%% +%% --- automatic overwriting of .sty is disabled------- +%% ========================================================= +%% Authors: RWD Nickalls (dick@nickalls.org) +%% and Apostolos Syropoulos (asyropoulos@yahoo.com) +%% +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\batchfile{rubiktwocube.ins} +\input docstrip.tex + +\preamble + +----------------------------------------------------------------- + Authors: RWD Nickalls (dick@nickalls.org) + and Apostolos Syropoulos (asyropoulos@yahoo.com) + + Copyright February 25, 2018 RWD Nickalls and A Syropoulos + + VERSION 5.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{rubiktwocube.sty}{\from{rubiktwocube.dtx}{rubiktwocube}}} + +%%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{* rubiktwocube.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file *} +\Msg{* rubiktwocube.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/tex/latex/rubik/rubikcube.sty b/Master/texmf-dist/tex/latex/rubik/rubikcube.sty index 40e52aa7266..e673ce4c30d 100644 --- a/Master/texmf-dist/tex/latex/rubik/rubikcube.sty +++ b/Master/texmf-dist/tex/latex/rubik/rubikcube.sty @@ -10,9 +10,9 @@ %% Authors: RWD Nickalls (dick@nickalls.org) %% and Apostolos Syropoulos (asyropoulos@yahoo.com) %% -%% Copyright 03 March 2017 RWD Nickalls and A Syropoulos +%% Copyright February 25, 2018 RWD Nickalls and A Syropoulos %% -%% VERSION 4.0 +%% VERSION 5.0 %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -30,7 +30,7 @@ %% %% This package requires the basic TikZ package to be loaded already %% ------------------------------------------------------------------ -%%% \CheckSum{5683} +%%% \CheckSum{6231} %%% \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 @@ -52,11 +52,9 @@ %% \DescribeMacro{\RubikCubeSolvedWB} -%%set up the UP face -%%draw the UP face and sides -\def\RCfileversion{4.0}% -\def\RCfiledate{2017/03/03}% +\def\RCfileversion{5.0}% +\def\RCfiledate{2018/02/25}% February 25, 2018 \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{rubikcube}[\RCfiledate\space (v\RCfileversion)] \@ifpackageloaded{tikz}{}{% @@ -109,18 +107,18 @@ \newcommand{\xcount}{\thislevelcount} \newcommand{\ShowSequence}[3]{% \ForEachX{,}{% - \ifthenelse{\xcount=1}{#2{\x}}{#1#2{\x}}% + {\ifthenelse{\xcount=1}{#2{\x}}{#1#2{\x}}}% }{#3}% }% \newcommand{\ShowSequenceF}[3]{% \fbox{% \ForEachX{,}{% - \ifthenelse{\xcount=1}{#2{\x}}{#1#2{\x}}% + {\ifthenelse{\xcount=1}{#2{\x}}{#1#2{\x}}}% }{#3}% }}% \newcommand{\ShowSequencef}[3]{% \ForEachX{,}{% - \ifthenelse{\xcount=1}{\fbox{#2{\x}}}{#1{\fbox{#2{\x}}}}% + {\ifthenelse{\xcount=1}{\fbox{#2{\x}}}{#1{\fbox{#2{\x}}}}}% }{#3}% }% \newcommand{\SequenceInfo}{{}}% %% INFO only @@ -131,6 +129,7 @@ \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}% @@ -197,17 +196,28 @@ \RubikFaceRightAll{X}% \RubikFaceFrontAll{X}% \RubikFaceBackAll{X}% - \newcommand{\RubikCubeGrey}{% -\RubikFaceUp {X}{X}{X}{X}{W}{X}{X}{X}{X}% -\RubikFaceDown {X}{X}{X}{X}{Y}{X}{X}{X}{X}% -\RubikFaceLeft {X}{X}{X}{X}{B}{X}{X}{X}{X}% -\RubikFaceRight{X}{X}{X}{X}{G}{X}{X}{X}{X}% -\RubikFaceFront{X}{X}{X}{X}{O}{X}{X}{X}{X}% -\RubikFaceBack {X}{X}{X}{X}{R}{X}{X}{X}{X}% + \RubikFaceRight{X}{X}{X}{X}{G}{X}{X}{X}{X}% + \RubikFaceLeft {X}{X}{X}{X}{B}{X}{X}{X}{X}% + \RubikFaceUp {X}{X}{X}{X}{W}{X}{X}{X}{X}% + \RubikFaceDown {X}{X}{X}{X}{Y}{X}{X}{X}{X}% + \RubikFaceFront{X}{X}{X}{X}{O}{X}{X}{X}{X}% + \RubikFaceBack {X}{X}{X}{X}{R}{X}{X}{X}{X}% } \newcommand{\RubikCubeGray}{\RubikCubeGrey} -\newcommand{\SolvedConfig}[6]{% +\newcommand{\RubikCubeGreyWY}{\RubikCubeGrey} +\newcommand{\RubikCubeGrayWY}{\RubikCubeGreyWY} +%% +\newcommand{\RubikCubeGreyWB}{% + \RubikFaceRight{X}{X}{X}{X}{R}{X}{X}{X}{X}% + \RubikFaceLeft {X}{X}{X}{X}{O}{X}{X}{X}{X}% + \RubikFaceUp {X}{X}{X}{X}{W}{X}{X}{X}{X}% + \RubikFaceDown {X}{X}{X}{X}{B}{X}{X}{X}{X}% + \RubikFaceFront{X}{X}{X}{X}{G}{X}{X}{X}{X}% + \RubikFaceBack {X}{X}{X}{X}{Y}{X}{X}{X}{X}% +} +\newcommand{\RubikCubeGrayWB}{\RubikCubeGreyWB} +\newcommand{\RubikSolvedConfig}[6]{% \RubikFaceRightAll{#1}% \RubikFaceLeftAll{#2}% \RubikFaceUpAll{#3}% @@ -215,11 +225,11 @@ \RubikFaceFrontAll{#5}% \RubikFaceBackAll{#6}% } -\newcommand{\RubikCubeGreyAll}{\SolvedConfig{X}{X}{X}{X}{X}{X}}% +\newcommand{\RubikCubeGreyAll}{\RubikSolvedConfig{X}{X}{X}{X}{X}{X}}% \newcommand{\RubikCubeGrayAll}{\RubikCubeGreyAll} -\newcommand{\RubikCubeSolved}{\SolvedConfig{G}{B}{W}{Y}{O}{R}}% +\newcommand{\RubikCubeSolved}{\RubikSolvedConfig{G}{B}{W}{Y}{O}{R}}% \newcommand{\RubikCubeSolvedWY}{\RubikCubeSolved}% -\newcommand{\RubikCubeSolvedWB}{\SolvedConfig{R}{O}{W}{B}{G}{Y}}% +\newcommand{\RubikCubeSolvedWB}{\RubikSolvedConfig{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}% @@ -272,7 +282,6 @@ \draw[line join=round,line cap=round,ultra thick,fill=\Frb]% (2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle; } - \newcommand{\DrawRubikCubeRU}{% \DrawRubikCubeFrontFace %% frontface %%-----------Up face---------- @@ -463,55 +472,7 @@ (2,3) -- (1.66, 3.33) -- (2.66,3.33) -- (3,3) -- cycle;% \ %%trailing space } -\newcommand{\DrawRubikLayerFace}[9]{% -%%-----------FRONT face--------- -%%---top row -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(0,2) -- (0, 3) -- (1,3) -- (1,2) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#2]% -(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#3]% -(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle; -%%-----middle row -\draw[line join=round,line cap=round,ultra thick,fill=#4]% -(0,1) -- (0, 2) -- (1,2) -- (1,1) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#5]% -(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#6]% -(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle; -%%----bottom row -\draw[line join=round,line cap=round,ultra thick,fill=#7]% -(0,0) -- (0, 1) -- (1,1) -- (1,0) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#8]% -(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#9]% -(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle; -} -\newcommand{\DrawRubikLayerFaceAll}[1]{% -%%----------FRONT face----------- -%%---top row -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(0,2) -- (0, 3) -- (1,3) -- (1,2) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle; -%%-----middle row -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(0,1) -- (0, 2) -- (1,2) -- (1,1) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle; -%%----bottom row -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(0,0) -- (0, 1) -- (1,1) -- (1,0) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle; -\draw[line join=round,line cap=round,ultra thick,fill=#1]% -(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle; -} -\newcommand{\DrawFlatUp}[2]{% +\newcommand{\DrawRubikFlatUp}[2]{% \pgfmathsetmacro{\ux}{#1}% \pgfmathsetmacro{\uy}{#2}% %%---top row @@ -546,7 +507,7 @@ -- (\ux + 3,\uy + 0) -- cycle; } %%------------------------- -\newcommand{\DrawFlatDown}[2]{% +\newcommand{\DrawRubikFlatDown}[2]{% \pgfmathsetmacro{\ddx}{#1}% \pgfmathsetmacro{\ddy}{#2}% %%---top row @@ -581,61 +542,77 @@ -- (\ddx + 3,\ddy + 0) -- cycle; } %%------------------------- -\newcommand{\DrawFlatLeft}[2]{% +\newcommand{\DrawRubikFlatLeft}[2]{% \pgfmathsetmacro{\lx}{#1}% \pgfmathsetmacro{\ly}{#2}% -%% NOTE: y variable coord not yet implemented %%---top row \draw[line join=round,line cap=round,ultra thick,fill=\Llt]% -(\lx + 0,2) -- (\lx + 0, 3) -- (\lx + 1,3) -- (\lx + 1,2) -- cycle; +(\lx + 0, \ly + 2) -- (\lx + 0, \ly + 3) -- (\lx + 1, \ly + 3)% + -- (\lx + 1, \ly + 2) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Lmt]% -(\lx + 1,2) -- (\lx + 1, 3) -- (\lx + 2,3) -- (\lx + 2,2) -- cycle; +(\lx + 1, \ly + 2) -- (\lx + 1, \ly + 3) -- (\lx + 2, \ly + 3)% + -- (\lx + 2, \ly + 2) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Lrt]% -(\lx + 2,2) -- (\lx + 2, 3) -- (\lx + 3,3) -- (\lx + 3,2) -- cycle; +(\lx + 2, \ly + 2) -- (\lx + 2, \ly + 3) -- (\lx + 3, \ly + 3)% + -- (\lx + 3, \ly + 2) -- cycle; %%-----middle row \draw[line join=round,line cap=round,ultra thick,fill=\Llm]% -(\lx + 0,1) -- (\lx + 0, 2) -- (\lx + 1,2) -- (\lx + 1,1) -- cycle; +(\lx + 0, \ly + 1) -- (\lx + 0, \ly + 2) -- (\lx + 1, \ly + 2)% + -- (\lx + 1, \ly + 1) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Lmm]% -(\lx + 1,1) -- (\lx + 1, 2) -- (\lx + 2,2) -- (\lx + 2,1) -- cycle; +(\lx + 1, \ly + 1) -- (\lx + 1, \ly + 2) -- (\lx + 2, \ly + 2)% + -- (\lx + 2, \ly + 1) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Lrm]% -(\lx + 2,1) -- (\lx + 2, 2) -- (\lx + 3,2) -- (\lx + 3,1) -- cycle; +(\lx + 2, \ly + 1) -- (\lx + 2, \ly + 2) -- (\lx + 3, \ly + 2)% + -- (\lx + 3, \ly + 1) -- cycle; %%----bottom row \draw[line join=round,line cap=round,ultra thick,fill=\Llb]% -(\lx + 0,0) -- (\lx + 0, 1) -- (\lx + 1,1) -- (\lx + 1,0) -- cycle; +(\lx + 0, \ly + 0) -- (\lx + 0, \ly + 1) -- (\lx + 1, \ly + 1)% + -- (\lx + 1, \ly + 0) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Lmb]% -(\lx + 1,0) -- (\lx + 1, 1) -- (\lx + 2,1) -- (\lx + 2,0) -- cycle; +(\lx + 1, \ly + 0) -- (\lx + 1, \ly + 1) -- (\lx + 2, \ly + 1)% + -- (\lx + 2, \ly + 0) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Lrb]% -(\lx + 2,0) -- (\lx + 2, 1) -- (\lx + 3,1) -- (\lx + 3,0) -- cycle; +(\lx + 2, \ly + 0) -- (\lx + 2, \ly + 1) -- (\lx + 3, \ly + 1)% + -- (\lx + 3, \ly + 0) -- cycle; } %%-------------------------- -\newcommand{\DrawFlatRight}[2]{% -\pgfmathsetmacro{\rx}{#1}% %3 -\pgfmathsetmacro{\ry}{#2}% %0 -%% NOTE: y variable coord not yet implemented +\newcommand{\DrawRubikFlatRight}[2]{% +\pgfmathsetmacro{\rx}{#1}% +\pgfmathsetmacro{\ry}{#2}% %%---top row \draw[line join=round,line cap=round,ultra thick,fill=\Rlt]% -(\rx + 0,2) -- (\rx + 0, 3) -- (\rx + 1,3) -- (\rx + 1,2) -- cycle; +(\rx + 0, \ry + 2) -- (\rx + 0, \ry + 3) -- (\rx + 1, \ry + 3)% + -- (\rx + 1, \ry + 2) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Rmt]% -(\rx + 1,2) -- (\rx + 1, 3) -- (\rx + 2,3) -- (\rx + 2,2) -- cycle; +(\rx + 1, \ry + 2) -- (\rx + 1, \ry + 3) -- (\rx + 2, \ry + 3)% + -- (\rx + 2, \ry + 2) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Rrt]% -(\rx + 2,2) -- (\rx + 2, 3) -- (\rx + 3,3) -- (\rx + 3,2) -- cycle; +(\rx + 2, \ry + 2) -- (\rx + 2, \ry + 3) -- (\rx + 3, \ry + 3)% + -- (\rx + 3, \ry + 2) -- cycle; %%-----middle row \draw[line join=round,line cap=round,ultra thick,fill=\Rlm]% -(\rx + 0,1) -- (\rx + 0, 2) -- (\rx + 1,2) -- (\rx + 1,1) -- cycle; +(\rx + 0, \ry + 1) -- (\rx + 0, \ry + 2) -- (\rx + 1, \ry + 2)% + -- (\rx + 1, \ry + 1) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Rmm]% -(\rx + 1,1) -- (\rx + 1, 2) -- (\rx + 2,2) -- (\rx + 2,1) -- cycle; +(\rx + 1, \ry + 1) -- (\rx + 1, \ry + 2) -- (\rx + 2, \ry + 2)% + -- (\rx + 2, \ry + 1) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Rrm]% -(\rx + 2,1) -- (\rx + 2, 2) -- (\rx + 3,2) -- (\rx + 3,1) -- cycle; +(\rx + 2, \ry + 1) -- (\rx + 2, \ry + 2) -- (\rx + 3, \ry + 2)% + -- (\rx + 3, \ry + 1) -- cycle; %%----bottom row \draw[line join=round,line cap=round,ultra thick,fill=\Rlb]% -(\rx + 0,0) -- (\rx + 0, 1) -- (\rx + 1,1) -- (\rx + 1,0) -- cycle; +(\rx + 0, \ry + 0) -- (\rx + 0, \ry + 1) -- (\rx + 1, \ry + 1)% + -- (\rx + 1, \ry + 0) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Rmb]% -(\rx + 1,0) -- (\rx + 1, 1) -- (\rx + 2,1) -- (\rx + 2,0) -- cycle; +(\rx + 1, \ry + 0) -- (\rx + 1, \ry + 1) -- (\rx + 2, \ry + 1)% + -- (\rx + 2, \ry + 0) -- cycle; \draw[line join=round,line cap=round,ultra thick,fill=\Rrb]% -(\rx + 2,0) -- (\rx + 2, 1) -- (\rx + 3,1) -- (\rx + 3,0) -- cycle; +(\rx + 2, \ry + 0) -- (\rx + 2, \ry + 1) -- (\rx + 3, \ry + 1)% + -- (\rx + 3, \ry + 0) -- cycle; } %%----------------------- -\newcommand{\DrawFlatFront}{% +\newcommand{\DrawRubikFlatFront}{% %% This command is used /only/ by the \cmd{\DrawRubikCubeF} command. %% NOTE: x, y variables not implemented as not required here %%---top row @@ -667,7 +644,7 @@ (2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle; } %%------------------------- -\newcommand{\DrawFlatBack}[2]{% +\newcommand{\DrawRubikFlatBack}[2]{% \pgfmathsetmacro{\bx}{#1}% \pgfmathsetmacro{\by}{#2}% %%---top row @@ -702,186 +679,360 @@ -- (\bx + 3,\by + 0) -- cycle; } \newcommand{\DrawRubikCubeF}{% - \DrawFlatUp{0}{3}% - \DrawFlatDown{0}{-3}% - \DrawFlatLeft{-3}{0}% - \DrawFlatFront% - \DrawFlatRight{3}{0}% - \DrawFlatBack{6}{0}% + \DrawRubikFlatUp{0}{3}% + \DrawRubikFlatDown{0}{-3}% + \DrawRubikFlatLeft{-3}{0}% + \DrawRubikFlatFront% + \DrawRubikFlatRight{3}{0}% + \DrawRubikFlatBack{6}{0}% } \newcommand{\DrawRubikCubeSF}{% - \DrawRubikCube% - \DrawFlatDown{0}{-3}% - \DrawFlatLeft{-3}{0}% - \DrawFlatBack{4}{1}% -} -\newcommand{\DrawFlatUpSide}{% -\DrawFlatUp{0}{0}% -\DrawRubikLayerSideT{\Brt}{\Bmt}{\Blt}% -\DrawRubikLayerSideL{\Llt}{\Lmt}{\Lrt}% -\DrawRubikLayerSideR{\Rrt}{\Rmt}{\Rlt}% -\DrawRubikLayerSideB{\Flt}{\Fmt}{\Frt}% -} -\newcommand{\DrawFlatFrontSide}{% -\DrawFlatFront{0}{0}% -\DrawRubikLayerSideT{\Ulb}{\Umb}{\Urb}% -\DrawRubikLayerSideL{\Lrt}{\Lrm}{\Lrb}% -\DrawRubikLayerSideR{\Rlt}{\Rlm}{\Rlb}% -\DrawRubikLayerSideB{\Dlt}{\Dmt}{\Drt}% -} -\newcommand{\DrawFlatRightSide}{% -\DrawFlatRight{0}{0}% -\DrawRubikLayerSideT{\Urb}{\Urm}{\Urt}% -\DrawRubikLayerSideL{\Frt}{\Frm}{\Frb}% -\DrawRubikLayerSideR{\Blt}{\Blm}{\Blb}% -\DrawRubikLayerSideB{\Drt}{\Drm}{\Drb}% -} -\newcommand{\DrawFlatLeftSide}{% -\DrawFlatLeft{0}{0}% -\DrawRubikLayerSideT{\Ult}{\Ulm}{\Ulb}% -\DrawRubikLayerSideL{\Brt}{\Brm}{\Brb}% -\DrawRubikLayerSideR{\Flt}{\Flm}{\Flb}% -\DrawRubikLayerSideB{\Dlb}{\Dlm}{\Dlt}% -} -\newcommand{\DrawFlatBackSide}{% -\DrawFlatBack{0}{0}% -\DrawRubikLayerSideT{\Urt}{\Umt}{\Ult}% -\DrawRubikLayerSideL{\Rrt}{\Rrm}{\Rrb}% -\DrawRubikLayerSideR{\Llt}{\Llm}{\Llb}% -\DrawRubikLayerSideB{\Drb}{\Dmb}{\Dlb}% -} -\newcommand{\DrawFlatDownSide}{% -\DrawFlatDown{0}{0}% -\DrawRubikLayerSideT{\Flb}{\Fmb}{\Frb}% -\DrawRubikLayerSideL{\Lrb}{\Lmb}{\Llb}% -\DrawRubikLayerSideR{\Rlb}{\Rmb}{\Rrb}% -\DrawRubikLayerSideB{\Brb}{\Bmb}{\Blb}% -} -\newcommand{\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} + \DrawRubikCubeRU% + \DrawRubikFlatDown{0}{-3}% + \DrawRubikFlatLeft{-3}{0}% + \DrawRubikFlatBack{4}{1}% +} +\newcommand{\DrawRubikFaceUpSide}{% +\DrawRubikFlatUp{0}{0}% +\side@barT{1}{\Brt} +\side@barT{2}{\Bmt} +\side@barT{3}{\Blt} +\side@barL{1}{\Lrt} +\side@barL{2}{\Lmt} +\side@barL{3}{\Llt} +\side@barR{1}{\Rlt} +\side@barR{2}{\Rmt} +\side@barR{3}{\Rrt} +\side@barB{1}{\Flt} +\side@barB{2}{\Fmt} +\side@barB{3}{\Frt} +} +\newcommand{\DrawRubikFaceFrontSide}{% +\DrawRubikFlatFront{0}{0}% +\side@barT{1}{\Ulb} +\side@barT{2}{\Umb} +\side@barT{3}{\Urb} +\side@barL{1}{\Lrb} +\side@barL{2}{\Lrm} +\side@barL{3}{\Lrt} +\side@barR{1}{\Rlb} +\side@barR{2}{\Rlm} +\side@barR{3}{\Rlt} +\side@barB{1}{\Dlt} +\side@barB{2}{\Dmt} +\side@barB{3}{\Drt} +} +\newcommand{\DrawRubikFaceRightSide}{% +\DrawRubikFlatRight{0}{0}% +\side@barT{1}{\Urb} +\side@barT{2}{\Urm} +\side@barT{3}{\Urt} +\side@barL{1}{\Frb} +\side@barL{2}{\Frm} +\side@barL{3}{\Frt} +\side@barR{1}{\Blb} +\side@barR{2}{\Blm} +\side@barR{3}{\Blt} +\side@barB{1}{\Drt} +\side@barB{2}{\Drm} +\side@barB{3}{\Drb} +} +\newcommand{\DrawRubikFaceLeftSide}{% +\DrawRubikFlatLeft{0}{0}% +\side@barT{1}{\Ult} +\side@barT{2}{\Ulm} +\side@barT{3}{\Ulb} +\side@barL{1}{\Brb} +\side@barL{2}{\Brm} +\side@barL{3}{\Brt} +\side@barR{1}{\Flb} +\side@barR{2}{\Flm} +\side@barR{3}{\Flt} +\side@barB{1}{\Dlb} +\side@barB{2}{\Dlm} +\side@barB{3}{\Dlt} +} +\newcommand{\DrawRubikFaceBackSide}{% +\DrawRubikFlatBack{0}{0}% +\side@barT{1}{\Urt} +\side@barT{2}{\Umt} +\side@barT{3}{\Ult} +\side@barL{1}{\Rrb} +\side@barL{2}{\Rrm} +\side@barL{3}{\Rrt} +\side@barR{1}{\Llb} +\side@barR{2}{\Llm} +\side@barR{3}{\Llt} +\side@barB{1}{\Drb} +\side@barB{2}{\Dmb} +\side@barB{3}{\Dlb} +} +\newcommand{\DrawRubikFaceDownSide}{% +\DrawRubikFlatDown{0}{0}% +\side@barT{1}{\Flb} +\side@barT{2}{\Fmb} +\side@barT{3}{\Frb} +\side@barL{1}{\Llb} +\side@barL{2}{\Lmb} +\side@barL{3}{\Lrb} +\side@barR{1}{\Rrb} +\side@barR{2}{\Rmb} +\side@barR{3}{\Rlb} +\side@barB{1}{\Brb} +\side@barB{2}{\Bmb} +\side@barB{3}{\Blb} +} +\newcommand{\DrawRubikFaceUp}{\DrawRubikFlatUp{0}{0}} +\newcommand{\DrawRubikFaceDown}{\DrawRubikFlatDown{0}{0}} +\newcommand{\DrawRubikFaceLeft}{\DrawRubikFlatLeft{0}{0}} +\newcommand{\DrawRubikFaceRight}{\DrawRubikFlatRight{0}{0}} +\newcommand{\DrawRubikFaceFront}{\DrawRubikFlatFront{0}{0}} +\newcommand{\DrawRubikFaceBack}{\DrawRubikFlatBack{0}{0}} +%% RWDN19A Finally, we create the short-hand versions. +\newcommand{\DrawRubikFaceU}{\DrawRubikFaceUp} +\newcommand{\DrawRubikFaceD}{\DrawRubikFaceDown} +\newcommand{\DrawRubikFaceL}{\DrawRubikFaceLeft} +\newcommand{\DrawRubikFaceR}{\DrawRubikFaceRight} +\newcommand{\DrawRubikFaceF}{\DrawRubikFaceFront} +\newcommand{\DrawRubikFaceB}{\DrawRubikFaceBack} +\newcommand{\DrawRubikFaceUS}{\DrawRubikFaceUpSide} +\newcommand{\DrawRubikFaceDS}{\DrawRubikFaceDownSide} +\newcommand{\DrawRubikFaceLS}{\DrawRubikFaceLeftSide} +\newcommand{\DrawRubikFaceRS}{\DrawRubikFaceRightSide} +\newcommand{\DrawRubikFaceFS}{\DrawRubikFaceFrontSide} +\newcommand{\DrawRubikFaceBS}{\DrawRubikFaceBackSide} +\newcommand{\RubikSidebarWidth}[1]{\pgfmathsetmacro{\bw}{#1}} +\newcommand{\RubikSidebarLength}[1]{\pgfmathsetmacro{\bl}{#1}} +\newcommand{\RubikSidebarSep}[1]{\pgfmathsetmacro{\bs}{#1}} +\RubikSidebarWidth{0.3}% +\RubikSidebarLength{1}% +\RubikSidebarSep{0.3}% \newcommand{\RubikSideBarWidth}[1]{\pgfmathsetmacro{\bw}{#1}} \newcommand{\RubikSideBarLength}[1]{\pgfmathsetmacro{\bl}{#1}} \newcommand{\RubikSideBarSep}[1]{\pgfmathsetmacro{\bs}{#1}} -\RubikSideBarWidth{0.3}% -\RubikSideBarLength{1}% -\RubikSideBarSep{0.3}% + +\def\no@sidebar{}% +\newcommand{\NoSidebar}[1]{\def\no@sidebar{#1}} \newcommand{\side@barL}[2]{% -%% #1 = cubie possn no, #2 = colour -\pgfmathsetmacro{\blh}{\bl*(0.5)}% -\pgfmathsetmacro{\dx}{0 - \bs - \bw}% -\pgfmathsetmacro{\dy}{#1-1+0.5-\blh}% -\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{0 - \bs - \bw}% + \pgfmathsetmacro{\dy}{#1-1+0.5-\blh}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; -} +}} \newcommand{\side@barR}[2]{% -%% #1 = cubie possn no, #2 = colour -\pgfmathsetmacro{\blh}{\bl*(0.5)}% -\pgfmathsetmacro{\dx}{3 + \bs}% -\pgfmathsetmacro{\dy}{#1 -1+0.5-\blh}% -\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{3 + \bs}% + \pgfmathsetmacro{\dy}{#1 -1+0.5-\blh}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; -} +}} \newcommand{\side@barT}[2]{% -%% #1 = cubie possn no, #2 = colour -\pgfmathsetmacro{\blh}{\bl*(0.5)}% -\pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}% -\pgfmathsetmacro{\dy}{3 +\bs}% -\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}% + \pgfmathsetmacro{\dy}{3 +\bs}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; -} +}} \newcommand{\side@barB}[2]{% -%% #1 = cubie possn no, #2 = colour -\pgfmathsetmacro{\blh}{\bl*(0.5)}% -\pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}% -\pgfmathsetmacro{\dy}{0 -\bs-\bw}% -\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}% + \pgfmathsetmacro{\dy}{0 -\bs-\bw}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; +}} +\newcommand{\side@barRubikRbackRU}[2]{% + %% #1 = cubie possn no, #2 = colour + %% dx --> dx+1 + %% dy --> dy+1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{3 + \bs +1}% + \pgfmathsetmacro{\dy}{#1 -1+0.5-\blh +1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; +}} +\newcommand{\DrawRubikCubeSidebarRBRU}{% +\side@barRubikRbackRU{3}{\Blt}% +\side@barRubikRbackRU{2}{\Blm}% +\side@barRubikRbackRU{1}{\Blb}% +} +\newcommand{\DrawRubikCubeSidebarBRRU}{\DrawRubikCubeSidebarRBRU} +\newcommand{\DrawRubikCubeSidebarRB}[1]{\@join{\DrawRubikCubeSidebarRB}{#1}} +\newcommand{\DrawRubikCubeSidebarBR}[1]{\@join{\DrawRubikCubeSidebarBR}{#1}} +\newcommand{\side@barRubikTbackRU}[2]{% + %% #1 = cubie possn no; #2 = colour + %% dx --> dx+1 + %% dy --> dy+1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{#1 -1+0.5-\blh +1}% + \pgfmathsetmacro{\dy}{3 +\bs +1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; +}} +\newcommand{\DrawRubikCubeSidebarUBRU}{% +\side@barRubikTbackRU{1}{\Brt}% +\side@barRubikTbackRU{2}{\Bmt}% +\side@barRubikTbackRU{3}{\Blt}% +} +\newcommand{\DrawRubikCubeSidebarBURU}{\DrawRubikCubeSidebarUBRU} +\newcommand{\DrawRubikCubeSidebarUB}[1]{\@join{\DrawRubikCubeSidebarUB}{#1}} +\newcommand{\DrawRubikCubeSidebarBU}[1]{\@join{\DrawRubikCubeSidebarBU}{#1}} +\newcommand{\DrawRubikCubeSidebarFLRU}{% +\side@barL{3}{\Lrt}% +\side@barL{2}{\Lrm}% +\side@barL{1}{\Lrb}% +} +\newcommand{\DrawRubikCubeSidebarLFRU}{\DrawRubikCubeSidebarFLRU} +\newcommand{\DrawRubikCubeSidebarFL}[1]{\@join{\DrawRubikCubeSidebarFL}{#1}} +\newcommand{\DrawRubikCubeSidebarLF}[1]{\@join{\DrawRubikCubeSidebarLF}{#1}} +\newcommand{\DrawRubikCubeSidebarFDRU}{% +\side@barB{1}{\Dlt}% +\side@barB{2}{\Dmt}% +\side@barB{3}{\Drt}% +} +\newcommand{\DrawRubikCubeSidebarDFRU}{\DrawRubikCubeSidebarFDRU} +\newcommand{\DrawRubikCubeSidebarFD}[1]{\@join{\DrawRubikCubeSidebarFD}{#1}} +\newcommand{\DrawRubikCubeSidebarDF}[1]{\@join{\DrawRubikCubeSidebarDF}{#1}} +\newcommand{\DrawRubikCubeSidebarDFLU}{\DrawRubikCubeSidebarDFRU} +\newcommand{\DrawRubikCubeSidebarFDLU}{\DrawRubikCubeSidebarFDRU} +\newcommand{\side@barRubikLbackLU}[2]{% + %% #1 = cubie possn no, #2 = colour + %% dx --> dx-1 + %% dy --> dy+1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{0 - \bs -\bw -1}% + \pgfmathsetmacro{\dy}{#1 -1+0.5-\blh +1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; +}} +\newcommand{\DrawRubikCubeSidebarLBLU}{% +\side@barRubikLbackLU{3}{\Brt}% +\side@barRubikLbackLU{2}{\Brm}% +\side@barRubikLbackLU{1}{\Brb}% +} +\newcommand{\DrawRubikCubeSidebarBLLU}{\DrawRubikCubeSidebarLBLU} +\newcommand{\DrawRubikCubeSidebarLB}[1]{\@join{\DrawRubikCubeSidebarLB}{#1}} +\newcommand{\DrawRubikCubeSidebarBL}[1]{\@join{\DrawRubikCubeSidebarBL}{#1}} +\newcommand{\side@barRubikTbackLU}[2]{% + %% #1 = cubie possn no; #2 = colour + %% dx --> dx-1 + %% dy --> dy+1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{#1 -1+0.5-\blh -1}% + \pgfmathsetmacro{\dy}{3 +\bs +1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; +}} +\newcommand{\DrawRubikCubeSidebarUBLU}{% +\side@barRubikTbackLU{1}{\Brt}% +\side@barRubikTbackLU{2}{\Bmt}% +\side@barRubikTbackLU{3}{\Blt}% +} +\newcommand{\DrawRubikCubeSidebarBULU}{\DrawRubikCubeSidebarUBLU} +\newcommand{\DrawRubikCubeSidebarFRLU}{% +\side@barR{3}{\Rlt}% +\side@barR{2}{\Rlm}% +\side@barR{1}{\Rlb}% +} +\newcommand{\DrawRubikCubeSidebarRFLU}{\DrawRubikCubeSidebarFRLU} +\newcommand{\DrawRubikCubeSidebarFR}[1]{\@join{\DrawRubikCubeSidebarFR}{#1}} +\newcommand{\DrawRubikCubeSidebarRF}[1]{\@join{\DrawRubikCubeSidebarRF}{#1}} +\newcommand{\DrawRubikCubeSidebarFURD}{% +\side@barT{1}{\Ulb}% +\side@barT{2}{\Umb}% +\side@barT{3}{\Urb}% +} +\newcommand{\DrawRubikCubeSidebarUFRD}{\DrawRubikCubeSidebarFURD} +\newcommand{\DrawRubikCubeSidebarFU}[1]{\@join{\DrawRubikCubeSidebarFU}{#1}} +\newcommand{\DrawRubikCubeSidebarUF}[1]{\@join{\DrawRubikCubeSidebarUF}{#1}} +\newcommand{\DrawRubikCubeSidebarFLRD}{\DrawRubikCubeSidebarFLRU} +\newcommand{\DrawRubikCubeSidebarLFRD}{\DrawRubikCubeSidebarLFRU} +\newcommand{\side@barRubikRbackRD}[2]{% + %% #1 = cubie possn no, #2 = colour + %% dx --> dx+1 + %% dy --> dy-1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{3 + \bs +1}% + \pgfmathsetmacro{\dy}{#1 -1+0.5-\blh -1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; +}} +\newcommand{\DrawRubikCubeSidebarRBRD}{% +\side@barRubikRbackRD{3}{\Blt}% +\side@barRubikRbackRD{2}{\Blm}% +\side@barRubikRbackRD{1}{\Blb}% +} +\newcommand{\DrawRubikCubeSidebarBRRD}{\DrawRubikCubeSidebarRBRD} +\newcommand{\side@barRubikBbackRD}[2]{% + %% #1 = cubie possn no; #2 = colour + %% dx --> dx+1 + %% dy --> dy-1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{#1 -1+0.5-\blh +1}% + \pgfmathsetmacro{\dy}{0 -\bs - \bw -1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; +}} +\newcommand{\DrawRubikCubeSidebarDBRD}{% +\side@barRubikBbackRD{1}{\Brb}% +\side@barRubikBbackRD{2}{\Bmb}% +\side@barRubikBbackRD{3}{\Blb}% +} +\newcommand{\DrawRubikCubeSidebarBDRD}{\DrawRubikCubeSidebarDBRD} +\newcommand{\DrawRubikCubeSidebarDB}[1]{\@join{\DrawRubikCubeSidebarDB}{#1}} +\newcommand{\DrawRubikCubeSidebarBD}[1]{\@join{\DrawRubikCubeSidebarBD}{#1}} +\newcommand{\DrawRubikCubeSidebarFULD}{\DrawRubikCubeSidebarFURD} +\newcommand{\DrawRubikCubeSidebarUFLD}{\DrawRubikCubeSidebarUFRD} +\newcommand{\DrawRubikCubeSidebarFRLD}{\DrawRubikCubeSidebarFRLU} +\newcommand{\DrawRubikCubeSidebarRFLD}{\DrawRubikCubeSidebarRFLU} +\newcommand{\side@barRubikLbackLD}[2]{% + %% #1 = cubie possn no, #2 = colour + %% dx --> dx-1 + %% dy --> dy-1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{0 - \bs -\bw -1}% + \pgfmathsetmacro{\dy}{#1 -1+0.5-\blh -1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; +}} +\newcommand{\DrawRubikCubeSidebarLBLD}{% +\side@barRubikLbackLD{3}{\Brt}% +\side@barRubikLbackLD{2}{\Brm}% +\side@barRubikLbackLD{1}{\Brb}% +} +\newcommand{\DrawRubikCubeSidebarBLLD}{\DrawRubikCubeSidebarLBLD} +\newcommand{\side@barRubikBbackLD}[2]{% + %% #1 = cubie possn no; #2 = colour + %% dx --> dx-1 + %% dy --> dy-1 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\blh}{\bl*(0.5)}% + \pgfmathsetmacro{\dx}{#1 -1+0.5-\blh -1}% + \pgfmathsetmacro{\dy}{0 -\bs - \bw -1}% + \draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; +}} +\newcommand{\DrawRubikCubeSidebarDBLD}{% +\side@barRubikBbackLD{1}{\Brb}% +\side@barRubikBbackLD{2}{\Bmb}% +\side@barRubikBbackLD{3}{\Blb}% } -%%---Left side -\newcommand{\DrawRubikLayerSideLTx}[1]{\side@barL{3}{#1}} -\newcommand{\DrawRubikLayerSideLMx}[1]{\side@barL{2}{#1}} -\newcommand{\DrawRubikLayerSideLM}[1]{\side@barL{2}{#1}} -\newcommand{\DrawRubikLayerSideLBx}[1]{\side@barL{1}{#1}} -\newcommand{\DrawRubikLayerSideRTx}[1]{\side@barR{3}{#1}} -\newcommand{\DrawRubikLayerSideRMx}[1]{\side@barR{2}{#1}} -\newcommand{\DrawRubikLayerSideRM}[1]{\side@barR{2}{#1}} -\newcommand{\DrawRubikLayerSideRBx}[1]{\side@barR{1}{#1}} -\newcommand{\DrawRubikLayerSideLTy}[1]{\side@barT{1}{#1}} -\newcommand{\DrawRubikLayerSideMTy}[1]{\side@barT{2}{#1}} -\newcommand{\DrawRubikLayerSideMT}[1]{\side@barT{2}{#1}} -\newcommand{\DrawRubikLayerSideRTy}[1]{\side@barT{3}{#1}} -\newcommand{\DrawRubikLayerSideLBy}[1]{\side@barB{1}{#1}} -\newcommand{\DrawRubikLayerSideMBy}[1]{\side@barB{2}{#1}} -\newcommand{\DrawRubikLayerSideMB}[1]{\side@barB{2}{#1}} -\newcommand{\DrawRubikLayerSideRBy}[1]{\side@barB{3}{#1}} -%%--Top side--- -\newcommand{\DrawRubikLayerSideT}[3]{% - \DrawRubikLayerSideLTy{#1}% - \DrawRubikLayerSideMTy{#2}% - \DrawRubikLayerSideRTy{#3}% -} -%%--Bottom side--- -\newcommand{\DrawRubikLayerSideB}[3]{% - \DrawRubikLayerSideLBy{#1}% - \DrawRubikLayerSideMBy{#2}% - \DrawRubikLayerSideRBy{#3}% -} -%%--Left side-------- -%% colours run vertically DOWN -\newcommand{\DrawRubikLayerSideL}[3]{% - \DrawRubikLayerSideLTx{#1}% - \DrawRubikLayerSideLMx{#2}% - \DrawRubikLayerSideLBx{#3}% -} -%%--Right side-------- -%% colours run vertically DOWN -\newcommand{\DrawRubikLayerSideR}[3]{% - \DrawRubikLayerSideRTx{#1}% - \DrawRubikLayerSideRMx{#2}% - \DrawRubikLayerSideRBx{#3}% -} -\newcommand{\DrawRubikLayerSideLR}[6]{% - \DrawRubikLayerSideLTx{#1}% - \DrawRubikLayerSideRTx{#2}% - \DrawRubikLayerSideLMx{#3}% - \DrawRubikLayerSideRMx{#4}% - \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{\DrawRubikCubeSidebarBDLD}{\DrawRubikCubeSidebarDBLD} \newcommand{\DrawNCubeAll}[4]{% \pgfmathsetmacro{\ncubes}{#1-1}% %% need to subtract 1 from the given number of cubies per side @@ -1035,14 +1186,22 @@ \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{\@xyzhp}[1]{[{\@rubikfont #1\raisebox{-0.6pt}{\@rubikprime}}]} +\newcommand{\@xyzRubik}[1]% + {\raisebox{3.45pt}{[{\@rubikfont #1}]}} +\newcommand{\@xyzRubikp}[1]% + {\raisebox{3.45pt}{[{\@rubikfont #1\raisebox{-0.6pt}{\@rubikprime}}]}} +\newcommand{\@xyzhbdfl}[1]% + {[\raisebox{-0.6pt}{{\@rubikfont #1}}]} +\newcommand{\@xyzhbdflp}[1]% + {[\raisebox{-0.6pt}{{\@rubikfont #1\@rubikprime}}]} +\newcommand{\@xyzbdflRubik}[1]% + {\raisebox{3.45pt}{[\raisebox{-0.6pt}{{\@rubikfont #1}}]}} +\newcommand{\@xyzbdflRubikp}[1]% + {\raisebox{3.45pt}{[\raisebox{-0.6pt}{{\@rubikfont #1\@rubikprime}}]}} \newcommand{\@SquareLetter}[1]{\setlength{\fboxsep}{2.5pt}% - \setlength{\fboxrule}{0.8pt}% - \fbox{\rule[-1pt]{0pt}{8.5pt}\raisebox{-0.5pt}{#1}}} + \setlength{\fboxrule}{0.8pt}% + \fbox{\rule[-1pt]{0pt}{8.5pt}\raisebox{-0.5pt}{#1}}} \newlength\@hRubik% \setlength{\@hRubik}{0.185cm}% \newcommand{\@tlen}{\hspace{1pt}}% @@ -2086,23 +2245,41 @@ \newcommand{\Rubikzp}{\@xyzRubikp{z}} \newcommand{\rrhzp}{\@xyzhp{z}} \newcommand{\rru}{\@rr{u}} -\newcommand{\Rubiku}{\@xyzRubik{u}} +\newcommand{\rrup}{\@rrp{u}} \newcommand{\rrhu}{\@xyzh{u}} +\newcommand{\rrhup}{\@xyzhp{u}} +\newcommand{\Rubiku}{\@xyzRubik{u}} +\newcommand{\Rubikup}{\@xyzRubikp{u}} \newcommand{\rrd}{\@rr{d}} +\newcommand{\rrdp}{\@rrp{d}} \newcommand{\rrhd}{\@xyzhbdfl{d}} +\newcommand{\rrhdp}{\@xyzhbdflp{d}} \newcommand{\Rubikd}{\@xyzbdflRubik{d}} +\newcommand{\Rubikdp}{\@xyzbdflRubikp{d}} \newcommand{\rrl}{\@rr{l}} +\newcommand{\rrlp}{\@rrp{l}} \newcommand{\rrhl}{\@xyzhbdfl{l}} +\newcommand{\rrhlp}{\@xyzhbdflp{l}} \newcommand{\Rubikl}{\@xyzbdflRubik{l}} +\newcommand{\Rubiklp}{\@xyzbdflRubikp{l}} \newcommand{\rrr}{\@rr{r}} -\newcommand{\Rubikr}{\@xyzRubik{r}} +\newcommand{\rrrp}{\@rrp{r}} \newcommand{\rrhr}{\@xyzh{r}} +\newcommand{\rrhrp}{\@xyzhp{r}} +\newcommand{\Rubikr}{\@xyzRubik{r}} +\newcommand{\Rubikrp}{\@xyzRubikp{r}} \newcommand{\rrf}{\@rr{f}} +\newcommand{\rrfp}{\@rrp{f}} \newcommand{\rrhf}{\@xyzhbdfl{f}} +\newcommand{\rrhfp}{\@xyzhbdflp{f}} \newcommand{\Rubikf}{\@xyzbdflRubik{f}} +\newcommand{\Rubikfp}{\@xyzbdflRubikp{f}} \newcommand{\rrb}{\@rr{b}} +\newcommand{\rrbp}{\@rrp{b}} \newcommand{\rrhb}{\@xyzhbdfl{b}} +\newcommand{\rrhbp}{\@xyzhbdflp{b}} \newcommand{\Rubikb}{\@xyzbdflRubik{b}} +\newcommand{\Rubikbp}{\@xyzbdflRubikp{b}} \newcommand{\@xyzhc}[1]{[\raisebox{-1.2pt}% {{\@rubikfont #1\@rubikfontFNS c}}]} \newcommand{\@xyzhcp}[1]{[\raisebox{-1.2pt}% @@ -2594,11 +2771,17 @@ \newcommand{\textRubikz}{\rrhz} \newcommand{\textRubikzp}{\rrhzp} \newcommand{\textRubikl}{\rrhl} +\newcommand{\textRubiklp}{\rrhlp} \newcommand{\textRubikr}{\rrhr} +\newcommand{\textRubikrp}{\rrhrp} \newcommand{\textRubiku}{\rrhu} +\newcommand{\textRubikup}{\rrhup} \newcommand{\textRubikd}{\rrhd} +\newcommand{\textRubikdp}{\rrhdp} \newcommand{\textRubikf}{\rrhf} +\newcommand{\textRubikfp}{\rrhfp} \newcommand{\textRubikb}{\rrhb} +\newcommand{\textRubikbp}{\rrhbp} \newcommand{\textRubikLc}{\rrhLc} \newcommand{\textRubikLcp}{\rrhLcp} \newcommand{\textRubikRc}{\rrhRc} diff --git a/Master/texmf-dist/tex/latex/rubik/rubikpatterns.sty b/Master/texmf-dist/tex/latex/rubik/rubikpatterns.sty index 3415a93d29f..9b53eedb87e 100644 --- a/Master/texmf-dist/tex/latex/rubik/rubikpatterns.sty +++ b/Master/texmf-dist/tex/latex/rubik/rubikpatterns.sty @@ -10,9 +10,9 @@ %% Authors: RWD Nickalls (dick@nickalls.org) %% and Apostolos Syropoulos (asyropoulos@yahoo.com) %% -%% Copyright March 03, 2017 RWD Nickalls and A Syropoulos +%% Copyright February 25, 2018 RWD Nickalls and A Syropoulos %% -%% VERSION 4.0 +%% VERSION 5.0 %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -47,101 +47,136 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} -\def\RPfileversion{4.0}% -\def\RPfiledate{2017/03/03}% + +\def\RPfileversion{5.0}% +\def\RPfiledate{2018/02/25}% 25 February 2018 \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],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>}% + {[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>}% + {[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],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],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)>}% + {[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{\ChristmasCross}{[ChristmasCross],U,F,Bp,L2,U2,L2,Fp,B,U2,L2,U,% + <(16q*, 11f*)>}% +\newcommand{\christmascross}{\ChristmasCross}% \newcommand{\PlummersCross}% -{[PlummersCross],R2,Lp,D,F2,Rp,Dp,Rp,L,Up,D,R,D,B2,Rp,U,D2,<(20q*, 16f*)>}% + {[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],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],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],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],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*)>}% + {[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*)>}% + {[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],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],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],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],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*)>}% + {[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],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],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)>}% + {[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)>}% + {[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*)>}% + {[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*)>}% + {[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*)>}% + {[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)>}% + {[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*)>}% + {[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>}% + {[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>}% + {[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*)>}% + {[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)>}% + {[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*)>}% + {[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*)>}% + {[ExchangedDuckFeet],U,F,R2,Fp,Dp,R,U,B2,U2,Fp,R2,F,D,B2,R,Bp,% + <(21q*, 16f*)>}% \newcommand{\exchangedduckfeet}{\ExchangedDuckFeet}% \endinput %% diff --git a/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty b/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty index 6c3a06347aa..2b2904ef2db 100644 --- a/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty +++ b/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty @@ -10,9 +10,9 @@ %% Authors: RWD Nickalls (dick@nickalls.org) %% and Apostolos Syropoulos (asyropoulos@yahoo.com) %% -%% Copyright 03 March 2017 RWD Nickalls and A Syropoulos +%% Copyright February 25, 2018 RWD Nickalls and A Syropoulos %% -%% VERSION 4.0 +%% VERSION 5.0 %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -30,8 +30,7 @@ %% %% This package requires the basic TikZ package to be loaded already %% ------------------------------------------------------------------ - -%%% \CheckSum{322} +%%% \CheckSum{332} %%% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -48,8 +47,8 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} -\def\RRfileversion{4.0}% -\def\RRfiledate{2017/03/03}% +\def\RRfileversion{5.0}% +\def\RRfiledate{2018/02/25}% 25 February 2018 \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{rubikrotation}[\RRfiledate\space (v\RRfileversion)] \@ifpackageloaded{rubikcube}{}{% @@ -90,21 +89,21 @@ \typeout{---creating file rubikstateERRORS.dat}% \newwrite\outfile% \immediate\openout\outfile=rubikstateERRORS.dat% -\@print{\@comment rubikstateERRORS.dat}% -\@print{\@comment --------------------}% +\@print{\@comment ShowErrors (rubikstateERRORS.dat)}% +\@print{\@comment ---------------------------------}% \immediate\closeout\outfile% \typeout{---setting up newwrite for rubikrotation.sty to use...}% \newwrite\outfile% \newcommand{\@openstatefile}{\immediate\openout\outfile=rubikstate.dat} \newcommand{\@closestatefile}{\immediate\closeout\outfile} \newcommand{\@printrubikstate}{% + \@print{cubesize,three}% \@print{up,\Ult,\Umt,\Urt,\Ulm,\Umm,\Urm,\Ulb,\Umb,\Urb}% \@print{down,\Dlt,\Dmt,\Drt,\Dlm,\Dmm,\Drm,\Dlb,\Dmb,\Drb}% \@print{left,\Llt,\Lmt,\Lrt,\Llm,\Lmm,\Lrm,\Llb,\Lmb,\Lrb}% \@print{right,\Rlt,\Rmt,\Rrt,\Rlm,\Rmm,\Rrm,\Rlb,\Rmb,\Rrb}% \@print{front,\Flt,\Fmt,\Frt,\Flm,\Fmm,\Frm,\Flb,\Fmb,\Frb}% \@print{back,\Blt,\Bmt,\Brt,\Blm,\Bmm,\Brm,\Blb,\Bmb,\Brb}% - \@print{checkstate}% } \newcommand{\SaveRubikState}[1]{% \typeout{---NEW save command------------------}% @@ -144,10 +143,11 @@ \next } \newcommand{\RubikRotation}[2][1]{% - \typeout{---TeX process (rubikrotation.sty)-------}% - \typeout{---NEW rotation command------------------}% + \typeout{---TeX process---------------------------}% + \typeout{---script = rubikrotation.sty v\RRfileversion\space (\RRfiledate)}% + \typeout{---NEW rotation command}% \typeout{---command = RubikRotation[#1]{#2}}% - \typeout{---writing current Rubik state to file rubikstate.dat}% + \typeout{---writing current cube state to file rubikstate.dat}% \@openstatefile% open data file \@print{\@comment filename: rubikstate.dat}% \@print{\@comment written by rubikrotation.sty% @@ -164,18 +164,19 @@ \input{rubikstateNEW.dat}% \typeout{-----------------------------------------}% } -\newcommand{\ShowRubikErrors}{% - \typeout{---ShowRubikErrors: inputting file rubikstateERRORS.dat}% +\newcommand{\ShowErrors}{% + \typeout{---ShowErrors: inputting file rubikstateERRORS.dat}% \VerbatimInput{rubikstateERRORS.dat}% } -\newcommand{\ShowErrors}{\ShowRubikErrors} -\newcommand{\CheckRubikState}{% +\newcommand{\ShowRubikErrors}{\ShowErrors} +\newcommand{\CheckState}{% \typeout{---NEW check command------------------}% - \typeout{---command = CheckRubikState}% - \typeout{---writing current Rubik state to file rubikstate.dat}% + \typeout{---command = CheckState}% + \typeout{---writing current cube state to file rubikstate.dat}% \@openstatefile% opens data file \@print{\@comment filename: rubikstate.dat}% \@printrubikstate% + \immediate\write\outfile{checkstate}% \@closestatefile% close data file \typeout{---running Perl script (rubikrotation.pl)}% \immediate\write18{\rubikperlcmd}% @@ -183,6 +184,7 @@ \input{rubikstateNEW.dat}% \typeout{-----------------------------------------}% } +\newcommand{\CheckRubikState}{\CheckState} \endinput %% %% End of file `rubikrotation.sty'. diff --git a/Master/texmf-dist/tex/latex/rubik/rubiktwocube.sty b/Master/texmf-dist/tex/latex/rubik/rubiktwocube.sty new file mode 100644 index 00000000000..145175df8dd --- /dev/null +++ b/Master/texmf-dist/tex/latex/rubik/rubiktwocube.sty @@ -0,0 +1,1061 @@ +%% +%% This is file `rubiktwocube.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% rubiktwocube.dtx (with options: `rubiktwocube') +%% +%% ----------------------------------------------------------------- +%% Authors: RWD Nickalls (dick@nickalls.org) +%% and Apostolos Syropoulos (asyropoulos@yahoo.com) +%% +%% Copyright February 25, 2018 RWD Nickalls and A Syropoulos +%% +%% VERSION 5.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{2308} +%%% \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\RTCfileversion{5.0}% +\def\RTCfiledate{2018/02/25}% February 25, 2018 +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{rubiktwocube}[\RTCfiledate\space (v\RTCfileversion)] +\@ifpackageloaded{tikz}{}{% + \typeout{---rubiktwocube requires the TikZ package.}% + \RequirePackage{tikz}}% +\@ifpackageloaded{rubikcube}{}{% + \typeout{---rubiktwocube requires the rubikcube package.}% + }% +\@ifpackageloaded{rubikrotation}{}{% + \typeout{---rubiktwocube requires the rubikrotation package.}% + }% +\newcommand{\rubiktwocube}{\textsc{rubiktwocube}}% +\newcommand{\@printTWOstate}{% + \@print{cubesize,two}% + \@print{\space \space up,\Ult,\Umt,\Urt,\Ulm,\Umm,\Urm,\Ulb,\Umb,\Urb}% + \@print{down,\Dlt,\Dmt,\Drt,\Dlm,\Dmm,\Drm,\Dlb,\Dmb,\Drb}% + \@print{left,\Llt,\Lmt,\Lrt,\Llm,\Lmm,\Lrm,\Llb,\Lmb,\Lrb}% + \@print{right,\Rlt,\Rmt,\Rrt,\Rlm,\Rmm,\Rrm,\Rlb,\Rmb,\Rrb}% + \@print{front,\Flt,\Fmt,\Frt,\Flm,\Fmm,\Frm,\Flb,\Fmb,\Frb}% + \@print{back,\Blt,\Bmt,\Brt,\Blm,\Bmm,\Brm,\Blb,\Bmb,\Brb}% +} +\newcommand{\SaveTwoState}{\SaveRubikState} +\newcommand{\TwoRotation}[2][1]{% + \typeout{---TeX process}% + \typeout{---script = TwoRotation cmd (rubiktwocube.sty)% + v\RTCfileversion\space (\RTCfiledate)}% + \typeout{---NEW rotation command}% + \typeout{---command = TwoRotation[#1]{#2}}% + \typeout{---writing current TWOcube state to file rubikstate.dat}% + \@openstatefile% open data file + \@print{\@comment filename: rubikstate.dat}% + \@print{\@comment written by TwoRotation cmd (rubiktwocube.sty)% + v\RTCfileversion\space (\RTCfiledate)}% + \@printTWOstate% + %% countingloop code from Feuersaenger (2015) + \newcount\ourRRcounter% + \@countingloop{\ourRRcounter} in 1:{#1}{% + \immediate\write\outfile{rotation,#2}}% + \@closestatefile% close data file + \typeout{---CALLing Perl script (rubikrotation.pl)}% + \immediate\write18{\rubikperlcmd}% + \typeout{---inputting NEW datafile (data written by Perl script)}% + \input{rubikstateNEW.dat}% + \typeout{-----------------------------------------}% + } +\newcommand{\TwoFaceUp}[4]{% + \def\Ult{#1}\def\Urt{#2}\def\Ulb{#3}\def\Urb{#4}} +\newcommand{\TwoFaceFront}[4]{% + \def\Flt{#1}\def\Frt{#2}\def\Flb{#3}\def\Frb{#4}} +\newcommand{\TwoFaceRight}[4]{% + \def\Rlt{#1}\def\Rrt{#2}\def\Rlb{#3}\def\Rrb{#4}} +\newcommand{\TwoFaceDown}[4]{% + \def\Dlt{#1}\def\Drt{#2}\def\Dlb{#3}\def\Drb{#4}} +\newcommand{\TwoFaceLeft}[4]{% + \def\Llt{#1}\def\Lrt{#2}\def\Llb{#3}\def\Lrb{#4}} +\newcommand{\TwoFaceBack}[4]{% + \def\Blt{#1}\def\Brt{#2}\def\Blb{#3}\def\Brb{#4}} +\newcommand{\TwoFaceUpAll}[1]{% + \def\Ult{#1}\def\Urt{#1}\def\Ulb{#1}\def\Urb{#1}} +\newcommand{\TwoFaceFrontAll}[1]{% + \def\Flt{#1}\def\Frt{#1}\def\Flb{#1}\def\Frb{#1}} +\newcommand{\TwoFaceRightAll}[1]{% + \def\Rlt{#1}\def\Rrt{#1}\def\Rlb{#1}\def\Rrb{#1}} +\newcommand{\TwoFaceLeftAll}[1]{% + \def\Llt{#1}\def\Lrt{#1}\def\Llb{#1}\def\Lrb{#1}} +\newcommand{\TwoFaceDownAll}[1]{% + \def\Dlt{#1}\def\Drt{#1}\def\Dlb{#1}\def\Drb{#1}} +\newcommand{\TwoFaceBackAll}[1]{% + \def\Blt{#1}\def\Brt{#1}\def\Blb{#1}\def\Brb{#1}} +%% set the default colour = grey = X +\TwoFaceUpAll{X}% +\TwoFaceDownAll{X}% +\TwoFaceLeftAll{X}% +\TwoFaceRightAll{X}% +\TwoFaceFrontAll{X}% +\TwoFaceBackAll{X}% +\newcommand{\TwoSolvedConfig}[6]{% + \TwoFaceRightAll{#1}% + \TwoFaceLeftAll{#2}% + \TwoFaceUpAll{#3}% + \TwoFaceDownAll{#4}% + \TwoFaceFrontAll{#5}% + \TwoFaceBackAll{#6}% +} +\newcommand{\TwoCubeGrey}{\RubikCubeGreyAll\TwoSolvedConfig{X}{X}{X}{X}{X}{X}}% +\newcommand{\TwoCubeGreyAll}{\TwoCubeGrey} +\newcommand{\TwoCubeGray}{\TwoCubeGrey} +\newcommand{\TwoCubeGrayAll}{\TwoCubeGrey} +\newcommand{\TwoCubeSolvedWY}{\RubikCubeGreyAll\TwoSolvedConfig{G}{B}{W}{Y}{O}{R}}% +\newcommand{\TwoCubeSolved}{\TwoCubeSolvedWY}% +\newcommand{\TwoCubeSolvedWB}{\RubikCubeGreyAll\TwoSolvedConfig{R}{O}{W}{B}{G}{Y}}% +\newcommand{\TwoSliceTopR}[4]{% + \def\Flt{#1}\def\Frt{#2}\def\Rlt{#3}\def\Rrt{#4}} +\newcommand{\TwoSliceTopL}[4]{% + \def\Llt{#1}\def\Lrt{#2}\def\Flt{#3}\def\Frt{#4}} +\newcommand{\TwoSliceBottomR}[4]{% + \def\Flb{#1}\def\Frb{#2}\def\Rlb{#3}\def\Rrb{#4}} +\newcommand{\TwoSliceBottomL}[4]{% + \def\Llb{#1}\def\Lrb{#2}\def\Flb{#3}\def\Frb{#4}} +%%--------------------- +\newcommand{\DrawTwoCubeFrontFace}{% +\draw[line join=round,line cap=round,ultra thick,fill=\Flt]% +(0,1) -- (0, 2) -- (1,2) -- (1,1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Frt]% +(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle; +%% +\draw[line join=round,line cap=round,ultra thick,fill=\Flb]% +(0,0) -- (0, 1) -- (1,1) -- (1,0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Frb]% +(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle; +} +\newcommand{\DrawTwoCubeRU}{% +%%-----------Front face---------- +\DrawTwoCubeFrontFace %% frontface +%%-----------Up face---------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Ult]% +(0.33,2.33) -- (0.66,2.66) -- (1.66,2.66) -- (1.33,2.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urt]% +(1.33,2.33) -- (1.66,2.66) -- (2.66,2.66) -- (2.33,2.33) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]% +(0,2) -- (0.33,2.33) -- (1.33,2.33) -- (1,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urb]% +(1,2) -- (1.33,2.33) -- (2.33,2.33) -- (2,2) -- cycle; +%%-----------Right face---------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]% +(2,1) -- (2, 2) -- (2.33,2.33) -- (2.33,1.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]% +(2.33,1.33) -- (2.33, 2.33) -- (2.66,2.66) -- (2.66,1.66) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]% +(2,0) -- (2, 1) -- (2.33,1.33) -- (2.33,0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]% +(2.33,0.33) -- (2.33, 1.33) -- (2.66,1.66) -- (2.66,0.66) -- cycle; +} +%% +\newcommand{\DrawTwoCube}{\DrawTwoCubeRU} +%% +\newcommand{\DrawTwoCubeRD}{% +\DrawTwoCubeFrontFace %% frontface +%%----------Right face-------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]% +(2,1) -- (2, 2) -- (2.33,1.66) -- (2.33,0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]% +(2.33,0.66) -- (2.33, 1.66) -- (2.66,1.33) -- (2.66,0.33) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]% +(2,0) -- (2, 1) -- (2.33,0.66) -- (2.33,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]% +(2.33,-0.33) -- (2.33, 0.66) -- (2.66,0.33) -- (2.66,-0.66) -- cycle; +%%-----------Down face--------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]% +(0.33,-0.33) -- (0, 0) -- (1,0) -- (1.33,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drt]% +(1.33,-0.33) -- (1, 0) -- (2,0) -- (2.33,-0.33) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]% +(0.66,-0.66) -- (0.33, -0.33) -- (1.33,-0.33) -- (1.66,-0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drb]% +(1.66,-0.66) -- (1.33, -0.33) -- (2.33,-0.33) -- (2.66,-0.66) -- cycle; +} +%% +\newcommand{\DrawTwoCubeLD}{% +\DrawTwoCubeFrontFace %% frontface +%%------------Left face-------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Llt]% +(-0.66,0.33) -- (-0.66, 1.33) -- (-0.33,1.66) -- (-0.33,0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]% +(-0.33,0.66) -- (-0.33, 1.66) -- (0,2) -- (0,1) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Llb]% +(-0.66,-0.66) -- (-0.66, 0.33) -- (-0.33,0.66) -- (-0.33,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]% +(-0.33,-0.33) -- (-0.33, 0.66) -- (0,1) -- (0,0) -- cycle; +%%------------Down face---------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]% +(-0.33,-0.33) -- (0, 0) -- (1,0) -- (0.66,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drt]% +(0.66,-0.33) -- (1, 0) -- (2,0) -- (1.66,-0.33) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]% +(-0.66,-0.66) -- (-0.33, -0.33) -- (0.66,-0.33) -- (0.33,-0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drb]% +(0.33,-0.66) -- (0.66, -0.33) -- (1.66,-0.33) -- (1.33,-0.66) -- cycle; +} +%% +\newcommand{\DrawTwoCubeLU}{% +\DrawTwoCubeFrontFace %% frontface +%%-----------Left face----------- +%%------top row +\draw[line join=round,line cap=round,ultra thick,fill=\Llt]% +(-0.66,1.66) -- (-0.66, 2.66) -- (-0.33,2.33) -- (-0.33,1.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]% +(-0.33,1.33) -- (-0.33, 2.33) -- (0,2) -- (0,1) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Llb]% +(-0.66,0.66) -- (-0.66, 1.66) -- (-0.33,1.33) -- (-0.33,0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]% +(-0.33,0.33) -- (-0.33, 1.33) -- (0,1) -- (0,0) -- cycle; +%%-----------Up face--------- +\draw[line join=round,line cap=round,ultra thick,fill=\Ult]% +(-0.33,2.33) -- (-0.66, 2.66) -- (0.33,2.66) -- (0.66,2.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urt]% +(0.66,2.33) -- (0.33, 2.66) -- (1.33,2.66) -- (1.66,2.33) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]% +(0,2) -- (-0.33, 2.33) -- (0.66,2.33) -- (1,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urb]% +(1,2) -- (0.66, 2.33) -- (1.66,2.33) -- (2,2) -- cycle; +} +%%---------------------- +\newcommand{\DrawTwoFlatUp}[2]{% +\pgfmathsetmacro{\ux}{#1}% +\pgfmathsetmacro{\uy}{#2}% +%%-----top row +\draw[line join=round,line cap=round,ultra thick,fill=\Ult]% +(\ux + 0,\uy + 1) -- (\ux + 0,\uy + 2) -- (\ux + 1,\uy + 2)% + -- (\ux + 1,\uy + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urt]% +(\ux + 1,\uy + 1) -- (\ux + 1,\uy + 2) -- (\ux + 2,\uy + 2)% + -- (\ux + 2,\uy + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]% +(\ux + 0,\uy + 0) -- (\ux + 0,\uy + 1) -- (\ux + 1,\uy + 1)% + -- (\ux + 1,\uy + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urb]% +(\ux + 1,\uy + 0) -- (\ux + 1,\uy + 1) -- (\ux + 2,\uy + 1)% + -- (\ux + 2,\uy + 0) -- cycle; +} +%%------------------------- +\newcommand{\DrawTwoFlatDown}[2]{% +\pgfmathsetmacro{\ddx}{#1}% +\pgfmathsetmacro{\ddy}{#2}% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]% +(\ddx + 0,\ddy + 1) -- (\ddx + 0,\ddy + 2) -- (\ddx + 1,\ddy + 2)% + -- (\ddx + 1,\ddy + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drt]% +(\ddx + 1,\ddy + 1) -- (\ddx + 1,\ddy + 2) -- (\ddx + 2,\ddy + 2)% + -- (\ddx + 2,\ddy + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]% +(\ddx + 0,\ddy + 0) -- (\ddx + 0,\ddy + 1) -- (\ddx + 1,\ddy + 1)% + -- (\ddx + 1,\ddy + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drb]% +(\ddx + 1,\ddy + 0) -- (\ddx + 1,\ddy + 1) -- (\ddx + 2,\ddy + 1)% + -- (\ddx + 2,\ddy + 0) -- cycle; +} +%%------------------------- +\newcommand{\DrawTwoFlatLeft}[2]{% +\pgfmathsetmacro{\lx}{#1}% +\pgfmathsetmacro{\ly}{#2}% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Llt]% +(\lx + 0, \ly + 1) -- (\lx + 0, \ly + 2) -- (\lx + 1, \ly + 2)% + -- (\lx + 1, \ly + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]% +(\lx + 1, \ly + 1) -- (\lx + 1, \ly + 2) -- (\lx + 2, \ly + 2)% + -- (\lx + 2, \ly + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Llb]% +(\lx + 0, \ly + 0) -- (\lx + 0, \ly + 1) -- (\lx + 1, \ly + 1)% + -- (\lx + 1, \ly + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]% +(\lx + 1, \ly + 0) -- (\lx + 1, \ly + 1) -- (\lx + 2, \ly + 1)% + -- (\lx + 2, \ly + 0) -- cycle; +} +%%-------------------------- +\newcommand{\DrawTwoFlatRight}[2]{% +\pgfmathsetmacro{\rx}{#1}% +\pgfmathsetmacro{\ry}{#2}% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]% +(\rx + 0, \ry + 1) -- (\rx + 0, \ry + 2) -- (\rx + 1, \ry + 2)% + -- (\rx + 1, \ry + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]% +(\rx + 1, \ry + 1) -- (\rx + 1, \ry + 2) -- (\rx + 2, \ry + 2)% + -- (\rx + 2, \ry + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]% +(\rx + 0, \ry + 0) -- (\rx + 0, \ry + 1) -- (\rx + 1, \ry + 1)% + -- (\rx + 1, \ry + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]% +(\rx + 1, \ry + 0) -- (\rx + 1, \ry + 1) -- (\rx + 2, \ry + 1)% + -- (\rx + 2, \ry + 0) -- cycle; +} +%%-------------- +\newcommand{\DrawTwoFlatFront}{% +%% This command is used /only/ by the \cmd{\DrawRubikFlat} command. +%% NOTE: x, y variables not implemented as not required here +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Flt]% +(0,1) -- (0, 2) -- (1,2) -- (1,1) -- cycle; +%% +\draw[line join=round,line cap=round,ultra thick,fill=\Frt]% +(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Flb]% +(0,0) -- (0, 1) -- (1,1) -- (1,0) -- cycle; +%% +\draw[line join=round,line cap=round,ultra thick,fill=\Frb]% +(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle; +} +%%-------------------------- +\newcommand{\DrawTwoFlatBack}[2]{% +\pgfmathsetmacro{\bx}{#1}% +\pgfmathsetmacro{\by}{#2}% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Blt]% +(\bx + 0,\by + 1) -- (\bx + 0,\by + 2) -- (\bx + 1,\by + 2)% + -- (\bx + 1,\by + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Brt]% +(\bx + 1,\by + 1) -- (\bx + 1,\by + 2) -- (\bx + 2,\by + 2)% + -- (\bx + 2,\by + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Blb]% +(\bx + 0,\by + 0) -- (\bx + 0,\by + 1) -- (\bx + 1,\by + 1)% + -- (\bx + 1,\by + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Brb]% +(\bx + 1,\by + 0) -- (\bx + 1,\by + 1) -- (\bx + 2,\by + 1)% + -- (\bx + 2,\by + 0) -- cycle; +} +%%------------------------------ +\newcommand{\DrawTwoCubeF}{% + \DrawTwoFlatUp{0}{2}% + \DrawTwoFlatDown{0}{-2}% + \DrawTwoFlatLeft{-2}{0}% + \DrawTwoFlatFront% + \DrawTwoFlatRight{2}{0}% + \DrawTwoFlatBack{4}{0}% +} +%% +\newcommand{\DrawTwoCubeSF}{% + \DrawTwoCubeRU% RU + \DrawTwoFlatDown{0}{-2}% + \DrawTwoFlatLeft{-2}{0}% + \DrawTwoFlatBack{2.666}{0.66}% +} +\newcommand{\TwoSidebarWidth}[1]{\pgfmathsetmacro{\tbw}{#1}} +\newcommand{\TwoSidebarLength}[1]{\pgfmathsetmacro{\tbl}{#1}} +\newcommand{\TwoSidebarSep}[1]{\pgfmathsetmacro{\tbs}{#1}} +\TwoSidebarWidth{0.2} +\TwoSidebarLength{1.0} +\TwoSidebarSep{0.2} + +\newcommand{\TWOside@barL}[2]{% + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{0 - \tbs - \tbw}% + \pgfmathsetmacro{\tdy}{#1-1+0.5-\tblh}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbl) + -- (\tdx+\tbw,\tdy+\tbl) -- (\tdx+\tbw,\tdy) -- cycle; +}} +%% changed Rubik value (3 + \bs) --> (2 + \tbs) (as only TWO squares) +\newcommand{\TWOside@barR}[2]{% + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{2 + \tbs}% + \pgfmathsetmacro{\tdy}{#1 -1+0.5-\tblh}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbl) + -- (\tdx+\tbw,\tdy+\tbl) -- (\tdx+\tbw,\tdy) -- cycle; +}} +%% changed Rubik value (3 + \bs) --> (2 + \tbs) (as only TWO squares) +\newcommand{\TWOside@barT}[2]{% + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{#1 -1+0.5-\tblh}% + \pgfmathsetmacro{\tdy}{2 +\tbs}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbw) + -- (\tdx+\tbl,\tdy+\tbw) -- (\tdx+\tbl,\tdy) -- cycle; +}} +\newcommand{\TWOside@barB}[2]{% + %% #1 = cubie possn no, #2 = colour + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{#1 -1+0.5-\tblh}% + \pgfmathsetmacro{\tdy}{0 -\tbs-\tbw}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbw) + -- (\tdx+\tbl,\tdy+\tbw) -- (\tdx+\tbl,\tdy) -- cycle; +}} + +\newcommand{\DrawTwoFaceUpSide}{% + \DrawTwoFlatUp{0}{0}% + \TWOside@barT{1}{\Brt}% + \TWOside@barT{2}{\Blt}% + \TWOside@barL{2}{\Llt}% + \TWOside@barL{1}{\Lrt}% + \TWOside@barR{2}{\Rrt}% + \TWOside@barR{1}{\Rlt}% + \TWOside@barB{1}{\Flt}% + \TWOside@barB{2}{\Frt}% +} +\newcommand{\DrawTwoFaceFrontSide}{% + \DrawTwoFlatFront{0}{0}% + \TWOside@barT{1}{\Ulb}% + \TWOside@barT{2}{\Urb}% + \TWOside@barL{2}{\Lrt}% + \TWOside@barL{1}{\Lrb}% + \TWOside@barR{2}{\Rlt}% + \TWOside@barR{1}{\Rlb}% + \TWOside@barB{1}{\Dlt}% + \TWOside@barB{2}{\Drt}% +} +\newcommand{\DrawTwoFaceRightSide}{% + \DrawTwoFlatRight{0}{0}% + \TWOside@barT{1}{\Urb}% + \TWOside@barT{2}{\Urt}% + \TWOside@barL{2}{\Frt}% + \TWOside@barL{1}{\Frb}% + \TWOside@barR{2}{\Blt}% + \TWOside@barR{1}{\Blb}% + \TWOside@barB{1}{\Drt}% + \TWOside@barB{2}{\Drb}% +} +\newcommand{\DrawTwoFaceLeftSide}{% + \DrawTwoFlatLeft{0}{0}% + \TWOside@barT{1}{\Ult}% + \TWOside@barT{2}{\Ulb}% + \TWOside@barL{2}{\Brt}% + \TWOside@barL{1}{\Brb}% + \TWOside@barR{2}{\Flt}% + \TWOside@barR{1}{\Flb}% + \TWOside@barB{1}{\Dlb}% + \TWOside@barB{2}{\Dlt}% +} +\newcommand{\DrawTwoFaceBackSide}{% + \DrawTwoFlatBack{0}{0}% + \TWOside@barT{1}{\Urt}% + \TWOside@barT{2}{\Ult}% + \TWOside@barL{2}{\Rrt}% + \TWOside@barL{1}{\Rrb}% + \TWOside@barR{2}{\Llt}% + \TWOside@barR{1}{\Llb}% + \TWOside@barB{1}{\Drb}% + \TWOside@barB{2}{\Dlb}% +} +\newcommand{\DrawTwoFaceDownSide}{% + \DrawTwoFlatDown{0}{0}% + \TWOside@barT{1}{\Flb}% + \TWOside@barT{2}{\Frb}% + \TWOside@barL{2}{\Lrb}% + \TWOside@barL{1}{\Llb}% + \TWOside@barR{2}{\Rlb}% + \TWOside@barR{1}{\Rrb}% + \TWOside@barB{1}{\Brb}% + \TWOside@barB{2}{\Blb}% +} +%% +%% v5: made Face versions (for USER) without the (x,y) coordinates +\newcommand{\DrawTwoFaceUp}{\DrawTwoFlatUp{0}{0}} +\newcommand{\DrawTwoFaceDown}{\DrawTwoFlatDown{0}{0}} +\newcommand{\DrawTwoFaceLeft}{\DrawTwoFlatLeft{0}{0}} +\newcommand{\DrawTwoFaceRight}{\DrawTwoFlatRight{0}{0}} +\newcommand{\DrawTwoFaceFront}{\DrawTwoFlatFront{0}{0}} +\newcommand{\DrawTwoFaceBack}{\DrawTwoFlatBack{0}{0}} +%% +%% v5: made short forms --> abbreviations +\newcommand{\DrawTwoFaceU}{\DrawTwoFlatUp{0}{0}} +\newcommand{\DrawTwoFaceD}{\DrawTwoFlatDown{0}{0}} +\newcommand{\DrawTwoFaceL}{\DrawTwoFlatLeft{0}{0}} +\newcommand{\DrawTwoFaceR}{\DrawTwoFlatRight{0}{0}} +\newcommand{\DrawTwoFaceF}{\DrawTwoFlatFront{0}{0}} +\newcommand{\DrawTwoFaceB}{\DrawTwoFlatBack{0}{0}} +%% +%% v5: made short forms --> abbreviations +\newcommand{\DrawTwoFaceUS}{\DrawTwoFaceUpSide} +\newcommand{\DrawTwoFaceDS}{\DrawTwoFaceDownSide} +\newcommand{\DrawTwoFaceLS}{\DrawTwoFaceLeftSide} +\newcommand{\DrawTwoFaceRS}{\DrawTwoFaceRightSide} +\newcommand{\DrawTwoFaceFS}{\DrawTwoFaceFrontSide} +\newcommand{\DrawTwoFaceBS}{\DrawTwoFaceBackSide} +\newcommand{\TWOside@barRbackRU}[2]{% + %% #1 = cubie possn no, #2 = colour + %% tdx --> tdx + (2/3) + %% tdy --> tdy + (2/3) + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{2 + \tbs +0.666}% + \pgfmathsetmacro{\tdy}{#1 -1+0.5-\tblh +0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbl) + -- (\tdx+\tbw,\tdy+\tbl) -- (\tdx+\tbw,\tdy) -- cycle;% +}} +\newcommand{\DrawTwoCubeSidebarRBRU}{% + \TWOside@barRbackRU{2}{\Blt}% + \TWOside@barRbackRU{1}{\Blb}% +} +\newcommand{\DrawTwoCubeSidebarBRRU}{\DrawTwoCubeSidebarRBRU} +\newcommand{\DrawTwoCubeSidebarRB}[1]{\@join{\DrawTwoCubeSidebarRB}{#1}} +\newcommand{\DrawTwoCubeSidebarBR}[1]{\@join{\DrawTwoCubeSidebarBR}{#1}} +\newcommand{\TWOside@barTbackRU}[2]{% + %% #1 = cubie possn no; #2 = colour + %% tdx --> tdx + (2/3) + %% tdy --> tdy + (2/3) + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{#1 -1+0.5-\tblh +0.666}% + \pgfmathsetmacro{\tdy}{2 +\tbs +0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbw) + -- (\tdx+\tbl,\tdy+\tbw) -- (\tdx+\tbl,\tdy) -- cycle; +}} +\newcommand{\DrawTwoCubeSidebarUBRU}{% + \TWOside@barTbackRU{1}{\Brt}% + \TWOside@barTbackRU{2}{\Blt}% +} +\newcommand{\DrawTwoCubeSidebarBURU}{\DrawTwoCubeSidebarUBRU} +\newcommand{\DrawTwoCubeSidebarUB}[1]{\@join{\DrawTwoCubeSidebarUB}{#1}} +\newcommand{\DrawTwoCubeSidebarBU}[1]{\@join{\DrawTwoCubeSidebarBU}{#1}} +\newcommand{\DrawTwoCubeSidebarFLRU}{% + \TWOside@barL{2}{\Lrt}% + \TWOside@barL{1}{\Lrb}% +} +\newcommand{\DrawTwoCubeSidebarLFRU}{\DrawTwoCubeSidebarFLRU} +\newcommand{\DrawTwoCubeSidebarFL}[1]{\@join{\DrawTwoCubeSidebarFL}{#1}} +\newcommand{\DrawTwoCubeSidebarLF}[1]{\@join{\DrawTwoCubeSidebarLF}{#1}} +\newcommand{\DrawTwoCubeSidebarFDRU}{% + \TWOside@barB{1}{\Dlt}% + \TWOside@barB{2}{\Drt}% +} +\newcommand{\DrawTwoCubeSidebarDFRU}{\DrawTwoCubeSidebarFDRU} +\newcommand{\DrawTwoCubeSidebarFD}[1]{\@join{\DrawTwoCubeSidebarFD}{#1}} +\newcommand{\DrawTwoCubeSidebarDF}[1]{\@join{\DrawTwoCubeSidebarDF}{#1}} +\newcommand{\DrawTwoCubeSidebarDFLU}{\DrawTwoCubeSidebarDFRU} +\newcommand{\DrawTwoCubeSidebarFDLU}{\DrawTwoCubeSidebarFDRU} +\newcommand{\TWOside@barLbackLU}[2]{% + %% #1 = cubie possn no, #2 = colour + %% tdx --> tdx - 2/3 + %% tdy --> tdy + 2/3 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{0 - \tbs -\tbw -0.666}% + \pgfmathsetmacro{\tdy}{#1 -1+0.5-\tblh +0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbl) + -- (\tdx+\tbw,\tdy+\tbl) -- (\tdx+\tbw,\tdy) -- cycle; +}} +\newcommand{\DrawTwoCubeSidebarLBLU}{% + \TWOside@barLbackLU{2}{\Brt}% + \TWOside@barLbackLU{1}{\Brb}% +} +\newcommand{\DrawTwoCubeSidebarBLLU}{\DrawTwoCubeSidebarLBLU} +\newcommand{\DrawTwoCubeSidebarLB}[1]{\@join{\DrawTwoCubeSidebarLB}{#1}} +\newcommand{\DrawTwoCubeSidebarBL}[1]{\@join{\DrawTwoCubeSidebarBL}{#1}} +\newcommand{\TWOside@barTbackLU}[2]{% + %% #1 = cubie possn no; #2 = colour + %% tdx --> tdx-2/3 + %% tdy --> tdy+2/3 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{#1 -1+0.5-\tblh -0.666}% + \pgfmathsetmacro{\tdy}{2 +\tbs +0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbw) + -- (\tdx+\tbl,\tdy+\tbw) -- (\tdx+\tbl,\tdy) -- cycle; +}} +\newcommand{\DrawTwoCubeSidebarUBLU}{% + \TWOside@barTbackLU{1}{\Brt}% + \TWOside@barTbackLU{2}{\Blt}% +} +\newcommand{\DrawTwoCubeSidebarBULU}{\DrawTwoCubeSidebarUBLU} +\newcommand{\DrawTwoCubeSidebarFRLU}{% + \TWOside@barR{2}{\Rlt}% + \TWOside@barR{1}{\Rlb}% +} +\newcommand{\DrawTwoCubeSidebarRFLU}{\DrawTwoCubeSidebarFRLU} +\newcommand{\DrawTwoCubeSidebarFR}[1]{\@join{\DrawTwoCubeSidebarFR}{#1}} +\newcommand{\DrawTwoCubeSidebarRF}[1]{\@join{\DrawTwoCubeSidebarRF}{#1}} +\newcommand{\DrawTwoCubeSidebarFURD}{% + \TWOside@barT{1}{\Ulb}% + \TWOside@barT{2}{\Urb}% +} +\newcommand{\DrawTwoCubeSidebarUFRD}{\DrawTwoCubeSidebarFURD} +\newcommand{\DrawTwoCubeSidebarFU}[1]{\@join{\DrawTwoCubeSidebarFU}{#1}} +\newcommand{\DrawTwoCubeSidebarUF}[1]{\@join{\DrawTwoCubeSidebarUF}{#1}} +\newcommand{\DrawTwoCubeSidebarFLRD}{\DrawTwoCubeSidebarFLRU} +\newcommand{\DrawTwoCubeSidebarLFRD}{\DrawTwoCubeSidebarLFRU} +\newcommand{\TWOside@barRbackRD}[2]{% + %% #1 = cubie possn no, #2 = colour + %% tdx --> tdx + (2/3) + %% tdy --> tdy - (2/3) + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{2 + \tbs +0.666}% + \pgfmathsetmacro{\tdy}{#1 -1+0.5-\tblh -0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbl) + -- (\tdx+\tbw,\tdy+\tbl) -- (\tdx+\tbw,\tdy) -- cycle; +}} +\newcommand{\DrawTwoCubeSidebarRBRD}{% +\TWOside@barRbackRD{2}{\Blt}% +\TWOside@barRbackRD{1}{\Blb}% +} +\newcommand{\DrawTwoCubeSidebarBRRD}{\DrawTwoCubeSidebarRBRD} +\newcommand{\TWOside@barBbackRD}[2]{% + %% #1 = cubie possn no; #2 = colour + %% tdx --> tdx+2/3 + %% tdy --> tdy-2/3 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{#1 -1+0.5-\tblh +0.666}% + \pgfmathsetmacro{\tdy}{0 -\tbs - \tbw -0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbw) + -- (\tdx+\tbl,\tdy+\tbw) -- (\tdx+\tbl,\tdy) -- cycle; +}} +\newcommand{\DrawTwoCubeSidebarDBRD}{% + \TWOside@barBbackRD{1}{\Brb}% + \TWOside@barBbackRD{2}{\Blb}% +} +\newcommand{\DrawTwoCubeSidebarBDRD}{\DrawTwoCubeSidebarDBRD} +%% Now make the join commands +\newcommand{\DrawTwoCubeSidebarDB}[1]{\@join{\DrawTwoCubeSidebarDB}{#1}} +\newcommand{\DrawTwoCubeSidebarBD}[1]{\@join{\DrawTwoCubeSidebarBD}{#1}} +\newcommand{\DrawTwoCubeSidebarFULD}{\DrawTwoCubeSidebarFURD} +\newcommand{\DrawTwoCubeSidebarUFLD}{\DrawTwoCubeSidebarUFRD} +\newcommand{\DrawTwoCubeSidebarFRLD}{\DrawTwoCubeSidebarFRLU} +\newcommand{\DrawTwoCubeSidebarRFLD}{\DrawTwoCubeSidebarRFLU} +\newcommand{\TWOside@barLbackLD}[2]{% + %% #1 = cubie possn no, #2 = colour + %% tdx --> tdx-2/3 + %% tdy --> tdy-2/3 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{0 - \tbs -\tbw -0.666}% + \pgfmathsetmacro{\tdy}{#1 -1+0.5-\tblh -0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbl) + -- (\tdx+\tbw,\tdy+\tbl) -- (\tdx+\tbw,\tdy) -- cycle; +}} +\newcommand{\DrawTwoCubeSidebarLBLD}{% + \TWOside@barLbackLD{2}{\Brt}% + \TWOside@barLbackLD{1}{\Brb}% +} +\newcommand{\DrawTwoCubeSidebarBLLD}{\DrawTwoCubeSidebarLBLD} +\newcommand{\TWOside@barBbackLD}[2]{% + %% #1 = cubie possn no; #2 = colour + %% tdx --> tdx-2/3 + %% tdy --> tdy-2/3 + \ifthenelse{\equal{#2}{\no@sidebar}}{}{% + \pgfmathsetmacro{\tblh}{\tbl*(0.5)}% + \pgfmathsetmacro{\tdx}{#1 -1+0.5-\tblh -0.666}% + \pgfmathsetmacro{\tdy}{0 -\tbs - \tbw -0.666}% + \draw[fill=#2] (\tdx,\tdy) -- (\tdx,\tdy + \tbw) + -- (\tdx+\tbl,\tdy+\tbw) -- (\tdx+\tbl,\tdy) -- cycle; +}} +\newcommand{\DrawTwoCubeSidebarDBLD}{% +\TWOside@barBbackLD{1}{\Brb}% +\TWOside@barBbackLD{2}{\Blb}% +} +\newcommand{\DrawTwoCubeSidebarBDLD}{\DrawTwoCubeSidebarDBLD} +\pgfmathsetmacro{\@tx}{0.0833} +\pgfmathsetmacro{\@ty}{0.0833} +\newcommand{\@tr}[1]{{\@rubikfont #1}} +\newcommand{\@trp}[1]{{\@rubikfont #1\@rubikprime}} +\newcommand*{\tr}[1]{\@join{\tr}{#1}} +\newcommand*{\trh}[1]{\@join{\trh}{#1}} +\newcommand*{\Two}[1]{\@join{\Two}{#1}} +\newcommand*{\textTwo}[1]{\@join{\textTwo}{#1}} +\newcommand{\trB}{\rrB} +\newcommand{\trBp}{\rrBp} +\newcommand{\trhB}{\rrhB} +\newcommand{\trhBp}{\rrhBp} +\newcommand{\TwoB}{\RubikB} +\newcommand{\TwoBp}{\RubikBp} +\newcommand{\textTwoB}{\textRubikB} +\newcommand{\textTwoBp}{\textRubikBp} +%% +\newcommand{\trD}{\@tr{D}} +%% +\newcommand{\SquaretD}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\@sb,\@sddd - \@ty) -- (\@sbh, \@sddd - \@ty); +\draw [thick, ->] (\@sb,\@sd + \@ty) -- (\@sbh, \@sd + \@ty); +\end{tikzpicture}% +} +\newcommand{\trhD}{\raisebox{-0.333\height}{\@tlen\SquaretD\@tlen}} +%% +\newcommand{\TwoD}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretD\\ +\trD% +\end{minipage}% +}} +\newcommand{\textTwoD}{\trD\,\trhD} +\newcommand{\trDp}{\@trp{D}} +%% +\newcommand{\SquaretDp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\@sb,\@sddd - \@ty) -- (\@sbh, \@sddd - \@ty); +\draw [thick, <-] (\@sb,\@sd + \@ty) -- (\@sbh, \@sd + \@ty); +\end{tikzpicture}% +} +\newcommand{\trhDp}{\raisebox{-0.333\height}{\@tlen\SquaretDp\@tlen}} +%% +\newcommand{\TwoDp}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretDp\\ +\trDp% +\end{minipage}% +}} +\newcommand{\textTwoDp}{\trDp\,\trhDp} +\newcommand{\trF}{\rrF} +\newcommand{\trFp}{\rrFp} +\newcommand{\trhF}{\rrhF} +\newcommand{\trhFp}{\rrhFp} +\newcommand{\TwoF}{\RubikF} +\newcommand{\TwoFp}{\RubikFp} +\newcommand{\textTwoF}{\textRubikF} +\newcommand{\textTwoFp}{\textRubikFp} +\newcommand{\trL}{\@tr{L}} +%% +\newcommand{\SquaretL}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\@sd + \@tx, \@sb) -- (\@sd + \@tx, \@sbh); +\draw [thick] (\@sddd - \@tx, \@sb) -- (\@sddd - \@tx, \@sbh); +\end{tikzpicture}% +} +\newcommand{\trhL}{\raisebox{-0.333\height}{\@tlen\SquaretL\@tlen}} +%% +\newcommand{\TwoL}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretL\\ +\trL% +\end{minipage}% +}} +\newcommand{\textTwoL}{\trL\,\trhL} +\newcommand{\trLp}{\@trp{L}} +%% +\newcommand{\SquaretLp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick,->] (\@sd + \@tx, \@sb) -- (\@sd + \@tx, \@sbh); +\draw [thick] (\@sddd - \@tx, \@sb) -- (\@sddd - \@tx, \@sbh); +\end{tikzpicture}% +} +\newcommand{\trhLp}{\raisebox{-0.333\height}{\@tlen\SquaretLp\@tlen}} +%% +\newcommand{\TwoLp}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretLp\\ +\trLp% +\end{minipage}% +}} +\newcommand{\textTwoLp}{\trLp\,\trhLp} +\newcommand{\trR}{\@tr{R}} +%% +\newcommand{\SquaretR}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +%% draw three lines in the square, one with an arrow +\draw [thick] (\@sd + \@tx, \@sb) -- (\@sd + \@tx, \@sbh); +\draw [thick, ->] (\@sddd - \@tx, \@sb) -- (\@sddd - \@tx, \@sbh); +\end{tikzpicture}% +} +\newcommand{\trhR}{\raisebox{-0.333\height}{\@tlen\SquaretR\@tlen}} +%% +\newcommand{\TwoR}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretR\\ +\trR% +\end{minipage}% +}} +\newcommand{\textTwoR}{\trR\,\trhR} +\newcommand{\trRp}{\@trp{R}} +%% +\newcommand{\SquaretRp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\@sd + \@tx, \@sb) -- (\@sd + \@tx, \@sbh); +\draw [thick, <-] (\@sddd - \@tx, \@sb) -- (\@sddd - \@tx, \@sbh); +\end{tikzpicture}% +} +\newcommand{\trhRp}{\raisebox{-0.333\height}{\@tlen\SquaretRp\@tlen}} +%% +\newcommand{\TwoRp}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretRp\\ +\trRp% +\end{minipage}% +}} +\newcommand{\textTwoRp}{\trRp\,\trhRp} +\newcommand{\trU}{\@tr{U}} +%% +\newcommand{\SquaretU}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\@sb,\@sddd - \@ty) -- (\@sbh, \@sddd - \@ty); +\draw [thick] (\@sb,\@sd + \@ty) -- (\@sbh, \@sd + \@ty); +\end{tikzpicture}% +} +\newcommand{\trhU}{\raisebox{-0.333\height}{\@tlen\SquaretU\@tlen}} +%% +\newcommand{\TwoU}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretU\\ +\trU% +\end{minipage}%% +}} +\newcommand{\textTwoU}{\trU\,\trhU} +\newcommand{\trUp}{\@trp{U}} +%% +\newcommand{\SquaretUp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, ->] (\@sb,\@sddd - \@ty) -- (\@sbh, \@sddd - \@ty); +\draw [thick] (\@sb,\@sd + \@ty) -- (\@sbh, \@sd + \@ty); +\end{tikzpicture}% +} +\newcommand{\trhUp}{\raisebox{-0.333\height}{\@tlen\SquaretUp\@tlen}} +%% +\newcommand{\TwoUp}{% +{\@rubikfont% +\begin{minipage}{0.6cm} +\centering% +\SquaretUp\\ +\trUp% +\end{minipage}%% +}} +\newcommand{\textTwoUp}{\trUp\,\trhUp} +\newcommand{\trx}{\rrx} +\newcommand{\trxp}{\rrxp} +\newcommand{\try}{\rry} +\newcommand{\tryp}{\rryp} +\newcommand{\trz}{\rrz} +\newcommand{\trzp}{\rrzp} +\newcommand{\trl}{\rrl} + \newcommand{\trlp}{\rrlp} %%new +\newcommand{\trr}{\rrr} + \newcommand{\trrp}{\rrrp} %%new +\newcommand{\tru}{\rru} + \newcommand{\trup}{\rrup} %%new +\newcommand{\trd}{\rrd} + \newcommand{\trdp}{\rrdp} %%new +\newcommand{\trf}{\rrf} + \newcommand{\trfp}{\rrfp} %%new +\newcommand{\trb}{\rrb} + \newcommand{\trbp}{\rrbp} %%new +\newcommand{\trLc}{\rrLc} +\newcommand{\trLcp}{\rrLcp} +\newcommand{\trRc}{\rrRc} +\newcommand{\trRcp}{\rrRcp} +\newcommand{\trUc}{\rrUc} +\newcommand{\trUcp}{\rrUcp} +\newcommand{\trDc}{\rrDc} +\newcommand{\trDcp}{\rrDcp} +\newcommand{\trFc}{\rrFc} +\newcommand{\trFcp}{\rrFcp} +\newcommand{\trBc}{\rrBc} +\newcommand{\trBcp}{\rrBcp} +\newcommand{\trCL}{\rrCL} +\newcommand{\trCLp}{\rrCLp} +\newcommand{\trCR}{\rrCR} +\newcommand{\trCRp}{\rrCRp} +\newcommand{\trCU}{\rrCU} +\newcommand{\trCUp}{\rrCUp} +\newcommand{\trCD}{\rrCD} +\newcommand{\trCDp}{\rrCDp} +\newcommand{\trCF}{\rrCF} +\newcommand{\trCFp}{\rrCFp} +\newcommand{\trCB}{\rrCB} +\newcommand{\trCBp}{\rrCBp} +\newcommand{\trhx}{\rrhx} +\newcommand{\trhxp}{\rrhxp} +\newcommand{\trhy}{\rrhy} +\newcommand{\trhyp}{\rrhyp} +\newcommand{\trhz}{\rrhz} +\newcommand{\trhzp}{\rrhzp} +\newcommand{\trhl}{\rrhl} + \newcommand{\trhlp}{\rrhlp} % new +\newcommand{\trhr}{\rrhr} + \newcommand{\trhrp}{\rrhrp} % new +\newcommand{\trhu}{\rrhu} + \newcommand{\trhup}{\rrhup} % new +\newcommand{\trhd}{\rrhd} + \newcommand{\trhdp}{\rrhdp} % new +\newcommand{\trhf}{\rrhf} + \newcommand{\trhfp}{\rrhfp} % new +\newcommand{\trhb}{\rrhb} + \newcommand{\trhbp}{\rrhbp} % new +\newcommand{\trhLc}{\rrhLc} +\newcommand{\trhLcp}{\rrhLcp} +\newcommand{\trhRc}{\rrhRc} +\newcommand{\trhRcp}{\rrhRcp} +\newcommand{\trhUc}{\rrhUc} +\newcommand{\trhUcp}{\rrhUcp} +\newcommand{\trhDc}{\rrhDc} +\newcommand{\trhDcp}{\rrhDcp} +\newcommand{\trhFc}{\rrhFc} +\newcommand{\trhFcp}{\rrhFcp} +\newcommand{\trhBc}{\rrhBc} +\newcommand{\trhBcp}{\rrhBcp} +\newcommand{\trhCL}{\rrhCL} +\newcommand{\trhCLp}{\rrhCLp} +\newcommand{\trhCR}{\rrhCR} +\newcommand{\trhCRp}{\rrhCRp} +\newcommand{\trhCU}{\rrhCU} +\newcommand{\trhCUp}{\rrhCUp} +\newcommand{\trhCD}{\rrhCD} +\newcommand{\trhCDp}{\rrhCDp} +\newcommand{\trhCF}{\rrhCF} +\newcommand{\trhCFp}{\rrhCFp} +\newcommand{\trhCB}{\rrhCB} +\newcommand{\trhCBp}{\rrhCBp} +\newcommand{\Twox}{\Rubikx} +\newcommand{\Twoxp}{\Rubikxp} +\newcommand{\Twoy}{\Rubiky} +\newcommand{\Twoyp}{\Rubikyp} +\newcommand{\Twoz}{\Rubikz} +\newcommand{\Twozp}{\Rubikzp} +\newcommand{\Twol}{\Rubikl} + \newcommand{\Twolp}{\Rubiklp} % new +\newcommand{\Twor}{\Rubikr} + \newcommand{\Tworp}{\Rubikrp} % new +\newcommand{\Twou}{\Rubiku} + \newcommand{\Twoup}{\Rubikup} % new +\newcommand{\Twod}{\Rubikd} + \newcommand{\Twodp}{\Rubikdp} % new +\newcommand{\Twof}{\Rubikf} + \newcommand{\Twofp}{\Rubikfp} % new +\newcommand{\Twob}{\Rubikb} + \newcommand{\Twobp}{\Rubikbp} % new +\newcommand{\TwoLc}{\RubikLc} +\newcommand{\TwoLcp}{\RubikLcp} +\newcommand{\TwoRc}{\RubikRc} +\newcommand{\TwoRcp}{\RubikRcp} +\newcommand{\TwoUc}{\RubikUc} +\newcommand{\TwoUcp}{\RubikUcp} +\newcommand{\TwoDc}{\RubikDc} +\newcommand{\TwoDcp}{\RubikDcp} +\newcommand{\TwoFc}{\RubikFc} +\newcommand{\TwoFcp}{\RubikFcp} +\newcommand{\TwoBc}{\RubikBc} +\newcommand{\TwoBcp}{\RubikBcp} +\newcommand{\TwoCL}{\RubikCL} +\newcommand{\TwoCLp}{\RubikCLp} +\newcommand{\TwoCR}{\RubikCR} +\newcommand{\TwoCRp}{\RubikCRp} +\newcommand{\TwoCU}{\RubikCU} +\newcommand{\TwoCUp}{\RubikCUp} +\newcommand{\TwoCD}{\RubikCD} +\newcommand{\TwoCDp}{\RubikCDp} +\newcommand{\TwoCF}{\RubikCF} +\newcommand{\TwoCFp}{\RubikCFp} +\newcommand{\TwoCB}{\RubikCB} +\newcommand{\TwoCBp}{\RubikCBp} +\newcommand{\textTwox}{\rrhx} +\newcommand{\textTwoxp}{\rrhxp} +\newcommand{\textTwoy}{\rrhy} +\newcommand{\textTwoyp}{\rrhyp} +\newcommand{\textTwoz}{\rrhz} +\newcommand{\textTwozp}{\rrhzp} +\newcommand{\textTwol}{\rrhl} + \newcommand{\textTwolp}{\rrhlp} %new +\newcommand{\textTwor}{\rrhr} + \newcommand{\textTworp}{\rrhrp} %new +\newcommand{\textTwou}{\rrhu} + \newcommand{\textTwoup}{\rrhup} %new +\newcommand{\textTwod}{\rrhd} + \newcommand{\textTwodp}{\rrhdp} %new +\newcommand{\textTwof}{\rrhf} + \newcommand{\textTwofp}{\rrhfp} %new +\newcommand{\textTwob}{\rrhb} + \newcommand{\textTwobp}{\rrhbp} %new +\newcommand{\textTwoLc}{\rrhLc} +\newcommand{\textTwoLcp}{\rrhLcp} +\newcommand{\textTwoRc}{\rrhRc} +\newcommand{\textTwoRcp}{\rrhRcp} +\newcommand{\textTwoUc}{\rrhUc} +\newcommand{\textTwoUcp}{\rrhUcp} +\newcommand{\textTwoDc}{\rrhDc} +\newcommand{\textTwoDcp}{\rrhDcp} +\newcommand{\textTwoFc}{\rrhFc} +\newcommand{\textTwoFcp}{\rrhFcp} +\newcommand{\textTwoBc}{\rrhBc} +\newcommand{\textTwoBcp}{\rrhBcp} +\newcommand{\textTwoCL}{\rrhCL} +\newcommand{\textTwoCLp}{\rrhCLp} +\newcommand{\textTwoCR}{\rrhCR} +\newcommand{\textTwoCRp}{\rrhCRp} +\newcommand{\textTwoCU}{\rrhCU} +\newcommand{\textTwoCUp}{\rrhCUp} +\newcommand{\textTwoCD}{\rrhCD} +\newcommand{\textTwoCDp}{\rrhCDp} +\newcommand{\textTwoCF}{\rrhCF} +\newcommand{\textTwoCFp}{\rrhCFp} +\newcommand{\textTwoCB}{\rrhCB} +\newcommand{\textTwoCBp}{\rrhCBp} +\endinput +%% +%% End of file `rubiktwocube.sty'. |