% \iffalse meta-comment
%
%  rubikcube.dtx
% 
%  version 3.0    25 September 2015
%
%  Copyright 2015  
%  RWD Nickalls (dick@nickalls.org) and 
%  A Syropoulos (asyropoulos@yahoo.com)
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% 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 rubikcube.dtx and rubikcube.ins
% and the derived file rubikcube.sty.
%
%<*readme>
%
% The rubikcube package provides a collection of LaTeX commands and macros 
% for the typesetting of Rubik cube configurations and rotation 
% sequences using the TikZ graphic language.
%
% Please report errors or suggestions for improvement to
%
%         Dick Nickalls or Apostolos Syropoulos
%
% This package requires the basic TikZ package to be loaded already
%</readme>
%
%<*driver>
\listfiles
\documentclass{ltxdoc}
\IfFileExists{rubikcube.sty}{\usepackage{rubikcube}}{%
    \GenericWarning{rubikcube.dtx}{Package file rubikcube.sty not found.
    Documentation will be messed up!^^J
    (Generate rubikcube.sty by (La)TeXing rubikcube.ins, and then^^J
    process rubikcube.dtx again)^^J}\stop
}%
\usepackage{ifpdf}
\usepackage{url,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{rubikcube.dtx}
  \PrintChanges
  \PrintIndex
\end{document}
%</driver>
% \fi
%
%
% 
% \CheckSum{4105}
%
%%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%
%
% \title{The \textsc{rubikcube} package}
%
% \author{
%      RWD Nickalls (dick@nickalls.org) \\
%     A Syropoulos (asyropoulos@yahoo.com)
%       }
%  \date{This file describes version \RCfileversion\ (\RCfiledate)\\
%   \texttt{www.ctan.org/pkg/rubik}}
%  \maketitle
%
%  \begin{abstract}
%  The \rubikcube\ package provides LaTeX commands and macros 
%  for  typesetting  Rubik cube (3x3x3) notation,  configurations, and 
%  rotation sequences  using the  TikZ graphic language. It is part of the 
%   rubik `bundle'.
%  \end{abstract}
%
% \medskip
%
% \begin{minipage}{11cm}
% \centering
% \ifpdf
%  \includegraphics[width=10cm]{Rubik-doc-figF.pdf}
% \else
% \fi
% \end{minipage}
%
%  \tableofcontents
%
% \pagebreak
%
% \section{Introduction}
%
% The  \rubikcube\  package (part of the \textsc{rubik} `bundle') provides  a 
% collection of \LaTeX\ commands 
% and macros for  typesetting  Rubik cube  configurations  using the  
% PGF/TikZ graphic languages. Note that this package relates  only to  the 
% familiar  3x3x3 Rubik cube. 
% We have extended  the  layer-rotation  hieroglyphic notation,  originally  
% developed  by Garfath-Cox (1981), and improved by Duvoid (2010, 2011).
%
% The \rubikcube\ package is designed to be  used in conjunction 
% with the  \textsc{rubikrotation} package (see below); the former deals 
% primarily with  typesetting, while the latter  processes  rotation sequences
%  and keeps  track of the cube's configuration.
%
%  The \rubikcube\ package has been road-tested  on a Microsoft 
%  platform (with \textsf{MiK}\TeX), a Linux platform (Mandriva and {\TeX}Live),
%  and on a Solaris platform (OpenIndiana).
%
% 
% For the mathematics and group theory associated with the   Rubik cube  see Chen~(2004), 
% Davis (2006), Golomb~(1981, 1982), Joyner~(2008), Hofstadter (1981), Hutchings~(2011), 
% Kociemba web site, Rokicki~\textit{et al.} (2013), Tran~(2005).
%  Useful web sites for solvers are the Speedsolving website, and  those 
% maintained  by Duvoid,  by Fridrich, by Jelinek,  by Reid, and by Vandenburgh 
% (see References).
%
%
%      \subsection{Requirements}
%
%  The \rubikcube\ package requires the TikZ package.
%  In particular, we make  use the \cmd{\pgfmathsetmacro} command and 
% the TikZ picture environment.
%
%
%  \subsection[rubikrotation package]{Supporting  tool---the 
%   \textsc{rubikrotation} package}
%  \label{sec:addons}
%
%  The \textsc{rubikrotation} package, is a dynamic extension to
% the \rubikcube\ package, and is part of the `Rubk bundle'. It consists of  the  
% Perl program  \texttt{rubikrotation.pl}  and the associated  style option
%  \texttt{rubikrotation.sty}. 
%  The \textsc{rubikrotation} package  implements rotation sequences and 
%  random  scrambling of the 3x3x3 Rubik cube on-the-fly using a
%   \cmd{\RubikRotation}\marg{rotation-sequence} command. It returns the 
% new state in a form which is then used by the \rubikcube\ package.
%
%  Since the  \cmd{\RubikRotation} command works by \textsc{call}ing the  
%  \texttt{rubikrotation.pl} program, it follows that the \textsc{rubikrotation}
%   package requires  (a)~Perl to be installed, 
%  and (b)~\LaTeX\ needs to be run using the  \texttt{--shell-escape} commandline option.
%  See the \textsc{rubikrotation}  documentation for details.
%
%
%  \subsection{Copyright}
%  Copyright 2014--2015 RWD Nickalls and A Syropoulos.
%
% \medskip
% {\noindent}This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or any
% later version. The latest version of this licence is in 
%  |www.latex-project.org/lppl.txt|
%
%
% \section{Installation}
%
%
%  \subsection{Generating the files}
%
%  Place the file \texttt{rubikcube.zip} into a temporary directory, and unzip it. 
% This will generate the following files:
%\begin{verbatim}
%   rubikcube.ins
%   rubikcube.dtx
%   rubikcube.pdf
%   Rubik-doc-figA.pdf
%   Rubik-doc-figB.pdf
%   Rubik-doc-figC.pdf
%   Rubik-doc-figD.pdf
%   Rubik-doc-figE.pdf
%   Rubik-doc-figF.pdf
%\end{verbatim}
%  The  style option \texttt{rubikcube.sty} is generated by  running (pdf)\LaTeX\ on  
% the file \texttt{rubikcube.ins}  as follows:
%\begin{verbatim}
%   pdflatex  rubikcube.ins 
%\end{verbatim}
% This documentation file (\texttt{rubikcube.pdf}) can then be generated using the following
% steps\,\footnote{Since the documentation includes a complicated indexing 
% system as well a \textsc{pdf} index and hyperef links (the package \texttt{hypdoc}
% is used), then  several pdflatex runs are required. Prior to the first run it is
% a good idea to delete any relevant \texttt{.toc}, \texttt{.aux}, \texttt{.out} files.}:
%\begin{verbatim}
%   pdflatex   rubikcube.dtx
%   pdflatex   rubikcube.dtx
%   makeindex -s gind.ist  rubikcube
%   makeindex -s gglo.ist -o rubikcube.gls  rubikcube.glo
%   pdflatex   rubikcube.dtx
%   pdflatex   rubikcube.dtx
%\end{verbatim}
%
%
%  \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\{rubikcube\}}.
% Note that the \rubikcube\ package requires the TikZ package, and so always load TikZ 
% before \rubikcube\  as follows:
% \begin{quote}
%\begin{verbatim}
% \usepackage{tikz}
% \usepackage{rubikcube,rubikrotation}
%\end{verbatim}
% \end{quote}
% However, the \rubikcube\ package does check for the presence of TikZ, and will 
% load it  if TikZ is not already loaded.
% While \rubikcube\ is a stand-alone package, it is best to also load the complementary
%  \textsc{rubikrotation}  package.
%
%
%    \section{TikZ picture environment}
%      \label{sec:tikz}
%
%  For a basic introduction to the use of TikZ see the following manuals
%  (from CTAN or from \texttt{http://altermundus.com/}).
%  \begin{itemize}
%  \item \texttt{pgfmanual.pdf}, version 3.0.1a (August 2015) (1161 pages)
%  \item \texttt{pgfplot.pdf}, version 1.12.1 (2015) (504 pages)
%  \item tkz-base-screen.pdf
%  \end{itemize}
% An example of the TikZ picture environment for use with the \rubikcube\ package 
% is as follows:  
% \begin{quote}
%\begin{verbatim}
% \begin{tikzpicture}[scale=0.5]
% ....
% \end{tikzpicture}%
%\end{verbatim}
% \end{quote}
% If no scale is used (default scale = 1), then each of the small
% cubie sides  will have a length of 1~cm.
%
% A very useful feature of  TikZ  is that it automatically 
% minimises the surrounding  white-space, and consequently this is 
% mostly quite sufficient. However, it is good practice to place 
% a \% symbol after the \verb!\end{tikzpicture}! command *see above) 
% to avoid  additional white space (see Section~\ref{sec:trailingpercent}).
%
%
%   \subsection[ShowCube command]{\cmd{\ShowCube} command}
%   \label{sec:showcube}
%
% \DescribeMacro{\ShowCube}
% \DescribeMacro{\ShowCubeF}
% When making side-by-side figures it can be very helpful
%  to place each sub-figure inside a  minipage.
% In this case, a useful approach is to  first adjust 
% the  tikzpicture `scale' parameter  to obtain the appropriate size, and 
% then adjust the minipage width as necessary 
% (see Section~\ref{sec:sizeofminipage}).
% The  \cmd{\ShowCube} macro (See Section~\ref{sec:showcubecode}) places one 
% or more commands  inside a tikzpicture environment  and places all of 
% these inside a minipage.  It takes three arguments: the first is the 
% minipage width (\verb!#1!), second is  the tikzpicture scale 
% factor (\verb!#2!), and third is a \cmd{\Draw..} command (|#3|).
% 
% \noindent\textsc{usage}:
% The following command would display a Rubik cube  in a 
% minipage of  width 2cm  using a tikzpicture scale factor of 0.5:
%\begin{verbatim}
% \ShowCube{2cm}{0.5}{\DrawRubikCubeRU}
%\end{verbatim}
% For example, the following two sets of commands are equivalent (see
%  Section~\ref{sec:showcubecode} for the code); i.e.,~any commands which are valid in
% a \texttt{tikzpicture} environment may be used as the main argument for the 
% \cmd{\ShowCube} command.
% $$
%   \left.
%   \begin{array}{l} 
%   \verb!\RubikCubeSolved!\\
%   \verb!\begin{minipage}{2cm}!\\
%   \ \   \verb!\centering!\\
%   \ \   \verb!\begin{tikzpicture}[scale=0.5]!\\
%   \ \ \ \ \   \verb!\DrawRubikCubeRU!\\
%   \ \ \ \ \   \verb!\draw[->] (0.5,5) -- (0.5,4);!\\
%   \ \   \verb!\end{tikzpicture}!\\
%   \verb!\end{minipage}!\\
%   \end{array}
%         \right\}  
%                 \begin{array}{l}  
%                 \verb!\RubikCubeSolved!\\
%                 \verb!\ShowCube{2cm}{0.5}{%!\\
%                 \ \ \ \ \verb!\DrawRubikCubeRU!\\
%                 \ \ \ \ \verb!\draw[->] (0.5,5) -- (0.5,4);!\\
%                 \ \verb!}!\\
%                 \end{array}
% $$
%
% The  \cmd{\ShowCubeF} command is similar in all respects except that it places 
% an fbox around the minipage in order to enable users to see the extent of any 
% associated white space.
%
% Unexpected spacing between two adjacent images, or between an 
% image and adjacent text, is usually related to 
% `hidden' white-space associated with the image itself or excessive width 
% of the associated \cmd{\minipage} (see also Section~\ref{sec:trailingpercent}).
% Consequently,  a temporary fbox around the minipage can be a 
% useful aid  when trying to  visualise the  full extent of the minipage 
% (and its associated whitespace). Use the \cmd{\ShowCubeF} command for this, as follows:
%
% \medskip
%
% \RubikCubeSolved
% \ShowCubeF{4cm}{0.3}{\DrawRubikCubeRU}
%\begin{minipage}{5cm}
%\begin{verbatim}
% \ShowCubeF{4cm}{0.3}{\DrawRubikCubeRU}
%\end{verbatim}
%\end{minipage}
%
% \medskip
% {\noindent}Clearly either the minipage is too wide (4cm) or the \texttt{tikzpicture} 
% scale factor is too  small (0.3). Once the figure/code has been corrected, then the 
% \texttt{F}  in  the  \cmd{\ShowCubeF} command  can be removed. Note that while 
% the \cmd{\ShowCube} command centers  the image  inside the minipage, \LaTeX\ positions 
% the minipage in the \cmd{\textwidth}, and  hence it is  generally best to minimise 
% the white-space as revealed by the \cmd{\ShowCubeF}  command.  The relationship 
% between the required width of the minipage and the TikZ  scale factor  for the various 
% Rubik cube images is detailed in  Section~\ref{sec:sizeofminipage}.
%
%
%
%   \subsection[Draw.. error message]{\cmd{\Draw} error message}
%   \label{sec:drawerrormessage}
%
% If a \rubikcube\   \cmd{\Draw..} command is used \textit{outside} a 
% TikZ picture  environment, then \LaTeX\  issues an
%  ``Undefined control sequence'' error message, indicating 
% that it is trying to draw  something using an undefined 
% TikZ \cmd{\draw} command. 
%
% For example, if we  use  the \rubikcube\ command 
%  \cmd{\DrawRubikFlat}  without a surrounding TikZ picture environment 
%  then something similar to  the following error message will be generated.
%\begin{verbatim} 
%! Undefined control sequence.
%\DrawFlatUp ... }{#1}\pgfmathsetmacro {\uy }{#2}\draw
%                                                      [line join=round,...
%l.56 \DrawRubikFlat
%\end{verbatim}
%
%
%
%        \section{Command conventions}
%        \label{sec:conventions}
%
%   \subsection{Commands and  environments}
%
% Although the \rubikcube\ package has been designed with TikZ in mind, 
% it is important to appreciate that of all the  various \rubikcube\  
% commands only the Rubik \cmd{\Draw...} commands and  TikZ commands actually 
% have to be  used  inside  a  TikZ picture environment. 
%
% Indeed, using  \rubikcube\  commands which influence the Rubik colour state
% (configuration) outside the \texttt{tikzpicture}, \texttt{minipage} or 
% \texttt{figure}  environments can make for useful 
% flexibility when a document is generating  more than one figure
% or image. This is because the scope of any colours specified by commands inside
% these  environments is constrained to 
% be `local' to that particular environment, and hence  any change in the 
% Rubik colour state brought  about by such commands is not accessable 
% globally (i.e.,~outside  the environment) ---see also Section~5 in the documentation 
% of the \textsc{rubikrotation} package.
%
% Consequently users need to be mindful of the  environments when  
% drawing long sequences of rotations across several figures; for example, keeping 
% \cmd{\RubikRotation} commands outside the environments keeps their effects global. 
%
%   \subsection{Capital letters}
%
%  Each `word' in a command (except the word `text')  starts with a capital letter. 
%  For example,  \cmd{\DrawRubikCubeRU}, \cmd{\DrawCubieRU}. 
%  However, as with  \LaTeX,  `text..' commands start with a lowercase `t'; 
%  for example \cmd{\textCubieRU}.  Letters  for  colours (R, O, Y, G, B, W, X)  are 
%  always written in uppercase. 
%
%
%     \subsection{XYZ argument ordering}
%
% Many commands have an appended two (XY) or three (XYZ) ordered letter code 
% which is used to for  specifying some feature of the command; perhaps 
%  either  face or cubie colours or a viewpoint direction. 
%
% The convention is that the letter codes are ordered in the XYZ order; 
% i.e.,~the first code relates to  an X-related parameter; 
% for example  L (Left) or R (Right); the second relates to  a Y-related 
% parameter;  for example  U (Up) or D (Down); the third (if required) 
% relates to  a Z-related  parameter;  for example  F (Front) or B (Back).
%
%
% \textsc{example}: |\DrawCubieRU{G}{Y}{O}|  draws a cubie from 
% the RightUp viewpoint. The sequence of  colour codes for the three visible 
% faces are XYZ ordered, and hence result in the cube having a Green Right face, 
% Yellow Up face and Orange Front face.
%
%
%  \subsection{Trailing \% on the end of commands}
% \label{sec:trailingpercent}
%
% It is important to include a trailing \% on the end of \rubikcube\ 
% commands when used \textit{outside}  a TikZ picture environment, and 
% also on the end of each \cmd{\end\{tikzpicture\}} environment command. 
% This is to prevent  unwanted `space' characters appearing in 
% the graphics. In \TeX\ every newline character is automatically converted
%  to a white space---unless you have an empty line 
% (Feuers\"{a}nger 2015, \S\,3.2.3, page~20). 
%
%
%
%     \subsection{Cubies, cubicles, faces and facelets}
%
% The  sub-cubes which make up the Rubik cube are  known as `cubies'; the small 
% coloured  face of a cubie is known as a `facelet'. The cubies 
% are named  either  according to  the colours of their  two or three  facelets, or 
% according to their physical position.   
%
% We distinguish three types of cubie:  
% centre-cubies (single colour), edge-cubies (two colours) and corner-cubies 
% (three colours). For example, the red/white edge-cubie  is called  
% the RW cubie, and  the red/white/green corner-cubie  is called the 
% RWG cubie etc. Note that the colour of a particular face of a  3x3x3 Rubik 
% cube is determined by the colour of its  centre-cubie. 
%
% Similarly, the positions (known as `cubicles') occupied by cubies  are 
% defined using either a  two or three  letter face  code. For example the  
% right edge position  in the Up-layer is termed  the  Up/Right position, 
% or just the UR position, and the  corner   joining the \textsc{down}  
% \textsc{front} and \textsc{right} faces is the DFR position.    
%
%
%
%    \section{Colours}
%
% The \rubikcube\ package uses seven colours which are defined as follows: 
% red~(R), orange~(O), yellow~(Y),  green~(G), blue~(B),  white~(W), 
% and   grey~(X). Now  according to the following webpage\,\footnote{We thank Peter Bartal  
% for bringing this to our attention.}
%
% \medskip
% \noindent\texttt{http://The-Rubiks-Cube.deviantart.com/journal/Using-Official-Rubik}
% \newline\texttt{-s-Cube-Colors-268760351}
%
% \medskip
% {\noindent}the official Rubik cube colours are defined as
% \begin{quote}
%\begin{verbatim}
% .... colours which are red (PMS 200C*), green (PMS 347C*),
% blue (PMS 293C*), orange (PMS 021C*), yellow (PMS 012C*)
% and white.
% .....
% Pantone colors can not be accurately converted to RGB colors, 
% the colors the web runs on. But they can be approximated. 
% Through some research, I have found some estimations which 
% may help you which I have listed below. Remember, these are
% just approximate RGB equivalents to the official Rubik's Cube
%  colors.
% 
% Red: 200C #C41E3A  (www.perbang.dk/rgb/c41e3a/)
% Green: 347C #009E60 (www.perbang.dk/rgb/009e60/)
% Blue: 293C #0051BA (www.perbang.dk/rgb/0051ba/)
% Orange: 021C "Pantone Orange" #FF5800 (www.perbang.dk/rgb/ff5800/)
% Yellow: 012C "Pantone Yellow" #FFD500 (www.perbang.dk/rgb/ffd500/)
% White: N/A #FFFFFF
%
% Red    {HTML}{C41E3A}
% green  {HTML}{009E60}
% Blue   {HTML}{0051BA}
% Yellow {HTML}{FFD500}
% Orange {HTML}{FF5800}
% White  {HTML}{FFFFFF}
%\end{verbatim}
% \end{quote}
%  However, we have optimised these prescribed colours very slightly 
%  for screen \& print use (for example, the yellow  was made very 
%  slightly brighter),  and so the actual colours implemented by 
%  the \rubikcube\ package  are as follows 
% (see Section~\ref{sec:codecolours}):
%
% \begin{quote}
%\begin{verbatim}
% \definecolor{R}{HTML}{C41E33}
% \definecolor{G}{HTML}{00BE38}
% \definecolor{B}{HTML}{0051BA}
% \definecolor{Y}{HTML}{FFFF00}
% \colorlet{O}{orange}
% \colorlet{W}{white}
% \colorlet{X}{black!30}%
%\end{verbatim}
% \end{quote}
% Different colours  can be allocated   to  the ROYGBWX letters  (using the 
% \cmd{\colorlet} command) as required. For example, the standard `red' 
% colour could  be allocated to the letter R using the command
% \begin{quote}
%    \cmd{\colorlet\{R\}\{red\}}
% \end{quote}
% However, it is important to appreciate that  the letter codes 
% ROYGBWX are `hardwired' into many of the macros in the \rubikcube\ package,
%  so don't change these.
%
%
%
%     \subsection{Colour state of the cube}
%     \label{sec:colourstate}
%
% Initially, when \LaTeX\ reads the file \texttt{rubikcube.sty} all facelets
% are allocated the code X, which can be regarded as a zero-colour state. 
% Until a facelet is allocated  one of the six  Rubik colours it will be  rendered as
%   grey  by a command  which just draws the current colour state of the cube or  a face 
%  (e.g.,~\cmd{\DrawFlatUpSide}).
%
% It is important to appreciate that the various commands which typeset faces 
% or facelets with colours  differ in whether  they derive the colours
% from the current internal colour `state' (configuration) of the Rubik cube, or not. 
% 
% The colour state of cubies in faces and slices can be allocated using  \cmd{\RubikFace...} 
% and \cmd{\RubikSlice...} (see Sections~\ref{sec:facecommands} and \ref{sec:slicecommands}).
% The commands \cmd{\RubikCubeSolved} and \cmd{RubikCubeGrey} allocate the colour state
% for the whole cube, and are useful starting points for subsequent rotations. 
% Note that cubies will retain their colour allocation even if the cubies are are moved by 
% rotation commands, unless they are overwritten by a subsequent colour allocation command.
% To  then visualise the cube one has to use a \cmd{\Draw...} command.
%
% The \textsc{rubikrotation} package keeps track of the Rubik state following
% rotations and sequences of rotations processed by its \cmd{\RubikRotation} command.
% The current colour state of the Rubik cube can be saved and  written to a named file 
% using its  \cmd{\SaveRubikState} command; this file can then be \cmd{\input}  when required. 
%
% Note that although some \cmd{\Draw...} commands (e.g.,~\cmd{\DrawRubikLayerFace...}) use 
% colours as arguments, these commands really only  `paint' colours onto  cubie positions 
% (on the page, so to speak); i.e.,~these commands do not update the internal Rubik 
% colour state, and hence  these colours do not  exist outside  the particular
%  \texttt{tikzpicture} environment the \cmd{\Draw..} command was used in.
%
%
%     \section{Rubik cube coordinates}
%     \label{sec:coordinates}
%
% The coordinate origin  of each view of the Rubik cube  is located  
% at the bottom-left corner of the \textsc{front} face, as shown in 
%  Figure~\ref{fig:cubesquaregraph}. Note also that the bottom left 
%  corner of the cube  itself is at $(-1,-1)$, 
%  and hence the default height and width of the cube is 4cm. 
%
% Using the \textsc{front} bottom-left corner as the origin
% is an important feature since knowing the location of the 
% origin enables one to easily use any of the  TikZ commands
% (e.g.,~\cmd{\draw} and \cmd{\node} commands) to  superimpose lines, 
% arrows and text etc.\ onto the Rubik cube (see Section~\ref{sec:arrows}).
%
% \begin{figure}[hbt]
% \centering
% \ifpdf
%   \includegraphics[height=3cm]{Rubik-doc-figB.pdf}
% \else
% \includegraphics[height=3cm]{Rubik-doc-figB.eps}
% \fi
%
% \parbox{9cm}{\caption{\label{fig:cubesquaregraph}Origin of coordinates 
%  is at the  bottom left corner of the grey \textsc{front} face. 
%  The bottom left corner of the cube  itself is at $(-1,-1)$, 
%  and hence the default height and width of the 3D-cube is 4cm.}}
% \end{figure}
%
%
%
%      \subsection[Size of cube minipage]{Size of cube \cmd{\minipage}}
%      \label{sec:sizeofminipage}
%
%  Since the the default height and width of the 3D-cube is 4cm (see above), 
%  it follows that the width of the \cmd{\minipage} required for a cube in a 
%  \texttt{tikzpicture}  environment can be easily calculated. For example, 
%  if the \texttt{tikzpicture} scale factor used is $0.5$, then the minimum
%  width of the required minipage for the \cmd{\DrawRubikCubeLD} view (shown above)
%  is therefore $0.5 \times 4\mbox{cm} =  2\mbox{cm}$. 
%
% The default width of the semi-flat cube representation is 10cm ($=3+3+1+3$), 
% and that of the  flat cube is 12cm ($=3+3+3+3$). If in doubt check the extent of 
% any horizontal white-space  using an fbox, or the \cmd{\ShowCubeF} command.
%
%
%
%      \section{Rotation commands}
%      \label{sec:RubikCommands} 
%
% We  use the standard Rubik cube notation  of WCA~(2012)---see article~12---and
% also the `s' (Slice) and `a' (anti-Slice) notation described in   the 
% `Notation and terminology' section
% in the `Pretty patterns' page on the website of  
% Fridrich (see References).
% 
% It is recommended  that  commas  are used to separate sequential 
% Rubik moves or commands to avoid  ambiguity, especially when using just
%  lettercodes on their own. 
% For example, in the following sequence the commas  remove any ambiguity:
%  \rr{U},\rr{Lw}2,\rr{Usp},\rr{Da} \ \ (|\rr{U},\rr{Lw}2,\rr{Usp},\rr{Da}|).
%
% 
%
%   \subsection{Overview}
%     \label{sec:overview}
%
% The \rubikcube\  notation  comprises  a range of 
% commands for moves or rotations (e.g.,~\rr{R}, \rr{y}, \rr{Bw}) and their equivalent  hieroglyphs 
% (e.g.,~\rrh{R}, \rrh{y}, \rrh{Bw}), as well as commands for  drawing 3x3x3 cubes and single cubies.
%
% Note that there are a few rotation commands which  do not have arrow 
% hieroglyphs---their their rotation  is not visible from the \textsc{front} face 
% and hence cannot easily be rendered as  an arrow hieroglyph. Consequently these 
% rotations  have a simple `letter' hieroglyph 
% in the form of the rotation-code in a square; for example \rrhBw, \rrhSb. 
%
% \DescribeMacro{\rr}
%  The rotation-code of a rotation is typeset  (as in text) using the rubik-rotation 
%  \cmd{\rr\marg{rotation-code}} command: i.e.,~\rr{R}\ is typeset using the command \cmd{\rr\{R\}}. 
% The hieroglyph of a rotation command is generated  (in text) by
% \DescribeMacro{\rrh}
% using instead the command \cmd{\rrh\marg{rotation-code}}. Thus the command \cmd{\rrh\{R\}} generates 
% \rrh{R}\  which is the hieroglyph associated with \rr{R}.
%
% \DescribeMacro{\Rubik}
% A vertically combined rotation-code  and its hieroglyph  is generated using the command 
% \cmd{\Rubik\marg{rotation-code}}. For example, \Rubik{R}\ is generated by the command \cmd{\Rubik\{R\}}, 
% with  the square hieroglyph sitting on the baseline.
% For some hieroglyphs (e.g.,~\rrh{x}, \rrh{y}, \rrh{z}\ denoting 90~degree axis rotations) 
% the only  difference between the \cmd{\rrh\{\}} and \cmd{\Rubik\{\}} forms is that 
% the \cmd{\Rubik\{\}}  form is elevated  to sit on the baseline just like the other
%  \cmd{\Rubik\{\}} hieroglyphs. 
% For example \cmd{\rrh\{yp\}} generates \rrh{yp}, while
% \cmd{\Rubik\{yp\}} generates \Rubik{yp}.
% 
% \DescribeMacro{\textRubik}
% A horizontally combined  rotation-code and its hieroglyph (in sequence as in text) 
% is generated using  the command stem  \cmd{\textRubik\marg{rotation-code}}. 
% For example,  \textRubik{R}\ is typeset using the command \cmd{\textRubik\{R\}}.
% A list of all commands and their associated  hieroglyphs is given in
%  Section~\ref{sec:listofcommands}. 
%
% \pagebreak
%
% \subsection{Face rotations}
%
% \DescribeMacro{U}
% \DescribeMacro{D}
% \DescribeMacro{L}
% \DescribeMacro{R}
% \DescribeMacro{F}
% \DescribeMacro{B}
% The six main faces of the cube are denoted as \textsc{front} (towards the observer), 
% \textsc{back},  \textsc{left}, \textsc{right},  \textsc{up}, \textsc{down}.
% The uppercase initial letter  of each face-name (\rr{F}, \rr{B}, \rr{L}, \rr{R}, \rr{U}, \rr{D}) 
% denotes a clockwise 90-degree rotation of the  face as shown in  
% Figure~\ref{fig:notation}. 
% For example, \rr{D}\ is generated by the `rubik rotation' command \cmd{\rr\{D\}}.
%
% \DescribeMacro{Up}
% \DescribeMacro{Dp}
% \DescribeMacro{Lp}
% \DescribeMacro{Rp}
% \DescribeMacro{Fp}
% \DescribeMacro{Bp}
%  An appended  prime~$^\prime$ indicates an anticlockwise rotation; e.g.,~\rr{Fp}. 
%  This is sometimes written as  \rr{F}$\boldmath{^{-1}}$. The `prime' notation is 
%  achieved by appending a lowercase `p' to the face rotation command. For example, \rr{Rp}\ 
%  is generated by \cmd{\rr\{Rp\}}. 
%
% \vspace{-0.2cm}
% \begin{figure}[hbt]
%  \centering
%  \ifpdf
%    \includegraphics[height=5cm]{Rubik-doc-figA.pdf}
%  \fi
% \caption{\label{fig:notation}} 
% \end{figure}
%
%
%      \subsection{Slice rotations}
%      \label{sec:slicerotations}
%
% \DescribeMacro{Su}
% \DescribeMacro{Sd}
% \DescribeMacro{Sl}
% \DescribeMacro{Sr}
% \DescribeMacro{Sf}
% \DescribeMacro{Sb}
% The Rubik cube (3x3x3) has three orthogonal so-called `inner' slices, whose +ve 
% rotation  direction follows that of a named face. For example the inner slice 
% rotation  between the \textsc{right} and \textsc{left} faces  whose rotation 
% direction follows the rotation \rr{R}\ (rotation is isomorphic to \rr{R}) is denoted 
% as \rr{Sr}, which is typeset using the command \cmd{\rr\{Sr\}}. Note that in these cases
%  the trailing  \texttt{r}  in the command  is lowercase.
%
% \bigskip\bigskip\bigskip
%
% \DescribeMacro{Sup}
% \DescribeMacro{Sdp}
% \DescribeMacro{Slp}
% \DescribeMacro{Srp}
% \DescribeMacro{Sfp}
% \DescribeMacro{Sbp}
% Each of these slice rotations (S rotations) has a reversed (primed)  p-form,
% the command for which is generated by appending the suffix `p'.
% For example  the inner slice rotations  \rr{Slp}\ (\cmd{\rr\{Slp\}}) and 
% \rr{Sr}\ (\cmd{\rr\{Sr\}}) are identical.
% The equivalence is more obvious when we see their respective hieroglyphs.
% For example, in this case \linebreak \rr{Slp}\ (\cmd{\rr\{Slp\}}) 
%  $\equiv$ \rrh{Slp}\ (\cmd{\rrh\{Slp\}}), 
%  and  \rr{Sr}\ (\cmd{\rr\{Sr\}}) $\equiv$ \rrh{Sr}\ (\cmd{\rrh\{Sr\}}). 
%
% \bigskip
%
% \pagebreak
%
%        \subsubsection*{MES slice notation}
%
% \DescribeMacro{M}
% \DescribeMacro{E}
% \DescribeMacro{S}
% \DescribeMacro{Mp}
% \DescribeMacro{Ep}
% \DescribeMacro{Sp}
% An alternative and somewhat confusing (and hence is non-standard) slice notation
%  which is sometimes used  is the following 
% so-called MES notation,  as used in the Waterman algorithm
%  (Treep and Waterman 1987).
% \begin{itemize}
% \item[\rr{M}] \ (\textsc{middle} \rrh{M}, between the \textsc{left} 
%      and \textsc{right} faces;  direction  follows  \rr{L}),
% \item[\rr{E}] \  (\textsc{equator} \rrh{E}, between the \textsc{up} and \textsc{down} 
%      faces;  direction follows \rr{D}),
%  \item[\rr{S}] \  (\textsc{standing} \rrh{S}, between the \textsc{front} and 
%      \textsc{back} faces;   direction follows \rr{F}).
% \end{itemize}
% Each of these also has a reversed (prime) version, and  a hieroglyph 
% (see Section~\ref{sec:listofcommands}).
% The equivalent S notation (see above) is therefore 
% as follows:  \rr{E}\ $\equiv$ \rr{Sd},  \rr{Ep}\ $\equiv$ \rr{Su}, 
% \rr{M}\ $\equiv$ \rr{Sl}, \rr{Mp}\ $\equiv$ \rr{Sr}, \rr{S}\ $\equiv$ \rr{Sf}, 
%  \rr{Sp}\ $\equiv$ \rr{Sb}. 
%
% 
%
% \subsubsection*{Singmaster slice notation}
%
% \DescribeMacro{Us}
% \DescribeMacro{Ds}
% \DescribeMacro{Ls}
% \DescribeMacro{Rs}
% \DescribeMacro{Fs}
% \DescribeMacro{Bs}
% These are an alternative (but somewhat less intuitive) form of  
% slice notation  which can be thought of as complementing the 
% inner slice  rotations. These were originally described by 
% Singmaster (Frey and Singmaster, 1982).
% See the link to `notation' on the `Pretty patterns' page of the 
% Fridrich website.
%
% Each of these commands denotes a  rotation of  two opposite faces 
% in the same  direction. For example, \textRubik{Us}\ $\equiv$ \textRubik{U}\ + \textRubik{Dp}, 
% which is typeset as: 
% \newline |\textRubik{Us}\ $\equiv$ \textRubik{U}\ + \textRubik{Dp}|, 
% i.e.,~for  \rr{Us}\ both face-rotations are in the \textit{same} direction 
% as \rr{U}. 
%
%
% \subsubsection*{Anti-slice notation}
%
% \DescribeMacro{Ua}
% \DescribeMacro{Da}
% \DescribeMacro{La}
% \DescribeMacro{Ra}
% \DescribeMacro{Fa}
% \DescribeMacro{Ba}
% Each of these commands denotes a  rotation of  two opposite faces 
% in \textit{opposite}  directions. 
% For example, \textRubik{Ua}\ $\equiv$ \textRubik{U}\ + \textRubik{D}, 
% which is typeset as: 
% \newline |\textRubik{Ua}\ $\equiv$ \textRubik{U}\ + \textRubik{D}|.
% See the link to `notation' on the `Pretty patterns' page of the 
% Fridrich website.
%
%   \bigskip\bigskip
%
%      \subsection{Wide rotations}
%
% \DescribeMacro{Uw}
% \DescribeMacro{Dw}
% \DescribeMacro{Lw}
% \DescribeMacro{Rw}
% \DescribeMacro{Fw}
% \DescribeMacro{Bw}
% The  clockwise \textit{combined} rotation of  an outer face AND its inner slice 
% (officially known as a `double outer slice' rotation) is denoted by appending a 
% lowercase  \textbf{\textsf{\footnotesize{w}}} (denoting `wide') to a face rotation command.
% For example,  a \textsc{right} double outer slice rotation is  denoted as \rr{Rw}. 
% Similarly, the prime $^\prime$ version \rr{Lwp}\  is generated by \cmd{\rr\{Lwp\}}.
%
%  The superscript~$^2$, or sometimes just an ordinary 2, indicates that the rotation
%  is applied twice. For example \rr{R}\textbf{$^2$} or \rr{R}\textbf{2} 
%  denote  \textit{two} successive 90~degree clockwise rotations of the \textsc{right} face.
% Clearly \rr{R}\textbf{$^3$} is equivalent to \rr{Rp} etc.
%
%
%
%
%     \subsection{Axis rotations}
%
% \DescribeMacro{x}
% \DescribeMacro{y}
% \DescribeMacro{z}
% Whole-cube clockwise rotations  of 90-degrees about about the orthogonal  axes centred 
% on the  \textsc{right}, \textsc{up}, \textsc{front}  faces are denoted 
% as \rr{x}, \rr{y}, \rr{z}\ (the \cmd{\rr\{\}} forms) respectively (see Figure~\ref{fig:notation}), 
% with their hieroglyphs (the \cmd{\rrh\{\}} forms) being denoted 
% as \rrh{x}, \rrh{y}, \rrh{z}\ in order to distinguish them from  square layer-rotation 
% hieroglyphs.
% Note that since \rr{x}, \rr{y}, \rr{z}\ rotations are always expressed in lowercase, 
%  this practice is extended also to the commands. 
%
% An \rr{x}\textbf{2} rotation (two \rr{x}\ rotations one after 
% the other, i.e.,~\rrh{x}\ \rrh{x}) denotes rotating 
% the cube 180~degrees about its x axis so as to bring the \textsc{down} face  
% into the \textsc{up} position.
%
%  An appended  prime~$^\prime$ indicates an anticlockwise rotation; 
% for example, \rr{xp}\ (which is generated by appending a `p' to the end of 
% the command, i.e.,~\cmd{\rr\{xp\}}). 
%
% The \cmd{\Rubik\{\}}  forms (and their prime `p' versions) generate the same
%  hieroglyphs  as their \cmd{\rrh\{\}} versions, except that their spacing is 
%  similar to that associated with the `square box'  \cmd{\Rubik\{\}}  hieroglyphs.  
% Consequently  when typesetting  an axis command in a sequence of  `square-box' 
% \cmd{\Rubik\{\}} commands, it is better to use the \cmd{\Rubik\{\}} form rather than
% the equivalent \cmd{\rrh\{\}} form (see the examples in Section~\ref{sec:examples}).
% There are no \cmd{\textRubik\{\}} forms for the axis commands (since they are 
% not necessary).
%
%
% \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 
% lowercase face letter to denote a 90~degree whole-cube rotation  in the same 
% directional sense as that of the   standard face rotations. 
%
% {\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}.
%
% As with the \rrh{x}, \rrh{y}, \rrh{z}\ forms (described above) there also 
% equivalent \cmd{\rrh\{\}} and \cmd{\Rubik\{\}} forms. For example, 
% \rrh{d}\ is generated by the command \cmd{\rrh\{d\}}.
%
%
%
%  \subsection{Examples}
%  \label{sec:examples}
%  
%    {\noindent}\rr{R}\  is generated by  the `rubik rotation' command \cmd{\rr\{R\}}
%
%    {\noindent}\rr{Fw}\  is generated by  the `rubik rotation' command \cmd{\rr\{Fw\}}
%
%    {\noindent}\rr{L}$^2$ is generated by \cmd{\rr\{L\}}\verb!$^2$!
%
%    {\noindent}\rr{L}2 is generated by \cmd{\rr\{L\}2}
%
%    {\noindent}\rr{Rp}\ is generated by \cmd{\rr\{Rp\}}
%
%    {\noindent}\rr{Fwp}\  is generated by \cmd{\rr\{Fwp\}}
%
%    {\noindent}\rr{x}\ and \rrh{y}\ and \Rubik{zp}\ are  generated by 
%   \cmd{\rr\{x\}}  and \cmd{\rrh\{y\}} and \cmd{\Rubik\{zp\}}
%
%    {\noindent}\rr{f}\ and \rrh{b}\ are  generated by \cmd{\rr\{f\}} and \cmd{\rrh\{b\}}
%
%   {\noindent}\rr{U}\rr{U}\rr{R}\rr{R}\ is generated by
%      \cmd{\rr\{U\}}\cmd{\rr\{U\}}\cmd{\rr\{R\}}\cmd{\rr\{R\}}
%  
%  \bigskip
%
%  {\noindent}\Rubik{F}\Rubik{U}\Rubik{y}\Rubik{Rp}\Rubik{Lwp}\
%  \ \  \verb!\Rubik{F}\Rubik{U}\Rubik{y}\Rubik{Rp}\Rubik{Lwp}!
%  
%  \bigskip
%  
%  {\noindent}\textRubik{F}\ \textRubik{U}\ \ \ \  
%       \verb!\textRubik{F}\ \textRubik{U}!
%  
%  \bigskip
% 
% {\noindent}Commas can be important in avoiding  ambiguity; for example
%
% \bigskip
%
% {\noindent}\rr{D},\rr{U}2,\rr{F}2,\rr{Ds}2,\rr{B},  \ \ \ \  \verb!\rr{U}2,\rr{F}2,\rr{Ds}2,\rr{B},!
%
%  \bigskip
%
% {\noindent}\rrh{U}2,\,\rrh{F}2,\,\rrh{Ds}2,\, \ \ \ \  \verb!\rrh{U}2,\,\rrh{F}2,\,\rrh{Ds}2,!
%
%  \bigskip
%  
%  {\noindent}\rrh{F}\rrh{U}\rrh{y}\rrh{Rp}\rrh{Lwp} \ \ \ \
%  \verb!\rrh{F}\rrh{U}\rrh{y}\rrh{Rp}\rrh{Lwp}! 
%
%
%
%  \bigskip
%
%  \subsection{Backwards compatibility}
%   \label{sec:backwardscompat}
%
% Note that in keeping with `backwards compatibility'  all rotation commands (see below) 
% can still  be written without the usual curley braces \verb!{}!. 
% For example,  the hieroglyph \rrhD\  (\cmd{\rrh\{D\}}) can also be generated using the command
%   \cmd{\rrhD}. 
%
%  \bigskip
%
%  \subsection{Listing of all rotation commands}
%   \label{sec:listofcommands}
%
%
% Note that all the commands presented here also have a \cmd{\Rubik\{\}} equivalent form which 
% typesets both the hieroglyph and its lettercode in a vertical format, 
% as shown in the `Examples' section above. These have been ommitted  here
% owing to the difficulty of including this form easily in the following table.
%
% Note also that some \cmd{\rrh\{\}} commands (eg~the \cmd{\rrh\{B\}} command)  
% show only the lettercode in a square box, e.g.,~\rrh{B}. This is because these  rotations
%  do not have a `true' visual representation as seen from the \textsc{front} face,
% and hence can be somewhat ambiguous unless typeset with their associated 
% lettercode. 
%
%  \newcommand{\dnstrut}{\rule{0pt}{17pt}}
%  \newcommand{\dns}{\hspace{2mm}}
%  \newcommand{\dnsp}{\hspace{2mm}} 
%
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
%  \dnstrut\rr{U}\dns\cmd{\rr\{U\}}
%  & \rrh{U}\dns\cmd{\rrh\{U\}}
%  & \textRubik{U}\dns\cmd{\textRubik\{U\}} \nonumber\\ 
%  \dnstrut\rr{Up}\dns\cmd{\rr\{Up\}}
%  & \rrh{Up}\dns\cmd{\rrh\{Up\}}
%  & \textRubik{Up}\dns\cmd{\textRubik\{Up\}} \nonumber\\ 
%  \dnstrut\rr{Uw}\dns\cmd{\rr\{Uw\}}
%  & \rrh{Uw}\dns\cmd{\rrh\{Uw\}}
%  & \textRubik{Uw}\dns\cmd{\textRubik\{Uw\}} \nonumber\\ 
%  \dnstrut\rr{Uwp}\dns\cmd{\rr\{Uwp\}}
%  & \rrh{Uwp}\dns\cmd{\rrh\{Uwp\}}
%  & \textRubik{Uwp}\dns\cmd{\textRubik\{Uwp\}} \nonumber\\ 
%  \dnstrut\rr{Us}\dns\cmd{\rr\{Us\}}
%  & \rrh{Us}\dns\cmd{\rrh\{Us\}}
%  & \textRubik{Us}\dns\cmd{\textRubik\{Us\}} \nonumber\\ 
%  \dnstrut\rr{Usp}\dns\cmd{\rr\{Usp\}}
%  & \rrh{Usp}\dns\cmd{\rrh\{Usp\}}
%  & \textRubik{Usp}\dns\cmd{\textRubik\{Usp\}} \nonumber\\ 
%  \dnstrut\rr{Ua}\dns\cmd{\rr\{Ua\}}
%  & \rrh{Ua}\dns\cmd{\rrh\{Ua\}}
%  & \textRubik{Ua}\dns\cmd{\textRubik\{Ua\}} \nonumber\\ 
%  \dnstrut\rr{Uap}\dns\cmd{\rr\{Uap\}}
%  & \rrh{Uap}\dns\cmd{\rrh\{Uap\}}
%  & \textRubik{Uap}\dns\cmd{\textRubik\{Uap\}} \nonumber\\
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
%  \dnstrut\rr{D}\dns\cmd{\rr\{D\}}
%  & \rrh{D}\dns\cmd{\rrh\{D\}}
%  & \textRubik{D}\dns\cmd{\textRubik\{D\}} \nonumber\\ 
%  \dnstrut\rr{Dp}\dns\cmd{\rr\{Dp\}}
%  & \rrh{Dp}\dns\cmd{\rrh\{Dp\}}
%  & \textRubik{Dp}\dns\cmd{\textRubik\{Dp\}} \nonumber\\ 
%  \dnstrut\rr{Dw}\dns\cmd{\rr\{Dw\}}
%  & \rrh{Dw}\dns\cmd{\rrh\{Dw\}}
%  & \textRubik{Dw}\dns\cmd{\textRubik\{Dw\}} \nonumber\\ 
%  \dnstrut\rr{Dwp}\dns\cmd{\rr\{Dwp\}}
%  & \rrh{Dwp}\dns\cmd{\rrh\{Dwp\}}
%  & \textRubik{Dwp}\dns\cmd{\textRubik\{Dwp\}} \nonumber\\ 
%  \dnstrut\rr{Ds}\dns\cmd{\rr\{Ds\}}
%  & \rrh{Ds}\dns\cmd{\rrh\{Ds\}}
%  & \textRubik{Ds}\dns\cmd{\textRubik\{Ds\}} \nonumber\\ 
%  \dnstrut\rr{Dsp}\dns\cmd{\rr\{Dsp\}}
%  & \rrh{Dsp}\dns\cmd{\rrh\{Dsp\}}
%  & \textRubik{Dsp}\dns\cmd{\textRubik\{Dsp\}} \nonumber\\ 
%  \dnstrut\rr{Da}\dns\cmd{\rr\{Da\}}
%  & \rrh{Da}\dns\cmd{\rrh\{Da\}}
%  & \textRubik{Da}\dns\cmd{\textRubik\{Da\}} \nonumber\\ 
%  \dnstrut\rr{Dap}\dns\cmd{\rr\{Dap\}}
%  & \rrh{Dap}\dns\cmd{\rrh\{Dap\}}
%  & \textRubik{Dap}\dns\cmd{\textRubik\{Dap\}} \nonumber\\
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
%  \dnstrut\rr{L}\dns\cmd{\rr\{L\}}
%  & \rrh{L}\dns\cmd{\rrh\{L\}}
%  & \textRubik{L}\dns\cmd{\textRubik\{L\}} \nonumber\\ 
%  \dnstrut\rr{Lp}\dns\cmd{\rr\{Lp\}}
%  & \rrh{Lp}\dns\cmd{\rrh\{Lp\}}
%  & \textRubik{Lp}\dns\cmd{\textRubik\{Lp\}} \nonumber\\ 
%  \dnstrut\rr{Lw}\dns\cmd{\rr\{Lw\}}
%  & \rrh{Lw}\dns\cmd{\rrh\{Lw\}}
%  & \textRubik{Lw}\dns\cmd{\textRubik\{Lw\}} \nonumber\\ 
%  \dnstrut\rr{Lwp}\dns\cmd{\rr\{Lwp\}}
%  & \rrh{Lwp}\dns\cmd{\rrh\{Lwp\}}
%  & \textRubik{Lwp}\dns\cmd{\textRubik\{Lwp\}} \nonumber\\ 
%  \dnstrut\rr{Ls}\dns\cmd{\rr\{Ls\}}
%  & \rrh{Ls}\dns\cmd{\rrh\{Ls\}}
%  & \textRubik{Ls}\dns\cmd{\textRubik\{Ls\}} \nonumber\\ 
%  \dnstrut\rr{Lsp}\dns\cmd{\rr\{Lsp\}}
%  & \rrh{Lsp}\dns\cmd{\rrh\{Lsp\}}
%  & \textRubik{Lsp}\dns\cmd{\textRubik\{Lsp\}} \nonumber\\ 
%  \dnstrut\rr{La}\dns\cmd{\rr\{La\}}
%  & \rrh{La}\dns\cmd{\rrh\{La\}}
%  & \textRubik{La}\dns\cmd{\textRubik\{La\}} \nonumber\\ 
%  \dnstrut\rr{Lap}\dns\cmd{\rr\{Lap\}}
%  & \rrh{Lap}\dns\cmd{\rrh\{Lap\}}
%  & \textRubik{Lap}\dns\cmd{\textRubik\{Lap\}} \nonumber\\
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
%  \dnstrut\rr{R}\dns\cmd{\rr\{R\}}
%  & \rrh{R}\dns\cmd{\rrh\{R\}}
%  & \textRubik{R}\dns\cmd{\textRubik\{R\}} \nonumber\\ 
%  \dnstrut\rr{Rp}\dns\cmd{\rr\{Rp\}}
%  & \rrh{Rp}\dns\cmd{\rrh\{Rp\}}
%  & \textRubik{Rp}\dns\cmd{\textRubik\{Rp\}} \nonumber\\ 
%  \dnstrut\rr{Rw}\dns\cmd{\rr\{Rw\}}
%  & \rrh{Rw}\dns\cmd{\rrh\{Rw\}}
%  & \textRubik{Rw}\dns\cmd{\textRubik\{Rw\}} \nonumber\\ 
%  \dnstrut\rr{Rwp}\dns\cmd{\rr\{Rwp\}}
%  & \rrh{Rwp}\dns\cmd{\rrh\{Rwp\}}
%  & \textRubik{Rwp}\dns\cmd{\textRubik\{Rwp\}} \nonumber\\ 
%  \dnstrut\rr{Rs}\dns\cmd{\rr\{Rs\}}
%  & \rrh{Rs}\dns\cmd{\rrh\{Rs\}}
%  & \textRubik{Rs}\dns\cmd{\textRubik\{Rs\}} \nonumber\\ 
%  \dnstrut\rr{Rsp}\dns\cmd{\rr\{Rsp\}}
%  & \rrh{Rsp}\dns\cmd{\rrh\{Rsp\}}
%  & \textRubik{Rsp}\dns\cmd{\textRubik\{Rsp\}} \nonumber\\ 
%  \dnstrut\rr{Ra}\dns\cmd{\rr\{Ra\}}
%  & \rrh{Ra}\dns\cmd{\rrh\{Ra\}}
%  & \textRubik{Ra}\dns\cmd{\textRubik\{Ra\}} \nonumber\\ 
%  \dnstrut\rr{Rap}\dns\cmd{\rr\{Rap\}}
%  & \rrh{Rap}\dns\cmd{\rrh\{Rap\}}
%  & \textRubik{Rap}\dns\cmd{\textRubik\{Rap\}} \nonumber\\
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
%  \dnstrut\rr{F}\dns\cmd{\rr\{F\}}
%  & \rrh{F}\dns\cmd{\rrh\{F\}}
%  & \textRubik{F}\dns\cmd{\textRubik\{F\}} \nonumber\\ 
%  \dnstrut\rr{Fp}\dns\cmd{\rr\{Fp\}}
%  & \rrh{Fp}\dns\cmd{\rrh\{Fp\}}
%  & \textRubik{Fp}\dns\cmd{\textRubik\{Fp\}} \nonumber\\ 
%  \dnstrut\rr{Fw}\dns\cmd{\rr\{Fw\}}
%  & \rrh{Fw}\dns\cmd{\rrh\{Fw\}}
%  & \textRubik{Fw}\dns\cmd{\textRubik\{Fw\}} \nonumber\\ 
%  \dnstrut\rr{Fwp}\dns\cmd{\rr\{Fwp\}}
%  & \rrh{Fwp}\dns\cmd{\rrh\{Fwp\}}
%  & \textRubik{Fwp}\dns\cmd{\textRubik\{Fwp\}} \nonumber\\ 
%  \dnstrut\rr{Fs}\dns\cmd{\rr\{Fs\}}
%  & \rrh{Fs}\dns\cmd{\rrh\{Fs\}}
%  & \textRubik{Fs}\dns\cmd{\textRubik\{Fs\}} \nonumber\\ 
%  \dnstrut\rr{Fsp}\dns\cmd{\rr\{Fsp\}}
%  & \rrh{Fsp}\dns\cmd{\rrh\{Fsp\}}
%  & \textRubik{Fsp}\dns\cmd{\textRubik\{Fsp\}} \nonumber\\ 
%  \dnstrut\rr{Fa}\dns\cmd{\rr\{Fa\}}
%  & \rrh{Fa}\dns\cmd{\rrh\{Fa\}}
%  & \textRubik{Fa}\dns\cmd{\textRubik\{Fa\}} \nonumber\\ 
%  \dnstrut\rr{Fap}\dns\cmd{\rr\{Fap\}}
%  & \rrh{Fap}\dns\cmd{\rrh\{Fap\}}
%  & \textRubik{Fap}\dns\cmd{\textRubik\{Fap\}} \nonumber\\
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
%  \dnstrut\rr{B}\dns\cmd{\rr\{B\}}
%  & \rrh{B}\dns\cmd{\rrh\{B\}}
%  & \textRubik{B}\dns\cmd{\textRubik\{B\}} \nonumber\\ 
%  \dnstrut\rr{Bp}\dns\cmd{\rr\{Bp\}}
%  & \rrh{Bp}\dns\cmd{\rrh\{Bp\}}
%  & \textRubik{Bp}\dns\cmd{\textRubik\{Bp\}} \nonumber\\ 
%  \dnstrut\rr{Bw}\dns\cmd{\rr\{Bw\}}
%  & \rrh{Bw}\dns\cmd{\rrh\{Bw\}}
%  & \textRubik{Bw}\dns\cmd{\textRubik\{Bw\}} \nonumber\\ 
%  \dnstrut\rr{Bwp}\dns\cmd{\rr\{Bwp\}}
%  & \rrh{Bwp}\dns\cmd{\rrh\{Bwp\}}
%  & \textRubik{Bwp}\dns\cmd{\textRubik\{Bwp\}} \nonumber\\ 
%  \dnstrut\rr{Bs}\dns\cmd{\rr\{Bs\}}
%  & \rrh{Bs}\dns\cmd{\rrh\{Bs\}}
%  & \textRubik{Bs}\dns\cmd{\textRubik\{Bs\}} \nonumber\\ 
%  \dnstrut\rr{Bsp}\dns\cmd{\rr\{Bsp\}}
%  & \rrh{Bsp}\dns\cmd{\rrh\{Bsp\}}
%  & \textRubik{Bsp}\dns\cmd{\textRubik\{Bsp\}} \nonumber\\ 
%  \dnstrut\rr{Ba}\dns\cmd{\rr\{Ba\}}
%  & \rrh{Ba}\dns\cmd{\rrh\{Ba\}}
%  & \textRubik{Ba}\dns\cmd{\textRubik\{Ba\}} \nonumber\\ 
%  \dnstrut\rr{Bap}\dns\cmd{\rr\{Bap\}}
%  & \rrh{Bap}\dns\cmd{\rrh\{Bap\}}
%  & \textRubik{Bap}\dns\cmd{\textRubik\{Bap\}} \nonumber\\
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
%  \dnstrut\rr{Su}\dns\cmd{\rr\{Su\}}
%  & \rrh{Su}\dns\cmd{\rrh\{Su\}}
%  & \textRubik{Su}\dns\cmd{\textRubik\{Su\}} \nonumber\\ 
%  \dnstrut\rr{Sup}\dns\cmd{\rr\{Sup\}}
%  & \rrh{Sup}\dns\cmd{\rrh\{Sup\}}
%  & \textRubik{Sup}\dns\cmd{\textRubik\{Sup\}} \nonumber\\ 
%  \dnstrut\rr{Sd}\dns\cmd{\rr\{Sd\}}
%  & \rrh{Sd}\dns\cmd{\rrh\{Sd\}}
%  & \textRubik{Sd}\dns\cmd{\textRubik\{Sd\}} \nonumber\\ 
%  \dnstrut\rr{Sdp}\dns\cmd{\rr\{Sdp\}}
%  & \rrh{Sdp}\dns\cmd{\rrh\{Sdp\}}
%  & \textRubik{Sdp}\dns\cmd{\textRubik\{Sdp\}} \nonumber\\ 
%  \dnstrut\rr{Sl}\dns\cmd{\rr\{Sl\}}
%  & \rrh{Sl}\dns\cmd{\rrh\{Sl\}}
%  & \textRubik{Sl}\dns\cmd{\textRubik\{Sl\}} \nonumber\\ 
%  \dnstrut\rr{Slp}\dns\cmd{\rr\{Slp\}}
%  & \rrh{Slp}\dns\cmd{\rrh\{Slp\}}
%  & \textRubik{Slp}\dns\cmd{\textRubik\{Slp\}} \nonumber\\ 
%  \dnstrut\rr{Sr}\dns\cmd{\rr\{Sr\}}
%  & \rrh{Sr}\dns\cmd{\rrh\{Sr\}}
%  & \textRubik{Sr}\dns\cmd{\textRubik\{Sr\}} \nonumber\\ 
%  \dnstrut\rr{Srp}\dns\cmd{\rr\{Srp\}}
%  & \rrh{Srp}\dns\cmd{\rrh\{Srp\}}
%  & \textRubik{Srp}\dns\cmd{\textRubik\{Srp\}} \nonumber\\ 
%  \dnstrut\rr{Sf}\dns\cmd{\rr\{Sf\}}
%  & \rrh{Sf}\dns\cmd{\rrh\{Sf\}}
%  & \textRubik{Sf}\dns\cmd{\textRubik\{Sf\}} \nonumber\\ 
%  \dnstrut\rr{Sfp}\dns\cmd{\rr\{Sfp\}}
%  & \rrh{Sfp}\dns\cmd{\rrh\{Sfp\}}
%  & \textRubik{Sfp}\dns\cmd{\textRubik\{Sfp\}} \nonumber\\ 
%  \dnstrut\rr{Sb}\dns\cmd{\rr\{Sb\}}
%  & \rrh{Sb}\dns\cmd{\rrh\{Sb\}}
%  & \textRubik{Sb}\dns\cmd{\textRubik\{Sb\}} \nonumber\\ 
%  \dnstrut\rr{Sbp}\dns\cmd{\rr\{Sbp\}}
%  & \rrh{Sbp}\dns\cmd{\rrh\{Sbp\}}
%  & \textRubik{Sbp}\dns\cmd{\textRubik\{Sbp\}} \nonumber\\ 
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
%  \dnstrut\rr{E}\dns\cmd{\rr\{E\}}
%  & \rrh{E}\dns\cmd{\rrh\{E\}}
%  & \textRubik{E}\dns\cmd{\textRubik\{E\}} \nonumber\\ 
%  \dnstrut\rr{Ep}\dns\cmd{\rr\{Ep\}}
%  & \rrh{Ep}\dns\cmd{\rrh\{Ep\}}
%  & \textRubik{Ep}\dns\cmd{\textRubik\{Ep\}} \nonumber\\ 
%  \dnstrut\rr{M}\dns\cmd{\rr\{M\}}
%  & \rrh{M}\dns\cmd{\rrh\{M\}}
%  & \textRubik{M}\dns\cmd{\textRubik\{M\}} \nonumber\\ 
%  \dnstrut\rr{Mp}\dns\cmd{\rr\{Mp\}}
%  & \rrh{Mp}\dns\cmd{\rrh\{Mp\}}
%  & \textRubik{Mp}\dns\cmd{\textRubik\{Mp\}} \nonumber\\ 
%  \dnstrut\rr{S}\dns\cmd{\rr\{S\}}
%  & \rrh{S}\dns\cmd{\rrh\{S\}}
%  & \textRubik{S}\dns\cmd{\textRubik\{S\}} \nonumber\\ 
%  \dnstrut\rr{Sp}\dns\cmd{\rr\{Sp\}}
%  & \rrh{Sp}\dns\cmd{\rrh\{Sp\}}
%  & \textRubik{Sp}\dns\cmd{\textRubik\{Sp\}} \nonumber\\ 
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
%  \dnstrut\rr{x}\dns\cmd{\rr\{x\}}
%  & \rrh{x}\dns\cmd{\rrh\{x\}}
%  & \Rubik{x}\dns\cmd{\Rubik\{x\}} \nonumber\\ 
%  \dnstrut\rr{xp}\dns\cmd{\rr\{xp\}}
%  & \rrh{xp}\dns\cmd{\rrh\{xp\}}
%  & \Rubik{xp}\dns\cmd{\Rubik\{xp\}} \nonumber\\ 
%  \dnstrut\rr{y}\dns\cmd{\rr\{y\}}
%  & \rrh{y}\dns\cmd{\rrh\{y\}}
%  & \Rubik{y}\dns\cmd{\Rubik\{y\}} \nonumber\\ 
%  \dnstrut\rr{yp}\dns\cmd{\rr\{yp\}}
%  & \rrh{yp}\dns\cmd{\rrh\{yp\}}
%  & \Rubik{yp}\dns\cmd{\Rubik\{yp\}} \nonumber\\ 
%  \dnstrut\rr{z}\dns\cmd{\rr\{z\}}
%  & \rrh{z}\dns\cmd{\rrh\{z\}}
%  & \Rubik{z}\dns\cmd{\Rubik\{z\}} \nonumber\\ 
%  \dnstrut\rr{zp}\dns\cmd{\rr\{zp\}}
%  & \rrh{zp}\dns\cmd{\rrh\{zp\}}
%  & \Rubik{zp}\dns\cmd{\Rubik\{zp\}} \nonumber\\ 
%  \end{supertabular}
%
%
%  \begin{supertabular}[lll]{p{3cm} p{3cm} p{4.5cm}}
%  \dnstrut\rr{u}\dns\cmd{\rr\{u\}}
%  & \rrh{u}\dns\cmd{\rrh\{u\}}
%  & \Rubik{u}\dns\cmd{\Rubik\{u\}} \nonumber\\ 
%  \dnstrut\rr{d}\dns\cmd{\rr\{d\}}
%  & \rrh{d}\dns\cmd{\rrh\{d\}}
%  & \Rubik{d}\dns\cmd{\Rubik\{d\}} \nonumber\\ 
%  \dnstrut\rr{l}\dns\cmd{\rr\{l\}}
%  & \rrh{l}\dns\cmd{\rrh\{l\}}
%  & \Rubik{l}\dns\cmd{\Rubik\{l\}} \nonumber\\ 
%  \dnstrut\rr{r}\dns\cmd{\rr\{r\}}
%  & \rrh{r}\dns\cmd{\rrh\{r\}}
%  & \Rubik{r}\dns\cmd{\Rubik\{r\}} \nonumber\\ 
%  \dnstrut\rr{f}\dns\cmd{\rr\{f\}}
%  & \rrh{f}\dns\cmd{\rrh\{f\}}
%  & \Rubik{f}\dns\cmd{\Rubik\{f\}} \nonumber\\ 
%  \dnstrut\rr{b}\dns\cmd{\rr\{b\}}
%  & \rrh{b}\dns\cmd{\rrh\{b\}}
%  & \Rubik{b}\dns\cmd{\Rubik\{b\}} \nonumber\\ 
%  \end{supertabular}
%
%
% \pagebreak
%
%       \section{Other commands}
%
%
% \DescribeMacro{\rubikcube}
% This command generates the logo \rubikcube.
%
%
% All  \rubikcube\ commands assume a 3x3x3 cube by default.
% There are three primary command categories: (a)~\cmd{\Draw..} commands 
% (which must always be used \textit{inside} a TikZ picture environment), 
%  (b)~parameter-allocation' commands---e.g.,~\cmd{\RubikCubeSolved}---which can 
%  be used either inside or outside  a TikZ environment),  
%  and (c)~commands which can be used in ordinary text 
% (e.g.,~|\rr{}| rotation commands).
%
% Since \LaTeX\ commands have a maximum limit of only 9 parameters, 
% it is necessary to use separate  `Face' and `Slice'  commands (see below)
%   in order to accommodate  all 27 visible colours of a 3D~Rubik cube.
%
%
%
%    \subsection{Draw commands}
%
% A \cmd{\Draw..} command typesets  
% either a Rubik cube, cubie or a layer  using parameters set or defined via 
% previous parameter-allocation commands (eg~face colours, dimensions etc).
% Furthermore, \cmd{\Draw..} commands can only be used \textit{inside} a TikZ 
% picture environment  (see section~\ref{sec:drawerrormessage}).
%
%
%   \DescribeMacro{\DrawRubikCubeXY}
% This  command  draws Rubik cubes  in one of four 
% orientations as denoted by the following terminal XY viewing-direction 
% codes:  RU (RightUp),  RD (RightDown), LU (LeftUp),  LD (LeftDown). 
%  For example, the command
%  \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 these commands are equivalent to:
%\begin{verbatim}
% \RubikCubeSolved
% \ShowCube{3cm}{0.7}{\DrawRubikCubeRU} 
%\end{verbatim}
% \end{minipage}
%
% \bigskip 
%
%
%   \DescribeMacro{\DrawCubieXYxyz}
% This  command  draws a  single cubie  in one of four 
% orientations as denoted by the terminal XY viewing-direction 
% codes.
% Since a single cubie has only three visible faces we can include 
% colour parameters in \cmd{\DrawCubie} commands. Consequently \cmd{\DrawCubie}
%  commands have the format 
% \begin{quote}
%  \cmd{\DrawCubieXY\{x\}\{y\}\{z\}}  
% \end{quote}
% where the  XY pair denotes the viewing direction as before, and 
% the xyz parameters  denote the face colours associated with each of 
% the three axes. 
%
% For example, the  command    \cmd{\DrawCubieRU\{O\}\{Y\}\{G\}}   draws a 
%  single cubie as viewed  from the RightUp  direction, 
% with face colours Orange (x-axis), Yellow (y-axis), Green (z-axis), as follows.
% 
% \medskip
%
% \begin{minipage}{1.35cm}
% \begin{tikzpicture}[scale=1]
% \DrawCubieRU{O}{Y}{G} 
% \end{tikzpicture}%
% \end{minipage}
%    \hspace{1cm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
% \begin{tikzpicture}[scale=1]
%    \DrawCubieRU{O}{Y}{G} 
% \end{tikzpicture}%
%\end{verbatim}
% \end{minipage}
% 
% \medskip
%
% {\noindent}Since the front face is a unit 1cm and the width of the side approx 1/3cm, 
%  and the scale factor =1, then the the minimum minipage width required for the cubie 
% $=(1.33 \times 1) = 1.33$cm, and hence the  above commands are equivalent to 
% \begin{verbatim}
% \ShowCube{1.33cm}{1}{\DrawCubieRU{O}{Y}{G}}
% \end{verbatim}
%
%
% \begin{figure}[hbt]
%   \centering
% \ifpdf
%    \includegraphics[height=4cm]{Rubik-doc-figC.pdf}
%  \else
% \includegraphics[height=4cm]{Rubik-doc-figC.eps}
% \fi
% \vspace{-5mm}\caption{\label{fig:cubiedydx}Cubie dy dx parameters} 
% \end{figure}
%
%  \DescribeMacro{\Cubiedy}
%  \DescribeMacro{\Cubiedx}
%  Minor  cubie configuration changes  can be effected 
%  by adjusting the dy and dx  values ($> 0$; no units)  
% shown in Figure~\ref{fig:cubiedydx}  via the two commands
% \begin{quote}
% \cmd{\Cubiedy\{\}} \\
% \cmd{\Cubiedx\{\}} 
% \end{quote}
% as shown in the folowing example.
%
% \bigskip
%
% \begin{minipage}{1.7cm}
% \begin{tikzpicture}[scale=1]
% \Cubiedy{0.4}
% \Cubiedx{0.8}
% \DrawCubieRU{O}{Y}{G} 
% \end{tikzpicture}%
% \end{minipage}
% \hspace{2cm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
% \begin{tikzpicture}[scale=1]
%   \Cubiedy{0.4}
%   \Cubiedx{0.8}
%   \DrawCubieRU{O}{Y}{G} 
% \end{tikzpicture}%
%\end{verbatim}
% \end{minipage}
% 
% \bigskip
%
% {\noindent}Note that the  \textsc{front} 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. 
%
% \medskip
%
% \DescribeMacro{\textCubieRU}
% \DescribeMacro{\textCubieRD}
% \DescribeMacro{\textCubieLU}
% \DescribeMacro{\textCubieLD}
% For convenience, there are also four (smaller) `text' versions \textCubieRU{O}{Y}{G}   
%  of the  four \cmd{\DrawCubie} commands for use in ordinary text, as follows:
% \begin{quote}
%  \textCubieRU{O}{Y}{G} \ \ |\textCubieRU{O}{Y}{G}|
%
% \medskip
%
% \textCubieRD{O}{Y}{G} \ \  |\textCubieRD{O}{Y}{G}|     
%
% \medskip
%
% \textCubieLU{O}{Y}{G}  \ \ |\textCubieLU{O}{Y}{G}|
%
% \medskip
%
%  \textCubieLD{O}{Y}{G}  \ \  |\textCubieLD{O}{Y}{G}|  
% \end{quote}
% Note that these \cmd{\textCubieXY} commands are not influenced by the 
% \cmd{\Cubiedy}, \cmd{\Cubiedx} commands as their size is preset for text use. 
%
%
%     \subsubsection[Draw.. error message]{\cmd{\draw} error message}
%
% See also section~\ref{sec:drawerrormessage} regarding the error message associated with 
% using a \cmd{\Draw...} command  \textit{outside}  a TikZ picture environment.
%
%
%  \subsection{Face commands}
%   \label{sec:facecommands}
%
%  \DescribeMacro{\RubikFaceUp}
%  \DescribeMacro{\RubikFaceDown}
%  \DescribeMacro{\RubikFaceLeft}
%  \DescribeMacro{\RubikFaceRight}
%  \DescribeMacro{\RubikFaceFront}
%  \DescribeMacro{\RubikFaceBack}
% These  commands take nine colour arguments and  allocate   colours to the 
% individual cubies  of a  Rubik cube face.
% The ordering is isomorphic to the sequence 1--9, i.e.,~numbering the small 
% squares 1-3~(top row, left to right), 4-6~(middle row, left to right), 
% 7-9~(bottom row, left to right), as follows:
% \begin{quote}
% \fbox{
% \begin{minipage}{1.6cm}
% \#1 \#2 \#3 
%
% \#4 \#5 \#6
%
% \#7 \#8 \#9
% \end{minipage}
% }
% \end{quote}
% Conveniently, \LaTeX\ allows the colour arguments to be separated by spaces 
% (e.g.,~separated in groups of three), or even spread across several 
% lines (e.g.,~in a square block to resemble a 9-face) in order to 
% make the command more visually intuitive, as in the following examples.
% \begin{quote}
%\begin{verbatim}
% \RubikFaceUp{G}{B}{G}   {G}{W}{O}   {G}{O}{G}
%
% \RubikFaceFront{O}{W}{R}
%                {W}{W}{W}
%                {G}{W}{G}
% 
%\end{verbatim}
% \end{quote}
%
%  \DescribeMacro{\RubikFaceUpAll}
%  \DescribeMacro{\RubikFaceDownAll}
%  \DescribeMacro{\RubikFaceLeftAll}
%  \DescribeMacro{\RubikFaceRightAll}
%  \DescribeMacro{\RubikFaceFrontAll}
%  \DescribeMacro{\RubikFaceBackAll}
% For convenience, each of these commands has an associated 
% `\texttt{All}' command which allocates  the same colour to all the cubies 
% on a 9-face  (i.e.,~only a single colour argument is required).
%
% If you want a particular face to be all grey, then one can 
% either omit the particular `Face' command (since the 
% default colour is grey), or  use  a `Face' command specifying the 
% colour-code~X;  for example,  \cmd{\RubikFaceUpAll\{X\}}.
% However, if you do use a Face command, then all of the command's 
% colour arguments must be allocated, as otherwise you will generate a 
% `missing parameter' error, and no colour will be 
% allocated (i.e.,~you will see  a black-hole).
% Use of these commands is shown in the following figure.
%
% \bigskip
% 
% \begin{minipage}{2.8cm}
% \RubikFaceUpAll{X}
% \RubikFaceRightAll{R}
% \RubikFaceFront{W}{Y}{G}
%                {W}{Y}{G}
%                {W}{Y}{G}
% \begin{tikzpicture}[scale=0.7]
% \DrawRubikCubeRU
% \end{tikzpicture}%
% \end{minipage}
%    \hspace{5mm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
% \RubikFaceUpAll{X}
% \RubikFaceRightAll{R}
% \RubikFaceFront{W}{Y}{G}
%                {W}{Y}{G}
%                {W}{Y}{G}
% \ShowCube{3cm}{0.7}{\DrawRubikCubeRU}
% \end{verbatim}
% \end{minipage}
% 
%
%       \subsection{RubikCubeSolved command}
%    \label{sec:rubikcubesolved}
%
%  \DescribeMacro{\RubikCubeSolved}
% This command  sets all the face colours to that of a standard `solved' cube
% and is equivalent to the following set of face commands
%\begin{verbatim}
%  \RubikFaceUpAll{W}%
%  \RubikFaceDownAll{Y}%
%  \RubikFaceLeftAll{B}%
%  \RubikFaceRightAll{G}%
%  \RubikFaceFrontAll{O}%
%  \RubikFaceBackAll{R}%
%\end{verbatim}
% as shown in the following semi-flat image.
%
% \bigskip
%
% \begin{minipage}{5cm}
% \centering
% \begin{tikzpicture}[scale=0.5]
% \RubikCubeSolved
% \DrawRubikCubeFlat
% \end{tikzpicture}%
% \end{minipage}
% \begin{minipage}{0.5\textwidth}
%\begin{verbatim}
%  \RubikCubeSolved
%  \showcube{5cm}{0.5}{\DrawRubikCubeFlat}
%\end{verbatim}
% \end{minipage}
%
% \bigskip
%
% Note that the width of the minipage above  is set to 5cm. This is derived from the fact 
% that  the unscaled width of the semi-flat image is 10cm, and hence if
% the TikZ scale factor is to be 0.5 then the minimum minipage width = $10 \times 0.5 = 5$cm
% (see Section~\ref{sec:coordinates} for details).
%
% If other orientations of the solved cube are required, this can be easily achieved
% using the \cmd{\RubikRotation} command (from the \texttt{RubikRotation} package).
% For example, if one wants to show the solved cube upsidedown, then this format 
% could be defined as follows (here we have used the rotations \rrx, \rrx, \rry, to 
% invert the cube):
%\begin{verbatim}
%\newcommand{\CubeUpSideDown}{\RubikCubeSolved\RubikRotation{x2,y}}
%\end{verbatim}
% This command would then generate the following:
%
% \bigskip
%
% \begin{minipage}{2.8cm}
% \centering
% \begin{tikzpicture}[scale=0.6]
% \DrawNCubeAll{3}{O}{Y}{G}
% \end{tikzpicture}%
% \end{minipage}
%    \hspace{5mm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
% \CubeUpSideDown
% \ShowCube{2.4cm}{0.6}\DrawRubikCubeRU}
%\end{verbatim}
% \end{minipage}
%
% \bigskip
%
%  Users can easily set their own alternative `solved'  face/colour configuration by `renewing' 
%  the \cmd{\RubikCubeSolved} command as follows---remember to include the trailing \%  (note also
%  that the colours  ROYGBWX are currently hardwired  so do not  use a different set 
%  of uppercase letters).
%\begin{verbatim}
% \renewcommand{\RubikCubeSolved}{%
%    \RubikFaceUpAll{..}%
%    \RubikFaceDownAll{..}%
%    \RubikFaceLeftAll{..}%
%    \RubikFaceRightAll{..}%
%    \RubikFaceFrontAll{..}%
%    \RubikFaceBackAll{..}%
% }
%\end{verbatim} 
%
%
%
%       \subsection{RubikCubeGrey command}
%       \label{sec:rubikcubegrey}
%
%  \DescribeMacro{\RubikCubeGrey}
%  This command generates a 3x3x3 cube with no colours allocated except for the central
%  cubie of each face, which takes the same colour configuration as defined for the 
% \cmd{\RubikCubeSolved} command. 
% This command, which is useful starting point when wanting to describe the movement of 
% particular cubies, generates the following cube:
%
% \bigskip
%
% \RubikCubeGrey
% \ShowCube{3cm}{0.5}{\DrawRubikCubeRU}
%    \hspace{5mm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
% \RubikCubeGrey
% \ShowCube{3cm}{0.5}{\DrawRubikCubeRU}
%\end{verbatim}
% \end{minipage}
%
% \bigskip
%  Users can easily set their own alternative  face/colour configuration by `renewing' 
% the \cmd{\RubikCubeGrey} command along the lines shown above (the code is in Section~\ref{sec:codegrey}). 
%
%
%
%    \subsection{Slice commands}
%   \label{sec:slicecommands}
%
%  \DescribeMacro{\RubikSliceTopX}
%  \DescribeMacro{\RubikSliceMiddleX}
%  \DescribeMacro{\RubikSliceBottomX}
%  These three commands  allocate the six visible cubie colours associated with  a
%   \textit{horizontal}  slice of a Rubik cube. 
% There are three pairs of  Slice commands; one pair 
% (Left view \& Right view) for each of the horizontal  slices Top, Middle, Bottom.
% The six colour arguments  associated with a given slice run in sequence 
% from left to right irrespective of the viewpoint, e.g.,~\#1 \#2 \#3   \#4 \#5 \#6.
%
% Since the viewpoint of the Rubik cube (from the Right or from the Left) 
% influences which face the colours are associated with, it is necessary 
% to have the view (R or L) specified in the command name.
%
% The format of the `slice' command is shown in the following example.
% The Rubik  cube is shown from  the LeftDown (LD) view 
% and consequently  each of the `slice' commands in this
% particular example  ends in L, consistent with 
% the final \cmd{\DrawRubikCubeLD} command.
%
% Note that the two legacy `Equator' versions (now replaced by `Middle') 
% are retained to allow backward compatibility. 
%
% \bigskip
%
% \begin{minipage}{2.8cm}
% \centering
% \RubikFaceDownAll{Y}
% \RubikSliceTopL    {G}{G}{G} {R}{R}{R}
% \RubikSliceMiddleL {R}{R}{R} {B}{B}{B}
% \RubikSliceBottomL {O}{O}{O} {G}{G}{G}
% \begin{tikzpicture}[scale=0.7]
% \DrawRubikCubeLD
% \end{tikzpicture}%
% \end{minipage}
%    \hspace{5mm}
% \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
%    \RubikFaceDownAll{Y}
%    \RubikSliceTopL     {G}{G}{G} {R}{R}{R}
%    \RubikSliceMiddleL  {R}{R}{R} {B}{B}{B}
%    \RubikSliceBottomL  {O}{O}{O} {G}{G}{G}
%    \ShowCube{3cm}{0.7}{\DrawRubikCubeLD}
%\end{verbatim}
% \end{minipage}
%
%
%  \subsection{LayerFace \& LayerSide commands}
%  \label{sec:layerface}
%
%  These commands are   intended  for drawing  final layer 
%  configurations (i.e.,~typically using the yellow face in the  \textsc{up} position)
%  with or without the associated side faces of the cubies of the top layer
% (see also the \cmd{\DrawFlatUpSide} command in Section~\ref{sec:flatcommands}) 
%
%  \subsubsection{LayerFace}
%
%  \DescribeMacro{\DrawRubikLayerFace}
%  This LayerFace command  draws a  simple  Rubik cube 3x3 face and allocates colours
%  to the  9~cubies.
%  The command takes nine ordered colour arguments.
%  Their use is illustrated in the following example, which shows  a yellow cross configuration.
%  
%  \bigskip
%
%  \begin{minipage}{2.5cm}
%  \centering
%  \begin{tikzpicture}[scale=0.7]
%  \DrawRubikLayerFace{X}{Y}{X}
%                     {Y}{Y}{Y}
%                     {X}{Y}{X}
%  \end{tikzpicture}%
%  \end{minipage}
%  \hspace{1cm}
%  \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
%  \ShowCube{2.1cm}{0.7}{%
%     \DrawRubikLayerFace{X}{Y}{X}
%                        {Y}{Y}{Y}
%                        {X}{Y}{X}
%  }
%\end{verbatim}
%  \end{minipage}
%
% \medskip
%
%      \subsubsection[Draw.. error message]{\cmd{\draw} error message}
%
% See also section~\ref{sec:drawerrormessage} regarding the error message associated with 
% using a \cmd{\Draw...} command  \textit{outside}  a TikZ picture environment.
%
%  \medskip
%
%    \subsubsection{LayerSide}
%     \label{sec:layerside}
% 
%  \DescribeMacro{\DrawRubikLayerSideXYp}
%  LayerSide commands  draw the associated side colours  of  
%  the top layer   as  small rectangular sidebars.
%  The LayerSide commands  adopt a three-letter XYp \textbf{position} notation 
%   where the  XY pair define the location (X:[Left \verb!|! Middle \verb!|! Right]; 
%  Y:[Top \verb!|! Middle \verb!|! Bottom]) of a particular cubie in the layer face.
%
%  \begin{figure}[hbt]
%     \centering
%  \ifpdf
%     \includegraphics[height=3cm]{Rubik-doc-figD.pdf}
%  \else
%  \includegraphics[height=3cm]{Rubik-doc-figD.eps}
%  \fi
%  \vspace{-5mm}\caption{\label{fig:facenotation}LayerSide 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 (eg, left, middle, right),
%  while the L and R forms require the colour parameters to be in top-down 
%  vertical order (eg, top, middle, bottom).
%  Note that this means that the colour parameters of the  L and R commands 
%  can (if required) then be positioned intuitively (vertically) as follows:
%  \begin{quote}
%\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{\DrawFlatUpSide}
% \textsc{important note}: If the  colour configuration of the  \textit{whole} 
% cube is already known to the system (i.e.,~it has been specified before,
%  and (possibly) been manipulated using the \cmd{\RubikRotation..}  command 
% from \textsc{rubikrotation} package), then the above figure could be 
% drawn much more simply using just the single \cmd{\DrawFlatUpSide} command, 
% as described in  Section~\ref{sec:flatcommands}. In short, using  the 
% \texttt{rubikrotation} package to keep track of the Rubik cube configuration makes
%  drawing these images  considerably simpler.
%  
%  \bigskip
%
%  \DescribeMacro{\RubikSideBarWidth}
%  \DescribeMacro{\RubikSideBarLength}
%  \DescribeMacro{\RubikSideBarSep}
%  The default values (size) of the  sidebars are as follows:
%  width (0.3), length(1) and separation  from the square face (0.3). 
%  Note that the default value of the length of a cubie side is 1. 
%  These sidebar values (decimal values $\geq 0$; no units) can be 
%  changed from their default values using the three commands.
%  \begin{quote}
%  \cmd{\RubikSideBarWidth\{\}}\\
%  \cmd{\RubikSideBarLength\{\}}\\
%  \cmd{\RubikSideBarSep\{\}}
%  \end{quote}
%  Values set in the document preamble will apply globally, while values 
%  set within a TikZ picture environment will apply only locally to that 
%  particular environment, as shown in the following example where we have 
%  set both the sidebar width and length to 0.7.
%  
%  \bigskip
%
%  \begin{minipage}{2.5cm}
%  \centering
%  \begin{tikzpicture}[scale=0.7]
%  
%  
%  \DrawRubikLayerFace{X}{Y}{X}
%                     {Y}{Y}{Y}
%                     {X}{Y}{X}
%  
%  \RubikSideBarWidth{0.7}
%  \RubikSideBarLength{0.7}
%  \DrawRubikLayerSideMTy{G}
%  \end{tikzpicture}%
%  \end{minipage}
%      \hspace{1cm}
%  \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
%  \ShowCube{3cm}{0.7}{%
%     \DrawRubikLayerFace{X}{Y}{X}
%                        {Y}{Y}{Y}
%                        {X}{Y}{X}
%     \RubikSideBarWidth{0.7}
%     \RubikSideBarLength{0.7}
%     \DrawRubikLayerSideMTy{G}
%   }
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%  
%  Note also that changing the  sidebar-width or sidebar-separation 
%  values may well also change the surrounding white-space (use \cmd{\fbox} 
%  to visualise this) and may therefore require some fine-tuning of the 
%  minipage width setting in order to optimise  appearance. 
% 
%  Since the \textsc{front} face  drawn using  the \cmd{\DrawRubikCube} command is 
%  identical with that drawn using the \cmd{\DrawLayerFace} command it 
%  follows that LayerSide commands can also be used in conjunction with 
%  the \textsc{front} face drawn using  \cmd{\DrawRubikCube} command, as 
%  shown in the following example. Note that in this example we have used the 
% \cmd{\ShowCubeF} command as an exercise to implement the fbox and reveal
% the extent of the  surrounding white space associated with a minipage width of
% 3.5cm ($=5 \times 0.7$) ---showing that a sidebar increases the image width by about 
% 0.5 the width of a cubie.
%  
%  \bigskip
%  
%  \begin{minipage}{4cm}
%  \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}
%  }
%  \end{minipage}
%        \hspace{1cm}
%  \begin{minipage}{0.6\textwidth}
%\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}
%   }
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%  
%  {\noindent}Note that since using a left or a right \cmd{\DrawRubikLayerSide}  
%  command in conjunction with a \cmd{\DrawRubikCube} command will necessarily 
%  increase the width of the image, one may also have to adjust the width of 
%  the associated minipage. 
%  
% \pagebreak
% 
%  \subsection{Flat commands}
%  \label{sec:flatcommands}
%
%  \DescribeMacro{\DrawFlatUp}
%  \DescribeMacro{\DrawFlatDown}
%  \DescribeMacro{\DrawFlatLeft}
%  \DescribeMacro{\DrawFlatRight}
%  \DescribeMacro{\DrawFlatFront}
%  \DescribeMacro{\DrawFlatBack}
%  These commands  \cmd{\DrawFlat..}\marg{x}\marg{y}  draw a `flat' (square) 
%  representation of a  specified face such that its bottom left corner 
%  is positioned at ($x$, $y$). 
%  They are designed to supplement the \cmd{\DrawRubikCube...} commands and 
%  allow hidden faces to be represented. 
%  Each command (except \cmd{\DrawFlatFront}) takes two arguments, 
%  namely the  X-coordinate  and Y-coordinate of the bottom left 
%  corner of the  face.  This ($x$,$y$) pair allows the user to position
%  the face. 
%
%  Note that the Y-argument set for the \cmd{\DrawFlatLeft} 
%  and \cmd{\DrawFlatRight} commands is not currently actioned 
% (see Section~\ref{sec:drawflatxcommands}),
%  since both the \textsc{left} and \textsc{right} faces as used by the 
% \cmd{\DrawRubikCubeFlat} command---since this shows the RU view---requires only Y=0
%  (this (x,y) facility will  be fully extended to  the left and right forms in a 
%  later version).
%  Note also that the \cmd{\DrawFlatFront} command currently takes no arguments,
%  since by definition the bottom left corner of this face is always at (0,0), 
%  and there seems to be no reason (just now) for this face to have the 
%  (x,y) facility.
%
%  In the following example we use the command \verb!\DrawFlatBack{4}{1}! to
%  append the \textsc{back} face to the side of a 3D  cube. Note that since 
%  the coordinates of the bottom/back/right corner of the cube rendered by the 
%  command \cmd{\DrawRubikCubeRU} is (4,1) 
%  (see Section~\ref{sec:coordinates}), we can position the 
%  lower/left corner of the \textsc{back} face at this point using the command
%  \verb!\DrawFlatBack{4}{1}! as follows: 
%
%  \bigskip
%  
%  \begin{minipage}{0.4\textwidth}
%  \centering
%  \RubikCubeSolved
%  \begin{tikzpicture}[scale=0.4]
%  \DrawRubikCubeRU
%  \DrawFlatBack{4}{1}
%  \end{tikzpicture}%
%  \end{minipage}
%  \begin{minipage}{5cm}
%\begin{verbatim}
%  \RubikCubeSolved
%  \ShowCube{3cm}{0.4}{%
%     \DrawRubikCubeRU
%     \DrawFlatBack{4}{1}
%  }
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%
%
%  \DescribeMacro{\DrawFlatUpSide}
%  \DescribeMacro{\DrawFlatDownSide}
%  \DescribeMacro{\DrawFlatLeftSide}
%  \DescribeMacro{\DrawFlatRightSide}
%  \DescribeMacro{\DrawFlatFrontSide}
%  \DescribeMacro{\DrawFlatBackSide}
% These commands draw a face and all the associated side facelets. 
% In the following example we use the \cmd{\DrawFlatUpSide} command to
%  draw the \textsc{up} face and all its side-bars of a cube  having 
% a `solved' configuration.
%
%
%  \bigskip
%  
%  \begin{minipage}{0.4\textwidth}
%  \centering
%  \RubikCubeSolved
%  \begin{tikzpicture}[scale=0.4]
%  \DrawFlatUpSide
%  \end{tikzpicture}%
%  \end{minipage}
%  \begin{minipage}{5cm}
%\begin{verbatim}
%  \RubikCubeSolved
%  \ShowCube{1.6cm}{0.4}{%
%     \DrawFlatUpSide
%  }
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%
%  \DescribeMacro{\DrawRubikFlat}
%  This command  draws the completely flat format of the cube, as  shown in the following example.
%  
%  \bigskip
%  
%  \begin{minipage}{0.4\textwidth}
%  \centering
%  \begin{tikzpicture}[scale=0.4]
%  \RubikCubeSolved
%  \DrawRubikFlat
%  \node (U) at (1.5, 4.5)   [black]{\small\textsf{U}};
%  \node (D) at (1.5, -1.5)  [black]{\small\textsf{D}};
%  \node (L) at (-1.5, 1.5)  [black]{\small\textsf{L}};
%  \node (R) at (4.5, 1.5)   [black]{\small\textsf{R}};
%  \node (F) at (1.5, 1.5)   [black]{\small\textsf{F}};
%  \node (B) at (7.5, 1.5)   [black]{\small\textsf{B}};
%  \end{tikzpicture}%
%  \noindent\strut\hspace{5mm}\texttt{$\backslash$DrawRubikFlat}
%  \end{minipage}
%  \begin{minipage}{5cm}
%\begin{verbatim}
%  \RubikCubeSolved
%  \ShowCube{5cm}{0.4}{\DrawRubikFlat}
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%  
%  The addition of  text (numbers or letters) in the faces is 
%  straightforward---the origin of the 1-unit grid is located at the 
%  bottom left corner of the front face (orange here). 
%  The letters were placed using the following TikZ code inside the 
%  TikZ picture environment.
%  
%\begin{verbatim}
%  \RubikCubeSolved
%  \ShowCube{5cm}{0.4}{%
%    \DrawRubikFlat
%    \node (U) at (1.5, 4.5)   [black]{\small\textsf{U}};
%    \node (D) at (1.5, -1.5)  [black]{\small\textsf{D}};
%    \node (L) at (-1.5, 1.5)  [black]{\small\textsf{L}};
%    \node (R) at (4.5, 1.5)   [black]{\small\textsf{R}};
%    \node (F) at (1.5, 1.5)   [black]{\small\textsf{F}};
%    \node (B) at (7.5, 1.5)   [black]{\small\textsf{B}};
%  }
%\end{verbatim}
%  
%  \DescribeMacro{\DrawRubikCubeFlat}
%  {\noindent}A useful `semi-flat' alternative format, which uses 
%  the standard RU  view of the cube  and  appends the three hidden 
%  sides (see Rokicki \textit{etal.}, 2013),  is generated by the 
%  command \cmd{\DrawRubikCubeFlat} as follows.
%  
%  \bigskip
%
%  \begin{minipage}{5cm}
%  \begin{tikzpicture}[scale=0.5]
%  \RubikCubeSolved
%  \DrawRubikCubeFlat
%  \node (B) at (5.5, 2.5)   [white]{\small\textsf{B}};
%  \end{tikzpicture}%
%  \end{minipage}
%  \begin{minipage}{5cm}
%\begin{verbatim}
%  \RubikCubeSolved
%  \ShowCube{5cm}{0.5}{%
%     \DrawRubikCubeFlat
%     \node (B) at (5.5, 2.5)  
%              [white]{\small\textsf{B}};
%  }
%\end{verbatim}
%  \end{minipage}
%  
% \bigskip
%
% Note that even in this configuration it is straight-forward to
% write text on the graphic, since the width (on the page) of 
% the green  \textsc{right} face is exactly 1-unit, and the 
% bottom right-hand corner of the green face is raised exactly 1-unit
% (see Figure~\ref{fig:cubesquaregraph}).
% Consequently, since the origin of the grid is at the bottom left 
% corner of the front face, the  coordinates of the center of the 
% red \textsc{back} face is (5.5, 2.5). 
%  
%      \section[NCube]{NCube (NxNxN)}
%      \label{sec:NCube}
% 
%  \DescribeMacro{\DrawNCubeAll} 
%  An `NCube' is  a solved NxNxN cube drawn from the RU direction; 
%  (i.e.,~only shows faces \textsc{up}, \textsc{front}, \textsc{right}). 
%  The cubie colours of each face are All the same.
%  \begin{quote}
%    \cmd{\DrawNCubeAll\{N\}\{Xcolour\}\{Ycolour\}\{Zcolour\}}.
%  \end{quote}
%  This command takes four ordered parameters (N, X, Y, Z)---the number 
%  (integer; $N>0$) of cubies along an edge, followed by three face 
%  colours in XYZ order.
%  Since the viewpoint is only from the RU direction, the  three colour 
%  parameters are: X(Right), Y(Up), Z(Front).
%  
%  \bigskip
%  
%  \begin{minipage}{0.3\textwidth}
%  \begin{tikzpicture}[scale=0.5]
%     \DrawNCubeAll{5}{O}{Y}{G}
%  \end{tikzpicture}%
%  \end{minipage}
%  \begin{minipage}{0.5\textwidth}
%\begin{verbatim}
% \ShowCube{3.5cm}{0.5}{\DrawNCubeAll{5}{O}{Y}{G}}
%\end{verbatim}
%  \end{minipage}
%
% \medskip
%
%       \subsubsection[Draw.. error message]{\cmd{\draw} error message}
%
% See also section~\ref{sec:drawerrormessage} regarding the error message associated with 
% using a \cmd{\Draw...} command  \textit{outside}  a TikZ picture environment.
%  
%
%
%        \section{Arrows}
%        \label{sec:arrows}
%  
%  The \rubikcube\ package does not offer any special commands for drawing 
%  arrows since it is straightforward just to include the appropriate TikZ
%  `draw' commands in the \texttt{tikzpicture} environment. 
%  
%  In order to facilitate using the standard TikZ `draw' commands both 
%  the  RubikCubeFaceFront  and LayerFace commands have the coordinate origin 
%  at the bottom left corner, and draw `faces' consisting of 9~unit-squares 
%  in a  3x3 grid, as shown in  Figure~\ref{fig:facegraph}.
%  Consequently the start and finish coordinates for any arrow or line are 
%  easy to determine.
%  
%  \begin{figure}[hbt]
%     \centering
%  \ifpdf
%     \includegraphics[height=3cm]{Rubik-doc-figE.pdf}
%  \else
%  \includegraphics[height=3cm]{Rubik-doc-figE.eps}
%  \fi
%  \vspace{-5mm}\caption{\label{fig:facegraph}RubikCubeFaceFront and RubikLayerFace coordinates} 
%  \end{figure}
%  
%  For example, in Figure~\ref{fig:facegraph}  we have drawn a green
%   arrow  from the centre of cubie LB $(0.5, 0.5)$  to the centre of 
%  cubie MM\,\footnote{The code MM stands for x=Middle, y=Middle; 
%  see also Figure~\ref{fig:facenotation} on Rubik face-notation} $(1.5, 1.5)$.
%  To do this  we  just include  the following TikZ  command in the 
%  \texttt{tikzpicture} environment.
%  \begin{quote}
%\begin{verbatim}
%  \draw[->,color=green] (0.5,0.5) -- (1.5, 1.5);
%\end{verbatim}
%  \end{quote}
%
%  The following example shows the  cubie changes in the \textsc{up} face 
%  generated by the rotation sequence \rrF\rrR\rrU\rrRp\rrUp\rrFp.
%  The magenta arrows indicate movement \textit{with} cubie rotations, 
%  while the black arrow indicates movement \textit{without} rotation.
%  This example also highlights the fact that when there are several arrows, 
%  the start and end positions often need to be offset slightly away from cubie centres.
%  
%  \bigskip
%  \noindent
%  \ShowCube{2.5cm}{0.7}{%
%    \DrawRubikLayerFaceAll{W}
%    \draw[->,thick,color=magenta] (1.5,0.5) -- (2.4, 1.4);
%    \draw[->,thick] (2.5,1.5) -- (1.6, 2.4);
%    \draw[->,thick,color=magenta] (1.3, 2.3) -- (1.3, 0.5);
%    \draw[<->,thick,color=magenta] (0.5,2.6) -- (2.5, 2.6);
%    \draw[<->,thick,color=magenta] (0.5,0.3) -- (2.5, 0.3);
%  }
%  \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
%  \ShowCube{2.5cm}{0.7}{%
%    \DrawRubikLayerFaceAll{W}
%    \draw[->,thick,color=magenta] (1.5,0.5) -- (2.4, 1.4);
%    \draw[->,thick] (2.5,1.5) -- (1.6, 2.4);
%    \draw[->,thick,color=magenta] (1.3, 2.3) -- (1.3, 0.5);
%    \draw[<->,thick,color=magenta] (0.5,2.6) -- (2.5, 2.6);
%    \draw[<->,thick,color=magenta] (0.5,0.3) -- (2.5, 0.3);
%   }
%\end{verbatim}
%  \end{minipage}
%  
%  \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
%  
%  \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);
%  }
%  \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);
%   }
%\end{verbatim}
%  \end{minipage}
%  
%  \bigskip
%  
%  {\noindent}The following example shows an arrow on the Rubik cube. 
%  The origin of coordinates is at the bottom left corner of the 
%  \textsc{front} face (see Section~\ref{sec:coordinates}).
%  
%  \bigskip
%  \noindent
%  \begin{minipage}{2.8cm}
%  \centering
%  \begin{tikzpicture}[scale=0.7]
%  
%  \RubikFaceFront{O}{O}{O}
%                 {O}{O}{X}
%                 {X}{O}{X}
%  
%  \RubikFaceRight{G}{G}{G}
%                 {X}{G}{G}
%                 {X}{X}{X}
%  
%  \RubikFaceDown {X}{G}{X}
%                 {X}{Y}{X}
%                 {X}{X}{X}
%  
%  \DrawRubikCubeRD
%  \draw[ultra thick,->,color=blue] 
%            (1.5,0.5) -- (2.5, 1.5);
%  \end{tikzpicture}%
%  \end{minipage}
%     \hspace{1cm}
%  \begin{minipage}{0.6\textwidth}
%\begin{verbatim}
% \RubikFaceFront{O}{O}{O}
%                {O}{O}{X}
%                {X}{O}{X}
%  
% \RubikFaceRight{G}{G}{G}
%                {X}{G}{G}
%                {X}{X}{X}
%  
% \RubikFaceDown {X}{G}{X}
%                {X}{Y}{X}
%                {X}{X}{X}
% \ShowCube{3cm}{0.7}{%  
%    \DrawRubikCubeRD
%    \draw[ultra thick,->,color=blue] 
%                (1.5,0.5) -- (2.5, 1.5);  
%  }
%\end{verbatim}
%  \end{minipage}
%  
%
%
% \section{Final example}
%
% We now present, as a final example, the code used to draw the  front page 
% figure\,\footnote{This is a sequence of order 6 used to generate the `cross' 
% configuration when solving the cube. Doing it on  a `solved' cube allows you  
% to see how the three edge cubies  move, and either flip (magenta arrows) or do 
% not flip (black arrow).}. 
% This code uses both the \rubikcube\ and  \textsc{rubikrotation} packages,
% and therefore needs to be run using the \LaTeX\   \verb!--shell-escape! command-line switch,
% as described in the \textsc{rubikrotation} package.
%
%
% \bigskip
% \hfil
% \RubikCubeSolved
% \ShowCube{2cm}{0.4}{\DrawRubikCubeRU}
% \ShowCube{2cm}{0.4}{%
%    \DrawFlatUpSide
%    \draw[thick,->,color=magenta] (1.5,0.5) -- (2.4, 1.4);
%    \draw[thick,->] (2.5,1.5) -- (1.6, 2.4);
%    \draw[thick,->,color=magenta] (1.3, 2.3) -- (1.3, 0.5);
%    \draw[thick,<->,  color=blue] (0.5,2.6) -- (2.5, 2.6);
%    \draw[thick,<->,  color=blue] (0.5,0.3) -- (2.5, 0.3);
% }
% \Rubik{F}\Rubik{R}\Rubik{U}\Rubik{Rp}\Rubik{Up}\Rubik{Fp}%
% \ \ \ $\longrightarrow$
% \ShowCube{2cm}{0.4}{%
%     \DrawRubikLayerFace{W}{W}{B}
%                        {W}{W}{O}
%                        {W}{R}{B}
%     \DrawRubikLayerSideT {G}{G}{R}
%     \DrawRubikLayerSideLR{R}   {W}
%                          {B}   {W}
%                          {O}   {W}
%     \DrawRubikLayerSideB {G}{W}{O}
% }
% \hfil
% \bigskip
%
%
%\begin{verbatim}
% \hfil
% \RubikCubeSolved
% \ShowCube{2cm}{0.4}{\DrawRubikCubeRU}
% \ShowCube{2cm}{0.4}{%
%    \DrawFlatUpSide
%    \draw[thick,->,color=magenta] (1.5,0.5) -- (2.4, 1.4);
%    \draw[thick,->] (2.5,1.5) -- (1.6, 2.4);
%    \draw[thick,->,color=magenta] (1.3, 2.3) -- (1.3, 0.5);
%    \draw[thick,<->,  color=blue] (0.5,2.6) -- (2.5, 2.6);
%    \draw[thick,<->,  color=blue] (0.5,0.3) -- (2.5, 0.3);
% }
% \Rubik{F}\Rubik{R}\Rubik{U}\Rubik{Rp}\Rubik{Up}\Rubik{Fp}%
% \ \ \ $\longrightarrow$
% \RubikRotation{F,R,U,Rp,Up,Fp}
% \ShowCubeF{2cm}{0.4}{\DrawFlatUpSide}
% \hfil
%\end{verbatim}
%
%
%
%     \subsection[Without using {\textbackslash}RubikRotation]{Without using \cmd{\RubikRotation..}}
%
% If you really need to draw the above figure \textit{without}  using 
% the \textsc{rubikrotation}  package (as we had to in order to write 
% this particular document) then  you would need to  replace the 
% commands
%\begin{verbatim}
% \RubikRotation{F,R,U,Rp,Up,Fp}
% \ShowCubeF{2cm}{0.4}{\DrawFlatUpSide}
%\end{verbatim}
% with the following set of \cmd{\DrawRubikLayer...} commands.
%
%\begin{verbatim}
% \ShowCube{2cm}{0.4}{%
%     \DrawRubikLayerFace{W}{W}{B}
%                        {W}{W}{O}
%                        {W}{R}{B}
%     \DrawRubikLayerSideT {G}{G}{R}
%     \DrawRubikLayerSideLR{R}   {W}
%                          {B}   {W}
%                          {O}   {W}
%     \DrawRubikLayerSideB {G}{W}{O}
% }
%\end{verbatim}
%
%
%
%
%
%  \section{Known issues \& shortcomings}
%
% Please contact the authors regarding any ideas, errors or shortcomings etc. 
%
% \begin{itemize} 
%  
%  \item  The rotation hieroglyphs are optimised for a 10pt font, and  do 
%    not  scale  with document  font size.  However, they do 
%   seem to  work reasonably well with both 11pt and 12pt fonts.
%  Any suggestions are welcome.
%
%  \item The sidebars cannot be arbitrarily positioned.
% 
% \end{itemize}
%
%
%  \section{Acknowledgements}
%  
%  We would like to thank Peter Bartal and  Peter Grill for useful ideas and  
%  suggestions.   We have built on some of their ideas and have acknowledged
%  these instances in the documentation. 
%  We would also like to  thank Christian Tellechea for the  \cmd{\@join\{\}\{\}} command.
%  
%
%
%   \section{Future supporting packages}
%  
%  Since  Rubik-type cubes currently exist in  a variety of sizes (from 2x2x2 to 11x11x11)
%  it is possible that similar packages dealing with cubes of other sizes may be made in 
%  the future.  Supporting tools  may also be  made
%  using various programming languages, e.g.,~Lua etc. Consequently  the naming of such 
%  packages and tools, and even the associated CTAN directories, needs to be given 
%  some thought in order to prevent possible confusion.
%
%  In the event of new  packages being made, we suggest that a CTAN directory structure 
%  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{History}
%
% \begin{itemize}

% \item Version 3.0 (September 2015)
%
%  ---All rotation commands can now use the rotation-code as an argument; for example, 
% the rotation \rr{D} can now be typeset using the command \cmd{\rr\{D\}} etc 
%  (see Section~\ref{sec:RubikCommands}).
% The new rotation commands are:
% \begin{quote}
% \cmd{\rr\marg{rotation-code}}
% \newline\cmd{\rrh\marg{rotation-code}}
% \newline\cmd{\Rubik\marg{rotation-code}}
% \newline\cmd{\textRubik\marg{rotation-code}}
%\end{quote}
% The original rotation command formats (e.g.,~\cmd{\rrD}) are still supported  for  backwards compatibility.
%
%  --- \cmd{\ShowCube} and \cmd{\ShowCubeF} are new commands for displaying
% a cube inside a minipage (see Sections~\ref{sec:showcube} and \ref{sec:showcubecode}). 
%
% --- \cmd{\RubikCubeGrey} is a new command for setting up a `starter cube' for which the 
% only allocated colours are those for the centre cubies (see Section~\ref{sec:rubikcubegrey}). 
% The colour configuration matches that of the \cmd{\RubikCubeSolved}. 
%
% \item Version 2.2 (January 2015)
%
% ---Fixed typos and minor errors in the documentation. 
%
% ---Added the following commands to facilitate typesetting a face, 
% as described in Section~\ref{sec:flatcommands}.
%\begin{quote}
%\begin{verbatim}
%\DrawFlatUp
%\DrawFlatDown
%\DrawFlatLeft
%\DrawFlatRight
%\DrawFlatFront
%\DrawFlatBack
%\DrawFlatUpSide
%\DrawFlatDownSide
%\DrawFlatLeftSide
%\DrawFlatRightSide
%\DrawFlatFrontSide
%\DrawFlatBackSide
%\end{verbatim}
%\end{quote}
%
% ---Changed `Equator' $\rightarrow$ `Middle' in  all \cmd{\DrawLayer..} 
% commands (for consistency). Hence `E' $\rightarrow$ `M' in all Flat 
% commands and Slice commands. Note although former  use of `Equator' is
% retained for backward compatibility (for the moment) it is now deprecated. 
%
% ---Fixed a conflict with the \TeX\ \cmd{\sb} command as used by the  \textbf{url} 
% package which resulted in  reference chaos when the \textbf{url} package was used with 
% the \Rubikcube\ package (internalised \cmd{\sb} to \cmd{\@sb}). Also  internalised for 
%  convenience  \cmd{\sd} to \cmd{\@sd}; \cmd{\sh} to \cmd{\@sh}; \cmd{\sc} to \cmd{\@sc};
% \cmd{\sq} to \cmd{\@sq}.
% 
%
% \item Version 2.0 (February 5, 2014) 
%
% ---First release.
%
% \end{itemize}
%
%
%
%    \section{References}
%  
%  \begin{itemize}
%  
%  
%  \item  Bartal P (2011)
%  
%  \url{http://tex.stackexchange.com/questions/34482/}
%  
%  \item Chen JJ (2004). Group theory and the Rubik's cube.
%  \url{http://www.math.harvard.edu/~jjchen/docs/rubik.pdf}
%
%
% \item Davis T (2006). Group theory via Rubik's cube. 
%  \url{http://www.geometer.org/rubik/group.pdf}
  
%  \item Demaine ED, Demaine ML, Eisenstat S, Lubiw A and Winslow A (2011).
%  Algorithms for solving Rubik's cubes.
%  \url{http://www.arxiv.org/abs/1106.5736/}
%  
%  \item Garfath-Cox, A (1981). \textit{The cube},  (Bolden Publishing Co., 
%       East Molesey, Surrey) pp.32.  [copy in British Library]
%  
%  
%  \item Duvoid T (2010).
%  M\'{e}thode simple pour remonter le Rubik's cube. 
%  \newline\url{http://duvoid.fr/rubik/rubik-debutant-couleurs.pdf}
%  \newline\url{http://duvoid.fr/rubik/sources/notation_en.eps}
%  \newline\url{http://duvoid.fr/rubik/sources/rubik-debutant-couleurs.tex}
%  
%  \item Duvoid T (2011).
%  M\'{e}thode avanc\'{e}e  pour remonter le Rubik's cube. 
%  \newline\url{http://duvoid.fr/rubik/rubik-friddrich-couleurs.pdf}
%  \newline\url{http://duvoid.fr/rubik/sources/rubik-friddrich-couleurs.tex}
%
% \item Feuers\"{a}nger (2015). Manual for package \textsc{pgfplots} 
% (\texttt{pgfplots.pdf}).  v\,1.12.1 (2015/05/02),  \S\,3.2.3, page~20.
%  \url{http://www.ctan.org/pkg/pgfplots}.
%  
%  \item Fridrich J. \ \  \url{http://www.ws.binghamton.edu/fridrich/}.  
%  See the useful `notation' section  on the `Pretty patterns' webpage at 
%  \url{http://www.ws.binghamton.edu/fridrich/ptrns.html}.
%
%
%  \item Golomb SW (1981). Rubik's cube and a model of quark confinement.
%  \textit{Am.\ J.\ Phys.}; vol~49, pp~1030--1031. 
%
% \item Golomb SW (1982). Rubik's cube and quarks: twists on the eight corner cells 
% of Rubik's cube provide a model for many  aspects of quark behaviour.
%  \textit{American Scientist}; 
%    \underline{70}, pp.~257--259. \url{http://www.jstor.org/stable/27851433}
%  
%  \item Gymrek M (2009). The mathematics of the Rubik's cube.
%  \newline\url{http://web.mit.edu/sp.268/www/rubik.pdf}
%  
%  \item Hofstadter D (1981). Rubik cube. \textit{Scientific American}; March issue.
%  
%  \item Hutchings M (2011). The mathematics of Rubik's cube (slide presentation). 
%        \url{http://math.berkeley.edu/~hutching/rubik.pdf}
%
%
% \item Jelinek website (Jelinek J). Rubik's cube solution methods.
%  \url{http://www.rubikscube.info/}    
%  
%  \item Joyner D (2008). \textit{Adventures in group theory: 
%       Rubik's cube, Merlin's machine and other mathematical toys}; pp~322.
%  \url{http://www.mike.verdone.ca/media/rubiks.pdf}
%  
%  \item Kociemba  website (Kociemba H). \url{http://www.kociemba.org/cube.htm}
%  
%  \item Kriz I and Siegel P (2008). Rubik's cube-inspired puzzles demonstrate math's 
% simple groups.  \textit{Scientific American};  July 2008 
%  
%
%  \item Randelshofer website (Randelshofer W).  Pretty patterns. 
%  \url{http://www.randelshofer.ch/rubik/patterns/}
%
%   \item Reid website (Reid M) \ \  \url{http://www.cflmath.com/Rubik/}, 
%       for patterns see \url{http://www.cflmath.com/Rubik/patterns.html}
%
%  
%  \item Rokicki T, Kociemba H, Davidson M and Dethridge J (2013). The diameter of the 
%       Rubik's cube is twenty.  \textit{SIAM.\ J.\ Discrete Math.}, \underline{27}, 1082--1105.
%  (\url{http://tomas.rokicki.com/rubik20.pdf})
%
%  \item Rubik's cube. See Section on notation. 
%  \newline\url{http://en.wikipedia.org/wiki/Rubik's_Cube}
%  
%  \item Speedsolving website. \url{www.speedsolving.com/}
%  
%  \item Tran R (2005). A mathematical approach to solving Rubik's cube.
%  \url{http://www.math.ubc.ca/~cass/courses/m308/projects/rtran/rtran.pdf}
%  
%
%  \item Treep A and  Waterman M (1987). Marc Waterman's Algorithm, Part 2. 
%    \textit{Cubism For Fun 15}, p.~10 (Nederlandse Kubus Club)
%    [cited from \textit{Wikipedia} (Rubik's cube)]
%
%  
%  \item Vandenbergh L. \ \ \textsc{cubezone} \url{http://www.cubezone.be}
%  
%  \item WCA (2015). World Cube Association Regulations. See Section~12 for notation.
%   \url{http://www.worldcubeassociation.org/regulations.htm}
%  
%  
%  \end{itemize}
%  
%
%
% ^^A ==================================================
% \StopEventually{\PrintIndex}
%
%
%
% \section{The code (\texttt{rubikcube.sty})} 
%  
%  The conventions  we adopt regarding  capital letters and the 
%  XYZ argument ordering are detailed in  Section~\ref{sec:conventions}.
%
% Note that it is  important in a graphics package to use a trailing \% on 
% the end of lines which  break  before the terminal curley bracket of a newcommand.
% This is to prevent accumulating spurious spaces which may otherwise appear in 
% figures and diagrams as a strange or unexpected horizontal shift or whitespace.
%
%   \subsection{\hspace{3mm}Package heading}
%
%    \begin{macrocode}
%<*rubikcube>
\def\RCfileversion{3.0}%
\def\RCfiledate{2015/09/25}%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rubikcube}[\RCfiledate\space (v\RCfileversion)]
%    \end{macrocode}
%  The package requires TikZ---so we load it if not already loaded.
%    \begin{macrocode}
\@ifpackageloaded{tikz}{}{%
  \typeout{---rubikcube requires the TikZ package.}%
  \RequirePackage{tikz}}%
%    \end{macrocode}
%
%    \begin{macro}{\rubikcube}
%  First we create a suitable logo
%    \begin{macrocode}
\newcommand{\rubikcube}{\textsc{rubikcube}}%
\newcommand{\Rubikcube}{\textsc{Rubikcube}}%
%    \end{macrocode}
%    \end{macro}
%
%
%   \subsection{\hspace{3mm}Some useful internal commands}
%  \label{sec:usefulinternalcommands}
%
%  \begin{macro}{\@rr} 
%  \begin{macro}{\@rrp}
%  \begin{macro}{\@rrw} 
%  \begin{macro}{\@rrwp} 
%  \begin{macro}{\@rrs} 
%  \begin{macro}{\@rrsp}
%  \begin{macro}{\@rra} 
%  \begin{macro}{\@rrap} 
%  \begin{macro}{\@xyzh} 
%  \begin{macro}{\@xyzhp} 
%  \begin{macro}{\@xyzRubik} 
%  \begin{macro}{\@xyzRubikp} 
%  \begin{macro}{\@SquareLetter} 
%  \begin{macro}{\@hRubik} 
% Internal commands. These  are used to generate the
% prime, w, w-prime, s, s-prime, a, a-prime   
% rotation commands. The \cmd{\@xyz..} commands are used to generate the 
% x,y,z,u,d,l,r,f,b, and their prime rotation commands.
% The \cmd{\@SquareLetter} command is used to form the separate square hieroglyph  form
% used for rotations with no visible representation from the front 
% (eg~B.., Fs, Fsp, Fa, Fap, S, Sp, Sf, Sfp, Sb, Sbp).
% The \cmd{\@hRubik} is the vertical shift  used  to raise the box carying the rotation 
% rotation-code in \cmd{\Rubik..} commands not visible from the front.
%
%  The idea is that by using these internal
% tools we will be able to more easily standardise the  size and position 
% of all the various glyphs. However, these internal tools are currently 
% only partially implemented (= work in progress).
% \begin{macrocode}
\newcommand{\@rr}[1]{\textbf{\textsf{#1}}}
\newcommand{\@rrp}[1]{\textbf{\textsf{#1}$^\prime$}}
\newcommand{\@rrw}[1]{\textbf{\textsf{#1\footnotesize{w}}}}
\newcommand{\@rrwp}[1]{\textbf{\textsf{#1\footnotesize{w}}$^\prime$}}
\newcommand{\@rrs}[1]{\textbf{\textsf{#1\footnotesize{s}}}}
\newcommand{\@rrsp}[1]{\textbf{\textsf{#1\footnotesize{s}}$^\prime$}}
\newcommand{\@rra}[1]{\textbf{\textsf{#1\footnotesize{a}}}}
\newcommand{\@rrap}[1]{\textbf{\textsf{#1\footnotesize{a}}$^\prime$}}
\newcommand{\@xyzh}[1]{\textbf{[\textsf{#1}]}\,}
\newcommand{\@xyzhp}[1]{\textbf{[\textsf{#1}$^\prime$]}\,}
\newcommand{\@xyzRubik}[1]{\raisebox{3.45pt}{\textbf{[\textsf{#1}]}}}
\newcommand{\@xyzRubikp}[1]{\raisebox{3.45pt}{\textbf{[\textsf{#1}$^\prime$]}}}
\newcommand{\@SquareLetter}[1]{\setlength\fboxsep{2.5pt}\fboxrule=0.8pt%
   \fbox{\rule[-1pt]{0pt}{8.5pt}\raisebox{-0.5pt}{#1}}}
\newlength\@hRubik%
\setlength{\@hRubik}{0.185cm}%
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%
%  \begin{macro}{\@join} 
%  We also require a macro for joining two strings  so we can convert
%  a rotation-code, say U,  into a macro which typesets it in some form, say \cmd{\rrhU}.
%  The following \cmd{\@join\{\}\{\}} command is by Christian Tellechea.
%  {\newline}Usage: \cmd{\@join\marg{command-stem}\marg{rotation-code}}. For example, 
%  to create the command \cmd{\rrhU} we would write |\@join{\rrh}{U}|, and hence 
%  the command |\rrh{U}| is equivalent to \cmd{\rrhU} (see Section~\ref{sec:cmdsusingjoin}).
%  {\newline}Since this macro is also useful for processing rotation-codes in a  list, 
%  which may also include macros, it is important that |#2| is not detokenized.
% \begin{macrocode}
\newcommand*\@join[2]{%
    \csname\expandafter\@gobble\string#1#2\endcsname}
%    \end{macrocode}
%  \end{macro}
%
%
%   \subsection{\hspace{3mm}Colours}
%  \label{sec:codecolours}
%
%  These colour allocations were initially defined by Peter Bartal (2011).
%  We have modified only the colour grey, which is now defined as {black!30}.
%
%    \begin{macrocode}
\definecolor{R}{HTML}{C41E33}%
\definecolor{G}{HTML}{00BE38}%
\definecolor{B}{HTML}{0051BA}%
\definecolor{Y}{HTML}{FFFF00}%
\colorlet{X}{black!30}% grey
\colorlet{O}{orange}%
\colorlet{W}{white}%
%    \end{macrocode}
%
%
%
%  \subsection{\hspace{3mm}ShowCube command}
%  \label{sec:showcubecode}
%
%  \begin{macro}{\ShowCube} 
%  \begin{macro}{\ShowCubeF} 
%  The macro \cmd{\ShowCube}\marg{minipage width}\marg{TikZ scale factor}\marg{Draw.. cmd}  
%  displays the cube inside a minipage, so that we can easily tailor the minipage 
%  width (|#1|) and also the  TikZ scale factor (|#2|). The \cmd{\ShowCubeF} command
%  places an fbox around the minipage so users can see the extent of any white space.
% {\newline}\textsc{usage}: |\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}|
%    \begin{macrocode}
\newcommand{\ShowCube}[3]{%
  \begin{minipage}{#1}%
  \centering%
  \begin{tikzpicture}[scale=#2]%
  #3%
  \end{tikzpicture}%
  \end{minipage}%
}
\newcommand{\ShowCubeF}[3]{%
  \fbox{%
  \begin{minipage}{#1}%
  \centering%
  \begin{tikzpicture}[scale=#2]%
  #3%
  \end{tikzpicture}%
  \end{minipage}%
}}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%
%
%  \subsection{\hspace{3mm}Face commands}
%
% Cube face notation = U, D, L, R, F, B (Singmaster)
% {\newline}Cubie-square notation = t, m, b, l, m, r = top, middle, 
% bottom, left, middle, right.
% We  use t,b for cubie-squares (facelets) to avoid confusion with cube Face notation.
% We number the cubie-squares on a face 1--9 reading from left-to-right, 
% starting top-left, ending bottom-right, as follows 
% (see also Figure~\ref{fig:facenotation}): 
% {\newline}\strut\hspace{1cm}top row \ \ \ \ \ (1,2,3) = tl, tm, tr
% {\newline}\strut\hspace{1cm}middle row (4,5,6) = ml, mm, mr
% {\newline}\strut\hspace{1cm}bottom row (7,8,9) = bl, bm, br
%
%  \begin{macro}{\RubikFaceUp} 
%  \begin{macro}{\RubikFaceDown} 
%  \begin{macro}{\RubikFaceLeft} 
%  \begin{macro}{\RubikFaceRight} 
%  \begin{macro}{\RubikFaceFront}  
%  \begin{macro}{\RubikFaceBack}  
% These 5 commands allocate a colour to each of the 9 cubie-squares in the 
% specified face (Up, Down, Left, Right, Front, Back).  Each command takes 9 arguments 
% (colour codes) in the order 1--9 as specified above. 
%
% {\noindent}\textsc{example}:  \cmd{\RubikFaceUp\{R\}\{O\}\{Y\} \{G\}\{B\}\{W\} \{X\}\{R\}\{G\}}
%
%
% {\noindent}Each of the 9 \cmd{\def\{\}} commands below allocates one colour 
% to a specific cubie-square (facelet), using a simple three-letter encoding. 
% Each letter is an initial letter of the words Up, Down, Left, Right, Front, Back, 
% left, middle, right, top, middle, bottom. 
%
% For example, in the command \cmd{\Urt\{\#1\}} 
% the U stands for the Up face of the cube, while the \texttt{rt} stands 
% for the ``right-top'' facelet on this face. Note that the order 
% of the two lowercase letters (in this case \texttt{rt}) are always written 
% in the $x,y$ order; i.e.,~the first of the two lowercase letters relates to the $x$ 
% direction (either left, middle, or right), while the second  lowercase letter 
% relates to the $y$  direction (either top, middle, or bottom)---this rule makes it
% easy to remember the order.
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro} 
%  \end{macro}
%  \end{macro}
%    \begin{macrocode}
\newcommand{\RubikFaceUp}[9]{%
\def\Ult{#1}\def\Umt{#2}\def\Urt{#3}% 
\def\Ulm{#4}\def\Umm{#5}\def\Urm{#6}%
\def\Ulb{#7}\def\Umb{#8}\def\Urb{#9}%
}   
\newcommand{\RubikFaceFront}[9]{%
\def\Flt{#1}\def\Fmt{#2}\def\Frt{#3}% 
\def\Flm{#4}\def\Fmm{#5}\def\Frm{#6}%
\def\Flb{#7}\def\Fmb{#8}\def\Frb{#9}%
}
\newcommand{\RubikFaceRight}[9]{%
\def\Rlt{#1}\def\Rmt{#2}\def\Rrt{#3}% 
\def\Rlm{#4}\def\Rmm{#5}\def\Rrm{#6}%
\def\Rlb{#7}\def\Rmb{#8}\def\Rrb{#9}%
}
\newcommand{\RubikFaceDown}[9]{%
\def\Dlt{#1}\def\Dmt{#2}\def\Drt{#3}% 
\def\Dlm{#4}\def\Dmm{#5}\def\Drm{#6}%
\def\Dlb{#7}\def\Dmb{#8}\def\Drb{#9}%
}
\newcommand{\RubikFaceLeft}[9]{%
\def\Llt{#1}\def\Lmt{#2}\def\Lrt{#3}% 
\def\Llm{#4}\def\Lmm{#5}\def\Lrm{#6}%
\def\Llb{#7}\def\Lmb{#8}\def\Lrb{#9}%
}
\newcommand{\RubikFaceBack}[9]{%
\def\Blt{#1}\def\Bmt{#2}\def\Brt{#3}% 
\def\Blm{#4}\def\Bmm{#5}\def\Brm{#6}%
\def\Blb{#7}\def\Bmb{#8}\def\Brb{#9}%
}
%    \end{macrocode}
%
%  \begin{macro}{\RubikFaceUpAll} 
%  \begin{macro}{\RubikFaceDownAll} 
%  \begin{macro}{\RubikFaceLeftAll} 
%  \begin{macro}{\RubikFaceRightAll} 
%  \begin{macro}{\RubikFaceFrontAll}  
%  \begin{macro}{\RubikFaceBackAll}  
% These 5 commands allocate the same colour to all 9 cubiesquares in the specified face (Up, Down, Left, Right, Front).  Each command therefore  takes only  1 argument (one of the colour codes).
%
% {\noindent}For example, \cmd{\RubikFaceUpAll\{R\}}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro} 
%  \end{macro}
%  \end{macro}
%    \begin{macrocode}
\newcommand{\RubikFaceUpAll}[1]{%
\def\Ult{#1}\def\Umt{#1}\def\Urt{#1}% 
\def\Ulm{#1}\def\Umm{#1}\def\Urm{#1}%
\def\Ulb{#1}\def\Umb{#1}\def\Urb{#1}%
}
\newcommand{\RubikFaceFrontAll}[1]{%
\def\Flt{#1}\def\Fmt{#1}\def\Frt{#1}% 
\def\Flm{#1}\def\Fmm{#1}\def\Frm{#1}%
\def\Flb{#1}\def\Fmb{#1}\def\Frb{#1}%
}
\newcommand{\RubikFaceRightAll}[1]{%
\def\Rlt{#1}\def\Rmt{#1}\def\Rrt{#1}% 
\def\Rlm{#1}\def\Rmm{#1}\def\Rrm{#1}%
\def\Rlb{#1}\def\Rmb{#1}\def\Rrb{#1}%
}
\newcommand{\RubikFaceLeftAll}[1]{%
\def\Llt{#1}\def\Lmt{#1}\def\Lrt{#1}% 
\def\Llm{#1}\def\Lmm{#1}\def\Lrm{#1}%
\def\Llb{#1}\def\Lmb{#1}\def\Lrb{#1}%
}
\newcommand{\RubikFaceDownAll}[1]{%
\def\Dlt{#1}\def\Dmt{#1}\def\Drt{#1}% 
\def\Dlm{#1}\def\Dmm{#1}\def\Drm{#1}%
\def\Dlb{#1}\def\Dmb{#1}\def\Drb{#1}%
}
\newcommand{\RubikFaceBackAll}[1]{%
\def\Blt{#1}\def\Bmt{#1}\def\Brt{#1}% 
\def\Blm{#1}\def\Bmm{#1}\def\Brm{#1}%
\def\Blb{#1}\def\Bmb{#1}\def\Brb{#1}%
}
%    \end{macrocode}
%
% {\noindent}We now use these commands to initialise all visible faces to  default colour grey (X)
%
% \begin{macrocode}
\RubikFaceUpAll{X}%
\RubikFaceDownAll{X}%
\RubikFaceLeftAll{X}%
\RubikFaceRightAll{X}%
\RubikFaceFrontAll{X}%
\RubikFaceBackAll{X}%
%    \end{macrocode}
%
%

%
%   \subsection{\hspace{3mm}RubikCubeGrey command}
%    \label{sec:codegrey}
%
%    \begin{macro}{\RubikCubeGrey}
% This command sets the face/colour configuration (state) of a 3x3x3 
% Rubik cube with no colours allocated except for the central cubie of each face.
% These central colours match those defined for the RubikCubeSolved command. 
%    \begin{macrocode}
\newcommand{\RubikCubeGrey}{%
\RubikFaceUp   {X}{X}{X}{X}{W}{X}{X}{X}{X}%
\RubikFaceDown {X}{X}{X}{X}{Y}{X}{X}{X}{X}%
\RubikFaceLeft {X}{X}{X}{X}{B}{X}{X}{X}{X}%
\RubikFaceRight{X}{X}{X}{X}{G}{X}{X}{X}{X}%
\RubikFaceFront{X}{X}{X}{X}{O}{X}{X}{X}{X}%
\RubikFaceBack {X}{X}{X}{X}{R}{X}{X}{X}{X}%
}
%    \end{macrocode}
%    \end{macro}
%
%
%   \subsection{\hspace{3mm}RubikCubeSolved command}
%
%    \begin{macro}{\RubikCubeSolved}
% This command sets the face/colour configuration (state) of a  typical 
% solved Rubik cube. 
%    \begin{macrocode}
\newcommand{\RubikCubeSolved}{%
  \RubikFaceUpAll{W}%
  \RubikFaceDownAll{Y}%
  \RubikFaceLeftAll{B}%
  \RubikFaceRightAll{G}%
  \RubikFaceFrontAll{O}%
  \RubikFaceBackAll{R}%
}
%    \end{macrocode}
%    \end{macro}
%
%
%
%         \subsection{\hspace{3mm}Slice commands}
%
% \begin{macro}{\RubikSliceTopR} 
% \begin{macro}{\RubikSliceTopL} 
% \begin{macro}{\RubikSliceMiddleR} 
% \begin{macro}{\RubikSliceMiddleL} 
% \begin{macro}{\RubikSliceBottomR} 
% \begin{macro}{\RubikSliceBottomL} 
% These 6~commands allocate the colour arguments for the 6~visible ordered 
% facelets along a horizontal slice. There are three horizontal 
% slices to consider (Top, Middle, Bottom) and each has two viewpoints.
% The colour-code arguments are  ordered 1--6 from left to right. 
% The terminal L and R denote the Left (L) viewpoint  and Right (R) 
% viewpoint versions.
% Note that the two legacy `Equator' versions (now replaced by `Middle') 
% are retained (below) to allow backward compatibility. 
%    \begin{macrocode}
\newcommand{\RubikSliceTopR}[6]{% 
\def\Flt{#1}\def\Fmt{#2}\def\Frt{#3}% 
\def\Rlt{#4}\def\Rmt{#5}\def\Rrt{#6}%
} 
\newcommand{\RubikSliceTopL}[6]{% 
\def\Llt{#1}\def\Lmt{#2}\def\Lrt{#3}% 
\def\Flt{#4}\def\Fmt{#5}\def\Frt{#6}%
} 
\newcommand{\RubikSliceMiddleR}[6]{% 
\def\Flm{#1}\def\Fmm{#2}\def\Frm{#3}%
\def\Rlm{#4}\def\Rmm{#5}\def\Rrm{#6}%
} 
\newcommand{\RubikSliceMiddleL}[6]{% 
\def\Llm{#1}\def\Lmm{#2}\def\Lrm{#3}%
\def\Flm{#4}\def\Fmm{#5}\def\Frm{#6}%
} 
\newcommand{\RubikSliceEquatorR}[6]{% 
\def\Flm{#1}\def\Fmm{#2}\def\Frm{#3}%
\def\Rlm{#4}\def\Rmm{#5}\def\Rrm{#6}%
} 
\newcommand{\RubikSliceEquatorL}[6]{% 
\def\Llm{#1}\def\Lmm{#2}\def\Lrm{#3}%
\def\Flm{#4}\def\Fmm{#5}\def\Frm{#6}%
}
\newcommand{\RubikSliceBottomR}[6]{% 
\def\Flb{#1}\def\Fmb{#2}\def\Frb{#3}%
\def\Rlb{#4}\def\Rmb{#5}\def\Rrb{#6}%
} 
\newcommand{\RubikSliceBottomL}[6]{% 
\def\Llb{#1}\def\Lmb{#2}\def\Lrb{#3}%
\def\Flb{#4}\def\Fmb{#5}\def\Frb{#6}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
%      \subsection{\hspace{3mm}Cube drawing macros}
%
% Since the three visible sides of a Rubik cube have up to  27  non-grey colours, 
% and \TeX\ has only 9 macro  parameters available, we are forced to draw 
% Rubik cubes  by first specifying the colours on each of the three faces, 
% and then  using a `DrawRubikCubeXY' command, where the trailing XY code
%  defines the  view direction (X = either R, L; Y = either U, D). 
% The order of the XY code is important: X~first, Y~second (so it is easy to remember).
%
% On each face the facelets are drawn in the following order: Top row 
% (left to right), Middle row (left to right), Bottom row (left to right).
%
% The TikZ  draw cycle for each facelet square on a Rubik cube face cycles 
% through the  four corners of the facelet in the following order: 
% lb $\rightarrow$ lt $\rightarrow$ rt $\rightarrow$ rb;  the code being 
% lb (LeftBottom), lt (LeftTop), rt (RightTop), rb (RightBottom)
% (only need four coords); the grid origin is at the bottom-left corner of the 
% \textsc{front} face.
%
%  \begin{macro}{\DrawRubikCubeFrontFace}
% This `FrontFace' command  is an `internal' command  which draws and paints 
% all the facelets on the \textsc{front} face of a Rubik cube.  It is used by all 
% of the  cube drawing macros which display the \textsc{front} face. 
% The 9~colours are allocated by an earlier \cmd{\RubikFaceFront} command.
% These Face macros are based, in part, on those of Peter Bartal (2011).
%    \begin{macrocode}
\newcommand{\DrawRubikCubeFrontFace}{%
%  ---top row left to right
\draw[line join=round,line cap=round,ultra thick,fill=\Flt]%
(0,2) -- (0, 3) -- (1,3) -- (1,2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Fmt]%
(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Frt]%
(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle;
% -----middle row left to right
\draw[line join=round,line cap=round,ultra thick,fill=\Flm]%
(0,1) -- (0, 2) -- (1,2) -- (1,1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Fmm]%
(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Frm]%
(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle;
% ----bottom row left to right
\draw[line join=round,line cap=round,ultra thick,fill=\Flb]%
(0,0) -- (0, 1) -- (1,1) -- (1,0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Fmb]%
(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Frb]%
(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle;
}
%    \end{macrocode}
% \end{macro}
%
%      \subsubsection{\hspace{3mm}Viewing direction}
%
%  The command  `DrawRubikCubeXY' command uses the trailing XY code
%  to specify  the  view direction (X = either R, L; Y = either U, D). 
%  The order of the XY code is important: X~first, Y~second (so it is easy
%  to remember).
%
%  \begin{macro}{\DrawRubikCubeRU}
% This command draws and paints a Rubik cube  as viewed from 
% the Right Upper (RU) viewpoint. It starts by using the internal 
% command \cmd{\DrawRubikCubeFrontFace} to draw the \textsc{front} face, 
% and then draws the \textsc{up} face  followed by the \textsc{right} face.
% The colours are allocated  to particular facelets using  the   \cmd{\RubikFaceUp},
%  \cmd{\RubikFaceRight} and  \cmd{\RubikFaceFront} commands. 
%
% The (x,y) grid origin is at the bottom-left corner of the \textsc{front} face.
% The perspective is designed so that the  2D~graphic image of the  side face 
% (\textsc{right} in this particular case) has its `horizontal' lines running 
% at 45~degrees. This has the useful advantage that the 2D~width of the side is 
% exactly 1-unit, and so makes it easy to determine the 2D~(x,y) coordinates
% of any position, and hence facilitates  typesetting text onto the image of 
% the cube using TikZ commands.

%    \end{macro}
%    \begin{macrocode}
\newcommand{\DrawRubikCubeRU}{%
\DrawRubikCubeFrontFace %% frontface
%%-----------Up face----------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Ult]%
(0.66,3.66) -- (1,4) -- (2,4) -- (1.66,3.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umt]%
(1.66,3.66) -- (2,4) -- (3,4) -- (2.66,3.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urt]%
(2.66,3.66) -- (3,4) -- (4,4) -- (3.66,3.66)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Ulm]%
(0.33,3.33) -- (0.66,3.66) -- (1.66,3.66) -- (1.33,3.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umm]%
(1.33,3.33) -- (1.66,3.66) -- (2.66,3.66) -- (2.33,3.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urm]%
(2.33,3.33) -- (2.66,3.66) -- (3.66,3.66) -- (3.33,3.33)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]%
(0,3) -- (0.33,3.33) -- (1.33,3.33) -- (1,3)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umb]%
(1,3) -- (1.33,3.33) -- (2.33,3.33) -- (2,3)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urb]%
(2,3) -- (2.33,3.33) -- (3.33,3.33) -- (3,3)  -- cycle;
%%-----------Right face----------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]%
(3,2) -- (3, 3) -- (3.33,3.33) -- (3.33,2.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmt]%
(3.33,2.33) -- (3.33, 3.33) -- (3.66,3.66) -- (3.66,2.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]%
(3.66,2.66) -- (3.66, 3.66) -- (4,4) -- (4,3)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlm]%
(3,1) -- (3, 2) -- (3.33,2.33) -- (3.33,1.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmm]%
(3.33,1.33) -- (3.33, 2.33) -- (3.66,2.66) -- (3.66,1.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrm]%
(3.66,1.66) -- (3.66, 2.66) -- (4,3) -- (4,2)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]%
(3,0) -- (3, 1) -- (3.33,1.33) -- (3.33,0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmb]%
(3.33,0.33) -- (3.33, 1.33) -- (3.66,1.66) -- (3.66,0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]%
(3.66,0.66) -- (3.66, 1.66) -- (4,2) -- (4,1)  -- cycle;
}
%    \end{macrocode}
%
% \begin{macro}{\DrawRubikCube}
% This command  is equivalent to the previous \cmd{\DrawRubikCubeRU}
% and hence is the default form (i.e.,~if  the trailing XY 
% viewpoint code is accidentally omitted).
% \end{macro}
%    \begin{macrocode}
\newcommand{\DrawRubikCube}{\DrawRubikCubeRU}
%    \end{macrocode}
%
%
% \begin{macro}{\DrawRubikCubeRD}
% This command draws and paints a Rubik cube  as viewed from 
% the Right Down (RD) viewpoint.
% \end{macro}
%    \begin{macrocode}
\newcommand{\DrawRubikCubeRD}{%
\DrawRubikCubeFrontFace %% frontface
%%----------Right face--------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]%
(3,2) -- (3, 3) -- (3.33,2.66) -- (3.33,1.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmt]%
(3.33,1.66) -- (3.33, 2.66) -- (3.66,2.33) -- (3.66,1.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]%
(3.66,1.33) -- (3.66, 2.33) -- (4,2) -- (4,1)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlm]%
(3,1) -- (3, 2) -- (3.33,1.66) -- (3.33,0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmm]%
(3.33,0.66) -- (3.33, 1.66) -- (3.66,1.33) -- (3.66,0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrm]%
(3.66,0.33) -- (3.66, 1.33) -- (4,1) -- (4,0)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]%
(3,0) -- (3, 1) -- (3.33,0.66) -- (3.33,-0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmb]%
(3.33,-0.33) -- (3.33, 0.66) -- (3.66,0.33) -- (3.66,-0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]%
(3.66,-0.66) -- (3.66, 0.33) -- (4,0) -- (4,-1)  -- cycle;
%%-----------Down face---------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]%
(0.33,-0.33) -- (0, 0) -- (1,0) -- (1.33,-0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmt]%
(1.33,-0.33) -- (1, 0) -- (2,0) -- (2.33,-0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drt]%
(2.33,-0.33) -- (2, 0) -- (3,0) -- (3.33,-0.33)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlm]%
(0.66,-0.66) -- (0.33, -0.33) -- (1.33,-0.33) -- (1.66,-0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmm]%
(1.66,-0.66) -- (1.33, -0.33) -- (2.33,-0.33) -- (2.66,-0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drm]%
(2.66,-0.66) -- (2.33, -0.33) -- (3.33,-0.33) -- (3.66,-0.66)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]%
(1,-1) -- (0.66, -0.66) -- (1.66,-0.66) -- (2,-1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmb]%
(2,-1) -- (1.66, -0.66) -- (2.66,-0.66) -- (3,-1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drb]%
(3,-1) -- (2.66, -0.66) -- (3.66,-0.66) -- (4,-1)  -- cycle;
}
%    \end{macrocode}
%
% \begin{macro}{\DrawRubikCubeLD}
% This command draws and paints a Rubik cube  as viewed from 
% the Left Down (LD) viewpoint.
% \end{macro}
%    \begin{macrocode}
\newcommand{\DrawRubikCubeLD}{%
\DrawRubikCubeFrontFace %% frontface
%%------------Left face--------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Llt]%
(-1,1) -- (-1, 2) -- (-0.66,2.33) -- (-0.66,1.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmt]%
(-0.66,1.33) -- (-0.66, 2.33) -- (-0.33,2.66) -- (-0.33,1.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]%
(-0.33,1.66) -- (-0.33, 2.66) -- (0,3) -- (0,2)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Llm]%
(-1,0) -- (-1, 1) -- (-0.66,1.33) -- (-0.66,0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmm]%
(-0.66,0.33) -- (-0.66, 1.33) -- (-0.33,1.66) -- (-0.33,0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrm]%
(-0.33,0.66) -- (-0.33, 1.66) -- (0,2) -- (0,1)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Llb]%
(-1,-1) -- (-1, 0) -- (-0.66,0.33) -- (-0.66,-0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmb]%
(-0.66,-0.66) -- (-0.66, 0.33) -- (-0.33,0.66) -- (-0.33,-0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]%
(-0.33,-0.33) -- (-0.33, 0.66) -- (0,1) -- (0,0)  -- cycle;
%%------------Down face----------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]%
(-0.33,-0.33) -- (0, 0) -- (1,0) -- (0.66,-0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmt]%
(0.66,-0.33) -- (1, 0) -- (2,0) -- (1.66,-0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drt]%
(1.66,-0.33) -- (2, 0) -- (3,0) -- (2.66,-0.33)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlm]%
(-0.66,-0.66) -- (-0.33, -0.33) -- (0.66,-0.33) -- (0.33,-0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmm]%
(0.33,-0.66) -- (0.66, -0.33) -- (1.66,-0.33) -- (1.33,-0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drm]%
(1.33,-0.66) -- (1.66, -0.33) -- (2.66,-0.33) -- (2.33,-0.66)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]%
(-1,-1) -- (-0.66, -0.66) -- (0.33,-0.66) -- (0,-1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmb]%
(0,-1) -- (0.33, -0.66) -- (1.33,-0.66) -- (1,-1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drb]%
(1,-1) -- (1.33, -0.66) -- (2.33,-0.66) -- (2,-1)  -- cycle;
}
%    \end{macrocode}
%
%
% \begin{macro}{\DrawRubikCubeLU}
% This command draws and paints a Rubik cube  as viewed from 
% the Left Up (LU) viewpoint.
% \end{macro}
%    \begin{macrocode}
\newcommand{\DrawRubikCubeLU}{%
\DrawRubikCubeFrontFace %% frontface
%%-----------Left face-----------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Llt]%
(-1,3) -- (-1, 4) -- (-0.66,3.66) -- (-0.66,2.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmt]%
(-0.66,2.66) -- (-0.66, 3.66) -- (-0.33,3.33) -- (-0.33,2.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]%
(-0.33,2.33) -- (-0.33, 3.33) -- (0,3) -- (0,2)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Llm]%
(-1,2) -- (-1, 3) -- (-0.66,2.66) -- (-0.66,1.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmm]%
(-0.66,1.66) -- (-0.66, 2.66) -- (-0.33,2.33) -- (-0.33,1.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrm]%
(-0.33,1.33) -- (-0.33, 2.33) -- (0,2) -- (0,1)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Llb]%
(-1,1) -- (-1, 2) -- (-0.66,1.66) -- (-0.66,0.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmb]%
(-0.66,0.66) -- (-0.66, 1.66) -- (-0.33,1.33) -- (-0.33,0.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]%
(-0.33,0.33) -- (-0.33, 1.33) -- (0,1) -- (0,0)  -- cycle;
%%-----------Up face---------
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Ult]%
(-0.66,3.66) -- (-1, 4) -- (0,4) -- (0.33,3.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umt]%
(0.33,3.66) -- (0, 4) -- (1,4) -- (1.33,3.66)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urt]%
(1.33,3.66) -- (1, 4) -- (2,4) -- (2.33,3.66)  -- cycle;
%%---middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Ulm]%
(-0.33,3.33) -- (-0.66, 3.66) -- (0.33,3.66) -- (0.66,3.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umm]%
(0.66,3.33) -- (0.33, 3.66) -- (1.33,3.66) -- (1.66,3.33)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urm]%
(1.66,3.33) -- (1.33, 3.66) -- (2.33,3.66) -- (2.66,3.33)  -- cycle;
%%---bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]%
(0,3) -- (-0.33, 3.33) -- (0.66,3.33) -- (1,3)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umb]%
(1,3) -- (0.66, 3.33) -- (1.66,3.33) -- (2,3)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urb]%
(2,3) -- (1.66, 3.33) -- (2.66,3.33) -- (3,3)  -- cycle;%
\ %%trailing space 
}
%    \end{macrocode}
%
%
%   \subsection{\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 placeholder for the colour of the TopLeft facelet etc.)
%  The second takes only one colour parameter (since \texttt{All} the 
%  colours are the same).
%  The drawing origin (0,0) = bottom left corner. 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}
%
% [\textsc{note}: These new commands (version 3.0) were modified from the 
%  earlier \cmd{\FlatUp}, \cmd{\FlatDown} etc., commands; i.e.,~they were 
%  reformulated as  a set of \cmd{\Draw...} commands to make them consistent 
%  with all the  other \cmd{\Draw..} commands].
%
%  \begin{macro}{\DrawFlatUp}
%  \begin{macro}{\DrawFlatDown}
%  \begin{macro}{\DrawFlatLeft}
%  \begin{macro}{\DrawFlatRight}
%  \begin{macro}{\DrawFlatFront}
%  \begin{macro}{\DrawFlatBack}
%  Each of these  commands draws a separate (flat) face (9~facelets).
%  Each command (except \cmd{\DrawFlatFront}) takes two arguments, 
%  namely the  X-coordinate  and Y-coordinate of the bottom-left 
%  corner of the  face.  This (X,Y) pair of coordinates therefore allows 
%  the user to position the face. These commands were motivated by a need to 
%  be able to show hidden faces under certain circumstances.
%
%  Note  that the Y-argument currently only works fully
%  with the \cmd{\DrawFlatUp}, \cmd{\DrawFlatDown} and \cmd{\DrawFlatBack}
%  commands, since  all the other faces currently only require Y=0 
%  (this will be  made more flexible in a later version).
%
%  Note also that the \cmd{\DrawFlatFront} command takes no arguments,
%  since by definition the bottom left corner of this face is at (0,0), 
%  and there seems to be no reason (just now) for this face to have the 
%  facility  to be positioned otherwise.
%
%  \textsc{example}: The following command positions the Up face so 
%  that its bottom left corner is located at (0,3): 
%  \begin{quote}
%    \cmd{\DrawFlatUp\{0\}\{3\}}
%  \end{quote}
%  These new commands are also used  by the commands \cmd{\DrawRubikFlat}  and 
%  \cmd{\DrawRubikCubeFlat} to draw various `flat' representations 
%  of a Rubik cube.
%
% The (x,y) variables are here encoded as (\cmd{\ux}, \cmd{\uy})  where the 
% `u' stands for Up etc. However, since we are unable to use `dx, dy' with the 
%  \cmd{\DrawFlatDown} command (since dx and dy are already used in the 
% \cmd{\cube@dxdydz...} command) we encode these instead as (\cmd{\ddx}, \cmd{\ddy}). 
%
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%    \begin{macrocode}
\newcommand{\DrawFlatUp}[2]{%
\pgfmathsetmacro{\ux}{#1}%
\pgfmathsetmacro{\uy}{#2}%
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Ult]%
(\ux + 0,\uy + 2) -- (\ux + 0,\uy + 3) -- (\ux + 1,\uy + 3)%
 -- (\ux + 1,\uy + 2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umt]%
(\ux + 1,\uy + 2) -- (\ux + 1,\uy + 3) -- (\ux + 2,\uy + 3)%
 -- (\ux + 2,\uy + 2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urt]%
(\ux + 2,\uy + 2) -- (\ux + 2,\uy + 3) -- (\ux + 3,\uy + 3)%
 -- (\ux + 3,\uy + 2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Ulm]%
(\ux + 0,\uy + 1) -- (\ux + 0,\uy + 2) -- (\ux + 1,\uy + 2)%
 -- (\ux + 1,\uy + 1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umm]%
(\ux + 1,\uy + 1) -- (\ux + 1,\uy + 2) -- (\ux + 2,\uy + 2)%
 -- (\ux + 2,\uy + 1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urm]%
(\ux + 2,\uy + 1) -- (\ux + 2,\uy + 2) -- (\ux + 3,\uy + 2)%
 -- (\ux + 3,\uy + 1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]%
(\ux + 0,\uy + 0) -- (\ux + 0,\uy + 1) -- (\ux + 1,\uy + 1)%
 -- (\ux + 1,\uy + 0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Umb]%
(\ux + 1,\uy + 0) -- (\ux + 1,\uy + 1) -- (\ux + 2,\uy + 1)%
 -- (\ux + 2,\uy + 0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Urb]%
(\ux + 2,\uy + 0) -- (\ux + 2,\uy + 1) -- (\ux + 3,\uy + 1)%
 -- (\ux + 3,\uy + 0) -- cycle;
}
%%-------------------------
\newcommand{\DrawFlatDown}[2]{%
\pgfmathsetmacro{\ddx}{#1}%
\pgfmathsetmacro{\ddy}{#2}%
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]%
(\ddx + 0,\ddy + 2) -- (\ddx + 0,\ddy + 3) -- (\ddx + 1,\ddy + 3)%
 -- (\ddx + 1,\ddy + 2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmt]%
(\ddx + 1,\ddy + 2) -- (\ddx + 1,\ddy + 3) -- (\ddx + 2,\ddy + 3)%
 -- (\ddx + 2,\ddy + 2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drt]%
(\ddx + 2,\ddy + 2) -- (\ddx + 2,\ddy + 3) -- (\ddx + 3,\ddy + 3)%
 -- (\ddx + 3,\ddy + 2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlm]%
(\ddx + 0,\ddy + 1) -- (\ddx + 0,\ddy + 2) -- (\ddx + 1,\ddy + 2)%
 -- (\ddx + 1,\ddy + 1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmm]%
(\ddx + 1,\ddy + 1) -- (\ddx + 1,\ddy + 2) -- (\ddx + 2,\ddy + 2)%
 -- (\ddx + 2,\ddy + 1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drm]%
(\ddx + 2,\ddy + 1) -- (\ddx + 2,\ddy + 2) -- (\ddx + 3,\ddy + 2)%
 -- (\ddx + 3,\ddy + 1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]%
(\ddx + 0,\ddy + 0) -- (\ddx + 0,\ddy + 1) -- (\ddx + 1,\ddy + 1)%
 -- (\ddx + 1,\ddy + 0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Dmb]%
(\ddx + 1,\ddy + 0) -- (\ddx + 1,\ddy + 1) -- (\ddx + 2,\ddy + 1)%
 -- (\ddx + 2,\ddy + 0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Drb]%
(\ddx + 2,\ddy + 0) -- (\ddx + 2,\ddy + 1) -- (\ddx + 3,\ddy + 1)%
 -- (\ddx + 3,\ddy + 0) -- cycle;
}
%%-------------------------
\newcommand{\DrawFlatLeft}[2]{%
\pgfmathsetmacro{\lx}{#1}%
\pgfmathsetmacro{\ly}{#2}%
%% NOTE: y variable coord not yet implemented
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Llt]%
(\lx + 0,2) -- (\lx + 0, 3) -- (\lx + 1,3) -- (\lx + 1,2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmt]%
(\lx + 1,2) -- (\lx + 1, 3) -- (\lx + 2,3) -- (\lx + 2,2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]%
(\lx + 2,2) -- (\lx + 2, 3) -- (\lx + 3,3) -- (\lx + 3,2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Llm]%
(\lx + 0,1) -- (\lx + 0, 2) -- (\lx + 1,2) -- (\lx + 1,1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmm]%
(\lx + 1,1) -- (\lx + 1, 2) -- (\lx + 2,2) -- (\lx + 2,1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrm]%
(\lx + 2,1) -- (\lx + 2, 2) -- (\lx + 3,2) -- (\lx + 3,1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Llb]%
(\lx + 0,0) -- (\lx + 0, 1) -- (\lx + 1,1) -- (\lx + 1,0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lmb]%
(\lx + 1,0) -- (\lx + 1, 1) -- (\lx + 2,1) -- (\lx + 2,0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]%
(\lx + 2,0) -- (\lx + 2, 1) -- (\lx + 3,1) -- (\lx + 3,0) -- cycle;
}
%%--------------------------
\newcommand{\DrawFlatRight}[2]{%
\pgfmathsetmacro{\rx}{#1}% %3
\pgfmathsetmacro{\ry}{#2}% %0
%% NOTE: y variable coord not yet implemented
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]%
(\rx + 0,2) -- (\rx + 0, 3) -- (\rx + 1,3) -- (\rx + 1,2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmt]%
(\rx + 1,2) -- (\rx + 1, 3) -- (\rx + 2,3) -- (\rx + 2,2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]%
(\rx + 2,2) -- (\rx + 2, 3) -- (\rx + 3,3) -- (\rx + 3,2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlm]%
(\rx + 0,1) -- (\rx + 0, 2) -- (\rx + 1,2) -- (\rx + 1,1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmm]%
(\rx + 1,1) -- (\rx + 1, 2) -- (\rx + 2,2) -- (\rx + 2,1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrm]%
(\rx + 2,1) -- (\rx + 2, 2) -- (\rx + 3,2) -- (\rx + 3,1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]%
(\rx + 0,0) -- (\rx + 0, 1) -- (\rx + 1,1) -- (\rx + 1,0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rmb]%
(\rx + 1,0) -- (\rx + 1, 1) -- (\rx + 2,1) -- (\rx + 2,0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]%
(\rx + 2,0) -- (\rx + 2, 1) -- (\rx + 3,1) -- (\rx + 3,0) -- cycle;
}
%%-----------------------
\newcommand{\DrawFlatFront}{%
%% This command is used /only/ by  the \cmd{\DrawRubikFlat} command.
%% NOTE: x, y variables not implemented as not required here
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Flt]%
(0,2) -- (0, 3) -- (1,3) -- (1,2)  -- cycle;
%%
\draw[line join=round,line cap=round,ultra thick,fill=\Fmt]%
(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle;
%%
\draw[line join=round,line cap=round,ultra thick,fill=\Frt]%
(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Flm]%
(0,1) -- (0, 2) -- (1,2) -- (1,1)  -- cycle;
%%
\draw[line join=round,line cap=round,ultra thick,fill=\Fmm]%
(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle;
%%
\draw[line join=round,line cap=round,ultra thick,fill=\Frm]%
(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Flb]%
(0,0) -- (0, 1) -- (1,1) -- (1,0)  -- cycle;
%%
\draw[line join=round,line cap=round,ultra thick,fill=\Fmb]%
(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle;
%%
\draw[line join=round,line cap=round,ultra thick,fill=\Frb]%
(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle;
}
%%-------------------------
\newcommand{\DrawFlatBack}[2]{%
\pgfmathsetmacro{\bx}{#1}%
\pgfmathsetmacro{\by}{#2}%
%%---top row
\draw[line join=round,line cap=round,ultra thick,fill=\Blt]%
(\bx + 0,\by + 2) -- (\bx + 0,\by + 3) -- (\bx + 1,\by + 3)%
 -- (\bx + 1,\by + 2)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Bmt]%
(\bx + 1,\by + 2) -- (\bx + 1,\by + 3) -- (\bx + 2,\by + 3)%
 -- (\bx + 2,\by + 2) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Brt]%
(\bx + 2,\by + 2) -- (\bx + 2,\by + 3) -- (\bx + 3,\by + 3)%
 -- (\bx + 3,\by + 2) -- cycle;
%%-----middle row
\draw[line join=round,line cap=round,ultra thick,fill=\Blm]%
(\bx + 0,\by + 1) -- (\bx + 0,\by + 2) -- (\bx + 1,\by + 2)%
 -- (\bx + 1,\by + 1)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Bmm]%
(\bx + 1,\by + 1) -- (\bx + 1,\by + 2) -- (\bx + 2,\by + 2)%
 -- (\bx + 2,\by + 1) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Brm]%
(\bx + 2,\by + 1) -- (\bx + 2,\by + 2) -- (\bx + 3,\by + 2)%
 -- (\bx + 3,\by + 1) -- cycle;
%%----bottom row
\draw[line join=round,line cap=round,ultra thick,fill=\Blb]%
(\bx + 0,\by + 0) -- (\bx + 0,\by + 1) -- (\bx + 1,\by + 1)%
 -- (\bx + 1,\by + 0)  -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Bmb]%
(\bx + 1,\by + 0) -- (\bx + 1,\by + 1) -- (\bx + 2,\by + 1)%
 -- (\bx + 2,\by + 0) -- cycle;
\draw[line join=round,line cap=round,ultra thick,fill=\Brb]%
(\bx + 2,\by + 0) -- (\bx + 2,\by + 1) -- (\bx + 3,\by + 1)%
 -- (\bx + 3,\by + 0) -- cycle;
}
%    \end{macrocode}
%
%  \begin{macro}{\DrawRubikFlat}
%  Draws a standard flat representation of the Rubik
%  cube (colours only). Note that \cmd{\DrawFlatFront} does not 
%  take any arguments (x,y) arguments.
%    \begin{macrocode}
\newcommand{\DrawRubikFlat}{%
  \DrawFlatUp{0}{3}%
  \DrawFlatDown{0}{-3}%
  \DrawFlatLeft{-3}{0}%
  \DrawFlatFront%
  \DrawFlatRight{3}{0}%
  \DrawFlatBack{6}{0}%
}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\DrawRubikCubeFlat}
%  Draws a Rubik  cube together with the three hidden faces
%   (colours only) in a semi-flat representation. The (x,y) 
%  arguments are for the bottom-left  corner of the face.
%    \begin{macrocode}
\newcommand{\DrawRubikCubeFlat}{%
  \DrawRubikCube%
  \DrawFlatDown{0}{-3}%
  \DrawFlatLeft{-3}{0}%
  \DrawFlatBack{4}{1}%
}
%    \end{macrocode}
%  \end{macro}
%
%
%
% \subsubsection{DrawFlatXSide commands}
%
%  These six commands draw  a face together with  all four sidebars
%  (colours only). We use the \cmd{\DrawFlatX} commands to draw the face.
%  We use the  \cmd{\DrawRubikLayerSideX} commands to  draw the sidebars. 
%  The parameter orders for the \cmd{\DrawRubikLayerSideX} 
%  commands are as follows: 
%  Top (T) and Bottom (B) = left to right;
%  Left (L) and Right (R) = top to bottom;
% (see the \cmd{\DrawRubikLayerSideX} command for details of the arguments).
%  
%
%  \begin{macro}{\DrawFlatUpSide}
%  Draws the \textsc{up} face together with  all four sidebars
%   (colours only).
%    \begin{macrocode}
\newcommand{\DrawFlatUpSide}{%
\DrawFlatUp{0}{0}%
\DrawRubikLayerSideT{\Brt}{\Bmt}{\Blt}%
\DrawRubikLayerSideL{\Llt}{\Lmt}{\Lrt}%
\DrawRubikLayerSideR{\Rrt}{\Rmt}{\Rlt}%
\DrawRubikLayerSideB{\Flt}{\Fmt}{\Frt}%
}
%    \end{macrocode}
%  \end{macro}
%
%
%  \begin{macro}{\DrawFlatFrontSide}
%  Draws the \textsc{front} face together with  all four sidebars
%   (colours only).
%    \begin{macrocode}
\newcommand{\DrawFlatFrontSide}{%
\DrawFlatFront{0}{0}%
\DrawRubikLayerSideT{\Ulb}{\Umb}{\Urb}%
\DrawRubikLayerSideL{\Lrt}{\Lrm}{\Lrb}%
\DrawRubikLayerSideR{\Rlt}{\Rlm}{\Rlb}%
\DrawRubikLayerSideB{\Dlt}{\Dmt}{\Drt}%
}
%    \end{macrocode}
%  \end{macro}
%
%
%  \begin{macro}{\DrawFlatRightSide}
%  Draws the \textsc{right} face together with  all four sidebars
%   (colours only).
%    \begin{macrocode}
\newcommand{\DrawFlatRightSide}{%
\DrawFlatRight{0}{0}%
\DrawRubikLayerSideT{\Urb}{\Urm}{\Urt}%
\DrawRubikLayerSideL{\Frt}{\Frm}{\Frb}%
\DrawRubikLayerSideR{\Blt}{\Blm}{\Blb}%
\DrawRubikLayerSideB{\Drt}{\Drm}{\Drb}%
}
%    \end{macrocode}
%  \end{macro}
%
%
%  \begin{macro}{\DrawFlatLeftSide}
%  Draws the \textsc{left} face together with  all four sidebars
%   (colours only).
%    \begin{macrocode}
\newcommand{\DrawFlatLeftSide}{%
\DrawFlatLeft{0}{0}%
\DrawRubikLayerSideT{\Ult}{\Ulm}{\Ulb}%
\DrawRubikLayerSideL{\Brt}{\Brm}{\Brb}%
\DrawRubikLayerSideR{\Flt}{\Flm}{\Flb}%
\DrawRubikLayerSideB{\Dlb}{\Dlm}{\Dlt}%
}
%    \end{macrocode}
%  \end{macro}
%
%
%  \begin{macro}{\DrawFlatBackSide}
%  Draws the \textsc{back} face together with  all four sidebars
%   (colours only).
%    \begin{macrocode}
\newcommand{\DrawFlatBackSide}{%
\DrawFlatBack{0}{0}%
\DrawRubikLayerSideT{\Urt}{\Umt}{\Ult}%
\DrawRubikLayerSideL{\Rrt}{\Rrm}{\Rrb}%
\DrawRubikLayerSideR{\Llt}{\Llm}{\Llb}%
\DrawRubikLayerSideB{\Drb}{\Dmb}{\Dlb}%
}
%    \end{macrocode}
%  \end{macro}
%
%
%  \begin{macro}{\DrawFlatDownSide}
%  Draws the \textsc{down} face together with  all four sidebars
%   (colours only).
%    \begin{macrocode}
\newcommand{\DrawFlatDownSide}{%
\DrawFlatDown{0}{0}%
\DrawRubikLayerSideT{\Flb}{\Fmb}{\Frb}%
\DrawRubikLayerSideL{\Lrb}{\Lmb}{\Llb}%
\DrawRubikLayerSideR{\Rlb}{\Rmb}{\Rrb}%
\DrawRubikLayerSideB{\Brb}{\Bmb}{\Blb}%
}
%    \end{macrocode}
%  \end{macro}
%
%
%
%   \subsection{\hspace{3mm}SideBar commands}
%
%  SideBar commands draw narrow bars of colour indicating  the 
%  side colours of each of the facelets forming the side of
%  a given layer (face). Each SideBar is the length of a single facelet.
%
%  \begin{macro}{\RubikSideBarWidth}
%  \begin{macro}{\RubikSideBarLength} 
%  \begin{macro}{\RubikSideBarSep}
% These three commands allow the user to set the Width, Length 
% and Separation parameters for the sidebar (in decimal values, 
% where 1~is equivalent to the length of the side of a facelet).
%  \end{macro}
%  \end{macro}
%  \end{macro}
%    \begin{macrocode}
\newcommand{\RubikSideBarWidth}[1]{\pgfmathsetmacro{\bw}{#1}}
\newcommand{\RubikSideBarLength}[1]{\pgfmathsetmacro{\bl}{#1}}
\newcommand{\RubikSideBarSep}[1]{\pgfmathsetmacro{\bs}{#1}}
%    \end{macrocode}
% We first set some default values
%    \begin{macrocode}
\RubikSideBarWidth{0.3}%
\RubikSideBarLength{1}%
\RubikSideBarSep{0.3}%
%    \end{macrocode}
%
%
% \subsubsection{\hspace{3mm}Allocating  a colour to a single facelet sidebar}
% 
% \begin{macro}{\side@barT}
% \begin{macro}{\side@barB}
% \begin{macro}{\side@barL}
% \begin{macro}{\side@barR}
% Internal commands.
% Full length face SideBars are really multiple instances of 
% single 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: 
%  \begin{quote}
%     \cmd{\side@barL}\marg{facelet-position}\marg{colour-code}
%  \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}) 
% 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 botton Left corner of the bar =(\cmd{\dx},\cmd{\dy})
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
\newcommand{\side@barL}[2]{%
%% #1 = cubie possn no, #2 = colour
\pgfmathsetmacro{\blh}{\bl*(0.5)}%
\pgfmathsetmacro{\dx}{0 - \bs - \bw}%
\pgfmathsetmacro{\dy}{#1-1+0.5-\blh}%
\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) 
  -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle;
}
\newcommand{\side@barR}[2]{%
%% #1 = cubie possn no, #2 = colour
\pgfmathsetmacro{\blh}{\bl*(0.5)}%
\pgfmathsetmacro{\dx}{3 + \bs}%
\pgfmathsetmacro{\dy}{#1 -1+0.5-\blh}%
\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl)
  -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle;
}
\newcommand{\side@barT}[2]{%
%% #1 = cubie possn no, #2 = colour
\pgfmathsetmacro{\blh}{\bl*(0.5)}%
\pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}%
\pgfmathsetmacro{\dy}{3 +\bs}%
\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw)
  -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle;
}
\newcommand{\side@barB}[2]{%
%% #1 = cubie possn no, #2 = colour
\pgfmathsetmacro{\blh}{\bl*(0.5)}%
\pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}%
\pgfmathsetmacro{\dy}{0 -\bs-\bw}%
\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw)
  -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle;
}
%    \end{macrocode}
%
%
% \subsubsection{\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 an $y$ parameter: either $\langle T\mid M \mid  B\rangle$
%  {\newline}X$_3$  is an extra parameter: either $\langle x\mid y \rangle$,
%  required by corner sidebars to indicate whether the sidebar was either 
%  above or below $\langle y \rangle$, or to the left or 
%  right $\langle x \rangle$ of the associated  cubie.
% An $X_3$ parameter is not required for the sidebar of an edge cubie, since 
% only one location is posible in these cases.
% \end{quote}
% For example, the following command
% \begin{quote}
%   \cmd{\DrawRubikLayerSideLTy\{G\}}
% \end{quote}
% draws a Green sidebar above the Top Left cubie. 
% \end{macro}
% 
% \begin{macrocode}
%%---Left side
\newcommand{\DrawRubikLayerSideLTx}[1]{\side@barL{3}{#1}}
\newcommand{\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}%
}
%%--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}%
}
%    \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}%
}
%    \end{macrocode}
%  \end{macro}
%
%
%
%    \subsection{\hspace{3mm}NCube command}
%
%  \textsc{history}: The essence of this command was originally developed by Peter Bartal 
%  as his command \cmd{\rubikcube} (see Bartal,
%  2011). We have modified it, as follows (June 2012):
%  \newline\strut\hspace{\parindent}(1) adjusted  to use the 
%  TikZ \cmd{\pgfmathsetmacro\{\}\{\}} command (suggested by Peter Grill),
%  \newline\strut\hspace{\parindent}(2)  renamed to \cmd{\DrawNCubeAll}.
%
%    \begin{macro}{\DrawNCubeAll}
% {\noindent}This command draws a solved NxNxN Rubik's cube from the RightUp viewpoint.
% All cubies on a given face have the same colour. 
% The command takes four ordered  arguments, as follows:
% \begin{quote}
%   \#1 = number of cubies ($n>0$) along each side,
%   {\newline}\#2, \#3, \#4 = colors of the visible faces (in X,Y,Z order);
%             X=Right face  colour, Y=Up face colour, Z=Front face colour.
% \end{quote}
% We use the  \cmd{\pgfmathsetmacro}\marg{variable-name}\marg{numeric value or maths}
% command. Note that the second argument must not involve any units---just numeric 
% values or mathematics.
%
% \begin{macrocode}
\newcommand{\DrawNCubeAll}[4]{%
   \pgfmathsetmacro{\ncubes}{#1-1}%
%% need to subtract 1 from the given number of cubies per side 
%% to avoid the origin of the initial cube to be displaced
    \foreach \x in {0,...,\ncubes}{%
      \foreach \y in {0,...,\ncubes}{%
        \foreach \z in {0,...,\ncubes}{%
          \cube@dxdydz{1}{#2}{#3}{#4}{\x}{\y}{\z}% 
  }}}}
%    \end{macrocode}
%    \end{macro}
%
%   \begin{macro}{\cube@dxdydz}
% This internal command is  used only by the \cmd{\DrawNCubeAll} command.
% The original version of this command was developed  by Peter Bartal (see Bartal, 2011).
% It was modified (2012) by RWD Nickalls (to implement  a more 
% intuitive X, Y, Z ordering of parameters).
%
%  The cube need not be in the origin, the distances of 
% the \textsc{down}-behind [L] corner from 
% the origin are taken as parameters 5,6,7.
% The command takes 7 ordered arguments:
% \begin{quote}
% 1 - length of an edge 
% {\newline}2 - X-face colour (\textsc{right} face)
% {\newline}3 - Y-face colour (\textsc{up} face)
% {\newline}4 - Z-face colour (\textsc{front} face)
% {\newline}5 - x-position in space
% {\newline}6 - y-position in space
% {\newline}7 - z-position in space
% \end{quote}
%
% \textsc{usage}:  |\cube@dxdydz{1}{X}{Y}{Z}{x}{y}{z}|
%
% {\noindent}The original code
%   |\pgfmathparse{#1+#5}\let\dy\pgfmathresult| 
% {\newline} was changed  to the more intuitive  |\pgfmathsetmacro{\dx}{#1+#5}|
% (suggested by Peter Grill 2011).
%
% \textsc{changes}: RWD Nickalls (2012): 
% (1) added the [line join=round,line cap=round] 
% options to  each of the TikZ  \cmd{\draw} commands, in order to improve 
% the line joining (first two options); (2) adjusted  the \cmd{\cube@dxdydz} macro 
% to adopt the ordered  XYZ face colour notation
% (by reassigning \#2, \#3, \#4).
%
%    \begin{macrocode}
\newcommand{\cube@dxdydz}[7]{%
   \pgfmathsetmacro{\dx}{#1+#5}% 
%% calculates the 'displacement' (distance from the origin) of the 
%% far corners of the cube along the x axis from the arguments
   \pgfmathsetmacro{\dy}{#1+#6}%
%% calculates the 'displacement' (distance from the origin) of the 
%% far corners of the cube along the y axis from the arguments
   \pgfmathsetmacro{\dz}{#1+#7}%
%% calculates the 'displacement' (distance from the origin) of the 
%% far corners of the cube along the z axis from the arguments
%% Draw FRONT face   (using the X colour = #4)
    \draw[line join=round,line cap=round,ultra thick,fill=#4]%
 (#5,#6,\dz) -- (\dx,#6,\dz) -- (\dx,\dy,\dz) -- (#5,\dy,\dz) -- cycle;
%% The 'rectangle' command does not work with 3D coordinates, 
%% so this is the way to draw the squres with space coordinates
%% Draw UP face (using the Y colour = #3)
   \draw[line join=round,line cap=round,ultra thick,fill=#3]%
 (#5,\dy,\dz) -- (\dx,\dy,\dz) -- (\dx,\dy,#7) -- (#5,\dy,#7) -- cycle;
%% Draw RIGHT face   (using the X colour = #2)
 \draw[line join=round,line cap=round,ultra thick,fill=#2]%
 (\dx,#6,\dz) -- (\dx,#6,#7) -- (\dx,\dy,#7) -- (\dx,\dy,\dz) -- cycle;
    }
%    \end{macrocode}
%    \end{macro}
%
%
%
%  \subsection{\hspace{3mm}Drawing single cubies}
%
%  \begin{macro}{\Cubiedx}
%  \begin{macro}{\Cubiedy}
%  These two commands set the value of the two length parameters
%  \texttt{cx} and \texttt{cy}, and allow the user to vary the size 
%  (adjust \texttt{cy}) and horizontal viewpoint  (adjust \texttt{cx})
%  of a single cubie (described in more detail in the \rubikcube\ 
%   package  documentation).
%  Note that we cannot use the names \texttt{dx}, \texttt{dy} for variables since 
%  these have been  allocated already (see above). However, we do use 
%  \texttt{dx}, \texttt{dy} in the  command names  as these will be more 
%  readily understood by the user.
%    \begin{macrocode}
\newcommand{\Cubiedx}[1]{\pgfmathsetmacro{\cx}{#1}}
\newcommand{\Cubiedy}[1]{\pgfmathsetmacro{\cy}{#1}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
% We now set the default values (cx=cy=0.4)
%    \begin{macrocode}
\Cubiedx{0.4}
\Cubiedy{0.4}
%    \end{macrocode}
%
%
%  \begin{macro}{\DrawCubieRU}
%  \begin{macro}{\DrawCubieRD}
%  \begin{macro}{\DrawCubieLU}
%  \begin{macro}{\DrawCubieLD}
% These four commands draw a single cubie from the RightUp, RightDown, 
% LeftUp, LeftDown viewpoint. The viewpoint is specified using an appended 
% two-letter XY ordered viewpoint code: either RU, RD, LU, LD.
% These commands take three arguments, namely three different XYZ 
% ordered colour codes (R,O,Y,G,B,W,X).
% \newline\textsc{format}: \cmd{\DrawCubieRU}\marg{Xcolour}\marg{Ycolour}\marg{Zcolour}
% \newline\textsc{usage}: |\DrawCubieRU{G}{B}{W}|
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \begin{macrocode}
\newcommand{\DrawCubieRU}[3]{%
%% Front face (z)
\draw[line join=round,line cap=round,ultra thick,fill=#3]%
 (0,0) -- (0, 1) -- (1, 1) -- (1,0) -- cycle;
%% Up face(y)
\draw[line join=round,line cap=round,ultra thick,fill=#2]%
 (0,1) -- (\cx, 1+\cy) -- (1+\cx,1+\cy) -- (1,1) -- cycle;
%% Right face(x)
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
 (1,0) -- (1,1) -- (1+\cx,1+\cy) -- (1+\cx, \cy) -- cycle;
}
\newcommand{\DrawCubieRD}[3]{%
%% Front face (z)
\draw[line join=round,line cap=round,ultra thick,fill=#3]%
 (0,0) -- (0, 1) -- (1, 1) -- (1,0) -- cycle;
%% Down face (y)
\draw[line join=round,line cap=round,ultra thick,fill=#2]%
 (\cx,-\cy) -- (0, 0) -- (1,0) -- (1+\cx,-\cy) -- cycle;
%% Right face (x)
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
 (1,0) -- (1,1) -- (1+\cx,-\cy+1) -- (1+\cx, -\cy) -- cycle;
}
\newcommand{\DrawCubieLD}[3]{%
%% Front face (z)
\draw[line join=round,line cap=round,ultra thick,fill=#3]%
 (0,0) -- (0, 1) -- (1, 1) -- (1,0) -- cycle;
%% Down face (y)
\draw[line join=round,line cap=round,ultra thick,fill=#2]%
 (-\cx,-\cy) -- (0, 0) -- (1,0) -- (1-\cx,-\cy) -- cycle;
%% Left face (x)
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
 (-\cx,-\cy) -- (-\cx,-\cy+1) -- (0,1) -- (0,0) -- cycle;
}
\newcommand{\DrawCubieLU}[3]{%
%% Front face (z)
\draw[line join=round,line cap=round,ultra thick,fill=#3]%
 (0,0) -- (0, 1) -- (1, 1) -- (1,0) -- cycle;
%% Up face (y)
\draw[line join=round,line cap=round,ultra thick,fill=#2]%
 (-\cx,1+\cy) -- (1-\cx, 1+\cy) -- (1,1) -- (0,1) -- cycle;
%% Left face (x)
\draw[line join=round,line cap=round,ultra thick,fill=#1]%
 (-\cx, \cy) -- (-\cx,\cy+1) -- (0,1) -- (0,0) -- cycle;
}
%    \end{macrocode}
%
%
%  \subsection{\hspace{3mm}Text cubies}
% 
%  \begin{macro}{\textCubieRU}
%  \begin{macro}{\textCubieRD}
%  \begin{macro}{\textCubieLU}
%  \begin{macro}{\textCubieLD}
%  These four commands draw a single `text' cubie from the RightUp, RightDown, 
%  LeftUp, LeftDown viewpoint. 
%  They are `text' forms of the \cmd{\DrawCubie} commands described above.
%  Their size  was chosen to be suitable for use with  10--12 point fonts.  
%
%  As before, the viewpoint is specified using an appended 
% two-letter XY ordered viewpoint code: either RU, RD, LU, LD.
% These commands take three arguments, namely three different XYZ 
% ordered colour codes (R,O,Y,G,B,W,X).
% \newline\textsc{format}: \cmd{\textCubieRU}\marg{Xcolour}\marg{Ycolour}\marg{Zcolour}
% \newline\textsc{usage}: |\textCubieRU{G}{B}{W}|
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \begin{macrocode}
\newcommand{\textCubieRU}[3]{%
\begin{minipage}{0.66cm}
\centering
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieRU{#1}{#2}{#3}
\end{tikzpicture}%
\end{minipage}
}
\newcommand{\textCubieRD}[3]{%
\begin{minipage}{0.66cm}
\centering
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieRD{#1}{#2}{#3}
\end{tikzpicture}%
\end{minipage}
}
\newcommand{\textCubieLD}[3]{%
\begin{minipage}{0.66cm}
\centering
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieLD{#1}{#2}{#3}
\end{tikzpicture}%
\end{minipage}
}
\newcommand{\textCubieLU}[3]{%
\begin{minipage}{0.66cm}
\centering
\begin{tikzpicture}[scale=0.5]
\Cubiedx{0.4}\Cubiedy{0.4}
\DrawCubieLU{#1}{#2}{#3}
\end{tikzpicture}%
\end{minipage}
}
%    \end{macrocode}
%
%
%  \subsection{\hspace{3mm}Rotation commands}
%  \label{sec:rotationcommands}
%
%
%  \subsubsection{\hspace{3mm}Introduction}
%
%  We use a special prefix notation to denote each of four different repreresentations 
% of the  various  Rubik cube rotations as follows: the name of the rotation (rr), its 
% associated hieroglyph (rrh), and combinations of name and hieroglyph both vertical (Rubik)
% and horizontal (textRubik). A rotation command is a combination of a rotation-code appended 
% to one of the four prefixes.
%
%  For example, the command \cmd{\rrhD}  generates the hieroglyph (rrh) associated with 
% the rotation-code D. In this form it is used internally, but it is also available for the user.
% However, it is also made available to the user in the more  intuitive form
% |\rrh{D}| by the use of the internal macro |\@join| (see Sections~\ref{sec:cmdsusingjoin} 
% and \ref{sec:usefulinternalcommands}).
% 
% The square hieroglyphs are built up in stages. We first create an internal 
% command  for drawing the square (\cmd{\DrawNotationBox}), and then draw the 
% contents (lines, arrows, arcs of circles, and sometimes just text).
% (for the TikZ  ARC command see  TikZ pgfmanual (2012)  page~146 (\S 14.8)).
%
%  The presence of small overfilled \cmd{\hbox}es associated with these squares
% were originally checked using the \texttt{ltugboat.cls}, and all fixed mainly
% by setting the associated  minipages $\rightarrow$ width = 0.6cm, 
%  and using TikZ scale=0.5.
% 
%
%   \begin{macro}{\DrawNotationBox}
% This internal command draws the surrounding square box of  all the hieroglyphs.
% Note that we start at (0,0) and draw to the final point 
% in order to make a nice corner join.
%
% TODO: ? make this a proper internal command 
% using \verb!@! sometime.
%
%   \begin{macrocode}
\newcommand{\DrawNotationBox}{%
  \draw [thick] (0,0) -- (0,1) -- (1,1) -- (1,0) -- (0,0) -- (0,1)%
}
%    \end{macrocode}
%    \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
% for use in drawing the various lines and arrows.
% Some hieroglyphs contain either one circular arc, or two concentric arcs, 
% and these arcs require both a center and a start point. 
% Note that the final argument does not use any units.
%
% TODO: make a small  diagram to illustrate the position of these 
% parameters and make things a  bit clearer sometime.
% 
%\begin{macrocode}
\pgfmathsetmacro{\@sd}{0.25}    % a small horiz space 
\pgfmathsetmacro{\@sdd}{2*\@sd}  % 2x horiz space
\pgfmathsetmacro{\@sddd}{3*\@sd} % 3x horiz space
\pgfmathsetmacro{\@sh}{0.6} % height 
\pgfmathsetmacro{\@sb}{0.2} % base
\pgfmathsetmacro{\@sbh}{\@sb + \@sh} % UP
\pgfmathsetmacro{\@scx}{\@sdd+0.2} % Start of CircleX arc
\pgfmathsetmacro{\@scy}{\@sd*2/3}  % Start of CircleY arc
\pgfmathsetmacro{\@sqcx}{\@scx-0.13} %% SQuare CenterX coord
\pgfmathsetmacro{\@sqcy}{\@scy+0.25} %% SQuare CenterY cpprd
%    \end{macrocode}
%
%  All the \verb!@! internal commands used in the following  commands 
% and macros are described in Section~\ref{sec:usefulinternalcommands}.
%
%
%
%  \subsubsection{\hspace{3mm}Using {\textbackslash}\texttt{join}}
%  \label{sec:cmdsusingjoin}
%
%   \begin{macro}{\textRubik}
%   \begin{macro}{\Rubik}
%   \begin{macro}{\rr}
%   \begin{macro}{\rrh}
%  The following four commands typeset a single rotation, where the rotation-code (eg~U) is 
% the argument (see Section~\ref{sec:overview}). As an example, the format for 
%  the \cmd{\rrh\{\}} command is
% \cmd{\rrh}\marg{rotation-code}. In practice, these four commands are really a 
% sort of front-end for all the commands which follow this section. For example, the 
% command \cmd{\rrh\{U\}} generates the command \cmd{\rrhU} which itself typesets the 
% rotation hieroglyph for the rotation~U, etc. 
%
% These four commands, which use the 
% internal \cmd{\@join} command (see Section~\ref{sec:usefulinternalcommands}), are 
% especially useful when  typesetting  a list of rotation-codes. 
% Furthermore, it seems more intuitive to specify a rotation command
%  using the rotation-code as an argument.
%   \begin{macrocode}
\newcommand*{\Rubik}[1]{\@join{\Rubik}{#1}}
\newcommand*{\textRubik}[1]{\@join{\textRubik}{#1}}
\newcommand*{\rr}[1]{\@join{\rr}{#1}}
\newcommand*{\rrh}[1]{\@join{\rrh}{#1}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%
%  \subsubsection{\hspace{3mm}Rotation B}
%
%  \begin{macro}{\rrB}
%  \begin{macro}{\SquareB}
%  \begin{macro}{\rrhB}
%  \begin{macro}{\RubikB}
%  \begin{macro}{\textRubikB}
%  These commands  all draw forms which denote the B (\textsc{back}-face) rotation.
%  Not visible from the front.
% \begin{macrocode}
\newcommand{\rrB}{\@rr{B}}
\newcommand{\SquareB}{\@SquareLetter{\rrB}}
\newcommand{\rrhB}{\raisebox{-0.25mm}{\SquareB}\,}
\newcommand{\RubikB}{\raisebox{\@hRubik}{\SquareB}\,}
\newcommand{\textRubikB}{\rrhB\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Bp}
%
%  \begin{macro}{\rrBp}
%  \begin{macro}{\SquareBp}
%  \begin{macro}{\rrhBp}
%  \begin{macro}{\RubikBp}
%  \begin{macro}{\textRubikBp}
%  These commands  all draw forms which denote the Bp rotation.
%  Not visible from the front.
% \begin{macrocode}
\newcommand{\rrBp}{\@rrp{B}}
\newcommand{\SquareBp}{\@SquareLetter{\rrBp}}
\newcommand{\rrhBp}{\raisebox{-0.25mm}{\SquareBp}\,}
\newcommand{\RubikBp}{\raisebox{\@hRubik}{\SquareBp}\,}
\newcommand{\textRubikBp}{\rrhBp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Bw}
%
%  \begin{macro}{\rrBw}
%  \begin{macro}{\SquareBw}
%  \begin{macro}{\rrhBw}
%  \begin{macro}{\RubikBw}
%  \begin{macro}{\textRubikBw}
%  These commands  all draw forms which denote the Bw rotation.
%  Not visible from the front.
% \begin{macrocode}
%\newcommand{\rrBw}{\textbf{\textsf{Bw}}}
\newcommand{\rrBw}{\@rrw{B}}
\newcommand{\SquareBw}{\@SquareLetter{\rrBw}}
\newcommand{\rrhBw}{\raisebox{-0.25mm}{\SquareBw}\,}
\newcommand{\RubikBw}{\raisebox{\@hRubik}{\SquareBw}\,}
\newcommand{\textRubikBw}{\rrhBw\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Bwp}
%
%  \begin{macro}{\rrBwp}
%  \begin{macro}{\SquareBwp}
%  \begin{macro}{\rrhBwp}
%  \begin{macro}{\RubikBwp}
%  \begin{macro}{\textRubikBwp}
%  These commands  all draw forms which denote the Bwp rotation.
% Not visible from the front.
% \begin{macrocode}
%\newcommand{\rrBwp}{\textbf{\textsf{Bwp}}}
\newcommand{\rrBwp}{\@rrwp{B}}
\newcommand{\SquareBwp}{\@SquareLetter{\rrBwp}}
\newcommand{\rrhBwp}{\raisebox{-0.25mm}{\SquareBwp}\,}
\newcommand{\RubikBwp}{\raisebox{\@hRubik}{\SquareBwp}\,}
\newcommand{\textRubikBwp}{\rrhBwp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Bs}
%
%  \begin{macro}{\rrBs}
%  \begin{macro}{\SquareBs}
%  \begin{macro}{\rrhBs}
%  \begin{macro}{\RubikBs}
%  \begin{macro}{\textRubikBs}
%  These commands  all draw forms which denote the Bs rotation.
%  Not visible from the front.
% \begin{macrocode}
%\newcommand{\rrBs}{\textbf{\textsf{Bs}}}
\newcommand{\rrBs}{\@rrs{B}}
\newcommand{\SquareBs}{\@SquareLetter{\rrBs}}
\newcommand{\rrhBs}{\raisebox{-0.25mm}{\SquareBs}\,}
\newcommand{\RubikBs}{\raisebox{\@hRubik}{\SquareBs}\,}
\newcommand{\textRubikBs}{\rrhBs\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Bsp}
%
%  \begin{macro}{\rrBsp}
%  \begin{macro}{\SquareBsp}
%  \begin{macro}{\rrhBsp}
%  \begin{macro}{\RubikBsp}
%  \begin{macro}{\textRubikBsp}
%  These commands  all draw forms which denote the Bsp rotation.
%  Not visible from the front.
% \begin{macrocode}
%\newcommand{\rrBsp}{\textbf{\textsf{Bsp}}}
\newcommand{\rrBsp}{\@rrsp{B}}
\newcommand{\SquareBsp}{\@SquareLetter{\rrBsp}}
\newcommand{\rrhBsp}{\raisebox{-0.25mm}{\SquareBsp}\,}
\newcommand{\RubikBsp}{\raisebox{\@hRubik}{\SquareBsp}\,}
\newcommand{\textRubikBsp}{\rrhBsp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Ba}
%
%  \begin{macro}{\rrBa}
%  \begin{macro}{\SquareBa}
%  \begin{macro}{\rrhBa}
%  \begin{macro}{\RubikBa}
%  \begin{macro}{\textRubikBa}
%  These commands  all draw forms which denote the Ba rotation.
% Not visible from the front.
% \begin{macrocode}
%\newcommand{\rrBa}{\textbf{\textsf{Ba}}}
\newcommand{\rrBa}{\@rra{B}}
\newcommand{\SquareBa}{\@SquareLetter{\rrBa}}
\newcommand{\rrhBa}{\raisebox{-0.25mm}{\SquareBa}\,}
\newcommand{\RubikBa}{\raisebox{\@hRubik}{\SquareBa}\,}
\newcommand{\textRubikBa}{\rrhBa\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Bap}
%
%  \begin{macro}{\rrBap}
%  \begin{macro}{\SquareBap}
%  \begin{macro}{\rrhBap}
%  \begin{macro}{\RubikBap}
%  \begin{macro}{\textRubikBap}
%  These commands  all draw forms which denote the Bap rotation.
% Not visible from the front.
% \begin{macrocode}
%\newcommand{\rrBap}{\textbf{\textsf{Bap}}}
\newcommand{\rrBap}{\@rrap{B}}
\newcommand{\SquareBap}{\@SquareLetter{\rrBap}}
\newcommand{\rrhBap}{\raisebox{-0.25mm}{\SquareBap}\,}
\newcommand{\RubikBap}{\raisebox{\@hRubik}{\SquareBap}\,}
\newcommand{\textRubikBap}{\rrhBap\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation D}
%
%  \begin{macro}{\rrD}
%  \begin{macro}{\SquareD}
%  \begin{macro}{\rrhD}
%  \begin{macro}{\RubikD}
%  \begin{macro}{\textRubikD}
%  These commands  all draw forms which denote the D rotation.
% \begin{macrocode}
\newcommand{\rrD}{\textbf{\textsf{D}}}
%%
\newcommand{\SquareD}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick, ->]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhD}{\raisebox{-0.333\height}{\SquareD}\,}
%%
\newcommand{\RubikD}{%
\begin{minipage}{0.6cm}
\centering
\SquareD\\
\rrD
\end{minipage}%
}
\newcommand{\textRubikD}{\rrD\,\rrhD}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Dp}
%
%  \begin{macro}{\rrDp}
%  \begin{macro}{\SquareDp}
%  \begin{macro}{\rrhDp}
%  \begin{macro}{\RubikDp}
%  \begin{macro}{\textRubikDp}
%  These commands  all draw forms which denote the Dp rotation.
% \begin{macrocode}
\newcommand{\rrDp}{\textbf{\textsf{D}$^\prime$}}
%%
\newcommand{\SquareDp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick]     (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick]     (\@sb,\@sdd)  -- (\@sbh, \@sdd);
\draw [thick, <-] (\@sb,\@sd)   -- (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhDp}{\raisebox{-0.333\height}{\SquareDp}\,}
%%
\newcommand{\RubikDp}{%
\begin{minipage}{0.6cm}
\centering
\SquareDp\\
\rrDp
\end{minipage}%
}
\newcommand{\textRubikDp}{\rrDp\,\rrhDp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Dw}
%
%  \begin{macro}{\rrDw}
%  \begin{macro}{\SquareDw}
%  \begin{macro}{\rrhDw}
%  \begin{macro}{\RubikDw}
%  \begin{macro}{\textRubikDw}
%  These commands  all draw forms which denote the Dw rotation.
% \begin{macrocode}
\newcommand{\rrDw}{\textbf{\textsf{D\footnotesize{w}}}}
%%
\newcommand{\SquareDw}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick]     (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick, ->] (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick, ->] (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhDw}{\raisebox{-0.333\height}{\SquareDw}\,}
%%
\newcommand{\RubikDw}{%
\begin{minipage}{0.6cm}
\centering
\SquareDw\\
\rrDw
\end{minipage}%
}
\newcommand{\textRubikDw}{\rrDw\,\rrhDw}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Dwp}
%
%  \begin{macro}{\rrDwp}
%  \begin{macro}{\SquareDwp}
%  \begin{macro}{\rrhDwp}
%  \begin{macro}{\RubikDwp}
%  \begin{macro}{\textRubikDwp}
%  These commands  all draw forms which denote the Dwp rotation.
% \begin{macrocode}
\newcommand{\rrDwp}{\textbf{\textsf{D\footnotesize{w}}$^\prime$}}
%%
\newcommand{\SquareDwp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick]     (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick, <-] (\@sb,\@sdd)  -- (\@sbh, \@sdd);
\draw [thick, <-] (\@sb,\@sd)   -- (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhDwp}{\raisebox{-0.333\height}{\SquareDwp}\,}
%%
\newcommand{\RubikDwp}{%
\begin{minipage}{0.6cm}
\centering
\SquareDwp\\
\rrDwp
\end{minipage}%
}
\newcommand{\textRubikDwp}{\rrDwp\,\rrhDwp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Ds}
%
%  \begin{macro}{\rrDs}
%  \begin{macro}{\SquareDs}
%  \begin{macro}{\rrhDs}
%  \begin{macro}{\RubikDs}
%  \begin{macro}{\textRubikDs}
%  These commands  all draw forms which denote the Ds rotation.
% \begin{macrocode}
\newcommand{\rrDs}{\@rrs{D}}
%%
\newcommand{\SquareDs}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick, ->]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhDs}{\raisebox{-0.333\height}{\SquareDs}\,}
%%
\newcommand{\RubikDs}{%
\begin{minipage}{0.6cm}
\centering
\SquareDs\\
\rrDs
\end{minipage}%
}
\newcommand{\textRubikDs}{\rrDs\,\rrhDs}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Dsp}
%
%  \begin{macro}{\rrDsp}
%  \begin{macro}{\SquareDsp}
%  \begin{macro}{\rrhDsp}
%  \begin{macro}{\RubikDsp}
%  \begin{macro}{\textRubikDsp}
%  These commands  all draw forms which denote the Dsp rotation.
% \begin{macrocode}
\newcommand{\rrDsp}{\@rrsp{D}}
%%
\newcommand{\SquareDsp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick, <-]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhDsp}{\raisebox{-0.333\height}{\SquareDsp}\,}
%%
\newcommand{\RubikDsp}{%
\begin{minipage}{0.6cm}
\centering
\SquareDsp\\
\rrDsp
\end{minipage}%
}
\newcommand{\textRubikDsp}{\rrDsp\,\rrhDsp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Da} 
%
%  \begin{macro}{\rrDa}
%  \begin{macro}{\SquareDa}
%  \begin{macro}{\rrhDa}
%  \begin{macro}{\RubikDa}
%  \begin{macro}{\textRubikDa}
%  These commands  all draw forms which denote the Da rotation.
% \begin{macrocode}
\newcommand{\rrDa}{\@rra{D}}
%%
\newcommand{\SquareDa}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick, ->]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhDa}{\raisebox{-0.333\height}{\SquareDa}\,}
%%
\newcommand{\RubikDa}{%
\begin{minipage}{0.6cm}
\centering
\SquareDa\\
\rrDa
\end{minipage}%
}
\newcommand{\textRubikDa}{\rrDa\,\rrhDa}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Dap} 
%
%  \begin{macro}{\rrDap}
%  \begin{macro}{\SquareDap}
%  \begin{macro}{\rrhDap}
%  \begin{macro}{\RubikDap}
%  \begin{macro}{\textRubikDap}
%  These commands  all draw forms which denote the Dap rotation.
% \begin{macrocode}
\newcommand{\rrDap}{\@rrap{D}}
%%
\newcommand{\SquareDap}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick, <-]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhDap}{\raisebox{-0.333\height}{\SquareDap}\,}
%%
\newcommand{\RubikDap}{%
\begin{minipage}{0.6cm}
\centering
\SquareDap\\
\rrDap
\end{minipage}%
}
\newcommand{\textRubikDap}{\rrDap\,\rrhDap}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation E}
%
%  \begin{macro}{\rrE}
%  \begin{macro}{\SquareE}
%  \begin{macro}{\rrhE}
%  \begin{macro}{\RubikE}
%  \begin{macro}{\textRubikE}
%  These commands  all draw forms which denote the E rotation.
% \begin{macrocode}
\newcommand{\rrE}{\textbf{\textsf{E}}}
%%
\newcommand{\SquareE}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick, ->]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhE}{\raisebox{-0.333\height}{\SquareE}\,}
%%
\newcommand{\RubikE}{%
\begin{minipage}{0.6cm}
\centering
\SquareE\\
\rrE
\end{minipage}%
}
\newcommand{\textRubikE}{\rrE\,\rrhE}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Ep}
%
%  \begin{macro}{\rrEp}
%  \begin{macro}{\SquareEp}
%  \begin{macro}{\rrhEp}
%  \begin{macro}{\RubikEp}
%  \begin{macro}{\textRubikEp}
%  These commands  all draw forms which denote the Ep rotation.
% \begin{macrocode}
\newcommand{\rrEp}{\textbf{\textsf{E}$^\prime$}}
%%
\newcommand{\SquareEp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick, <-]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhEp}{\raisebox{-0.333\height}{\SquareEp}\,}
%%
\newcommand{\RubikEp}{%
\begin{minipage}{0.6cm}
\centering
\SquareEp\\
\rrEp
\end{minipage}%
}
\newcommand{\textRubikEp}{\rrEp\,\rrhEp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation F}
%
%  \begin{macro}{\rrF}
%  \begin{macro}{\SquareF}
%  \begin{macro}{\rrhF}
%  \begin{macro}{\RubikF}
%  \begin{macro}{\textRubikF}
%  These commands  all draw forms which denote the F rotation.
%  \begin{macrocode}
\newcommand{\rrF}{\textbf{\textsf{F}}}
%%
\newcommand{\SquareF}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\@scx, \@scy) arc[radius=0.35, start angle=-60, delta angle=290];
\end{tikzpicture}%
}
\newcommand{\rrhF}{\raisebox{-0.333\height}{\SquareF}\,}
%%
\newcommand{\RubikF}{%
\begin{minipage}{0.6cm}
\centering
\SquareF\\
\rrF
\end{minipage}%
}
\newcommand{\textRubikF}{\rrF\,\rrhF}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Fp}
%
%  \begin{macro}{\rrFp}
%  \begin{macro}{\SquareFp}
%  \begin{macro}{\rrhFp}
%  \begin{macro}{\RubikFp}
%  \begin{macro}{\textRubikFp}
%  These commands  all draw forms which denote the Fp rotation.
% \begin{macrocode}
\newcommand{\rrFp}{\textbf{\textsf{F}$^\prime$}}
%%
\newcommand{\SquareFp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\@scx, \@scy) arc[radius=0.35, start angle=-60, delta angle=290];
\end{tikzpicture}%
}
\newcommand{\rrhFp}{\raisebox{-0.333\height}{\SquareFp}\,}
%%
\newcommand{\RubikFp}{%
\begin{minipage}{0.6cm}
\centering
\SquareFp\\
\rrFp
\end{minipage}%
}
\newcommand{\textRubikFp}{\rrFp\,\rrhFp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Fw}
%
%  \begin{macro}{\rrFw}
%  \begin{macro}{\SquareFw}
%  \begin{macro}{\rrhFw}
%  \begin{macro}{\RubikFw}
%  \begin{macro}{\textRubikFw}
%  These commands  all draw forms which denote the Fw rotation.
% \begin{macrocode}
\newcommand{\rrFw}{\textbf{\textsf{F\footnotesize{w}}}}
%%
\newcommand{\SquareFw}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\@scx, \@scy) arc[radius=0.35, start angle=-60, delta angle=290];
\draw [thick] (\@sqcx,\@sqcy) arc[radius=0.1, start angle=-60, delta angle=360];
%\node (squareLab) at (0.5,0.5)  {$o$};
\end{tikzpicture}%
}
\newcommand{\rrhFw}{\raisebox{-0.333\height}{\SquareFw}\,}
%%
\newcommand{\RubikFw}{%
\begin{minipage}{0.6cm}
\centering
\SquareFw\\
\rrFw
\end{minipage}%
}
\newcommand{\textRubikFw}{\rrFw\,\rrhFw}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Fwp}
%
%  \begin{macro}{\rrFwp}
%  \begin{macro}{\SquareFwp}
%  \begin{macro}{\rrhFwp}
%  \begin{macro}{\RubikFwp}
%  \begin{macro}{\textRubikFwp}
%  These commands  all draw forms which denote the Fwp rotation.
% \begin{macrocode}
\newcommand{\rrFwp}{\textbf{\textsf{F\footnotesize{w}}$^\prime$}}
%%
\newcommand{\SquareFwp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\@scx, \@scy) arc[radius=0.35, start angle=-60, delta angle=290];
\draw [thick] (\@sqcx,\@sqcy) arc[radius=0.1, start angle=-60, delta angle=360];
\end{tikzpicture}%
}
\newcommand{\rrhFwp}{\raisebox{-0.333\height}{\SquareFwp}\,}
%%
\newcommand{\RubikFwp}{%
\begin{minipage}{0.6cm}
\centering
\SquareFwp\\
\rrFwp
\end{minipage}%
}
\newcommand{\textRubikFwp}{\rrFwp\,\rrhFwp}
%%
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Fs}
%
%  \begin{macro}{\rrFs}
%  \begin{macro}{\rrhFs}
%  \begin{macro}{\RubikFs}
%  \begin{macro}{\textRubikFs}
%  These commands  draw forms of the Singmaster Fs slice rotation.
%  We need to just make square with Fs in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
%  Not visible from the front.
% \begin{macrocode}
\newcommand{\rrFs}{\@rrs{F}}
\newcommand{\SquareFs}{\@SquareLetter{\rrFs}} 
\newcommand{\rrhFs}{\raisebox{-0.25mm}{\SquareFs}\,}
\newcommand{\RubikFs}{\raisebox{\@hRubik}{\SquareFs}\,}
\newcommand{\textRubikFs}{\rrhFs\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Fsp}
%
%  \begin{macro}{\rrFsp}
%  \begin{macro}{\rrhFsp}
%  \begin{macro}{\RubikFsp}
%  \begin{macro}{\textRubikFsp}
%  These commands  draw forms of the Singmaster Fsp slice rotation.
%  We need to just make square with Fsp in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
%  Not visible from the front.
% \begin{macrocode}
\newcommand{\rrFsp}{\@rrsp{F}}
\newcommand{\SquareFsp}{\@SquareLetter{\rrFsp}}
\newcommand{\rrhFsp}{\raisebox{-0.25mm}{\SquareFsp}\,}
\newcommand{\RubikFsp}{\raisebox{\@hRubik}{\SquareFsp}\,}
\newcommand{\textRubikFsp}{\rrhFsp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Fa}
%
%  \begin{macro}{\rrFa}
%  \begin{macro}{\rrhFa}
%  \begin{macro}{\RubikFa}
%  \begin{macro}{\textRubikFa}
%  These commands  draw forms of the Singmaster Fa slice rotation.
%  We need to just make square with Fa in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
%  Not visible from the front.
% \begin{macrocode}
\newcommand{\rrFa}{\@rra{F}}
\newcommand{\SquareFa}{\@SquareLetter{\rrFa}}
\newcommand{\rrhFa}{\raisebox{-0.25mm}{\SquareFa}\,}
\newcommand{\RubikFa}{\raisebox{\@hRubik}{\SquareFa}\,}
\newcommand{\textRubikFa}{\rrhFa\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Fap}
%
%  \begin{macro}{\rrFap}
%  \begin{macro}{\rrhFap}
%  \begin{macro}{\RubikFap}
%  \begin{macro}{\textRubikFap}
%  These commands  draw forms of the Singmaster Fap slice rotation.
%  We need to just make square with Fap in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
%  Not visible from the front.
% \begin{macrocode}
\newcommand{\rrFap}{\@rrap{F}}
\newcommand{\SquareFap}{\@SquareLetter{\rrFap}}
\newcommand{\rrhFap}{\raisebox{-0.25mm}{\SquareFap}\,}
\newcommand{\RubikFap}{\raisebox{\@hRubik}{\SquareFap}\,}
\newcommand{\textRubikFap}{\rrhFap\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation L}
%
%  \begin{macro}{\rrL}
%  \begin{macro}{\SquareL}
%  \begin{macro}{\rrhL}
%  \begin{macro}{\RubikL}
%  \begin{macro}{\textRubikL}
%  These commands  all draw forms which denote the L rotation.
% \begin{macrocode}
\newcommand{\rrL}{\textbf{\textsf{L}}}
%%
\newcommand{\SquareL}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhL}{\raisebox{-0.333\height}{\SquareL}\,}
%%
\newcommand{\RubikL}{%
\begin{minipage}{0.6cm}
\centering
\SquareL\\
\rrL
\end{minipage}%
}
\newcommand{\textRubikL}{\rrL\,\rrhL}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Lp}
%
%  \begin{macro}{\rrLp}
%  \begin{macro}{\SquareLp}
%  \begin{macro}{\rrhLp}
%  \begin{macro}{\RubikLp}
%  \begin{macro}{\textRubikLp}
%  These commands  all draw forms which denote the Lp rotation.
% \begin{macrocode}
\newcommand{\rrLp}{\textbf{\textsf{L}$^\prime$}}
%%
\newcommand{\SquareLp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick,->] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLp}{\raisebox{-0.333\height}{\SquareLp}\,}
%%
\newcommand{\RubikLp}{%
\begin{minipage}{0.6cm}
\centering
\SquareLp\\
\rrLp
\end{minipage}%
}
\newcommand{\textRubikLp}{\rrLp\,\rrhLp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Lw}
%
%  \begin{macro}{\rrLw}
%  \begin{macro}{\SquareLw}
%  \begin{macro}{\rrhLw}
%  \begin{macro}{\RubikLw}
%  \begin{macro}{\textRubikLw}
%  These commands  all draw forms which denote the Lw rotation.
% \begin{macrocode}
\newcommand{\rrLw}{\textbf{\textsf{L\footnotesize{w}}}}
%%
\newcommand{\SquareLw}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick, <-] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLw}{\raisebox{-0.333\height}{\SquareLw}\,}
%%
\newcommand{\RubikLw}{%
\begin{minipage}{0.6cm}
\centering
\SquareLw\\
\rrLw
\end{minipage}%
}
\newcommand{\textRubikLw}{\rrLw\,\rrhLw}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Lwp}
%
%  \begin{macro}{\rrLwp}
%  \begin{macro}{\SquareLwp}
%  \begin{macro}{\rrhLwp}
%  \begin{macro}{\RubikLwp}
%  \begin{macro}{\textRubikLwp}
%  These commands  all draw forms which denote the Lwp rotation.
% \begin{macrocode}
\newcommand{\rrLwp}{\textbf{\textsf{L\footnotesize{w}}$^\prime$}}
%%
\newcommand{\SquareLwp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick,->] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick,->] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLwp}{\raisebox{-0.333\height}{\SquareLwp}\,}
%%
\newcommand{\RubikLwp}{%
\begin{minipage}{0.6cm}
\centering
\SquareLwp\\
\rrLwp
\end{minipage}%
}
\newcommand{\textRubikLwp}{\rrLwp\,\rrhLwp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Ls}
%
%  \begin{macro}{\rrLs}
%  \begin{macro}{\SquareLs}
%  \begin{macro}{\rrhLs}
%  \begin{macro}{\RubikLs}
%  \begin{macro}{\textRubikLs}
%  These commands  all draw forms which denote the Ls rotation.
% \begin{macrocode}
\newcommand{\rrLs}{\@rrs{L}}
%%
\newcommand{\SquareLs}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick, <-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLs}{\raisebox{-0.333\height}{\SquareLs}\,}
%%
\newcommand{\RubikLs}{%
\begin{minipage}{0.6cm}
\centering
\SquareLs\\
\rrLs
\end{minipage}%
}
\newcommand{\textRubikLs}{\rrLs\,\rrhLs}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Lsp}
%
%  \begin{macro}{\rrLsp}
%  \begin{macro}{\SquareLsp}
%  \begin{macro}{\rrhLsp}
%  \begin{macro}{\RubikLsp}
%  \begin{macro}{\textRubikLsp}
%  These commands  all draw forms which denote the Lsp rotation.
% \begin{macrocode}
\newcommand{\rrLsp}{\@rrsp{L}}
%%
\newcommand{\SquareLsp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick, ->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLsp}{\raisebox{-0.333\height}{\SquareLsp}\,}
%%
\newcommand{\RubikLsp}{%
\begin{minipage}{0.6cm}
\centering
\SquareLsp\\
\rrLsp
\end{minipage}%
}
\newcommand{\textRubikLsp}{\rrLsp\,\rrhLsp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation La}
%
%  \begin{macro}{\rrLa}
%  \begin{macro}{\SquareLa}
%  \begin{macro}{\rrhLa}
%  \begin{macro}{\RubikLa}
%  \begin{macro}{\textRubikLa}
%  These commands  all draw forms which denote the La rotation.
% \begin{macrocode}
\newcommand{\rrLa}{\@rra{L}}
%%
\newcommand{\SquareLa}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick, ->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLa}{\raisebox{-0.333\height}{\SquareLa}\,}
%%
\newcommand{\RubikLa}{%
\begin{minipage}{0.6cm}
\centering
\SquareLa\\
\rrLa
\end{minipage}%
}
\newcommand{\textRubikLa}{\rrLa\,\rrhLa}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Lap}
%
%  \begin{macro}{\rrLap}
%  \begin{macro}{\SquareLap}
%  \begin{macro}{\rrhLap}
%  \begin{macro}{\RubikLap}
%  \begin{macro}{\textRubikLap}
%  These commands  all draw forms which denote the Lap rotation.
% \begin{macrocode}
\newcommand{\rrLap}{\@rrap{L}}
%%
\newcommand{\SquareLap}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick, <-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhLap}{\raisebox{-0.333\height}{\SquareLap}\,}
%%
\newcommand{\RubikLap}{%
\begin{minipage}{0.6cm}
\centering
\SquareLap\\
\rrLap
\end{minipage}%
}
\newcommand{\textRubikLap}{\rrLap\,\rrhLap}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation M}
%
%  \begin{macro}{\rrM}
%  \begin{macro}{\SquareM}
%  \begin{macro}{\rrhM}
%  \begin{macro}{\RubikM}
%  \begin{macro}{\textRubikM}
%  These commands  all draw forms which denote the M rotation.
% \begin{macrocode}
\newcommand{\rrM}{\textbf{\textsf{M}}}
%%
\newcommand{\SquareM}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick, <-] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhM}{\raisebox{-0.333\height}{\SquareM}\,}
%%
\newcommand{\RubikM}{%
\begin{minipage}{0.6cm}
\centering
\SquareM\\
\rrM
\end{minipage}%
}
\newcommand{\textRubikM}{\rrM\,\rrhM}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Mp}
%
%  \begin{macro}{\rrMp}
%  \begin{macro}{\SquareMp}
%  \begin{macro}{\rrhMp}
%  \begin{macro}{\RubikMp}
%  \begin{macro}{\textRubikMp}
%  These commands  all draw forms which denote the Mp rotation.
% \begin{macrocode}
\newcommand{\rrMp}{\textbf{\textsf{M}$^\prime$}}
%%
\newcommand{\SquareMp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick,->] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhMp}{\raisebox{-0.333\height}{\SquareMp}\,}
%%
\newcommand{\RubikMp}{%
\begin{minipage}{0.6cm}
\centering
\SquareMp\\
\rrMp
\end{minipage}%
}
\newcommand{\textRubikMp}{\rrMp\,\rrhMp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation R}
%
%  \begin{macro}{\rrR}
%  \begin{macro}{\SquareR}
%  \begin{macro}{\rrhR}
%  \begin{macro}{\RubikR}
%  \begin{macro}{\textRubikR}
%  These commands  all draw forms which denote the R rotation.
% \begin{macrocode}
\newcommand{\rrR}{\textbf{\textsf{R}}}
%%
\newcommand{\SquareR}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
%% draw three lines in the square, one with an arrow
\draw [thick] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick, ->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhR}{\raisebox{-0.333\height}{\SquareR}\,}
%%
\newcommand{\RubikR}{%
\begin{minipage}{0.6cm}
\centering
\SquareR\\
\rrR
\end{minipage}%
}
\newcommand{\textRubikR}{\rrR\,\rrhR}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Rp}
%
%  \begin{macro}{\rrRp}
%  \begin{macro}{\SquareRp}
%  \begin{macro}{\rrhRp}
%  \begin{macro}{\RubikRp}
%  \begin{macro}{\textRubikRp}
%  These commands  all draw forms which denote the Rp rotation.
% \begin{macrocode}
\newcommand{\rrRp}{\textbf{\textsf{R}$^\prime$}}
%%
\newcommand{\SquareRp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick, <-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRp}{\raisebox{-0.333\height}{\SquareRp}\,}
%%
\newcommand{\RubikRp}{%
\begin{minipage}{0.6cm}
\centering
\SquareRp\\
\rrRp
\end{minipage}%
}
\newcommand{\textRubikRp}{\rrRp\,\rrhRp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Rw}
%
%  \begin{macro}{\rrRw}
%  \begin{macro}{\SquareRw}
%  \begin{macro}{\rrhRw}
%  \begin{macro}{\RubikRw}
%  \begin{macro}{\textRubikRw}
%  These commands  all draw forms which denote the Rw rotation.
% \begin{macrocode}
\newcommand{\rrRw}{\textbf{\textsf{R\footnotesize{w}}}}
%%
\newcommand{\SquareRw}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick, ->] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick, ->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRw}{\raisebox{-0.333\height}{\SquareRw}\,}
%%
\newcommand{\RubikRw}{%
\begin{minipage}{0.6cm}
\centering
\SquareRw\\
\rrRw
\end{minipage}%
}
\newcommand{\textRubikRw}{\rrRw\,\rrhRw}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Rwp}
%
%  \begin{macro}{\rrRwp}
%  \begin{macro}{\SquareRwp}
%  \begin{macro}{\rrhRwp}
%  \begin{macro}{\RubikRwp}
%  \begin{macro}{\textRubikRwp}
%  These commands  all draw forms which denote the Rwp rotation.
% \begin{macrocode}
\newcommand{\rrRwp}{\textbf{\textsf{R\footnotesize{w}}$^\prime$}}
%%
\newcommand{\SquareRwp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick, <-] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick, <-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRwp}{\raisebox{-0.333\height}{\SquareRwp}\,}
%%
\newcommand{\RubikRwp}{%
\begin{minipage}{0.6cm}
\centering
\SquareRwp\\
\rrRwp
\end{minipage}%
}
\newcommand{\textRubikRwp}{\rrRwp\,\rrhRwp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Rs}
%
%  \begin{macro}{\rrRs}
%  \begin{macro}{\SquareRs}
%  \begin{macro}{\rrhRs}
%  \begin{macro}{\RubikRs}
%  \begin{macro}{\textRubikRs}
%  These commands  all draw forms which denote the Rs rotation.
% \begin{macrocode}
\newcommand{\rrRs}{\@rrs{R}}
%%
\newcommand{\SquareRs}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick,->] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick,->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRs}{\raisebox{-0.333\height}{\SquareRs}\,}
%%
\newcommand{\RubikRs}{%
\begin{minipage}{0.6cm}
\centering
\SquareRs\\
\rrRs
\end{minipage}%
}
\newcommand{\textRubikRs}{\rrRs\,\rrhRs}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Rsp}
%
%  \begin{macro}{\rrRsp}
%  \begin{macro}{\SquareRsp}
%  \begin{macro}{\rrhRsp}
%  \begin{macro}{\RubikRsp}
%  \begin{macro}{\textRubikRsp}
%  These commands  all draw forms which denote the Rsp rotation.
% \begin{macrocode}
\newcommand{\rrRsp}{\@rrsp{R}}
%%
\newcommand{\SquareRsp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick,<-] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick,<-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRsp}{\raisebox{-0.333\height}{\SquareRsp}\,}
%%
\newcommand{\RubikRsp}{%
\begin{minipage}{0.6cm}
\centering
\SquareRsp\\
\rrRsp
\end{minipage}%
}
\newcommand{\textRubikRsp}{\rrRsp\,\rrhRsp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Ra}
%
%  \begin{macro}{\rrRa}
%  \begin{macro}{\SquareRa}
%  \begin{macro}{\rrhRa}
%  \begin{macro}{\RubikRa}
%  \begin{macro}{\textRubikRa}
%  These commands  all draw forms which denote the Ra rotation.
% \begin{macrocode}
\newcommand{\rrRa}{\@rra{R}}
%%
\newcommand{\SquareRa}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick,<-] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick,->] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRa}{\raisebox{-0.333\height}{\SquareRa}\,}
%%
\newcommand{\RubikRa}{%
\begin{minipage}{0.6cm}
\centering
\SquareRa\\
\rrRa
\end{minipage}%
}
\newcommand{\textRubikRa}{\rrRa\,\rrhRa}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Rap}
%
%  \begin{macro}{\rrRap}
%  \begin{macro}{\SquareRap}
%  \begin{macro}{\rrhRap}
%  \begin{macro}{\RubikRap}
%  \begin{macro}{\textRubikRap}
%  These commands  all draw forms which denote the Rap rotation.
% \begin{macrocode}
\newcommand{\rrRap}{\@rrap{R}}
%%
\newcommand{\SquareRap}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick,->] (\@sd, \@sb) -- (\@sd, \@sbh);
\draw [thick] (\@sdd,\@sb) -- (\@sdd, \@sbh);
\draw [thick,<-] (\@sddd, \@sb) -- (\@sddd, \@sbh);
\end{tikzpicture}%
}
\newcommand{\rrhRap}{\raisebox{-0.333\height}{\SquareRap}\,}
%%
\newcommand{\RubikRap}{%
\begin{minipage}{0.6cm}
\centering
\SquareRap\\
\rrRap
\end{minipage}%
}
\newcommand{\textRubikRap}{\rrRap\,\rrhRap}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation S}
%
%  \begin{macro}{\rrS}
%  \begin{macro}{\SquareS}
%  \begin{macro}{\rrhS}
%  \begin{macro}{\RubikS}
%  \begin{macro}{\textRubikS}
%  These commands  all draw forms which denote the S rotation.
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrS}{\@rr{S}}
\newcommand{\SquareS}{\@SquareLetter{\rrS}}
\newcommand{\rrhS}{\raisebox{-0.25mm}{\SquareS}\,}
\newcommand{\RubikS}{\raisebox{\@hRubik}{\SquareS}\,}
\newcommand{\textRubikS}{\rrhS\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Sp}
%
%  \begin{macro}{\rrSp}
%  \begin{macro}{\SquareSp}
%  \begin{macro}{\rrhSp}
%  \begin{macro}{\RubikSp}
%  \begin{macro}{\textRubikSp}
%  These commands  all draw forms which denote the Sp rotation.
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrSp}{\@rrp{S}}
\newcommand{\SquareSp}{\@SquareLetter{\rrSp}}
\newcommand{\rrhSp}{\raisebox{-0.25mm}{\SquareSp}\,}
\newcommand{\RubikSp}{\raisebox{\@hRubik}{\SquareSp}\,}
\newcommand{\textRubikSp}{\rrhSp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Su}
%
%  \begin{macro}{\rrSu}
%  \begin{macro}{\rrhSu}
%  \begin{macro}{\RubikSu}
%  \begin{macro}{\textRubikSu}
%  These commands  draw forms of the Singmaster Su slice rotation.
%  We also need to finetune the spacing 
%  between these `slice' hieroglyphs (especially Fs  and Bs).
% \begin{macrocode}
\newcommand{\rrSu}{\textbf{\textsf{S\footnotesize{u}}}}
\newcommand{\rrhSu}{\rrhEp}%
\newcommand{\RubikSu}{%
\begin{minipage}{0.6cm}
\centering
\SquareEp\\
\rrSu
\end{minipage}%
}
\newcommand{\textRubikSu}{\rrSu\,\rrhEp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Sup}
%
%  \begin{macro}{\rrSup}
%  \begin{macro}{\rrhSup}
%  \begin{macro}{\RubikSup}
%  \begin{macro}{\textRubikSup}
%  These commands  draw forms of the Singmaster Sup slice rotation.
%  We also need to finetune the spacing 
%  between these `slice' hieroglyphs (especially Fs  and Bs).
% \begin{macrocode}
\newcommand{\rrSup}{\textbf{\textsf{S\footnotesize{u}}$^\prime$}}
\newcommand{\rrhSup}{\rrhE}%
\newcommand{\RubikSup}{%
\begin{minipage}{0.6cm}
\centering
\SquareE\\
\rrSup
\end{minipage}%
}
\newcommand{\textRubikSup}{\rrSup\,\rrhE}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Sd}
%
%  \begin{macro}{\rrSd}
%  \begin{macro}{\rrhSd}
%  \begin{macro}{\RubikSd}
%  \begin{macro}{\textRubikSd}
%  These commands  draw forms of the Singmaster Sd slice rotation.
% \begin{macrocode}
\newcommand{\rrSd}{\textbf{\textsf{S\footnotesize{d}}}}
\newcommand{\rrhSd}{\rrhE}%
\newcommand{\RubikSd}{%
\begin{minipage}{0.6cm}
\centering
\SquareE\\
\rrSd
\end{minipage}%
}
\newcommand{\textRubikSd}{\rrSd\,\rrhE}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Sdp}
%
%  \begin{macro}{\rrSdp}
%  \begin{macro}{\rrhSdp}
%  \begin{macro}{\RubikSdp}
%  \begin{macro}{\textRubikSdp}
%  These commands  draw forms of the Singmaster Sdp slice rotation.
% \begin{macrocode}
\newcommand{\rrSdp}{\textbf{\textsf{S\footnotesize{d}}$^\prime$}}
\newcommand{\rrhSdp}{\rrhEp}%
\newcommand{\RubikSdp}{%
\begin{minipage}{0.6cm}
\centering
\SquareEp\\
\rrSdp
\end{minipage}%
}
\newcommand{\textRubikSdp}{\rrSdp\,\rrhEp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Sl}
%
%  \begin{macro}{\rrSl}
%  \begin{macro}{\rrhSl}
%  \begin{macro}{\RubikSl}
%  \begin{macro}{\textRubikSl}
%  These commands  draw forms of the Singmaster Sl slice rotation.
% \begin{macrocode}
\newcommand{\rrSl}{\textbf{\textsf{S\footnotesize{l}}}}
\newcommand{\rrhSl}{\rrhM}%
\newcommand{\RubikSl}{%
\begin{minipage}{0.6cm}
\centering
\SquareM\\
\rrSl
\end{minipage}%
}
\newcommand{\textRubikSl}{\rrSl\,\rrhM}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Slp}
%
%  \begin{macro}{\rrSlp}
%  \begin{macro}{\rrhSlp}
%  \begin{macro}{\RubikSlp}
%  \begin{macro}{\textRubikSlp}
%  These commands  draw forms of the Singmaster Slp slice rotation.
% \begin{macrocode}
\newcommand{\rrSlp}{\textbf{\textsf{S\footnotesize{l}}$^\prime$}}
\newcommand{\rrhSlp}{\rrhMp}%
\newcommand{\RubikSlp}{%
\begin{minipage}{0.6cm}
\centering
\SquareMp\\
\rrSlp
\end{minipage}%
}
\newcommand{\textRubikSlp}{\rrSlp\,\rrhMp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Sr}
%
%  \begin{macro}{\rrSr}
%  \begin{macro}{\rrhSr}
%  \begin{macro}{\RubikSr}
%  \begin{macro}{\textRubikSr}
%  These commands  draw forms of the Singmaster Sr slice rotation.
% \begin{macrocode}
\newcommand{\rrSr}{\textbf{\textsf{S\footnotesize{r}}}}
\newcommand{\rrhSr}{\rrhMp}%
\newcommand{\RubikSr}{%
\begin{minipage}{0.6cm}
\centering
\SquareMp\\
\rrSr
\end{minipage}%
}
\newcommand{\textRubikSr}{\rrSr\,\rrhMp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Srp}
%
%  \begin{macro}{\rrSrp}
%  \begin{macro}{\rrhSrp}
%  \begin{macro}{\RubikSrp}
%  \begin{macro}{\textRubikSrp}
%  These commands  draw forms of the Singmaster Srp slice rotation.
% \begin{macrocode}
\newcommand{\rrSrp}{\textbf{\textsf{S\footnotesize{r}}$^\prime$}}
\newcommand{\rrhSrp}{\rrhM}%
\newcommand{\RubikSrp}{%
\begin{minipage}{0.6cm}
\centering
\SquareM\\
\rrSrp
\end{minipage}%
}
\newcommand{\textRubikSrp}{\rrSrp\,\rrhM}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Sf}
%
%  \begin{macro}{\rrSf}
%  \begin{macro}{\rrhSf}
%  \begin{macro}{\RubikSf}
%  \begin{macro}{\textRubikSf}
%  These commands  draw forms of the Singmaster Sf slice rotation.
%  We need to just make square with Sf in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrSf}{\textbf{\textsf{S\footnotesize{f}}}}
\newcommand{\SquareSf}{\@SquareLetter{\rrSf}}
\newcommand{\rrhSf}{\raisebox{-0.25mm}{\SquareSf}\,}
\newcommand{\RubikSf}{\raisebox{\@hRubik}{\SquareSf}\,}
\newcommand{\textRubikSf}{\rrhSf\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Sfp}
%
%  \begin{macro}{\rrSfp}
%  \begin{macro}{\rrhSfp}
%  \begin{macro}{\RubikSfp}
%  \begin{macro}{\textRubikSfp}
%  These commands  draw forms of the Singmaster Sfp slice rotation.
%  We need to just make square with Sfp in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrSfp}{\textbf{\textsf{S\footnotesize{f}}$^\prime$}}
\newcommand{\SquareSfp}{\@SquareLetter{\rrSfp}}
\newcommand{\rrhSfp}{\raisebox{-0.25mm}{\SquareSfp}\,}
\newcommand{\RubikSfp}{\raisebox{\@hRubik}{\SquareSfp}\,}
\newcommand{\textRubikSfp}{\rrhSfp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Sb}
%
%  \begin{macro}{\rrSb}
%  \begin{macro}{\rrhSb}
%  \begin{macro}{\RubikSb}
%  \begin{macro}{\textRubikSb}
%  These commands  draw forms of the Singmaster Sb slice rotation.
%  We need to just make square with Sb in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
% Not visible from the front.
% \begin{macrocode}
\newcommand{\rrSb}{\textbf{\textsf{S\footnotesize{b}}}}
\newcommand{\SquareSb}{\@SquareLetter{\rrSb}}
\newcommand{\rrhSb}{\raisebox{-0.25mm}{\SquareSb}\,}
\newcommand{\RubikSb}{\raisebox{\@hRubik}{\SquareSb}\,}
\newcommand{\textRubikSb}{\rrhSb\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Sbp}
%
%  \begin{macro}{\rrSbp}
%  \begin{macro}{\rrhSbp}
%  \begin{macro}{\RubikSbp}
%  \begin{macro}{\textRubikSbp}
%  These commands  draw forms of the Singmaster Sbp slice rotation.
%  We need to just make square with Sbp in square; 
%  adjust box height using a \cmd{\rule};
%  adjust \cmd{\fboxsep} (default=3pt);
%  adjust \cmd{\fboxrule} (default=0.4pt);
%  bounded by \{\} so no need to reset to defaults.
% Not visible from th front.
% \begin{macrocode}
\newcommand{\rrSbp}{\textbf{\textsf{S\footnotesize{b}}$^\prime$}}
\newcommand{\SquareSbp}{\@SquareLetter{\rrSbp}}
\newcommand{\rrhSbp}{\raisebox{-0.25mm}{\SquareSbp}\,}
\newcommand{\RubikSbp}{\raisebox{\@hRubik}{\SquareSbp}\,}
\newcommand{\textRubikSbp}{\rrhSbp\,}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation U}
%
%  \begin{macro}{\rrU}
%  \begin{macro}{\SquareU}
%  \begin{macro}{\rrhU}
%  \begin{macro}{\RubikU}
%  \begin{macro}{\textRubikU}
%  These commands  all draw forms which denote the U rotation.
% \begin{macrocode}
\newcommand{\rrU}{\textbf{\textsf{U}}}
%%
\newcommand{\SquareU}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhU}{\raisebox{-0.333\height}{\SquareU}\,}
%%
\newcommand{\RubikU}{%
\begin{minipage}{0.6cm}
\centering
\SquareU\\
\rrU
\end{minipage}%%
}
\newcommand{\textRubikU}{\rrU\,\rrhU}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Uw}
%
%  \begin{macro}{\rrUw}
%  \begin{macro}{\SquareUw}
%  \begin{macro}{\rrhUw}
%  \begin{macro}{\RubikUw}
%  \begin{macro}{\textRubikUw}
%  These commands  all draw forms which denote the Uw rotation.
% \begin{macrocode}
\newcommand{\rrUw}{\textbf{\textsf{U\footnotesize{w}}}}
%%
\newcommand{\SquareUw}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick, <-] (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
%
\newcommand{\rrhUw}{\raisebox{-0.333\height}{\SquareUw}\,}
%%
\newcommand{\RubikUw}{%
\begin{minipage}{0.6cm}
\centering
\SquareUw\\
\rrUw
\end{minipage}%%
}
%%
\newcommand{\textRubikUw}{\rrUw\,\rrhUw}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Up}
%
%  \begin{macro}{\rrUp}
%  \begin{macro}{\SquareUp}
%  \begin{macro}{\rrhUp}
%  \begin{macro}{\RubikUp}
%  \begin{macro}{\textRubikUp}
%  These commands  all draw forms which denote the Up rotation.
% \begin{macrocode}
\newcommand{\rrUp}{\textbf{\textsf{U}$^\prime$}}
%%
\newcommand{\SquareUp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhUp}{\raisebox{-0.333\height}{\SquareUp}\,}
%%
\newcommand{\RubikUp}{%
\begin{minipage}{0.6cm}
\centering
\SquareUp\\
\rrUp
\end{minipage}%%
}
\newcommand{\textRubikUp}{\rrUp\,\rrhUp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Uwp}
%
%  \begin{macro}{\rrUwp}
%  \begin{macro}{\SquareUwp}
%  \begin{macro}{\rrhUwp}
%  \begin{macro}{\RubikUwp}
%  \begin{macro}{\textRubikUwp}
%  These commands  all draw forms which denote the Uwp rotation.
% \begin{macrocode}
\newcommand{\rrUwp}{\textbf{\textsf{U\footnotesize{w}}$^\prime$}}
%%
\newcommand{\SquareUwp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick, ->] (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhUwp}{\raisebox{-0.333\height}{\SquareUwp}\,}
%%
\newcommand{\RubikUwp}{%
\begin{minipage}{0.6cm}
\centering
\SquareUwp\\
\rrUwp
\end{minipage}%%
}
\newcommand{\textRubikUwp}{\rrUwp\,\rrhUwp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Us} 
%
%  \begin{macro}{\rrUs}
%  \begin{macro}{\SquareUs}
%  \begin{macro}{\rrhUs}
%  \begin{macro}{\RubikUs}
%  \begin{macro}{\textRubikUs}
%  These commands  all draw forms which denote the Us rotation.
% \begin{macrocode}
\newcommand{\rrUs}{\@rrs{U}}
%%
\newcommand{\SquareUs}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick, <-]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhUs}{\raisebox{-0.333\height}{\SquareUs}\,}
%%
\newcommand{\RubikUs}{%
\begin{minipage}{0.6cm}
\centering
\SquareUs\\
\rrUs
\end{minipage}%
}
\newcommand{\textRubikUs}{\rrUs\,\rrhUs}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Usp} 
%
%  \begin{macro}{\rrUsp}
%  \begin{macro}{\SquareUsp}
%  \begin{macro}{\rrhUs}
%  \begin{macro}{\RubikUs}
%  \begin{macro}{\textRubikUsp}
%  These commands  all draw forms which denote the Usp rotation.
% \begin{macrocode}
\newcommand{\rrUsp}{\@rrsp{U}}
%%
\newcommand{\SquareUsp}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick, ->]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhUsp}{\raisebox{-0.333\height}{\SquareUsp}\,}
%%
\newcommand{\RubikUsp}{%
\begin{minipage}{0.6cm}
\centering
\SquareUsp\\
\rrUsp
\end{minipage}%
}
\newcommand{\textRubikUsp}{\rrUsp\,\rrhUsp}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Ua} 
%
%  \begin{macro}{\rrUa}
%  \begin{macro}{\SquareUa}
%  \begin{macro}{\rrhUa}
%  \begin{macro}{\RubikUa}
%  \begin{macro}{\textRubikUa}
%  These commands  all draw forms which denote the Ua rotation.
% \begin{macrocode}
\newcommand{\rrUa}{\@rra{U}}
%%
\newcommand{\SquareUa}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, <-] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick, ->]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhUa}{\raisebox{-0.333\height}{\SquareUa}\,}
%%
\newcommand{\RubikUa}{%
\begin{minipage}{0.6cm}
\centering
\SquareUa\\
\rrUa
\end{minipage}%
}
\newcommand{\textRubikUa}{\rrUa\,\rrhUa}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotation Uap} 
%
%  \begin{macro}{\rrUap}
%  \begin{macro}{\SquareUap}
%  \begin{macro}{\rrhUap}
%  \begin{macro}{\RubikUap}
%  \begin{macro}{\textRubikUap}
%  These commands  all draw forms which denote the Uap rotation.
% \begin{macrocode}
\newcommand{\rrUap}{\@rrap{U}}
%%
\newcommand{\SquareUap}{%
\begin{tikzpicture}[scale=0.5]
\DrawNotationBox;
\draw [thick, ->] (\@sb,\@sddd) -- (\@sbh, \@sddd);
\draw [thick]     (\@sb,\@sdd) --  (\@sbh, \@sdd);
\draw [thick, <-]     (\@sb,\@sd) --   (\@sbh, \@sd);
\end{tikzpicture}%
}
\newcommand{\rrhUap}{\raisebox{-0.333\height}{\SquareUap}\,}
%%
\newcommand{\RubikUap}{%
\begin{minipage}{0.6cm}
\centering
\SquareUap\\
\rrUap
\end{minipage}%
}
\newcommand{\textRubikUap}{\rrUap\,\rrhUap}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%
%  \subsubsection{\hspace{3mm}Rotations x and xp}
%
%  \begin{macro}{\rrx}
%  \begin{macro}{\rrhx}
%  \begin{macro}{\Rubikx}
%  These commands  all draw forms which denote the x rotation.
% \begin{macrocode}
\newcommand{\rrx}{\textbf{\textsf{x}}}
\newcommand{\Rubikx}{\@xyzRubik{x}}
\newcommand{\rrhx}{\@xyzh{x}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%  \begin{macro}{\rrxp}
%  \begin{macro}{\rrhxp}
%  \begin{macro}{\Rubikxp}
%  These commands  all draw forms which denote the xp rotation.
% \begin{macrocode}
\newcommand{\rrxp}{\textbf{\textsf{x}$^\prime$}}
\newcommand{\Rubikxp}{\@xyzRubikp{x}}
\newcommand{\rrhxp}{\@xyzhp{x}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotations y and yp}
%
%  \begin{macro}{\rry}
%  \begin{macro}{\rrhy}
%  \begin{macro}{\Rubiky}
%  These commands  all draw forms which denote the y rotation.
% \begin{macrocode}
\newcommand{\rry}{\textbf{\textsf{y}}}
\newcommand{\Rubiky}{\@xyzRubik{y}}
\newcommand{\rrhy}{\@xyzh{y}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%  \begin{macro}{\rryp}
%  \begin{macro}{\rrhyp}
%  \begin{macro}{\Rubikyp}
%  These commands  all draw forms which denote the yp rotation.
% \begin{macrocode}
\newcommand{\rryp}{\textbf{\textsf{y}$^\prime$}}
\newcommand{\Rubikyp}{\@xyzRubikp{y}}
\newcommand{\rrhyp}{\@xyzhp{y}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotations z and zp}
%
%  \begin{macro}{\rrz}
%  \begin{macro}{\rrhz}
%  \begin{macro}{\Rubikz}
%  These commands  all draw forms which denote the z rotation.
% \begin{macrocode}
\newcommand{\rrz}{\textbf{\textsf{z}}}
\newcommand{\Rubikz}{\@xyzRubik{z}}
\newcommand{\rrhz}{\@xyzh{z}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%  \begin{macro}{\rrzp}
%  \begin{macro}{\rrhzp}
%  \begin{macro}{\Rubikzp}
%  These commands  all draw forms which denote the zp rotation.
% \begin{macrocode}
\newcommand{\rrzp}{\textbf{\textsf{z}$^\prime$}}
\newcommand{\Rubikzp}{\@xyzRubikp{z}}
\newcommand{\rrhzp}{\@xyzhp{z}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotations u and d}
%
%  \begin{macro}{\rru}
%  \begin{macro}{\rrhu}
%  \begin{macro}{\Rubiku}
%  These commands  all draw forms which denote the u rotation.
% \begin{macrocode}
\newcommand{\rru}{\textbf{\textsf{u}}}
\newcommand{\Rubiku}{\@xyzRubik{u}}
\newcommand{\rrhu}{\@xyzh{u}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%  \begin{macro}{\rrd}
%  \begin{macro}{\rrhd}
%  \begin{macro}{\Rubikd}
%  These commands  all draw forms which denote the d rotation.
% \begin{macrocode}
\newcommand{\rrd}{\textbf{\textsf{d}}}
\newcommand{\Rubikd}{\@xyzRubik{d}}
\newcommand{\rrhd}{\@xyzh{d}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotations l and r}
%
%  \begin{macro}{\rrl}
%  \begin{macro}{\rrhl}
%  \begin{macro}{\Rubikl}
%  These commands  all draw forms which denote the l rotation.
% \begin{macrocode}
\newcommand{\rrl}{\textbf{\textsf{l}}}
\newcommand{\Rubikl}{\@xyzRubik{l}}
\newcommand{\rrhl}{\@xyzh{l}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%  \begin{macro}{\rrr}
%  \begin{macro}{\rrhr}
%  \begin{macro}{\Rubikr}
%  These commands  all draw forms which denote the r rotation.
% \begin{macrocode}
\newcommand{\rrr}{\textbf{\textsf{r}}}
\newcommand{\Rubikr}{\@xyzRubik{r}}
\newcommand{\rrhr}{\@xyzh{r}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%  \subsubsection{\hspace{3mm}Rotations f and b}
%
%  \begin{macro}{\rrf}
%  \begin{macro}{\rrhf}
%  \begin{macro}{\Rubikf}
%  These commands  all draw forms which denote the f rotation.
% \begin{macrocode}
\newcommand{\rrf}{\textbf{\textsf{f}}}
\newcommand{\Rubikf}{\@xyzRubik{f}}
\newcommand{\rrhf}{\@xyzh{f}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%  \begin{macro}{\rrb}
%  \begin{macro}{\rrhb}
%  \begin{macro}{\Rubikb}
%  These commands  all draw forms which denote the b rotation.
% \begin{macrocode}
\newcommand{\rrb}{\textbf{\textsf{b}}}
\newcommand{\Rubikb}{\@xyzRubik{b}}
\newcommand{\rrhb}{\@xyzh{b}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
% --------------------------
%    End of this package
% --------------------------
%    \begin{macrocode}
%</rubikcube>
%    \end{macrocode}
%
%
%
%
% \Finale
%
\endinput
