diff options
author | Karl Berry <karl@freefriends.org> | 2014-02-06 23:27:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-02-06 23:27:03 +0000 |
commit | 56864a978f93ea1c29086183c24fb535c4022270 (patch) | |
tree | 9d202380e1f31fbe99def3b9f7534e1fe0ab6544 /Master/texmf-dist/source | |
parent | 7be84a697eb5391a0974c23fc8dc82413a8c7631 (diff) |
rubik (4feb14)
git-svn-id: svn://tug.org/texlive/trunk@32893 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
6 files changed, 7217 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/rubik/example-rot1.bat b/Master/texmf-dist/source/latex/rubik/example-rot1.bat new file mode 100755 index 00000000000..3fc9ec4b31e --- /dev/null +++ b/Master/texmf-dist/source/latex/rubik/example-rot1.bat @@ -0,0 +1,2 @@ + pdflatex --shell-escape example-rot1.tex
+ pdflatex --shell-escape example-rot1.tex
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/rubik/example-rot2.bat b/Master/texmf-dist/source/latex/rubik/example-rot2.bat new file mode 100755 index 00000000000..e648b587ac7 --- /dev/null +++ b/Master/texmf-dist/source/latex/rubik/example-rot2.bat @@ -0,0 +1 @@ +pdflatex --shell-escape example-rot2.tex
diff --git a/Master/texmf-dist/source/latex/rubik/rubikcube.dtx b/Master/texmf-dist/source/latex/rubik/rubikcube.dtx new file mode 100644 index 00000000000..053c01df17f --- /dev/null +++ b/Master/texmf-dist/source/latex/rubik/rubikcube.dtx @@ -0,0 +1,6076 @@ +% \iffalse meta-comment +% +%% rubikcube.dtx +%% Copyright 2014 RWD Nickalls (dick@nickalls.org) and A Syropoulos (asyropoulos@yahoo.com) +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work are RWD Nickalls and A Syropoulos +% +% +% This work consists of the files rubikcube.dtx and rubikcube.ins +% and the derived file rubikcube.sty. +% +%<*readme> +% +% The rubikcube package provides a collection of LaTeX commands and macros +% for the typesetting of Rubik cube configurations and rotation +% sequences using the TikZ graphic language. +% +% Please report errors or suggestions for improvement to +% +% Dick Nickalls or Apostolos Syropoulos +% +% This package requires the basic TikZ package to be loaded already +%</readme> +% +%<*driver> +\listfiles +\documentclass{ltxdoc} +\IfFileExists{rubikcube.sty}{\usepackage{rubikcube}}{% + \GenericWarning{rubikcube.dtx}{Package file rubikcube.sty not found. + Documentation will be messed up!^^J + (Generate rubikcube.sty by (La)TeXing rubikcube.ins, and then^^J + process rubikcube.dtx again)^^J}\stop +}% +\usepackage{ifpdf} +\usepackage{url} %% for references +\usepackage{supertabular} %% for Notation table +%%\OnlyDescription +\EnableCrossrefs +\CodelineIndex +\CodelineNumbered +\RecordChanges +\setcounter{StandardModuleDepth}{1} +\begin{document} + \DocInput{rubikcube.dtx} + \PrintChanges + \PrintIndex +\end{document} +%</driver> +% \fi +% +% +% +% \CheckSum{3912} +% +%%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +% +% +% \title{The \textsf{rubikcube} package} +% +% \author{ +% RWD Nickalls (dick@nickalls.org) \\ +% A Syropoulos (asyropoulos@yahoo.com) +% } +% \date{This file describes version \RCfileversion, last revised \RCfiledate} +% \maketitle +% +% \begin{abstract} +% The \rubikcube\ package provides LaTeX commands and macros +% for typesetting Rubik cube (3x3x3) notation, configurations, and +% rotation sequences using the TikZ graphic language. +% \end{abstract} +% +% \bigskip +% \hfil +% \begin{minipage}{2cm} +% \centering +% \begin{tikzpicture}[scale=0.4] +% \RubikFaceUpAll{W} +% \RubikFaceFrontAll{O} +% \RubikFaceRightAll{G} +% \DrawRubikCubeRU +% \end{tikzpicture} +% \end{minipage} +% \begin{minipage}{2cm} +% \centering +% \begin{tikzpicture}[scale=0.4] +% \DrawRubikLayerFaceAll{W} +% \DrawRubikLayerSideT {R}{R}{R} +% \DrawRubikLayerSideLR{B} {G} +% {B} {G} +% {B} {G} +% \DrawRubikLayerSideB {O}{O}{O} +% \draw[thick,->,color=magenta] (1.5,0.5) -- (2.4, 1.4); +% \draw[thick,->] (2.5,1.5) -- (1.6, 2.4); +% \draw[thick,->,color=magenta] (1.3, 2.3) -- (1.3, 0.5); +% \draw[thick,<->, color=blue] (0.5,2.6) -- (2.5, 2.6); +% \draw[thick,<->, color=blue] (0.5,0.3) -- (2.5, 0.3); +% \end{tikzpicture} +% \end{minipage} +% \RubikF\RubikR\RubikU\RubikRp\RubikUp\RubikFp\ +% \ \ $\longrightarrow$ +% \begin{minipage}{2cm} +% \centering +% \begin{tikzpicture}[scale=0.4] +% \DrawRubikLayerFace{W}{W}{B} +% {W}{W}{O} +% {W}{R}{B} +% \DrawRubikLayerSideT {G}{G}{R} +% \DrawRubikLayerSideLR{R} {W} +% {B} {W} +% {O} {W} +% \DrawRubikLayerSideB {G}{W}{O} +% \end{tikzpicture} +% \end{minipage} +% \hfil +% +% \bigskip +% +% \tableofcontents +% +% \pagebreak +% +% \section{Introduction} +% +% The \rubikcube\ package provides a collection of \LaTeX\ commands +% and macros for typesetting Rubik cube configurations and layer-rotation +% instructions using the PGF/TikZ graphic languages---see examples below. +% We have extended slightly the layer-rotation hieroglyphic notation, originally +% developed by Garfath-Cox (1981), and improved by Duvoid (2010, 2011). +% +% The \textsf{rubikcube} package has been road-tested on a Microsoft +% platform (with MikTeX and Strawberry Perl) +% and on a Linux platform ({\TeX}Live and Mandriva). +% +% +% Useful web sites for solvers are the Speedsolving website, and those +% maintained by Duvoid, by Fridrich, by Jelinek, by Reid, and by Vandenburgh (see References). +% For the mathematics and group theory associated with Rubik's cube see Chen (2004), +% Joyner (2008), Hutchings (2011), Rokicki \textit{et al.}\ (2013). +% +% +% \subsection{Requirements} +% +% The \rubikcube\ package requires the TikZ package. +% +% +% \subsection{Supporting tool---the \textsf{rubikrotation} package} +% \label{sec:addons} +% +% The \textsf{rubikrotation} package, is a dynamic extension to +% the \rubikcube\ package. It consists of the Perl program +% \texttt{rubikrotation.pl} and style option \texttt{rubikrotation.sty}. +% The \textsf{rubikrotation} package implements rotation sequences and +% random scrambling of the 3x3x3 Rubik cube on-the-fly using a +% \cmd{\RubikRotation}\marg{rotation-sequence} command. It returns the +% new state in a form which is then used by the \rubikcube\ package. +% +% Since the \cmd{\RubikRotation} command works by \textsc{call}ing the +% \texttt{rubikrotation.pl} program, it follows that the \textsf{rubikrotation} +% package requires (a)~Perl to be installed, +% and (b)~\LaTeX\ needs to be run using the \texttt{--shell-escape} commandline option. +% See the \textsf{rubikrotation} documentation for details. +% The \textsf{rubikrotation} package has been road-tested on a Microsoft +% platform (with MikTeX and Strawberry Perl) +% and on a Linux platform ({\TeX}Live and Mandriva). +% +% +% \subsection{Copyright} +% Copyright 2014 RWD Nickalls and A Syropoulos. +% +% \medskip +% {\noindent}This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3c of this license or any +% later version. The latest version of this licence is in +% http://www.latex-project.org/lppl.txt +% +% +% \section{Installation} +% +% +% \subsection{Generating the files} +% +% Place the file \texttt{rubikcube.zip} into a temporary directory, and unzip it. +% This will generate the following files: +% \begin{verbatim} +% rubikcube.ins +% rubikcube.dtx +% rubikcube.sty +% rubikcube.pdf +% example-cube.tex +% example-cube.pdf +% Rubik_doc_figA.pdf +% Rubik_doc_figB.pdf +% Rubik_doc_figC.pdf +% Rubik_doc_figD.pdf +% Rubik_doc_figE.pdf +%\end{verbatim} +% The style option \texttt{rubikcube.sty} is generated by running (pdf)\LaTeX\ on +% the file \texttt{rubikcube.ins} as follows: +%\begin{verbatim} +% pdflatex rubikcube.ins +%\end{verbatim} +% The documentation file (\texttt{rubikcube.pdf}) was generated using the following +% steps: +% \begin{verbatim} +% pdflatex rubikcube.dtx +% pdflatex rubikcube.dtx +% makeindex -s gind.ist rubikcube +% makeindex -s gglo.ist -o rubikcube.gls rubikcube.glo +% pdflatex rubikcube.dtx +%\end{verbatim} +% +% +% \subsection{Placing the files} +% +% Place the files either in the local working directory, or where your system +% will find them. For a Linux system with a standard \TeX\ Directory Structure (TDS), then: +% +%\medskip +%{\noindent}*.sty $\rightarrow$ +% \texttt{/usr/local/texlive/texmf-local/tex/latex/local/rubikcube/} +%{\newline}*.pdf $\rightarrow$ \texttt{/usr/local/texlive/texmf-local/doc/rubikcube/} +% +% \medskip +% {\noindent}Finally, (depending on your system) update the \TeX\ file database using the +% \texttt{texhash} command. +% +% +% \subsection{Usage} +% +% Load the package by using the command \cmd{\usepackage\{rubikcube\}}. +% Note that the \rubikcube\ package requires the TikZ package, and so always load TikZ +% before \rubikcube\ as follows: +% \begin{quote} +%\begin{verbatim} +% \usepackage{tikz} +% \usepackage{rubikcube} +%\end{verbatim} +% \end{quote} +% However, the \rubikcube\ package does check for the presence of TikZ, and will +% load it if TikZ is not already loaded. +% +% +% \section{TikZ picture environment} +% +% For a basic introduction to the use of TikZ see the following manuals +% (from CTAN or from \texttt{http://altermundus.com/}). +% \begin{itemize} +% \item \texttt{pgfmanual.pdf}, version 2.10 (2012) (900 pages) +% \item tkz-base-screen.pdf +% \end{itemize} +% An example of the TikZ picture environment for use with \rubikcube\ is as follows +% If no scale is used (default scale = 1), then each of the small cubie sides +% will have a length of 1~cm. +% \begin{quote} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.5] +% .... +% \end{tikzpicture} +%\end{verbatim} +% \end{quote} +% A very useful feature of TikZ is that it automatically +% minimises the surrounding white-space, and consequently this is +% mostly quite sufficient. +% +% However, when making complicated side-by-side figures it is +% sometimes helpful to place each sub-figure in a surrounding minipage. +% In this case, a useful approach is to first adjust +% the `scale' parameter to obtain the appropriate size, and +% then adjust the minipage width as necessary. +% +% Note that sometimes a temporary \cmd{\fbox\{\}} can be a useful aid when +% trying to visualise the full extent of the minipage +% (and its whitespace). In this case remember to include a +% trailing \% after the first brace \{ of the fbox command in order not to +% collect any extra `space', as follows: +% \begin{quote} +%\begin{verbatim} +% \fbox{% +% \begin{minipage}{2cm} +% \centering +% \begin{tikzpicture}[scale=0.5] +% .... +% \end{tikzpicture} +% \end{minipage} +% } +%\end{verbatim} +% \end{quote} +% Unexpected spacing between two adjacent images, or between an +% image and adjacent text, is usually related to inappropriate +% (and hidden) white-space associated with the image or its +% associated \cmd{\minipage}. +% +% +% \subsection{\rubikcube\ commands} +% +% Although the \rubikcube\ package has been designed with TikZ in mind, +% it is important to appreciate that of all the various \rubikcube\ +% commands only the `Draw...' commands actually have to be used within +% a TikZ picture environment. +% +% Indeed, using \rubikcube\ +% commands outside the TikZ picture environment can make for useful +% flexibility when a documant is generating more than one figure +% or image. This is because the scope of a command when used inside +% a TikZ environment is constrained to be `local' to that particular +% environment, and hence its influence is not accessable outside +% the environment. +% +% For example, +% +% \subsection{\cmd{\draw} error message} +% \label{drawerrormessage} +% +% If a \cmd{\Draw...} command is used \textit{outside} a TikZ picture +% environment, then \LaTeX\ issues a \cmd{\draw} ``Undefined control +% sequence'' error message, indicating that it is trying to draw +% something using an undefined TikZ \cmd{\draw} command. +% +% For example, if we try to run the \rubikcube\ command +% \cmd{\DrawRubikFlat} without a surrounding TikZ picture environment +% you will see something like the following error message. +%\begin{verbatim} +%! Undefined control sequence. +%\FlatUp ... }{#1}\pgfmathsetmacro {\uy }{#2}\draw +% [line join=round,... +%l.56 \DrawRubikFlat +%\end{verbatim} +% +% +% \section{Command conventions} +% \label{sec:conventions} +% +% +% \DescribeMacro{\rubikcube} +% This command generates the logo \rubikcube. +% +% +% \subsection{Capital letters} +% +% Each `word' in a command (except the word `text') starts with a capital letter. +% For example, \cmd{\DrawRubikCubeRU}, \cmd{\DrawCubieRU}. +% However, in line with \LaTeX, `text' commands start with a lowercase `t'; +% for example \cmd{\textCubieRU}. Letters for colours (R, O, Y, G, B, W, X) are +% always written in uppercase. How the six face letters are written depends +% on the command; sometimes in uppercase (eg \cmd{\rrD}, \cmd{\rrDs}, \cmd{\rrDa} ), +% and sometimes in lowercase (eg~\cmd{\rrSu}, \cmd{\rrd}, \cmd{\rrhf}). +% +% \subsection{XYZ argument ordering} +% +% Many commands have an appended two (XY) or three (XYZ) ordered letter code +% which is used to for specifying some feature of the command; perhaps +% either face or cubie colours or a viewpoint direction. +% +% The convention is that the letter codes are ordered in the XYZ order; +% ie the first code relates to an X-related parameter; +% for example L (Left) or R (Right); the second relates to a Y-related +% parameter; for example U (Up) or D (Down); the third (if required) +% relates to a Z-related parameter; for example F (Front) or B (Back). +% +% \textsc{example}: |\DrawCubieRU{G}{Y}{O}| draws a cubie from +% the RightUp viewpoint. The sequence of colour codes for the three visible +% faces are XYZ ordered, and hence result in the cube having a Green Right face, +% Yellow Up face and Orange Front face. +% +% +% \subsection{Trailing \% on end of \rubikcube\ commands} +% +% It is important to include a trailing \% on the end of \rubikcube\ +% commands when used \textit{outside} a TikZ picture environment. +% This is to prevent unwanted `space' characters appearing in +% the graphics. Note that a useful feature of the TikZ environment +% is that it automatically minimises any such space. +% +% +% \section{Rubik rotation commands and notation} +% \label{sec:RubikCommands} +% +% We use the standard Rubik cube notation of WCA (2012)---see article~12---and +% also the `s' (Slice) and `a' (anti-Slice) notation described in the +% `Notation and terminology' section +% in the `Pretty patterns' page on the website of +% Fridrich (\url{http://www.ws.binghamton.edu/fridrich/ptrns.html}). +% By the term \rubikcube\ we denote only the familiar +% 3x3x3 puzzle cube. We denote similar puzzle cubes of a different size by +% the term NCubes (NxNxN). +% +% It is recommended that commas are used to separate sequestial +% Rubik moves or commands to avoid ambiguity, especially when using just +% lettercodes on their own. +% For example, in the following sequence the commas usefully remove any ambiguity: +% \rrU,\rrLw2,\rrUsp,\rrDa \ \ (|\rrU,\rrLw2,\rrUsp,\rrDa|). +% +% +% +% \subsection{Overview} +% +% The \rubikcube\ notation comprises a range of +% commands for moves or rotations (e.g.,~\rrR, \rry, \rrBw) and their equivalent hieroglyphs +% (e.g.,~\rrhR, \rrhy, \rrhBw), as well as commands for drawing 3x3x3 cubes and single cubies. +% +% Note that there are a few rotation commands which do not have arrow +% hieroglyphs---their their rotation is not visible from the \textsc{front} face +% and hence cannot easily be rendered as an arrow hieroglyph. Consequently these +% rotations have a simple `letter' hieroglyph +% in the form of the letter-code in a square; for example \rrhBw, \rrhSb. +% +% \DescribeMacro{\rr..} +% The letter-code of a rotation is typeset (as in text) using the rubik-rotation +% \cmd{\rr..} stem: ie \rrR\ is typeset using the command \cmd{\rrR}. +% The hieroglyph of a rotation command is generated (in text) by +% \DescribeMacro{\rrh..} +% using instead the stem \cmd{\rrh..}. \ Thus the command \cmd{\rrhR} generates +% \rrhR\ which is the hieroglyph associated with \rrR. +% +% \DescribeMacro{\Rubik..} +% A vertically combined lettercode and its hieroglyph is generated using the command +% stem \cmd{\Rubik..}. For example, \RubikR\ is generated by the command \cmd{\RubikR}, +% with the square hieroglyph sitting on the baseline. +% For some hieroglyphs, eg~the \rrhx, \rrhy, \rrhz\ denoting 90~degree axis rotations, +% the only difference between the \cmd{\rrh..} and \cmd{\Rubik..} forms is that +% the \cmd{\Rubik..} form is eleveted to sit on the baseline just like the other +% \cmd{\Rubik..} hieroglyphs. +% For example \cmd{\rrhyp} generates \rrhyp, while +% \cmd{\Rubikyp} generates \Rubikyp. +% +% \DescribeMacro{\textRubik..} +% A horizontally combined lettercode and its hieroglyph (in sequence as in text) +% is generated using the command stem \cmd{\textRubik..}. +% For example, \textRubikR\ is typeset using the command \cmd{\textRubikR}. +% A list of all commands and their associated hieroglyphs is given in +% Section~\ref{sec:listofcommands}. +% +% +% +% \subsection{Face rotations} +% +% \DescribeMacro{\rrU} +% \DescribeMacro{\rrD} +% \DescribeMacro{\rrL} +% \DescribeMacro{\rrR} +% \DescribeMacro{\rrF} +% \DescribeMacro{\rrB} +% The six main faces of the cube are denoted as \textsc{front} (towards the observer), +% \textsc{back}, \textsc{left}, \textsc{right}, \textsc{up}, \textsc{down}. +% The uppercase initial letter of each face-name (\rrF, \rrB, \rrL, \rrR, \rrU, \rrD) +% denotes a clockwise 90-degree rotation of the face as shown in +% Figure~\ref{fig:notation}. +% For example, \rrD\ is generated by the `rubik rotation' command \cmd{\rrD}. +% +% \DescribeMacro{\rrUp} +% \DescribeMacro{\rrDp} +% \DescribeMacro{\rrLp} +% \DescribeMacro{\rrRp} +% \DescribeMacro{\rrFp} +% \DescribeMacro{\rrBp} +% An appended prime~$^\prime$ indicates an anticlockwise rotation; eg \rrFp. +% This is sometimes written as \rrF$\boldmath{^{-1}}$. The `prime' notation is +% achieved by appending a lowercase `p' to the face rotation command. For example, \rrRp\ +% is generated by \cmd{\rrRp}. +% +% \begin{figure}[hbt] +% \centering +% \ifpdf +% \includegraphics[height=6cm]{Rubik_doc_figA.pdf} +% \fi +% \caption{\label{fig:notation}} +% \end{figure} +% +% +% \subsection{Slice rotations} +% +% \DescribeMacro{\rrSu} +% \DescribeMacro{\rrSd} +% \DescribeMacro{\rrSl} +% \DescribeMacro{\rrSr} +% \DescribeMacro{\rrSf} +% \DescribeMacro{\rrSb} +% The Rubik cube (3x3x3) has three orthogonal so-called `inner' slices, whose +ve +% rotation direction follows that of a named face. For example the inner slice +% rotation between the \textsc{right} and \textsc{left} faces whose rotation +% direction follows the rotation \rrR\ (rotation is isomorphic to \rrR) is denoted +% as \rrSr, which is typeset using the command \cmd{\rrSr}. Note that in these cases +% the trailing \texttt{r} in the command is lowercase. +% +% \DescribeMacro{\rrSup} +% \DescribeMacro{\rrSdp} +% \DescribeMacro{\rrSlp} +% \DescribeMacro{\rrSrp} +% \DescribeMacro{\rrSfp} +% \DescribeMacro{\rrSbp} +% Each of these slice rotations (S rotations) has a reversed (primed) p-form, +% the command for which is generated by appending the suffix `p'. +% For example the inner slice rotations \rrSlp\ (\cmd{\rrSlp}) and +% \rrSr\ (\cmd{\rrSr}) are identical. +% The equivalence is more obvious when we see their respective hieroglyphs. +% For example, in this case \linebreak \rrSlp\ (\cmd{\rrSlp}) +% $\equiv$ \rrhSlp\ (\cmd{\rrhSlP}), +% and \rrSr\ (\cmd{\rrSr}) $\equiv$ \rrhSr\ (\cmd{\rrhSr}). +% +% \pagebreak +% +% \subsubsection*{MES slice notation} +% +% \DescribeMacro{\rrM} +% \DescribeMacro{\rrE} +% \DescribeMacro{\rrS} +% \DescribeMacro{\rrMp} +% \DescribeMacro{\rrEp} +% \DescribeMacro{\rrSp} +% An alternative and somewhat confusing (and hence is non-standard) slice notation +% which is sometimes used is the following +% so-called MES notation, as used in the Waterman algorithm +% (Treep and Waterman 1987). +% \begin{itemize} +% \item[\rrM] \ (\textsc{middle} slice, between the \textsc{left} +% and \textsc{right} faces; direction follows \rrL), +% \item[\rrE] \ (\textsc{equator} slice, between the \textsc{up} and \textsc{down} +% faces; direction follows \rrD), +% \item[\rrS] \ (\textsc{standing} slice, between the \textsc{front} and +% \textsc{back} faces; +% direction follows \rrF). +% \end{itemize} +% Each of these also has a reversed (prime) version. +% The equivalent S notations are therefore as follows: \rrE\ $\equiv$ \rrSd, +% \rrEp\ $\equiv$ \rrSu, +% \rrM\ $\equiv$ \rrSl, \rrMp\ $\equiv$ \rrSr, \rrS\ $\equiv$ \rrSf, \rrSp\ $\equiv$ \rrSb. +% +% +% +% \subsubsection*{Singmaster slice notation} +% +% \DescribeMacro{\rrUs} +% \DescribeMacro{\rrDs} +% \DescribeMacro{\rrLs} +% \DescribeMacro{\rrRs} +% \DescribeMacro{\rrFs} +% \DescribeMacro{\rrBs} +% These are an alternative (but somewhat less intuitive) form of +% slice notation which can be thought of as complementing the +% inner slice rotations. These were originally described by +% Singmaster (Frey and Singmaster, 1982). +% See the link to `notation' on the `Pretty patterns' page of the +% Fridrich website. +% +% Each of these commands denotes a rotation of two opposite faces +% in the same direction. For example, \textRubikUs\ $\equiv$ \textRubikU\ + \textRubikDp, +% which is typeset as: +% \newline |\textRubikUs\ $\equiv$ \textRubikU\ + \textRubikDp|, +% i.e., for \rrUs\ both face-rotations are in the \textit{same} direction +% as \rrU. +% +% +% \subsubsection*{Anti-slice notation} +% +% \DescribeMacro{\rrUa} +% \DescribeMacro{\rrDa} +% \DescribeMacro{\rrLa} +% \DescribeMacro{\rrRa} +% \DescribeMacro{\rrFa} +% \DescribeMacro{\rrBa} +% Each of these commands denotes a rotation of two opposite faces +% in \textit{opposite} directions. +% For example, \textRubikUa\ $\equiv$ \textRubikU\ + \textRubikD, +% which is typeset as: +% \newline |\textRubikUa\ $\equiv$ \textRubikU\ + \textRubikD|. +% See the link to `notation' on the `Pretty patterns' page of the +% Fridrich website. +% +% +% \subsection{Wide rotations} +% +% \DescribeMacro{\rrUw} +% \DescribeMacro{\rrDw} +% \DescribeMacro{\rrLw} +% \DescribeMacro{\rrRw} +% \DescribeMacro{\rrFw} +% \DescribeMacro{\rrBw} +% The clockwise \textit{combined} rotation of an outer face AND its inner slice +% (officially known as a `double outer slice' rotation) is denoted by appending a +% lowercase \textbf{\textsf{\footnotesize{w}}} (denoting `wide') to a face rotation command. +% For example, a \textsc{right} double outer slice rotation is denoted as \rrRw. +% Similarly, the prime $^\prime$ version \rrLwp\ is generated by \cmd{\rrLwp}. +% +% The superscript~$^2$, or sometimes just an ordinary 2, indicates that the rotation +% is applied twice. For example \rrR\textbf{$^2$} or \rrR\textbf{2} +% denote \textit{two} successive 90~degree clockwise rotations of the \textsc{right} face. +% +% +% +% \subsection{Axis rotations} +% +% \DescribeMacro{\rrx} +% \DescribeMacro{\rry} +% \DescribeMacro{\rrz} +% \DescribeMacro{\rrhx} +% \DescribeMacro{\rrhy} +% \DescribeMacro{\rrhz} +% Whole-cube clockwise rotations of 90-degrees about about the orthogonal axes centred +% on the \textsc{right}, \textsc{up}, \textsc{front} faces are denoted +% as \rrx, \rry, \rrz\ (the \cmd{\rr..} forms) respectively, +% with their hieroglyphs (the \cmd{\rrh..} forms) being denoted +% as \rrhx, \rrhy, \rrhz\ in order to distinguish them from square layer-rotation +% hieroglyphs. +% Note that \rrx, \rry, \rrz\ rotations are always expressed in lowercase, +% and hence this practice is extended also to the commands. +% +% An \rrx\textbf{2} rotation (two \rrx\ rotations one after +% the other, ie~\rrhx\ \rrhx) denotes rotating +% the cube 180~degrees about its x axis so as to bring the \textsc{down} face +% into the \textsc{up} position. +% +% An appended prime~$^\prime$ indicates an anticlockwise rotation; +% for example, \rrxp\ (which is generated by appending a `p' to the end of +% the command, ie~\cmd{\rrxp}). +% +% \DescribeMacro{\Rubikx} +% \DescribeMacro{\Rubiky} +% \DescribeMacro{\Rubikz} +% These \cmd{\Rubik..} forms (and their prime `p' versions) generate the same +% hieroglyphs as their \cmd{\rrh..} versions, except that their spacing is +% similar to that associated with the `square box' \cmd{\Rubik..} hieroglyphs. +% Consequently when typesetting an axis command in a sequence of `square-box' +% \cmd{\Rubik..} commands, it is better to use the \cmd{\Rubik..} form rather than +% the equivalent \cmd{\rrh..} form (see the examples in Section~\ref{sec:examples}). +% There are no \cmd{\textRubik..} forms for the axis commands (since they are +% not necessary). +% +% +% \subsubsection*{The u, d, l, r, f, b notation} +% +% \DescribeMacro{\rru} +% \DescribeMacro{\rrd} +% \DescribeMacro{\rrl} +% \DescribeMacro{\rrr} +% \DescribeMacro{\rrf} +% \DescribeMacro{\rrb} +% A commonly used alternative for the \rrx, \rry, \rrz\ notation +% (and endorsed by the WCA) uses the +% lowercase face letter to denote a 90~degree whole-cube rotation in the same +% sense as that of the standard face rotations. +% +% {\noindent}Thus +% \rru\ $\equiv$ \rry, \ \rrd\ $\equiv$ \rryp, \ +% \rrl\ $\equiv$ \rrxp, \ \rrr\ $\equiv$ \rrx, \ +% \rrf\ $\equiv$ \rrz, \ \rrb\ $\equiv$ \rrzp, +% +% {\noindent}For example, \rrd\ is generated by the command \cmd{\rrd}. +% +% {\noindent}Note that these moves do not have prime $^\prime$ versions +% since \rru\ is the opposite of \rrd, \rrl\ is the opposite of \rrr, and +% \rrf\ is the opposite of \rrb. +% +% \DescribeMacro{\rrh..} +% \DescribeMacro{\Rubik..} +% As with the \rrhx, \rrhy, \rrhz\ forms (described above) there also +% equivalent \cmd{\rrh..} and \cmd{\Rubik..} forms. For example, +% \rrhd\ is generated by the command \cmd{\rrhd}. +% +% +% \subsection{Examples} +% \label{sec:examples} +% \begin{quote} +% \rrR\ is generated by the `rubik rotation' command \cmd{\rrR} +% +% \rrFw\ is generated by the `rubik rotation' command \cmd{\rrFw} +% +% \rrL$^2$ is generated by \cmd{\rrL}\verb!$^2$! +% +% \rrRp\ is generated by \cmd{\rrRp} +% +% \rrFwp\ is generated by \cmd{\rrFwp} +% +% \rrx\ and \rrhy\ and \Rubikzp\ are generated by +% \cmd{\rrx} and \cmd{\rrhy} and \cmd{\Rubikzp} +% +% \rrf\ and \rrhb\ are generated by \cmd{\rrf} and \cmd{\rrhb} +% +% The sequence \rrU\rrU\rrR\rrR\ is generated by \cmd{\rrU}\cmd{\rrU}\cmd{\rrR}\cmd{\rrR} +% \end{quote} +% +% \bigskip +% +% {\noindent}\RubikF\RubikR\RubikU\Rubiky\RubikRp\RubikLwp\ +% \ \ \verb!\RubikF\RubikR\RubikU\Rubiky\RubikRp\RubikLwp! +% +% \bigskip +% +% {\noindent}The equivalent `text' version of the first three +% rotations above (and their commands) are as follows: +% +% \bigskip +% +% {\noindent}\textRubikF\ \textRubikR\ \textRubikU\ \ \ \ +% \verb!\textRubikF\ \textRubikR\ \textRubikU! +% +% \bigskip +% {\noindent}Writing the first sequence using only letter-codes or only hieroglyphs, we have: +% +% \bigskip +% +% {\noindent}\rrF\rrR\rrU\rry\rrRp \ \ \ \ +% \verb!\rrF\rrR\rrU\rry\rrRp! +% +% \bigskip +% +% {\noindent}\rrhF\rrhR\rrhU\rrhy\rrhRp \ \ \ \ +% \verb!\rrhF\rrhR\rrhU\rrhy\rrhRp\! +% +% \bigskip +% +% The following shows the importance of using commas to avoid ambiguity: +% +% \bigskip +% +% {\noindent}\rrD,\rrU2,\rrF2,\rrDs2,\rrB, \ \ \ \ \verb!\rrD,\rrU2,\rrF2,\rrDs2,\rrB,! +% +% \bigskip +% +% {\noindent}\rrhD,\rrhU2,\rrhF2,\rrhDs2,\rrhB, \ \ \ \ \verb!\rrhD,\rrhU2,\rrhF2,\rrhDs2,\rrhB,! +% +% +% \subsection{Listing of all rotation commands} +% \label{sec:listofcommands} +% +% Note that all these commands also have a \cmd{\Rubik..} equivalent form which +% typesets both the hieroglyph and its lettercode in a vertical format, +% as shown in the above `Examples' section. These have been ommitted here +% owing to the difficulty of including this form easily in the following table. +% +% Note also that some \cmd{\rrh..} commands (eg~the \cmd{\rrhB..} commands) +% show only the lettercode in a square box. This is because these rotations, which +% do not have a `true' visual representation as seen from the \textsc{front} face, +% are somewhat ambiguous unless typeset with the associated lettercode (ie using the +% \cmd{\Rtbik..} or \cmd{\textRubik..} commands). +% +% \newcommand{\dnstrut}{\rule{0pt}{17pt}} +% \newcommand{\dns}{\hspace{2mm}} +% \newcommand{\dnsp}{\hspace{2mm}} +% +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}} +% \dnstrut\rrU\dns\cmd{\rrU} +% & \rrhU\dns\cmd{\rrhU} +% & \textRubikU\dns\cmd{\textRubikU} \nonumber\\ +% \dnstrut\rrUp\dns\cmd{\rrUp} +% & \rrhUp\dns\cmd{\rrhUp} +% & \textRubikUp\dns\cmd{\textRubikUp} \nonumber\\ +% \dnstrut\rrUw\dns\cmd{\rrUw} +% & \rrhUw\dns\cmd{\rrhUw} +% & \textRubikUw\dns\cmd{\textRubikUw} \nonumber\\ +% \dnstrut\rrUwp\dns\cmd{\rrUwp} +% & \rrhUwp\dns\cmd{\rrhUwp} +% & \textRubikUwp\dns\cmd{\textRubikUwp} \nonumber\\ +% \dnstrut\rrUs\dns\cmd{\rrUs} +% & \rrhUs\dns\cmd{\rrhUs} +% & \textRubikUs\dns\cmd{\textRubikUs} \nonumber\\ +% \dnstrut\rrUsp\dns\cmd{\rrUsp} +% & \rrhUsp\dns\cmd{\rrhUsp} +% & \textRubikUsp\dns\cmd{\textRubikUsp} \nonumber\\ +% \dnstrut\rrUa\dns\cmd{\rrUa} +% & \rrhUa\dns\cmd{\rrhUa} +% & \textRubikUa\dns\cmd{\textRubikUa} \nonumber\\ +% \dnstrut\rrUap\dns\cmd{\rrUap} +% & \rrhUap\dns\cmd{\rrhUap} +% & \textRubikUap\dns\cmd{\textRubikUap} \nonumber\\ +% \end{supertabular} +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}} +% \dnstrut\rrD\dns\cmd{\rrD} +% & \rrhD\dns\cmd{\rrhD} +% & \textRubikD\dns\cmd{\textRubikD} \nonumber\\ +% \dnstrut\rrDp\dns\cmd{\rrDp} +% & \rrhDp\dns\cmd{\rrhDp} +% & \textRubikDp\dns\cmd{\textRubikDp} \nonumber\\ +% \dnstrut\rrDw\dns\cmd{\rrDw} +% & \rrhDw\dns\cmd{\rrhDw} +% & \textRubikDw\dns\cmd{\textRubikDw} \nonumber\\ +% \dnstrut\rrDwp\dns\cmd{\rrDwp} +% & \rrhDwp\dns\cmd{\rrhDwp} +% & \textRubikDwp\dns\cmd{\textRubikDwp} \nonumber\\ +% \dnstrut\rrDs\dns\cmd{\rrDs} +% & \rrhDs\dns\cmd{\rrhDs} +% & \textRubikDs\dns\cmd{\textRubikDs} \nonumber\\ +% \dnstrut\rrDsp\dns\cmd{\rrDsp} +% & \rrhDsp\dns\cmd{\rrhDsp} +% & \textRubikDsp\dns\cmd{\textRubikDsp} \nonumber\\ +% \dnstrut\rrDa\dns\cmd{\rrDa} +% & \rrhDa\dns\cmd{\rrhDa} +% & \textRubikDa\dns\cmd{\textRubikDa} \nonumber\\ +% \dnstrut\rrDap\dns\cmd{\rrDap} +% & \rrhDap\dns\cmd{\rrhDap} +% & \textRubikDap\dns\cmd{\textRubikDap} \nonumber\\ +% \end{supertabular} +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}} +% \dnstrut\rrL\dns\cmd{\rrL} +% & \rrhL\dns\cmd{\rrhL} +% & \textRubikL\dns\cmd{\textRubikL} \nonumber\\ +% \dnstrut\rrLp\dns\cmd{\rrLp} +% & \rrhLp\dns\cmd{\rrhLp} +% & \textRubikLp\dns\cmd{\textRubikLp} \nonumber\\ +% \dnstrut\rrLw\dns\cmd{\rrLw} +% & \rrhLw\dns\cmd{\rrhLw} +% & \textRubikLw\dns\cmd{\textRubikLw} \nonumber\\ +% \dnstrut\rrLwp\dns\cmd{\rrLwp} +% & \rrhLwp\dns\cmd{\rrhLwp} +% & \textRubikLwp\dns\cmd{\textRubikLwp} \nonumber\\ +% \dnstrut\rrLs\dns\cmd{\rrLs} +% & \rrhLs\dns\cmd{\rrhLs} +% & \textRubikLs\dns\cmd{\textRubikLs} \nonumber\\ +% \dnstrut\rrLsp\dns\cmd{\rrLsp} +% & \rrhLsp\dns\cmd{\rrhLsp} +% & \textRubikLsp\dns\cmd{\textRubikLsp} \nonumber\\ +% \dnstrut\rrLa\dns\cmd{\rrLa} +% & \rrhLa\dns\cmd{\rrhLa} +% & \textRubikLa\dns\cmd{\textRubikLa} \nonumber\\ +% \dnstrut\rrLap\dns\cmd{\rrLap} +% & \rrhLap\dns\cmd{\rrhLap} +% & \textRubikLap\dns\cmd{\textRubikLap} \nonumber\\ +% \end{supertabular} +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}} +% \dnstrut\rrR\dns\cmd{\rrR} +% & \rrhR\dns\cmd{\rrhR} +% & \textRubikR\dns\cmd{\textRubikR} \nonumber\\ +% \dnstrut\rrRp\dns\cmd{\rrRp} +% & \rrhRp\dns\cmd{\rrhRp} +% & \textRubikRp\dns\cmd{\textRubikRp} \nonumber\\ +% \dnstrut\rrRw\dns\cmd{\rrRw} +% & \rrhRw\dns\cmd{\rrhRw} +% & \textRubikRw\dns\cmd{\textRubikRw} \nonumber\\ +% \dnstrut\rrRwp\dns\cmd{\rrRwp} +% & \rrhRwp\dns\cmd{\rrhRwp} +% & \textRubikRwp\dns\cmd{\textRubikRwp} \nonumber\\ +% \dnstrut\rrRs\dns\cmd{\rrRs} +% & \rrhRs\dns\cmd{\rrhRs} +% & \textRubikRs\dns\cmd{\textRubikRs} \nonumber\\ +% \dnstrut\rrRsp\dns\cmd{\rrRsp} +% & \rrhRsp\dns\cmd{\rrhRsp} +% & \textRubikRsp\dns\cmd{\textRubikRsp} \nonumber\\ +% \dnstrut\rrRa\dns\cmd{\rrRa} +% & \rrhRa\dns\cmd{\rrhRa} +% & \textRubikRa\dns\cmd{\textRubikRa} \nonumber\\ +% \dnstrut\rrRap\dns\cmd{\rrRap} +% & \rrhRap\dns\cmd{\rrhRap} +% & \textRubikRap\dns\cmd{\textRubikRap} \nonumber\\ +% \end{supertabular} +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}} +% \dnstrut\rrF\dns\cmd{\rrF} +% & \rrhF\dns\cmd{\rrhF} +% & \textRubikF\dns\cmd{\textRubikF} \nonumber\\ +% \dnstrut\rrFp\dns\cmd{\rrFp} +% & \rrhFp\dns\cmd{\rrhFp} +% & \textRubikFp\dns\cmd{\textRubikFp} \nonumber\\ +% \dnstrut\rrFw\dns\cmd{\rrFw} +% & \rrhFw\dns\cmd{\rrhFw} +% & \textRubikFw\dns\cmd{\textRubikFw} \nonumber\\ +% \dnstrut\rrFwp\dns\cmd{\rrFwp} +% & \rrhFwp\dns\cmd{\rrhFwp} +% & \textRubikFwp\dns\cmd{\textRubikFwp} \nonumber\\ +% \dnstrut\rrFs\dns\cmd{\rrFs} +% & \rrhFs\dns\cmd{\rrhFs} +% & \textRubikFs\dns\cmd{\textRubikFs} \nonumber\\ +% \dnstrut\rrFsp\dns\cmd{\rrFsp} +% & \rrhFsp\dns\cmd{\rrhFsp} +% & \textRubikFsp\dns\cmd{\textRubikFsp} \nonumber\\ +% \dnstrut\rrFa\dns\cmd{\rrFa} +% & \rrhFa\dns\cmd{\rrhFa} +% & \textRubikFa\dns\cmd{\textRubikFa} \nonumber\\ +% \dnstrut\rrFap\dns\cmd{\rrFap} +% & \rrhFap\dns\cmd{\rrhFap} +% & \textRubikFap\dns\cmd{\textRubikFap} \nonumber\\ +% \end{supertabular} +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}} +% \dnstrut\rrB\dns\cmd{\rrB} +% & \rrhB\dns\cmd{\rrhB} +% & \textRubikB\dns\cmd{\textRubikB} \nonumber\\ +% \dnstrut\rrBp\dns\cmd{\rrBp} +% & \rrhBp\dns\cmd{\rrhBp} +% & \textRubikBp\dns\cmd{\textRubikBp} \nonumber\\ +% \dnstrut\rrBw\dns\cmd{\rrBw} +% & \rrhBw\dns\cmd{\rrhBw} +% & \textRubikBw\dns\cmd{\textRubikBw} \nonumber\\ +% \dnstrut\rrBwp\dns\cmd{\rrBwp} +% & \rrhBwp\dns\cmd{\rrhBwp} +% & \textRubikBwp\dns\cmd{\textRubikBwp} \nonumber\\ +% \dnstrut\rrBs\dns\cmd{\rrBs} +% & \rrhBs\dns\cmd{\rrhBs} +% & \textRubikBs\dns\cmd{\textRubikBs} \nonumber\\ +% \dnstrut\rrBsp\dns\cmd{\rrBsp} +% & \rrhBsp\dns\cmd{\rrhBsp} +% & \textRubikBsp\dns\cmd{\textRubikBsp} \nonumber\\ +% \dnstrut\rrBa\dns\cmd{\rrBa} +% & \rrhBa\dns\cmd{\rrhBa} +% & \textRubikBa\dns\cmd{\textRubikBa} \nonumber\\ +% \dnstrut\rrBap\dns\cmd{\rrBap} +% & \rrhBap\dns\cmd{\rrhBap} +% & \textRubikBap\dns\cmd{\textRubikBap} \nonumber\\ +% \end{supertabular} +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}} +% \dnstrut\rrSu\dns\cmd{\rrSu} +% & \rrhSu\dns\cmd{\rrhSu} +% & \textRubikSu\dns\cmd{\textRubikSu} \nonumber\\ +% \dnstrut\rrSup\dns\cmd{\rrSup} +% & \rrhSup\dns\cmd{\rrhSup} +% & \textRubikSup\dns\cmd{\textRubikSup} \nonumber\\ +% \dnstrut\rrSd\dns\cmd{\rrSd} +% & \rrhSd\dns\cmd{\rrhSd} +% & \textRubikSd\dns\cmd{\textRubikSd} \nonumber\\ +% \dnstrut\rrSdp\dns\cmd{\rrSdp} +% & \rrhSdp\dns\cmd{\rrhSdp} +% & \textRubikSdp\dns\cmd{\textRubikSdp} \nonumber\\ +% \dnstrut\rrSl\dns\cmd{\rrSl} +% & \rrhSl\dns\cmd{\rrhSl} +% & \textRubikSl\dns\cmd{\textRubikSl} \nonumber\\ +% \dnstrut\rrSlp\dns\cmd{\rrSlp} +% & \rrhSlp\dns\cmd{\rrhSlp} +% & \textRubikSlp\dns\cmd{\textRubikSlp} \nonumber\\ +% \dnstrut\rrSr\dns\cmd{\rrSr} +% & \rrhSr\dns\cmd{\rrhSr} +% & \textRubikSr\dns\cmd{\textRubikSr} \nonumber\\ +% \dnstrut\rrSrp\dns\cmd{\rrSrp} +% & \rrhSrp\dns\cmd{\rrhSrp} +% & \textRubikSrp\dns\cmd{\textRubikSrp} \nonumber\\ +% \dnstrut\rrSf\dns\cmd{\rrSf} +% & \rrhSf\dns\cmd{\rrhSf} +% & \textRubikSf\dns\cmd{\textRubikSf} \nonumber\\ +% \dnstrut\rrSfp\dns\cmd{\rrSfp} +% & \rrhSfp\dns\cmd{\rrhSfp} +% & \textRubikSfp\dns\cmd{\textRubikSfp} \nonumber\\ +% \dnstrut\rrSb\dns\cmd{\rrSb} +% & \rrhSb\dns\cmd{\rrhSb} +% & \textRubikSb\dns\cmd{\textRubikSb} \nonumber\\ +% \dnstrut\rrSbp\dns\cmd{\rrSbp} +% & \rrhSbp\dns\cmd{\rrhSbp} +% & \textRubikSbp\dns\cmd{\textRubikSbp} \nonumber\\ +% \end{supertabular} +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}} +% \dnstrut\rrE\dns\cmd{\rrE} +% & \rrhE\dns\cmd{\rrhE} +% & \textRubikE\dns\cmd{\textRubikE} \nonumber\\ +% \dnstrut\rrEp\dns\cmd{\rrEp} +% & \rrhEp\dns\cmd{\rrhEp} +% & \textRubikEp\dns\cmd{\textRubikEp} \nonumber\\ +% \dnstrut\rrM\dns\cmd{\rrM} +% & \rrhM\dns\cmd{\rrhM} +% & \textRubikM\dns\cmd{\textRubikM} \nonumber\\ +% \dnstrut\rrMp\dns\cmd{\rrMp} +% & \rrhMp\dns\cmd{\rrhMp} +% & \textRubikMp\dns\cmd{\textRubikMp} \nonumber\\ +% \dnstrut\rrS\dns\cmd{\rrS} +% & \rrhS\dns\cmd{\rrhS} +% & \textRubikS\dns\cmd{\textRubikS} \nonumber\\ +% \dnstrut\rrSp\dns\cmd{\rrSp} +% & \rrhSp\dns\cmd{\rrhSp} +% & \textRubikSp\dns\cmd{\textRubikSp} \nonumber\\ +% \end{supertabular} +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}} +% \dnstrut\rrx\dns\cmd{\rrx} +% & \rrhx\dns\cmd{\rrhx} +% & \Rubikx\dns\cmd{\Rubikx} \nonumber\\ +% \dnstrut\rrxp\dns\cmd{\rrxp} +% & \rrhxp\dns\cmd{\rrhxp} +% & \Rubikxp\dns\cmd{\Rubikxp} \nonumber\\ +% \dnstrut\rry\dns\cmd{\rry} +% & \rrhy\dns\cmd{\rrhy} +% & \Rubiky\dns\cmd{\Rubiky} \nonumber\\ +% \dnstrut\rryp\dns\cmd{\rryp} +% & \rrhyp\dns\cmd{\rrhyp} +% & \Rubikyp\dns\cmd{\Rubikyp} \nonumber\\ +% \dnstrut\rrz\dns\cmd{\rrz} +% & \rrhz\dns\cmd{\rrhz} +% & \Rubikz\dns\cmd{\Rubikz} \nonumber\\ +% \dnstrut\rrzp\dns\cmd{\rrzp} +% & \rrhzp\dns\cmd{\rrhzp} +% & \Rubikzp\dns\cmd{\Rubikzp} \nonumber\\ +% \end{supertabular} +% +% +% \begin{supertabular}[lll]{p{3cm} p{3cm} p{4cm}} +% \dnstrut\rru\dns\cmd{\rru} +% & \rrhu\dns\cmd{\rrhu} +% & \Rubiku\dns\cmd{\Rubiku} \nonumber\\ +% \dnstrut\rrd\dns\cmd{\rrd} +% & \rrhd\dns\cmd{\rrhd} +% & \Rubikd\dns\cmd{\Rubikd} \nonumber\\ +% \dnstrut\rrl\dns\cmd{\rrl} +% & \rrhl\dns\cmd{\rrhl} +% & \Rubikl\dns\cmd{\Rubikl} \nonumber\\ +% \dnstrut\rrr\dns\cmd{\rrr} +% & \rrhr\dns\cmd{\rrhr} +% & \Rubikr\dns\cmd{\Rubikr} \nonumber\\ +% \dnstrut\rrf\dns\cmd{\rrf} +% & \rrhf\dns\cmd{\rrhf} +% & \Rubikf\dns\cmd{\Rubikf} \nonumber\\ +% \dnstrut\rrb\dns\cmd{\rrb} +% & \rrhb\dns\cmd{\rrhb} +% & \Rubikb\dns\cmd{\Rubikb} \nonumber\\ +% \end{supertabular} +% +% +% +% \section{Colours} +% +% The \rubikcube\ package defines seven colours which are defined as follows: +% red~(R), orange~(O), yellow~(Y), green~(G), blue~(B), white~(W), +% and grey~(X). Now according to the following webpage\,\footnote{I thank Peter Bartal +% for pointing this out.} +% +% \medskip +% \noindent\texttt{http://The-Rubiks-Cube.deviantart.com/journal/Using-Official-Rubik} +% \newline\texttt{-s-Cube-Colors-268760351} +% +% \medskip +% {\noindent}the official Rubik cube colours are defined as +% \begin{quote} +%\begin{verbatim} +% .... colours which are red (PMS 200C*), green (PMS 347C*), +% blue (PMS 293C*), orange (PMS 021C*), yellow (PMS 012C*) +% and white. +% ..... +% Pantone colors can not be accurately converted to RGB colors, +% the colors the web runs on. But they can be approximated. +% Through some research, I have found some estimations which +% may help you which I have listed below. Remember, these are +% just approximate RGB equivalents to the official Rubik's Cube +% colors. +% +% Red: 200C #C41E3A (www.perbang.dk/rgb/c41e3a/) +% Green: 347C #009E60 (www.perbang.dk/rgb/009e60/) +% Blue: 293C #0051BA (www.perbang.dk/rgb/0051ba/) +% Orange: 021C "Pantone Orange" #FF5800 (www.perbang.dk/rgb/ff5800/) +% Yellow: 012C "Pantone Yellow" #FFD500 (www.perbang.dk/rgb/ffd500/) +% White: N/A #FFFFFF +% +% Red {HTML}{C41E3A} +% green {HTML}{009E60} +% Blue {HTML}{0051BA} +% Yellow {HTML}{FFD500} +% Orange {HTML}{FF5800} +% White {HTML}{FFFFFF} +%\end{verbatim} +% \end{quote} +% However, we have optimised these prescribed colours very slightly +% for screen \& print use (for example, the yellow was made very +% slightly brighter), and so the actual colours as used by +% the \rubikcube\ package are as follows: +% +% \begin{quote} +%\begin{verbatim} +% \definecolor{R}{HTML}{C41E33} +% \definecolor{G}{HTML}{00BE38} +% \definecolor{B}{HTML}{0051BA} +% \definecolor{Y}{HTML}{FFFF00} +% \colorlet{O}{orange} +% \colorlet{W}{white} +% \colorlet{X}{black!30}% +%\end{verbatim} +% \end{quote} +% Different colours can be allocated to the ROYGBWX letters (using the +% \cmd{\colorlet} command) as required. For example, the standard `red' +% colour could be allocated to the letter R using the command +% \begin{quote} +% \cmd{\colorlet\{R\}\{red\}} +% \end{quote} +% However, it is important to appreciate that the letter codes +% ROYGBWX are `hardwired' into many of the macros in the \rubikcube\ package, +% so don't change these. +% +% +% \section{Rubik face coordinates} +% \label{sec:coordinates} +% +% The coordinate origin of each view of the Rubik cube is located +% at the bottom left corner of the \textsc{front} face, as shown in +% Figure~\ref{fig:cubesquaregraph}. Note also that the bottom left +% corner of the cube itself is at $(-1,-1)$, +% and hence the default height and width of the cube is 4cm. +% +% \begin{figure}[hbt] +% \centering +% \ifpdf +% \includegraphics[height=3cm]{Rubik_doc_figB.pdf} +% \else +% \includegraphics[height=3cm]{Rubik_doc_figB.eps} +% \fi +% +% \parbox{9cm}{\caption{\label{fig:cubesquaregraph}Origin of coordinates +% is at the bottom left corner of the grey \textsc{front} face. +% The bottom left corner of the cube itself is at $(-1,-1)$, +% and hence the default height and width of the 3D-cube is 4cm.}} +% \end{figure} +% +% This is an important feature since knowing the location of the +% origin enables one to easily use any of the TikZ commands +% (eg~\cmd{\draw} and \cmd{\node} commands) to superimpose lines, +% arrows and text etc onto the Rubik cube (see Section~\ref{sec:arrows}). +% +% +% \subsection{Size of cube \cmd{\minipage}} +% +% Since the the default height and width of the 3D-cube is 4cm (see above), +% it follows that the width of the \cmd{\minipage} required for a cube in a TikZ +% picture environment can be easily calculated. For example, if the TikZ +% scale used is $0.5$, then the appropriate width of the required minipage +% is $0.5 \times 4\mbox{cm} = 2\mbox{cm}$. +% +% The default width of the semi-flat cube representation is 10cm, and that of the +% flat cube is 12cm. +% +% \section{Commands} +% +% All |rubikcube| commands assume a 3x3x3 cube by default. +% There are three primary command categories: \cmd{\Draw..} commands +% (which must be used \textit{inside} a TikZ picture environment), +% `parameter-allocation' commands (either inside or outside a TikZ environment), +% and commands which can be used in ordinary text (eg~rotation commands). +% +% A \cmd{\Draw..} command typesets +% either a Rubik cube, cubie or a layer using parameters set or defined via +% previous parameter-allocation commands (eg~face colours, dimensions etc). +% +% +% \subsection{Draw commands} +% +% \DescribeMacro{\DrawRubikCubeXY} +% \DescribeMacro{\DrawCubieXYxyz} +% These commands draw Rubik cubes and single cubies in one of four +% orientations as denoted by the terminal XY viewing-direction code RU (RightUp), +% RD (RightDown), LU (LeftUp), LD (LeftDown). For example, the command +% \begin{quote} +% \cmd{\DrawRubikCubeRU} +% \end{quote} +% will draw a Rubik cube as viewed from the RightUp direction, as +% shown in the following figure. +% +% \bigskip +% +% \begin{minipage}{2.8cm} +% \begin{tikzpicture}[scale=0.7] +% \DrawRubikCubeRU +% \end{tikzpicture} +% \end{minipage} +% \hspace{5mm} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.7] +% \DrawRubikCubeRU +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% \bigskip +% +% {\noindent}Note that in the above example all the cubies are displayed +% in the default grey colour, since no Face colours have been specified. +% +% Since \LaTeX\ commands have a maximum limit of only 9 parameters, +% it is necessary to use separate commands +% (`Face' and `Slice' commands---see below) in order to accommodate +% all 27 visible colours of a 3D~Rubik cube. +% +% Since a single cubie has only three visible faces we can include +% colour parameters in \cmd{\DrawCubie} commands. Consequently \cmd{\DrawCubie} +% commands have the format +% \begin{quote} +% \cmd{\DrawCubieXY\{x\}\{y\}\{z\}} +% \end{quote} +% where the XY pair denote the viewing direction as before, and +% the xyz denote the face colours associated with each of the three axes. +% +% For example, the command \cmd{\DrawCubieRU\{O\}\{Y\}\{G\}} draws a +% single cubie as viewed from the RightUp direction, +% with face colours Orange (x-axis), Yellow (y-axis), Green (z-axis), as follows. +% +% \bigskip +% +% \begin{minipage}{1.35cm} +% \begin{tikzpicture}[scale=1] +% \DrawCubieRU{O}{Y}{G} +% \end{tikzpicture} +% \end{minipage} +% \hspace{1cm} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=1] +% \DrawCubieRU{O}{Y}{G} +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% \bigskip +% +% +% +% \begin{figure}[hbt] +% \centering +% \ifpdf +% \includegraphics[height=4cm]{Rubik_doc_figC.pdf} +% \else +% \includegraphics[height=4cm]{Rubik_doc_figC.eps} +% \fi +% \vspace{-5mm}\caption{\label{fig:cubiedydx}Cubie dy dx parameters} +% \end{figure} +% +% \DescribeMacro{\Cubiedy} +% \DescribeMacro{\Cubiedx} +% Minor cubie configuration changes can be effected +% (within a TikZ picture environment) by adjusting the dy and dx +% values ($> 0$; no units) shown in Figure~\ref{fig:cubiedydx} +% via the two commands +% \begin{quote} +% \cmd{\Cubiedy\{\}} \\ +% \cmd{\Cubiedx\{\}} +% \end{quote} +% as shown in the folowing example. +% +% \bigskip +% +% \begin{minipage}{1.7cm} +% \begin{tikzpicture}[scale=1] +% \Cubiedy{0.4} +% \Cubiedx{0.8} +% \DrawCubieRU{O}{Y}{G} +% \end{tikzpicture} +% \end{minipage} +% \hspace{2cm} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=1] +% \Cubiedy{0.4} +% \Cubiedx{0.8} +% \DrawCubieRU{O}{Y}{G} +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% \bigskip +% +% {\noindent}Note that the \textsc{front} of the cubie is a unit square, +% and the graphic origin of the cubie image is at the bottom left corner of the +% \textsc{front} (see also the section on Arrows). +% The default values of dy and dx are 0.4. +% +% \medskip +% +% \DescribeMacro{\textCubieRU} +% \DescribeMacro{\textCubieRD} +% \DescribeMacro{\textCubieLU} +% \DescribeMacro{\textCubieLD} +% For convenience, there are also four (smaller) `text' versions \textCubieRU{O}{Y}{G} +% of the four \cmd{\DrawCubie} commands for +% use in ordinary text, as follows: +% \begin{quote} +% \textCubieRU{O}{Y}{G} \ \ |\textCubieRU{O}{Y}{G}| +% +% \medskip +% +% \textCubieRD{O}{Y}{G} \ \ |\textCubieRD{O}{Y}{G}| +% +% \medskip +% +% \textCubieLU{O}{Y}{G} \ \ |\textCubieLU{O}{Y}{G}| +% +% \medskip +% +% \textCubieLD{O}{Y}{G} \ \ |\textCubieLD{O}{Y}{G}| +% \end{quote} +% Note that the \cmd{\textCubieXY} commands are not influenced by the +% \cmd{\Cubiedy}, \cmd{\Cubiedx} commands as their size is preset for text use. +% +% Other \cmd{\Draw..} commands which we shall meet later are +% \texttt{DrawRubikLayerFace..}, \texttt{DrawRubikLayerSide..}, +% \texttt{DrawNCube..}, \texttt{DrawRubikFlat} and \texttt{DrawRubikCubeFlat}. +% +% +% \subsubsection{\cmd{\draw} error message} +% +% See also section~\ref{drawerrormessage} regarding the error message associated with +% using a \cmd{\Draw...} command \textit{outside} a TikZ picture environment. +% +% +% \subsection{Face commands} +% +% \DescribeMacro{\RubikFaceUp} +% \DescribeMacro{\RubikFaceDown} +% \DescribeMacro{\RubikFaceLeft} +% \DescribeMacro{\RubikFaceRight} +% \DescribeMacro{\RubikFaceFront} +% \DescribeMacro{\RubikFaceBack} +% These commands take nine colour arguments and allocate colours to the +% individual cubies of a Rubik cube face. +% The ordering is isomorphic to the sequence 1--9, i.e.,~numbering the small +% squares 1-3~(top row, left to right), 4-6~(middle row, left to right), +% 7-9~(bottom row, left to right), as follows: +% \begin{quote} +% \fbox{ +% \begin{minipage}{1.6cm} +% \#1 \#2 \#3 +% +% \#4 \#5 \#6 +% +% \#7 \#8 \#9 +% \end{minipage} +% } +% \end{quote} +% Conveniently, \LaTeX\ allows the colour arguments to be separated by spaces +% (e.g.,~separated in groups of three), or even spread across several +% lines (e.g.,~in a square block to resemble a 9-face) in order to +% make the command more visually intuitive, as in the following examples. +% \begin{quote} +%\begin{verbatim} +% \RubikFaceUp{G}{B}{G} {G}{W}{O} {G}{O}{G} +% +% \RubikFaceFront{O}{W}{R} +% {W}{W}{W} +% {G}{W}{G} +% +%\end{verbatim} +% \end{quote} +% +% \DescribeMacro{\RubikFaceUpAll} +% \DescribeMacro{\RubikFaceDownAll} +% \DescribeMacro{\RubikFaceLeftAll} +% \DescribeMacro{\RubikFaceRightAll} +% \DescribeMacro{\RubikFaceFrontAll} +% \DescribeMacro{\RubikFaceBackAll} +% For convenience, each of these commands has an associated +% `\textsc{all}' command which allocates the same colour to all the cubies +% on a 9-face, as follows (only a single colour argument is required): +% +% If you want a particular face to be \textsc{all} grey, then one can +% either omit the particular `Face' command (since the +% default colour is grey), or use a `Face' command specifying the +% colour-code~X; for example, \cmd{\RubikFaceUpAll\{X\}}. +% However, if you do use a Face command, then all of the command's +% colour arguments must be used, as otherwise you will generate a +% `missing parameter' error, and no colour will be +% allocated (i.e.,~you will see a black-hole). +% Use of these commands is shown in the following figure. +% +% \bigskip +% +% \begin{minipage}{2.8cm} +% \begin{tikzpicture}[scale=0.7] +% \RubikFaceUpAll{X} +% \RubikFaceRightAll{R} +% \RubikFaceFront{W}{Y}{G} +% {W}{Y}{G} +% {W}{Y}{G} +% \DrawRubikCubeRU +% \end{tikzpicture} +% \end{minipage} +% \hspace{5mm} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.7] +% \RubikFaceUpAll{X} +% \RubikFaceRightAll{R} +% \RubikFaceFront{W}{Y}{G} +% {W}{Y}{G} +% {W}{Y}{G} +% \DrawRubikCubeRU +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% +% \subsection{RubikCubeSolved command} +% +% \DescribeMacro{\RubikCubeSolved} +% This command sets all the face colours to that of a standard `solved' cube +% as shown in the following semi-flat image. +% This command is equivalent to the following set of face commands: +%\begin{verbatim} +% \RubikFaceUpAll{W}% +% \RubikFaceDownAll{Y}% +% \RubikFaceLeftAll{B}% +% \RubikFaceRightAll{G}% +% \RubikFaceFrontAll{O}% +% \RubikFaceBackAll{R}% +%\end{verbatim} +% +% \begin{tikzpicture}[scale=0.6] +% \RubikCubeSolved +% \DrawRubikCubeFlat +% \end{tikzpicture} +% +% Users can easily set their own alternative `solved' face/colour configuration by `renewing' +% this command as follows---remember to include the trailing \% (note that the colours +% ROYGBWX are currently hardwired so don't use a different set of uppercase letters). +%\begin{verbatim} +% \renewcommand{\RubikCubeSolved}{% +% \RubikFaceUpAll{..}% +% \RubikFaceDownAll{..}% +% \RubikFaceLeftAll{..}% +% \RubikFaceRightAll{..}% +% \RubikFaceFrontAll{..}% +% \RubikFaceBackAll{..}% +% } +%\end{verbatim} +% +% +% \subsection{Slice commands} +% +% \DescribeMacro{\RubikSliceTopX} +% \DescribeMacro{\RubikSliceEquatorX} +% \DescribeMacro{\RubikSliceBottomX} +% These three commands allocate the six visible cubie colours associated with a +% \textit{horizontal} slice of a Rubik cube. +% There are three pairs of Slice commands; one pair +% (Left view \& Right view) for each of the horizontal slices Top, Equator, Bottom. +% The six colour arguments associated with a given slice run in sequence +% from left to right irrespective of the viewpoint, eg \#1 \#2 \#3 \#4 \#5 \#6. +% +% Since the viewpoint of the Rubik cube (from the Right or from the Left) +% influences which face the colours are associated with, it is necessary +% to have the view (R or L) represented in the command name. +% +% The format of the `slice' command is shown in the following example. +% The Rubik cube is shown from the LeftDown (LD) view +% and consequently each of the `slice' commands in this +% particular example ends in L, consistent with +% the final \cmd{\DrawRubikCubeLD} command. +% +% \bigskip +% +% \begin{minipage}{2.8cm} +% \centering +% \begin{tikzpicture}[scale=0.7] +% \RubikFaceDownAll{Y} +% \RubikSliceTopL {G}{G}{G} {R}{R}{R} +% \RubikSliceEquatorL{R}{R}{R} {B}{B}{B} +% \RubikSliceBottomL {O}{O}{O} {G}{G}{G} +% \DrawRubikCubeLD +% \end{tikzpicture} +% \end{minipage} +% \hspace{5mm} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.7] +% \RubikFaceDownAll{Y} +% \RubikSliceTopL {G}{G}{G} {R}{R}{R} +% \RubikSliceEquatorL {R}{R}{R} {B}{B}{B} +% \RubikSliceBottomL {O}{O}{O} {G}{G}{G} +% \DrawRubikCubeLD +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% +% \subsection{LayerFace \& LayerSide commands} +% \label{sec:layerface} +% +% These commands are mainly intended for drawing final layer +% configurations (ie typically using the yellow face in the \textsc{up} position) +% with or without the associated side faces of the cubies of the top layer. +% +% \subsubsection{LayerFace} +% +% \DescribeMacro{\DrawRubikLayerFace} +% This LayerFace command draws a simple Rubik cube 3x3 face and allocates colours to the 9 cubies. +% The command takes nine ordered colour arguments. +% Their use is illustrated in the following example, which shows a yellow cross configuration. +% +% \bigskip +% +% \begin{minipage}{2.5cm} +% \centering +% \begin{tikzpicture}[scale=0.7] +% \DrawRubikLayerFace{X}{Y}{X} +% {Y}{Y}{Y} +% {X}{Y}{X} +% \end{tikzpicture} +% \end{minipage} +% \hspace{1cm} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.7] +% \DrawRubikLayerFace{X}{Y}{X} +% {Y}{Y}{Y} +% {X}{Y}{X} +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% \medskip +% +% \subsubsection{\cmd{\draw} error message} +% +% See also section~\ref{drawerrormessage} regarding the error message associated with +% using a \cmd{\Draw...} command \textit{outside} a TikZ picture environment. +% +% \medskip +% +% \subsubsection{LayerSide} +% +% \DescribeMacro{\DrawLayerSideXYp} +% LayerSide commands draw the associated side colours of +% the top layer as small rectangular sidebars. +% The LayerSide commands adopt a three-letter XYp \textbf{position} notation +% where the XY pair define the location (X:[Left \verb!|! Middle \verb!|! Right]; +% Y:[Top \verb!|! Equator \verb!|! Bottom]) of a particular cubie in the layer face. +% +% \begin{figure}[hbt] +% \centering +% \ifpdf +% \includegraphics[height=3cm]{Rubik_doc_figD.pdf} +% \else +% \includegraphics[height=3cm]{Rubik_doc_figD.eps} +% \fi +% \vspace{-5mm}\caption{\label{fig:facenotation}LayerSide letter-codes } +% \end{figure} +% +% Since corner cubies have two side faces, the `p' parameter +% (p:[x\verb!|!y]) is required to denote the directional `position' of +% the cubie side-face relative to the cubicle XY position +% (x indicates adjacent along the x-axis, and y indicates adjacent along the y-axis). +% Since edge cubies have only one side face, the `p' parameter is optional +% (for consistency), since it is not strictly necessary. +% +% \medskip\noindent\textbf{Commands}: \ +% Various different LayerSide commands are available: those for +% drawing a single colour side bar, and others for facilitating +% drawing all 12 side bars. +% For example, \textit{either} of the following commands +% +% \begin{quote} +%\begin{verbatim} +% \DrawRubikLayerSideLE{G} +% \DrawRubikLayerSideLEx{G} +%\end{verbatim} +% \end{quote} +% draws a single small vertical green rectangle +% \begin{tikzpicture}[scale=0.5] +% \DrawRubikLayerSideLEx{G} +% \end{tikzpicture} +% just to the left of the Left Equator (LE) square of the 9-face. +% The following commands draw all three side bars of a given side (Top, Bottom, Left, Right) +% \begin{quote} +%\begin{verbatim} +% \DrawRubikLayerSideT{}{}{} +% \DrawRubikLayerSideB{}{}{} +% \DrawRubikLayerSideL{}{}{} +% \DrawRubikLayerSideR{}{}{} +%\end{verbatim} +% \end{quote} +% where the T and B forms require the colour parameters to be in left-right +% horizontal order (eg, left, middle, right), +% while the L and R forms require the colour parameters to be in top-down +% vertical order (eg, top, equator, bottom). +% Note that this means that the colour parameters of the L and R commands +% can (if required) then be positioned intuitively (vertically) as follows: +% \begin{quote} +%\begin{verbatim} +% \DrawRubikLayerSideL{} +% {} +% {} +%\end{verbatim} +% \end{quote} +% Extending this idea, the L and R forms are combined in the LR command, +% which takes six colour arguments ordered in left-right pairs, +% \begin{quote} +%\begin{verbatim} +% \DrawRubikLayerSideLR{}{} {}{} {}{} +%\end{verbatim} +% \end{quote} +% so that they can also be written vertically as left-right pairs. +% Use of these commands is shown in the following two examples. +% +% \bigskip +% +% \begin{minipage}{2.5cm} +% \centering +% \begin{tikzpicture}[scale=0.7] +% +% +% \DrawRubikLayerFace{X}{Y}{X} +% {Y}{Y}{Y} +% {X}{Y}{X} +% +% \DrawRubikLayerSideLTy{B} +% \DrawRubikLayerSideLTx{O} +% \DrawRubikLayerSideLE{G} +% \DrawRubikLayerSideR{O} +% {B} +% {R} +% \DrawRubikLayerSideB{R}{G}{O} +% \node (LT) at (0.5, 2.5) [red]{\small\textsf{LT}}; +% \node (LE) at (0.5, 1.5) [red]{\small\textsf{LE}}; +% \end{tikzpicture} +% \end{minipage} +% \hspace{1cm} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.7] +% \DrawRubikLayerFace{X}{Y}{X} +% {Y}{Y}{Y} +% {X}{Y}{X} +% +% \DrawRubikLayerSideLTy{B} +% \DrawRubikLayerSideLTx{O} +% \DrawRubikLayerSideLE{G} +% +% \DrawRubikLayerSideR{O}{B}{R} +% \DrawRubikLayerSideB{R}{G}{O} +% +% \node (LT) at (0.5, 2.5) +% [red]{\small\textsf{LT}}; +% \node (LE) at (0.5, 1.5) +% [red]{\small\textsf{LE}}; +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% \bigskip +% +% \begin{minipage}{2.5cm} +% \centering +% \begin{tikzpicture}[scale=0.7] +% +% \DrawRubikLayerFace{G}{Y}{R} +% {Y}{Y}{Y} +% {B}{Y}{Y} +% +% \DrawRubikLayerSideT {Y}{B}{B} +% \DrawRubikLayerSideLR{R} {Y} +% {R} {O} +% {Y} {O} +% \DrawRubikLayerSideB {O}{G}{G} +% +% \end{tikzpicture} +% \end{minipage} +% \hspace{1cm} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.7] +% \DrawRubikLayerFace{G}{Y}{R} +% {Y}{Y}{Y} +% {B}{Y}{Y} +% +% \DrawRubikLayerSideT {Y}{B}{B} +% \DrawRubikLayerSideLR{R} {Y} +% {R} {O} +% {Y} {O} +% \DrawRubikLayerSideB {O}{G}{G} +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% \bigskip +% +% The default values (size) of the sidebars are as follows: +% width (0.3), length(1) and separation from the square face (0.3). +% Note that the default value of the length of a cubie side is 1. +% These sidebar values (decimal values $\geq 0$; no units) can be +% changed from their default values using the three commands. +% \begin{quote} +% \cmd{\RubikSideBarWidth\{\}}\\ +% \cmd{\RubikSideBarLength\{\}}\\ +% \cmd{\RubikSideBarSep\{\}} +% \end{quote} +% Values set in the document preamble will apply globally, while values +% set within a TikZ picture environment will apply only locally to that +% particular environment, as shown in the following example where we have +% set both the sidebar width and length to 0.7. +% +% \bigskip +% +% \begin{minipage}{2.5cm} +% \centering +% \begin{tikzpicture}[scale=0.7] +% +% +% \DrawRubikLayerFace{X}{Y}{X} +% {Y}{Y}{Y} +% {X}{Y}{X} +% +% \RubikSideBarWidth{0.7} +% \RubikSideBarLength{0.7} +% \DrawRubikLayerSideMTy{G} +% \end{tikzpicture} +% \end{minipage} +% \hspace{1cm} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.7] +% \DrawRubikLayerFace{X}{Y}{X} +% {Y}{Y}{Y} +% {X}{Y}{X} +% \RubikSideBarWidth{0.7} +% \RubikSideBarLength{0.7} +% \DrawRubikLayerSideMTy{G} +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% \bigskip +% +% Note also that changing the sidebar-width or sidebar-separation +% values may well also change the surrounding white-space (use \cmd{\fbox} +% to visualise this) and may therefore require some fine-tuning of the +% minipage width setting in order to optimise appearance. +% +% Since the \textsc{front} face drawn using the \cmd{\DrawRubikCube} command is +% identical with that drawn using the \cmd{\DrawLayerFace} command it +% follows that LayerSide commands can also be used in conjunction with +% the \textsc{front} face drawn using \cmd{\DrawRubikCube} command, as +% shown in the following example. +% +% \bigskip +% +% \begin{minipage}{2.5cm} +% \centering +% \begin{tikzpicture}[scale=0.7] +% \RubikFaceUp {X}{W}{X}% +% {W}{W}{W}% +% {X}{W}{X}% +% +% \RubikFaceFront{O}{O}{X}% +% {O}{O}{X}% +% {X}{X}{W}% +% +% \RubikFaceRight{X}{G}{G}% +% {X}{G}{G}% +% {G}{X}{X}% +% \DrawRubikCubeRU +% +% \DrawRubikLayerSideL{O}{B}{R} +% \DrawRubikLayerSideB{R}{G}{O} +% \end{tikzpicture} +% \end{minipage} +% \hspace{1cm} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.7] +% \RubikFaceUp {X}{W}{X}% +% {W}{W}{W}% +% {X}{W}{X}% +% +% \RubikFaceFront{O}{O}{X}% +% {O}{O}{X}% +% {X}{X}{W}% +% +% \RubikFaceRight{X}{G}{G}% +% {X}{G}{G}% +% {G}{X}{X}% +% \DrawRubikCubeRU +% +% \DrawRubikLayerSideL{O}{B}{R} +% \DrawRubikLayerSideB{R}{G}{O} +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% \bigskip +% +% {\noindent}Note that since using a left or a right \cmd{\DrawRubikLayerSide} +% command in conjunction with a \cmd{\DrawRubikCube} command will necessarily +% increase the width of the image, one may also have to adjust the width of +% the associated minipage. +% +% +% \subsection{Flat commands} +% \label{sec:flatcommands} +% +% \DescribeMacro{\DrawRubikFlat} +% \DescribeMacro{\DrawRubikCubeFlat} +% Flat commands are used to draw `flat' representations of the cube. +% The most standard format, which is generated by the command \cmd{\DrawRubikFlat}, +% is shown in the following example. +% +% \bigskip +% +% \begin{minipage}{0.4\textwidth} +% \centering +% \begin{tikzpicture}[scale=0.4] +% \RubikCubeSolved +% +% \DrawRubikFlat +% \node (U) at (1.5, 4.5) [black]{\small\textsf{U}}; +% \node (D) at (1.5, -1.5) [black]{\small\textsf{D}}; +% \node (L) at (-1.5, 1.5) [black]{\small\textsf{L}}; +% \node (R) at (4.5, 1.5) [black]{\small\textsf{R}}; +% \node (F) at (1.5, 1.5) [black]{\small\textsf{F}}; +% \node (B) at (7.5, 1.5) [black]{\small\textsf{B}}; +% \end{tikzpicture} +% \noindent\strut\hspace{5mm}\texttt{$\backslash$DrawRubikFlat} +% \end{minipage} +% \begin{minipage}{5cm} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.4] +% \RubikCubeSolved +% \DrawRubikFlat +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% \bigskip +% +% The addition of text (numbers or letters) in the faces is +% straightforward---the origin of the 1-unit grid is located at the +% bottom left corner of the front face (green here). +% The letters were placed using the following TikZ code: +% +%\begin{verbatim} +% \node (U) at (1.5, 4.5) [black]{\small\textsf{U}}; +% \node (D) at (1.5, -1.5) [black]{\small\textsf{D}}; +% \node (L) at (-1.5, 1.5) [black]{\small\textsf{L}}; +% \node (R) at (4.5, 1.5) [black]{\small\textsf{R}}; +% \node (F) at (1.5, 1.5) [black]{\small\textsf{F}}; +% \node (B) at (7.5, 1.5) [black]{\small\textsf{B}}; +%\end{verbatim} +% +% {\noindent}An interesting `semi-flat' alternative format uses the standard +% view of the cube and appends the three hidden sides +% (see Rokicki \textit{etal.}, 2013), which is generated by the +% command \cmd{\DrawRubikCubeFlat} as follows. +% +% \bigskip +% +% \begin{minipage}{5cm} +% \begin{tikzpicture}[scale=0.5] +% \RubikCubeSolved +% \DrawRubikCubeFlat +% \end{tikzpicture} +% \end{minipage} +% \begin{minipage}{5cm} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.5] +% \RubikCubeSolved +% \DrawRubikCubeFlat +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% \medskip +% +% \subsubsection{\cmd{\draw} error message} +% +% See also section~\ref{drawerrormessage} regarding the error message associated with +% using a \cmd{\Draw...} command \textit{outside} a TikZ picture environment. +% +% +% \section[NCube]{NCube (NxNxN)} +% \label{sec:NCube} +% +% \DescribeMacro{\DrawNCubeAll} +% An `NCube' is a solved NxNxN cube drawn from the RU direction; +% (ie.~only shows faces \textsc{up}, \textsc{front}, \textsc{right}). +% The cubie colours of each face are All the same. +% \begin{quote} +% \cmd{\DrawNCubeAll\{N\}\{Xcolour\}\{Ycolour\}\{Zcolour\}}. +% \end{quote} +% This command takes four ordered parameters (N, X, Y, Z)---the number +% (integer; $N>0$) of cubies along an edge, followed by three face +% colours in XYZ order. +% Since the viewpoint is only from the RU direction, the three colour +% parameters are: X(Right), Y(Up), Z(Front). +% +% \bigskip +% +% \begin{minipage}{0.4\textwidth} +% \begin{tikzpicture}[scale=0.5] +% \DrawNCubeAll{5}{O}{Y}{G} +% \end{tikzpicture} +% \end{minipage} +% \begin{minipage}{0.5\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.5] +% \DrawNCubeAll{5}{O}{Y}{G} +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% \medskip +% +% \subsubsection{\cmd{\draw} error message} +% +% See also section~\ref{drawerrormessage} regarding the error message associated with +% using a \cmd{\Draw...} command \textit{outside} a TikZ picture environment. +% +% +% \section{Arrows} +% \label{sec:arrows} +% +% The \rubikcube\ package does not offer any special commands for drawing +% arrows since it is straightforward just to include the appropriate TikZ +% `draw' commands in the \texttt{tikzpicture} environment. +% +% In order to facilitate using the standard TikZ `draw' commands both +% the RubikCubeFaceFront and LayerFace commands have the coordinate origin +% at the bottom left corner, and draw `faces' consisting of 9~unit-squares +% in a 3x3 grid, as shown in Figure~\ref{fig:facegraph}. +% Consequently the start and finish coordinates for any arrow or line are +% easy to determine. +% +% \begin{figure}[hbt] +% \centering +% \ifpdf +% \includegraphics[height=3cm]{Rubik_doc_figE.pdf} +% \else +% \includegraphics[height=3cm]{Rubik_doc_figE.eps} +% \fi +% \vspace{-5mm}\caption{\label{fig:facegraph}RubikCubeFaceFront and RubikLayerFace coordinates} +% \end{figure} +% +% Thus, to draw an `ultra thick' green arrow from the centre of cubie LB +% (say point A) to the centre of cubie ME +% (say point B)---see Figure~\ref{fig:facegraph}---we first determine +% the coordinates of $A$ \& $B$, namely $A (0.5, 0.5)$, $B (1.5, 1.5)$. +% Now, to draw the arrow from $A$ to $B$ we just include the following TikZ +% command in the \texttt{tikzpicture} environment. +% \begin{quote} +%\begin{verbatim} +% \draw[->,ultra thick,color=green] (0.5,0.5) -- (1.5, 1.5); +%\end{verbatim} +% \end{quote} +% The following example shows the cubie changes in the \textsc{up} face +% generated by the rotation sequence \rrF\rrR\rrU\rrRp\rrUp\rrFp. +% The magenta arrows indicate movement \textit{with} cubie rotations, +% while the black arrow indicates movement \textit{without} rotation. +% +% This example also highlights the fact that when there are several arrows, +% the start and end positions often need to be offset slightly away from cubie centres. +% +% \bigskip +% \noindent +% \begin{minipage}{2.5cm} +% \centering +% \begin{tikzpicture}[scale=0.7] +% +% \DrawRubikLayerFaceAll{W} +% +% \draw[->,thick,color=magenta] (1.5,0.5) -- (2.4, 1.4); +% \draw[->,thick] (2.5,1.5) -- (1.6, 2.4); +% \draw[->,thick,color=magenta] (1.3, 2.3) -- (1.3, 0.5); +% \draw[<->,thick,color=magenta] (0.5,2.6) -- (2.5, 2.6); +% \draw[<->,thick,color=magenta] (0.5,0.3) -- (2.5, 0.3); +% \end{tikzpicture} +% \end{minipage} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.7] +% \DrawRubikLayerFaceAll{W} +% \draw[->,thick,color=magenta] (1.5,0.5) -- (2.4, 1.4); +% \draw[->,thick] (2.5,1.5) -- (1.6, 2.4); +% \draw[->,thick,color=magenta] (1.3, 2.3) -- (1.3, 0.5); +% \draw[<->,thick,color=magenta] (0.5,2.6) -- (2.5, 2.6); +% \draw[<->,thick,color=magenta] (0.5,0.3) -- (2.5, 0.3); +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% \bigskip +% Since the coordinates shown in Figure~\ref{fig:facegraph} extend +% outwards in all directions, they can also be used as a guide for drawing +% arrows (or other structures) outside this 3x3 `face' square. This approach +% is shown in the following example, where we have changed the TikZ scale +% to~0.4 in order to generate a small figure, and also reduced the minipage +% width to minimise surrounding white-space, in order to facilitate placing the +% figure and the code side-by-side. +% +% \bigskip +% +% \noindent +% \begin{minipage}{1.8cm} +% \centering +% \begin{tikzpicture}[scale=0.4] +% +% \DrawRubikLayerFace{G}{Y}{R}% +% {Y}{Y}{Y}% +% {B}{Y}{Y}% +% +% \DrawRubikLayerSideT {Y}{B}{B} +% \DrawRubikLayerSideLR{R} {Y} +% {R} {O} +% {Y} {O} +% \DrawRubikLayerSideB {O}{G}{G} +% +% \draw[->,ultra thick,color=green] (0.5,5) -- (0.5, 4); +% \end{tikzpicture} +% \end{minipage} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{minipage}{1.8cm} +% \centering +% \begin{tikzpicture}[scale=0.4] +% \DrawRubikLayerFace{G}{Y}{R} +% {Y}{Y}{Y} +% {B}{Y}{Y} +% +% \DrawRubikLayerSideT {Y}{B}{B} +% \DrawRubikLayerSideLR{R} {Y} +% {R} {O} +% {Y} {O} +% \DrawRubikLayerSideB {O}{G}{G} +% \draw[->,ultra thick,color=green] (0.5,5) -- (0.5, 4); +% \end{tikzpicture} +% \end{minipage} +%\end{verbatim} +% \end{minipage} +% +% \bigskip +% +% {\noindent}The following example shows an arrow on the Rubik cube. +% The origin of coordinates is at the bottom left corner of the +% \textsc{front} face (see Section~\ref{sec:coordinates}). +% +% \bigskip +% \noindent +% \begin{minipage}{2.8cm} +% \centering +% \begin{tikzpicture}[scale=0.7] +% +% \RubikFaceFront{O}{O}{O} +% {O}{O}{X} +% {X}{O}{X} +% +% \RubikFaceRight{G}{G}{G} +% {X}{G}{G} +% {X}{X}{X} +% +% \RubikFaceDown {X}{G}{X} +% {X}{Y}{X} +% {X}{X}{X} +% +% \DrawRubikCubeRD +% \draw[ultra thick,->,color=blue] +% (1.5,0.5) -- (2.5, 1.5); +% \end{tikzpicture} +% \end{minipage} +% \hspace{1cm} +% \begin{minipage}{0.6\textwidth} +%\begin{verbatim} +% \begin{tikzpicture}[scale=0.7] +% +% \RubikFaceFront{O}{O}{O} +% {O}{O}{X} +% {X}{O}{X} +% +% \RubikFaceRight{G}{G}{G} +% {X}{G}{G} +% {X}{X}{X} +% +% \RubikFaceDown {X}{G}{X} +% {X}{Y}{X} +% {X}{X}{X} +% +% \DrawRubikCubeRD +% \draw[ultra thick,->,color=blue] +% (1.5,0.5) -- (2.5, 1.5); +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% +% +% +% \section{Final example} +% +% We now present, as a final example, the code used to draw the front page figure: +% +% \bigskip +% \hfil +% \begin{minipage}{2cm} +% \centering +% \begin{tikzpicture}[scale=0.4] +% \RubikCubeSolved +% \DrawRubikCubeRU +% \end{tikzpicture} +% \end{minipage} +% \begin{minipage}{2cm} +% \centering +% \begin{tikzpicture}[scale=0.4] +% \DrawRubikLayerFaceAll{W} +% \DrawRubikLayerSideT {R}{R}{R} +% \DrawRubikLayerSideLR{B} {G} +% {B} {G} +% {B} {G} +% \DrawRubikLayerSideB {O}{O}{O} +% \draw[thick,->,color=magenta] (1.5,0.5) -- (2.4, 1.4); +% \draw[thick,->] (2.5,1.5) -- (1.6, 2.4); +% \draw[thick,->,color=magenta] (1.3, 2.3) -- (1.3, 0.5); +% \draw[thick,<->, color=blue] (0.5,2.6) -- (2.5, 2.6); +% \draw[thick,<->, color=blue] (0.5,0.3) -- (2.5, 0.3); +% \end{tikzpicture} +% \end{minipage} +% \RubikF\RubikR\RubikU\RubikRp\RubikUp\RubikFp\ +% \ \ $\longrightarrow$ +% \begin{minipage}{2cm} +% \centering +% \begin{tikzpicture}[scale=0.4] +% \DrawRubikLayerFace{W}{W}{B} +% {W}{W}{O} +% {W}{R}{B} +% \DrawRubikLayerSideT {G}{G}{R} +% \DrawRubikLayerSideLR{R} {W} +% {B} {W} +% {O} {W} +% \DrawRubikLayerSideB {G}{W}{O} +% \end{tikzpicture} +% \end{minipage} +% \hfil +% +% \bigskip +% +%\begin{verbatim} +% \hfil +% \begin{minipage}{2cm} +% \centering +% \begin{tikzpicture}[scale=0.4] +% \RubikCubeSolved +% \DrawRubikCubeRU +% \end{tikzpicture} +% \end{minipage} +% \begin{minipage}{2cm} +% \centering +% \begin{tikzpicture}[scale=0.4] +% \DrawRubikLayerFaceAll{W} +% \DrawRubikLayerSideT {R}{R}{R} +% \DrawRubikLayerSideLR{B} {G} +% {B} {G} +% {B} {G} +% \DrawRubikLayerSideB {O}{O}{O} +% \draw[thick,->,color=magenta] (1.5,0.5) -- (2.4, 1.4); +% \draw[thick,->] (2.5,1.5) -- (1.6, 2.4); +% \draw[thick,->,color=magenta] (1.3, 2.3) -- (1.3, 0.5); +% \draw[thick,<->, color=blue] (0.5,2.6) -- (2.5, 2.6); +% \draw[thick,<->, color=blue] (0.5,0.3) -- (2.5, 0.3); +% \end{tikzpicture} +% \end{minipage} +% \RubikF\RubikR\RubikU\RubikRp\RubikUp\RubikFp\ +% \ \ $\longrightarrow$ +% \begin{minipage}{2cm} +% \centering +% \begin{tikzpicture}[scale=0.4] +% \DrawRubikLayerFace{W}{W}{B} +% {W}{W}{O} +% {W}{R}{B} +% \DrawRubikLayerSideT {G}{G}{R} +% \DrawRubikLayerSideLR{R} {W} +% {B} {W} +% {O} {W} +% \DrawRubikLayerSideB {G}{W}{O} +% \end{tikzpicture} +% \end{minipage} +% \hfil +%\end{verbatim} +% +% +% \section{Known issues \& shortcomings} +% +% Please contact the authors regarding any errors, shortcomings and ideas etc. +% +% \begin{itemize} +% +% \item The rotation hieroglyphs are optimised for a 10pt font, and do +% not scale with document font size. This may be implemented in the future, +% and will require careful mapping of the TikZ scale factor to font point +% size, or just replacing all length parameters by a multiple of \cmd{\em} or \cmd{\en} etc. +% At the moment it seems to work reasonably well with both 11pt and 12pt fonts. +% +% \item The sidebars can only be drawn in relation to either a Front face of a +% cube, or a LayerFace. +% +% \item The \textsc{front} face as drawn using the \cmd{\DrawNCubeAll} macro does +% not have its origin at the bottom left corner. Not regarded as a significant +% problem since this macros is really just a cosmetic fix/tool for drawing a +% neat NxNxN cube. +% +% \end{itemize} +% +% +% \section{Acknowledgements} +% +% We would like to thank Peter Bartal and Peter Grill for useful ideas and +% suggestions. We have built on some of the initial +% ideas of Bartal (2011), and have cited these instances in the code documentation. +% +% +% +% \section{Future supporting packages} +% +% Since Rubik-type cubes currently exist in a variety of sizes (from 2x2x2 to 11x11x11) +% it is possible that similar packages dealing with cubes of other sizes may be made in +% the future. Supporting tools may also be made +% using various programming languages, eg Lua etc. Consequently the naming of such +% packages and tools, and even the associated CTAN directories, needs to be given +% some thought in order to prevent possible confusion. +% We suggest, therefore, the following directory structure for CTAN might be appropriate. +% +% $$ +% \textsc{rubik} \left\{ +% \begin{array}{l} +% \mbox{rubiktools}\\ +% \mbox{rubik2x}\\ +% \mbox{rubik3x}\\ +% \ldots\\ +% \mbox{rubik11x}\\ +% \end{array} +% \right.\\ +% $$ +% +% \section{References} +% +% +% \begin{itemize} +% +% +% \item Bartal P (2011) +% +% \url{http://tex.stackexchange.com/questions/34482/} +% +% \item Chen JJ (2004). Group theory and the Rubik's cube. +% \url{http://www.math.harvard.edu/~jjchen/docs/Group_Theory_and_the_Rubik's_Cube.pdf} +% +% \item Demaine ED, Demaine ML, Eisenstat S, Lubiw A and Winslow A (2011). +% Algorithms for solving Rubik's cubes. +% \url{http://www.arxiv.org/abs/1106.5736/} +% +% \item Garfath-Cox, A (1981). \textit{The cube}, (Bolden Publishing Co., +% East Molesey, Surrey) pp.32. [copy in British Library] +% +% +% \item Duvoid T (2010). +% M\'{e}thode simple pour remonter le Rubik's cube. +% \newline\url{http://duvoid.fr/rubik/rubik-debutant-couleurs.pdf} +% \newline\url{http://duvoid.fr/rubik/sources/notation_en.eps} +% \newline\url{http://duvoid.fr/rubik/sources/rubik-debutant-couleurs.tex} +% +% \item Duvoid T (2011). +% M\'{e}thode avanc\'{e}e pour remonter le Rubik's cube. +% \newline\url{http://duvoid.fr/rubik/rubik-friddrich-couleurs.pdf} +% \newline\url{http://duvoid.fr/rubik/sources/rubik-friddrich-couleurs.tex} +% +% \item Fridrich J. \ \ \url{http://www.ws.binghamton.edu/fridrich/}. +% See the useful `notation' section on the `Pretty patterns' webpage at +% \url{http://www.ws.binghamton.edu/fridrich/ptrns.html}. +% +% \item Golomb SW (1982). Rubik's cube and quarks. \textit{American Scientist}; +% \underline{70}, pp.~257--259. + +% +% \item Gymrek M (2009). The mathematics of toys and games. +% \newline\url{http://wen.mit.edu/sp.268/www/rubik.pdf} +% +% \item Hofstadter D (1981). Rubik cube. \textit{Scientific American}; March issue. +% +% \item Hutchings M (2011). The mathematics of Rubik's cube (slide presentation). +% \url{http://math.berkeley.edu/~hutching/} +% +% +% \item Jelinek website (Jelinek J). Rubik's cube solution method. \url{http://rubikscube.info/} +% +% \item Joyner D (2008). \textit{Adventures in group theory: +% Rubik's cube, Merlin's machine and other mathematical toys}. +% \url{http://mike.verdone.ca/media/rubiks.pdf} +% +% +% \item Kriz J and Siegel P (2008). Rubik's cube-inspired puzzles demonstrate math's simple groups. +% \textit{Scientific American}; [? July 2008] +% +% +% \item Learntofish (2010). +% \url{http://learntofish.wordpress.com/2010/10/08/20-moves-suffice-to-solve-the-rubiks-cube/} +% +% \item Randelhofer website (Randelhofer W). Pretty patterns. +% \url{http://www.randelhofer.ch/rubik/patterns/U080.01.html} +% +% \item Reid M. \ \ \url{http://www.math.ucf.edu/~reid/Rubik/} +% +% +% \item Rokicki T, Kociemba H, Davidson M and Dethridge J (2013). The diameter of the +% Rubik's cube is twenty. \textit{SIAM.\ J.\ Discrete Math.}, \underline{27}, 1082--1105. +% (\url{http://tomas.rokicki.com/rubik20.pdf}) +% +% \item Rubik's cube. See Section on notation. +% \newline\url{http://en.wikipedia.org/wiki/Rubik's_Cube} +% +% \item Speedsolving website. \url{www.speedsolving.com/} +% +% \item Tran R (2005). A mathematical approach to solving Rubik's cube. +% \url{http://www.math.ubc.ca/~cass/courses/m308/projects/rtran/rtran.pdf} +% +% +% \item Treep A and Waterman M (1987). Marc Waterman's Algorithm, Part 2. +% \textit{Cubism For Fun 15}, p.~10 (Nederlandse Kubus Club) +% [cited from \textit{Wikipedia} (Rubik's cube)] + +% +% \item Vandenbergh L. \ \ \textsc{cubezone} (\url{http://www.cubezone.be}). +% +% \item WCA (2012). World Cube Association Regulations. See Section~12 for notation. +% \url{http://www.worldcubeassociation.org/regulations.htm} +% +% +% \end{itemize} +% +% +% +% ^^A ================================================== +% \StopEventually{\PrintIndex} +% +% +% +% \section{The code} +% +% The conventions we adopt regarding capital letters and the +% XYZ argument ordering are detailed in Section~\ref{sec:conventions}. +% +% +% \subsection{ Package heading} +% +% \begin{macrocode} +%<*rubikcube> +\def\RCfileversion{2.0}% +\def\RCfiledate{2014/01/20}% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{rubikcube}[\RCfiledate\space (v\RCfileversion)] +% \end{macrocode} +% The package requires TikZ +% \begin{macrocode} +\@ifpackageloaded{tikz}{}{% + \typeout{---rubikcube requires the TikZ package.}% + \RequirePackage{tikz}}% +% \end{macrocode} +% +% \begin{macro}{\rubikcube} +% First we create a suitable logo +% \begin{macrocode} +\newcommand{\rubikcube}{\textsf{rubikcube}}% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{ Some useful internal commands} +% +% \begin{macro}{\@rr} +% \begin{macro}{\@rrp} +% \begin{macro}{\@rrw} +% \begin{macro}{\@rrwp} +% \begin{macro}{\@rrs} +% \begin{macro}{\@rrsp} +% \begin{macro}{\@rra} +% \begin{macro}{\@rrap} +% \begin{macro}{\@xyzh} +% \begin{macro}{\@xyzhp} +% \begin{macro}{\@xyzRubik} +% \begin{macro}{\@xyzRubikp} +% \begin{macro}{\@SquareLetter} +% \begin{macro}{\@hRubik} +% Internal commands. These are used to generate the +% prime, w, w-prime, s, s-prime, a, a-prime +% rotation commands. The \cmd{\@xyz..} commands are used to generate the +% x,y,z,u,d,l,r,f,b, and their prime rotation commands. +% The \cmd{\@SquareLetter} command is used to form the separate square hieroglyph form +% used for rotations with no \textsc{front} representation +% (eg B.., Fs, Fsp, Fa, Fap, S, Sp, Sf, Sfp, Sb, Sbp). +% The \cmd{\@hRubik} is the vertical shift used to raise the box carying the rotation +% letter-code in \cmd{\Rubik..} commands not visible from the front. +% +% The idea is that by using these internal +% tools we will be able to more easily standardise the size and position +% of all the various glyphs. However, these internal tools are currently +% only partially implemented (= work in progress). +% \begin{macrocode} +\newcommand{\@rr}[1]{\textbf{\textsf{#1}}} +\newcommand{\@rrp}[1]{\textbf{\textsf{#1}$^\prime$}} +\newcommand{\@rrw}[1]{\textbf{\textsf{#1\footnotesize{w}}}} +\newcommand{\@rrwp}[1]{\textbf{\textsf{#1\footnotesize{w}}$^\prime$}} +\newcommand{\@rrs}[1]{\textbf{\textsf{#1\footnotesize{s}}}} +\newcommand{\@rrsp}[1]{\textbf{\textsf{#1\footnotesize{s}}$^\prime$}} +\newcommand{\@rra}[1]{\textbf{\textsf{#1\footnotesize{a}}}} +\newcommand{\@rrap}[1]{\textbf{\textsf{#1\footnotesize{a}}$^\prime$}} +\newcommand{\@xyzh}[1]{\textbf{[\textsf{#1}]}\,} +\newcommand{\@xyzhp}[1]{\textbf{[\textsf{#1}$^\prime$]}\,} +\newcommand{\@xyzRubik}[1]{\raisebox{3.45pt}{\textbf{[\textsf{#1}]}}} +\newcommand{\@xyzRubikp}[1]{\raisebox{3.45pt}{\textbf{[\textsf{#1}$^\prime$]}}} +\newcommand{\@SquareLetter}[1]{\setlength\fboxsep{2.5pt}\fboxrule=0.8pt% + \fbox{\rule[-1pt]{0pt}{8.5pt}\raisebox{-0.5pt}{#1}}} +\newlength\@hRubik% +\setlength{\@hRubik}{0.185cm}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsection{ Colours} +% +% These colour allocations were initially defined by Peter Bartal (2011). +% Now modified so that grey is defined as {black!30}. +% +% \begin{macrocode} +\definecolor{R}{HTML}{C41E33}% +\definecolor{G}{HTML}{00BE38}% +\definecolor{B}{HTML}{0051BA}% +\definecolor{Y}{HTML}{FFFF00}% +\colorlet{X}{black!30}% grey +\colorlet{O}{orange}% +\colorlet{W}{white}% +% \end{macrocode} +% +% \subsection{ Face commands} +% +% Cubeface notation = U,D,L,R,F,B (Singmaster) +% {\newline}Cubiesquare notation = t,b,l,r = top,bottom,left,right. +% Need to use t,b for cubiesquares to avoid confusion with cubeFace notation. +% Number the cubiesquares on a face 1-9, starting topleft, ending bottom right, as follows: +% {\newline}\strut\hspace{1cm}Up row \ \ \ \ \ (1,2,3) = tl, tm, tr +% {\newline}\strut\hspace{1cm}middle row (4,5,6) = ml, mm, mr +% {\newline}\strut\hspace{1cm}bottom row (7,8,9) = bl, bm, br +% +% \begin{macro}{\RubikFaceUp} +% \begin{macro}{\RubikFaceDown} +% \begin{macro}{\RubikFaceLeft} +% \begin{macro}{\RubikFaceRight} +% \begin{macro}{\RubikFaceFront} +% \begin{macro}{\RubikFaceBack} +% These 5 commands allocate a colour to each of the 9 cubiesquares in the +% specified face (Up, Down, Left, Right, Front, Back). Each command takes 9 arguments +% (colour codes) in the order 1--9 as specified above. +% +% {\noindent}For example, \cmd{\RubikFaceUp\{R\}\{O\}\{Y\} \{G\}\{B\}\{W\} \{X\}\{R\}\{G\}} +% +% +% {\noindent}Each of the 9 \cmd{\def\{\}} commands below allocates one colour +% to a specific cubiesquare, using a simple three-letter encoding. +% Each letter is an initial letter of the words Up, Down, Left, Right, Front, Back, +% left, middle, right, top, middle, bottom. +% For example in the command \cmd{\Urt\{\#1\}} +% the U stands for the Up face of the cube, while the \texttt{rt} stands +% for the ``right-top'' cubiesquare on this face. Note that the order +% of the two lowercase letters (in this case \texttt{rt}) are written +% in the $x,y$ order; ie the first of the two lowercase letters relates to the $x$ +% direction (either left, middle, or right), while the second lowercase letter +% relates to the $y$ direction (either top, middle, or bottom) +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macrocode} +\newcommand{\RubikFaceUp}[9]{% +\def\Ult{#1}\def\Umt{#2}\def\Urt{#3}% +\def\Ulm{#4}\def\Umm{#5}\def\Urm{#6}% +\def\Ulb{#7}\def\Umb{#8}\def\Urb{#9}% +} +\newcommand{\RubikFaceFront}[9]{% +\def\Flt{#1}\def\Fmt{#2}\def\Frt{#3}% +\def\Flm{#4}\def\Fmm{#5}\def\Frm{#6}% +\def\Flb{#7}\def\Fmb{#8}\def\Frb{#9}% +} +\newcommand{\RubikFaceRight}[9]{% +\def\Rlt{#1}\def\Rmt{#2}\def\Rrt{#3}% +\def\Rlm{#4}\def\Rmm{#5}\def\Rrm{#6}% +\def\Rlb{#7}\def\Rmb{#8}\def\Rrb{#9}% +} +\newcommand{\RubikFaceDown}[9]{% +\def\Dlt{#1}\def\Dmt{#2}\def\Drt{#3}% +\def\Dlm{#4}\def\Dmm{#5}\def\Drm{#6}% +\def\Dlb{#7}\def\Dmb{#8}\def\Drb{#9}% +} +\newcommand{\RubikFaceLeft}[9]{% +\def\Llt{#1}\def\Lmt{#2}\def\Lrt{#3}% +\def\Llm{#4}\def\Lmm{#5}\def\Lrm{#6}% +\def\Llb{#7}\def\Lmb{#8}\def\Lrb{#9}% +} +\newcommand{\RubikFaceBack}[9]{% +\def\Blt{#1}\def\Bmt{#2}\def\Brt{#3}% +\def\Blm{#4}\def\Bmm{#5}\def\Brm{#6}% +\def\Blb{#7}\def\Bmb{#8}\def\Brb{#9}% +} +% \end{macrocode} +% +% \begin{macro}{\RubikFaceUpAll} +% \begin{macro}{\RubikFaceDownAll} +% \begin{macro}{\RubikFaceLeftAll} +% \begin{macro}{\RubikFaceRightAll} +% \begin{macro}{\RubikFaceFrontAll} +% \begin{macro}{\RubikFaceBackAll} +% These 5 commands allocate the same colour to all 9 cubiesquares in the specified face (Up, Down, Left, Right, Front). Each command therefore takes only 1 argument (one of the colour codes). +% +% {\noindent}For example, \cmd{\RubikFaceUpAll\{R\}} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macrocode} +\newcommand{\RubikFaceUpAll}[1]{% +\def\Ult{#1}\def\Umt{#1}\def\Urt{#1}% +\def\Ulm{#1}\def\Umm{#1}\def\Urm{#1}% +\def\Ulb{#1}\def\Umb{#1}\def\Urb{#1}% +} +\newcommand{\RubikFaceFrontAll}[1]{% +\def\Flt{#1}\def\Fmt{#1}\def\Frt{#1}% +\def\Flm{#1}\def\Fmm{#1}\def\Frm{#1}% +\def\Flb{#1}\def\Fmb{#1}\def\Frb{#1}% +} +\newcommand{\RubikFaceRightAll}[1]{% +\def\Rlt{#1}\def\Rmt{#1}\def\Rrt{#1}% +\def\Rlm{#1}\def\Rmm{#1}\def\Rrm{#1}% +\def\Rlb{#1}\def\Rmb{#1}\def\Rrb{#1}% +} +\newcommand{\RubikFaceLeftAll}[1]{% +\def\Llt{#1}\def\Lmt{#1}\def\Lrt{#1}% +\def\Llm{#1}\def\Lmm{#1}\def\Lrm{#1}% +\def\Llb{#1}\def\Lmb{#1}\def\Lrb{#1}% +} +\newcommand{\RubikFaceDownAll}[1]{% +\def\Dlt{#1}\def\Dmt{#1}\def\Drt{#1}% +\def\Dlm{#1}\def\Dmm{#1}\def\Drm{#1}% +\def\Dlb{#1}\def\Dmb{#1}\def\Drb{#1}% +} +\newcommand{\RubikFaceBackAll}[1]{% +\def\Blt{#1}\def\Bmt{#1}\def\Brt{#1}% +\def\Blm{#1}\def\Bmm{#1}\def\Brm{#1}% +\def\Blb{#1}\def\Bmb{#1}\def\Brb{#1}% +} +% \end{macrocode} +% +% {\noindent}We now use these commands to initialise all visible faces to default colour grey (X) +% +% \begin{macrocode} +\RubikFaceUpAll{X}% +\RubikFaceDownAll{X}% +\RubikFaceLeftAll{X}% +\RubikFaceRightAll{X}% +\RubikFaceFrontAll{X}% +\RubikFaceBackAll{X}% +% \end{macrocode} +% +% +% \subsection{ RubikCubeSolved command} +% +% \begin{macro}{\RubikCubeSolved} +% This command sets the face/colour configuration (state) of a typical +% solved Rubik cube. +% \begin{macrocode} +\newcommand{\RubikCubeSolved}{% + \RubikFaceUpAll{W}% + \RubikFaceDownAll{Y}% + \RubikFaceLeftAll{B}% + \RubikFaceRightAll{G}% + \RubikFaceFrontAll{O}% + \RubikFaceBackAll{R}% +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{ Slice macros} +% +% \begin{macro}{\RubikSliceTopR} +% \begin{macro}{\RubikSliceTopL} +% \begin{macro}{\RubikSliceEquatorR} +% \begin{macro}{\RubikSliceEquatorL} +% \begin{macro}{\RubikSliceBottomR} +% \begin{macro}{\RubikSliceBottomL} +% These 6 commands allocate colours for the 6 visible ordered +% cubiesquares along the side of a horizontal slice +% ordered 1--6 from left to right. We require both L view +% and R view versions. +% \begin{macrocode} +\newcommand{\RubikSliceTopR}[6]{% +\def\Flt{#1}\def\Fmt{#2}\def\Frt{#3}% +\def\Rlt{#4}\def\Rmt{#5}\def\Rrt{#6}% +} +\newcommand{\RubikSliceTopL}[6]{% +\def\Llt{#1}\def\Lmt{#2}\def\Lrt{#3}% +\def\Flt{#4}\def\Fmt{#5}\def\Frt{#6}% +} +\newcommand{\RubikSliceEquatorR}[6]{% +\def\Flm{#1}\def\Fmm{#2}\def\Frm{#3}% +\def\Rlm{#4}\def\Rmm{#5}\def\Rrm{#6}% +} +\newcommand{\RubikSliceEquatorL}[6]{% +\def\Llm{#1}\def\Lmm{#2}\def\Lrm{#3}% +\def\Flm{#4}\def\Fmm{#5}\def\Frm{#6}% +} +\newcommand{\RubikSliceBottomR}[6]{% +\def\Flb{#1}\def\Fmb{#2}\def\Frb{#3}% +\def\Rlb{#4}\def\Rmb{#5}\def\Rrb{#6}% +} +\newcommand{\RubikSliceBottomL}[6]{% +\def\Llb{#1}\def\Lmb{#2}\def\Lrb{#3}% +\def\Flb{#4}\def\Fmb{#5}\def\Frb{#6}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsection{ Cube drawing macros} +% +% Since the three visible sides of a Rubik cube have up to 27 non-grey colours, +% and \TeX\ has only 9 macro parameters available, we are forced to draw +% Rubik cubes by first specifying the colours on each of the three faces, +% and then using a `DrawRubikCubeXY' command, where the trailing XY code +% defines the view direction (X = either R, L; Y = either U, D). +% The order of the XY code is important: X first, Y second. +% +% On each face the cubies are drawn in the following order: Top row +% (left to right), Middle row (left to right), Bottom row (left to right). +% +% The TikZ draw cycle for each cubie square on a Rubik cube face cycles +% through the four corners of the cubie in the following order: +% lb $\rightarrow$ lt $\rightarrow$ rt $\rightarrow$ rb; the code being lb (LeftBottom), +% lt (LeftTop), rt (RightTop), rb (RightBottom) +% (only need four coords) origin at bottom left of front face. +% +% \begin{macro}{\DrawRubikCubeFrontFace} +% This `FrontFace' command is an `internal' command which draws and paints +% all the cubiesquares on the front face of a cube. It is used by all +% of the cube drawing macros which display the front face. +% The 9 colours are allocated by an earlier \cmd{\RubikFaceFront} command. +% These Face macros are based, in part, on those of Peter Bartal (2011). +% \begin{macrocode} +\newcommand{\DrawRubikCubeFrontFace}{% +% ---top row left to right +\draw[line join=round,line cap=round,ultra thick,fill=\Flt]% +(0,2) -- (0, 3) -- (1,3) -- (1,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Fmt]% +(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Frt]% +(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle; +% -----middle row left to right +\draw[line join=round,line cap=round,ultra thick,fill=\Flm]% +(0,1) -- (0, 2) -- (1,2) -- (1,1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Fmm]% +(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Frm]% +(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle; +% ----bottom row left to right +\draw[line join=round,line cap=round,ultra thick,fill=\Flb]% +(0,0) -- (0, 1) -- (1,1) -- (1,0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Fmb]% +(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Frb]% +(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle; +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{ Viewing direction} +% +% The command `DrawRubikCubeXY' command uses a trailing XY code +% to specify the view direction (X = either R, L; Y = either U, D). +% The order of the XY code is important: X first, Y second (so its easy +% to remember). +% +% \begin{macro}{\DrawRubikCubeRU} +% This command draws and paints a Rubik cube as viewed from +% the Right Upper (RU) viewpoint. It starts by using the internal +% command \cmd{\DrawRubikCubeFrontFace} to draw the Front face, +% and then draws the Up face followed by the Right face. +% The colours are allocated by the last \cmd{\RubikFaceUp} +% and \cmd{\RubikFaceRight} commands. +% \end{macro} +% \begin{macrocode} +\newcommand{\DrawRubikCubeRU}{% +\DrawRubikCubeFrontFace %% frontface +%%-----------Up face---------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Ult]% +(0.66,3.66) -- (1,4) -- (2,4) -- (1.66,3.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Umt]% +(1.66,3.66) -- (2,4) -- (3,4) -- (2.66,3.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urt]% +(2.66,3.66) -- (3,4) -- (4,4) -- (3.66,3.66) -- cycle; +%%---middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Ulm]% +(0.33,3.33) -- (0.66,3.66) -- (1.66,3.66) -- (1.33,3.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Umm]% +(1.33,3.33) -- (1.66,3.66) -- (2.66,3.66) -- (2.33,3.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urm]% +(2.33,3.33) -- (2.66,3.66) -- (3.66,3.66) -- (3.33,3.33) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]% +(0,3) -- (0.33,3.33) -- (1.33,3.33) -- (1,3) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Umb]% +(1,3) -- (1.33,3.33) -- (2.33,3.33) -- (2,3) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urb]% +(2,3) -- (2.33,3.33) -- (3.33,3.33) -- (3,3) -- cycle; +%%-----------Right face---------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]% +(3,2) -- (3, 3) -- (3.33,3.33) -- (3.33,2.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rmt]% +(3.33,2.33) -- (3.33, 3.33) -- (3.66,3.66) -- (3.66,2.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]% +(3.66,2.66) -- (3.66, 3.66) -- (4,4) -- (4,3) -- cycle; +%%---middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlm]% +(3,1) -- (3, 2) -- (3.33,2.33) -- (3.33,1.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rmm]% +(3.33,1.33) -- (3.33, 2.33) -- (3.66,2.66) -- (3.66,1.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrm]% +(3.66,1.66) -- (3.66, 2.66) -- (4,3) -- (4,2) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]% +(3,0) -- (3, 1) -- (3.33,1.33) -- (3.33,0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rmb]% +(3.33,0.33) -- (3.33, 1.33) -- (3.66,1.66) -- (3.66,0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]% +(3.66,0.66) -- (3.66, 1.66) -- (4,2) -- (4,1) -- cycle; +} +% \end{macrocode} +% +% \begin{macro}{\DrawRubikCube} +% This command is equivalent to the previous \cmd{\DrawRubikCubeRU} +% and hence is the default form (ie if one omits the trailing XY +% viewpoint code). +% \end{macro} +% \begin{macrocode} +\newcommand{\DrawRubikCube}{\DrawRubikCubeRU} +% \end{macrocode} +% +% +% \begin{macro}{\DrawRubikCubeRD} +% This command draws and paints a Rubik cube as viewed from +% the Right Down (RD) viewpoint. +% \end{macro} +% \begin{macrocode} +\newcommand{\DrawRubikCubeRD}{% +\DrawRubikCubeFrontFace %% frontface +%%----------Right face-------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]% +(3,2) -- (3, 3) -- (3.33,2.66) -- (3.33,1.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rmt]% +(3.33,1.66) -- (3.33, 2.66) -- (3.66,2.33) -- (3.66,1.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]% +(3.66,1.33) -- (3.66, 2.33) -- (4,2) -- (4,1) -- cycle; +%%---middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlm]% +(3,1) -- (3, 2) -- (3.33,1.66) -- (3.33,0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rmm]% +(3.33,0.66) -- (3.33, 1.66) -- (3.66,1.33) -- (3.66,0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrm]% +(3.66,0.33) -- (3.66, 1.33) -- (4,1) -- (4,0) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]% +(3,0) -- (3, 1) -- (3.33,0.66) -- (3.33,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rmb]% +(3.33,-0.33) -- (3.33, 0.66) -- (3.66,0.33) -- (3.66,-0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]% +(3.66,-0.66) -- (3.66, 0.33) -- (4,0) -- (4,-1) -- cycle; +%%-----------Down face--------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]% +(0.33,-0.33) -- (0, 0) -- (1,0) -- (1.33,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Dmt]% +(1.33,-0.33) -- (1, 0) -- (2,0) -- (2.33,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drt]% +(2.33,-0.33) -- (2, 0) -- (3,0) -- (3.33,-0.33) -- cycle; +%%---middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlm]% +(0.66,-0.66) -- (0.33, -0.33) -- (1.33,-0.33) -- (1.66,-0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Dmm]% +(1.66,-0.66) -- (1.33, -0.33) -- (2.33,-0.33) -- (2.66,-0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drm]% +(2.66,-0.66) -- (2.33, -0.33) -- (3.33,-0.33) -- (3.66,-0.66) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]% +(1,-1) -- (0.66, -0.66) -- (1.66,-0.66) -- (2,-1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Dmb]% +(2,-1) -- (1.66, -0.66) -- (2.66,-0.66) -- (3,-1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drb]% +(3,-1) -- (2.66, -0.66) -- (3.66,-0.66) -- (4,-1) -- cycle; +} +% \end{macrocode} +% +% \begin{macro}{\DrawRubikCubeLD} +% This command draws and paints a Rubik cube as viewed from +% the Left Down (LD) viewpoint. +% \end{macro} +% \begin{macrocode} +\newcommand{\DrawRubikCubeLD}{% +\DrawRubikCubeFrontFace %% frontface +%%------------Left face-------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Llt]% +(-1,1) -- (-1, 2) -- (-0.66,2.33) -- (-0.66,1.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lmt]% +(-0.66,1.33) -- (-0.66, 2.33) -- (-0.33,2.66) -- (-0.33,1.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]% +(-0.33,1.66) -- (-0.33, 2.66) -- (0,3) -- (0,2) -- cycle; +%%---middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Llm]% +(-1,0) -- (-1, 1) -- (-0.66,1.33) -- (-0.66,0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lmm]% +(-0.66,0.33) -- (-0.66, 1.33) -- (-0.33,1.66) -- (-0.33,0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrm]% +(-0.33,0.66) -- (-0.33, 1.66) -- (0,2) -- (0,1) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Llb]% +(-1,-1) -- (-1, 0) -- (-0.66,0.33) -- (-0.66,-0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lmb]% +(-0.66,-0.66) -- (-0.66, 0.33) -- (-0.33,0.66) -- (-0.33,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]% +(-0.33,-0.33) -- (-0.33, 0.66) -- (0,1) -- (0,0) -- cycle; +%%------------Down face---------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]% +(-0.33,-0.33) -- (0, 0) -- (1,0) -- (0.66,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Dmt]% +(0.66,-0.33) -- (1, 0) -- (2,0) -- (1.66,-0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drt]% +(1.66,-0.33) -- (2, 0) -- (3,0) -- (2.66,-0.33) -- cycle; +%%---middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlm]% +(-0.66,-0.66) -- (-0.33, -0.33) -- (0.66,-0.33) -- (0.33,-0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Dmm]% +(0.33,-0.66) -- (0.66, -0.33) -- (1.66,-0.33) -- (1.33,-0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drm]% +(1.33,-0.66) -- (1.66, -0.33) -- (2.66,-0.33) -- (2.33,-0.66) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]% +(-1,-1) -- (-0.66, -0.66) -- (0.33,-0.66) -- (0,-1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Dmb]% +(0,-1) -- (0.33, -0.66) -- (1.33,-0.66) -- (1,-1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drb]% +(1,-1) -- (1.33, -0.66) -- (2.33,-0.66) -- (2,-1) -- cycle; +} +% \end{macrocode} +% +% +% \begin{macro}{\DrawRubikCubeLU} +% This command draws and paints a Rubik cube as viewed from +% the Left Up (LU) viewpoint. +% \end{macro} +% \begin{macrocode} +\newcommand{\DrawRubikCubeLU}{% +\DrawRubikCubeFrontFace %% frontface +%%-----------Left face----------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Llt]% +(-1,3) -- (-1, 4) -- (-0.66,3.66) -- (-0.66,2.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lmt]% +(-0.66,2.66) -- (-0.66, 3.66) -- (-0.33,3.33) -- (-0.33,2.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]% +(-0.33,2.33) -- (-0.33, 3.33) -- (0,3) -- (0,2) -- cycle; +%%---middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Llm]% +(-1,2) -- (-1, 3) -- (-0.66,2.66) -- (-0.66,1.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lmm]% +(-0.66,1.66) -- (-0.66, 2.66) -- (-0.33,2.33) -- (-0.33,1.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrm]% +(-0.33,1.33) -- (-0.33, 2.33) -- (0,2) -- (0,1) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Llb]% +(-1,1) -- (-1, 2) -- (-0.66,1.66) -- (-0.66,0.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lmb]% +(-0.66,0.66) -- (-0.66, 1.66) -- (-0.33,1.33) -- (-0.33,0.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]% +(-0.33,0.33) -- (-0.33, 1.33) -- (0,1) -- (0,0) -- cycle; +%%-----------Up face--------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Ult]% +(-0.66,3.66) -- (-1, 4) -- (0,4) -- (0.33,3.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Umt]% +(0.33,3.66) -- (0, 4) -- (1,4) -- (1.33,3.66) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urt]% +(1.33,3.66) -- (1, 4) -- (2,4) -- (2.33,3.66) -- cycle; +%%---middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Ulm]% +(-0.33,3.33) -- (-0.66, 3.66) -- (0.33,3.66) -- (0.66,3.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Umm]% +(0.66,3.33) -- (0.33, 3.66) -- (1.33,3.66) -- (1.66,3.33) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urm]% +(1.66,3.33) -- (1.33, 3.66) -- (2.33,3.66) -- (2.66,3.33) -- cycle; +%%---bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]% +(0,3) -- (-0.33, 3.33) -- (0.66,3.33) -- (1,3) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Umb]% +(1,3) -- (0.66, 3.33) -- (1.66,3.33) -- (2,3) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urb]% +(2,3) -- (1.66, 3.33) -- (2.66,3.33) -- (3,3) -- cycle;% +\ %%trailing space +} +% \end{macrocode} +% +% +% \subsection{ LayerFace commands} +% +% \begin{macro}{\DrawRubikLayerFace} +% \begin{macro}{\DrawRubikLayerFaceAll} +% [Nov 2, 2013] These two LayerFace commands draw and paint a single +% 9-cubie face. The first command takes 9 ordered colour parameters, +% (ordered in layers from top left to bottom right, so \texttt{\#1} +% is the placeholder for the colour of the TopLeft cubie etc.) +% The second takes only one colour parameter (since all the +% colours are the same). +% The drawing origin (0,0) = bottom left corner. Cubies are drawn +% from left to right. +% NOTE: this macro is SAME as the internal command +% \cmd{\DrawRubikCubeFrontFace} +% which is used for drawing the front face of a cube. +% \end{macro} +% \end{macro} +% \begin{macrocode} +\newcommand{\DrawRubikLayerFace}[9]{% +%%-----------FRONT face--------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=#1]% +(0,2) -- (0, 3) -- (1,3) -- (1,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=#2]% +(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=#3]% +(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle; +%%-----middle row +\draw[line join=round,line cap=round,ultra thick,fill=#4]% +(0,1) -- (0, 2) -- (1,2) -- (1,1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=#5]% +(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=#6]% +(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=#7]% +(0,0) -- (0, 1) -- (1,1) -- (1,0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=#8]% +(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=#9]% +(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle; +} +\newcommand{\DrawRubikLayerFaceAll}[1]{% +%%----------FRONT face----------- +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=#1]% +(0,2) -- (0, 3) -- (1,3) -- (1,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=#1]% +(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=#1]% +(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle; +%%-----middle row +\draw[line join=round,line cap=round,ultra thick,fill=#1]% +(0,1) -- (0, 2) -- (1,2) -- (1,1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=#1]% +(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=#1]% +(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=#1]% +(0,0) -- (0, 1) -- (1,1) -- (1,0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=#1]% +(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=#1]% +(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle; +} +% \end{macrocode} +% +% +% \subsection{ Flat commands} +% +% \begin{macro}{\FlatUp} +% \begin{macro}{\FlatDown} +% \begin{macro}{\FlatLeft} +% \begin{macro}{\FlatRight} +% \begin{macro}{\FlatFront} +% \begin{macro}{\FlatBack} +% Each of these six internal `Flat' commands draws a separate face. +% Each command (except \cmd{\FlatFront}) takes two arguments, +% namely an X-coordinate and Y-coordinate of the bottom left +% corner of the face. This (X,Y) pair allows the user to position +% the face. Note that the \cmd{\FlatFront} command takes no arguments, +% since by definition the bottom left corner of this face is (0,0). +% +% \textsc{example}: The following command positions the Up face so +% that its bottom left corner is located at (0,3): +% \begin{quote} +% \cmd{\FlatUp\{0\}\{3\}} +% \end{quote} +% These internal commands are used by the commands \cmd{\DrawRubikFlat} +% and \cmd{\DrawRubikCubeFlat} to draw various flat representations +% of a Rubik's cube. +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macrocode} +\newcommand{\FlatUp}[2]{% +\pgfmathsetmacro{\ux}{#1}% +\pgfmathsetmacro{\uy}{#2}% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Ult]% +(\ux + 0,\uy + 2) -- (\ux + 0,\uy + 3) -- (\ux + 1,\uy + 3)% + -- (\ux + 1,\uy + 2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Umt]% +(\ux + 1,\uy + 2) -- (\ux + 1,\uy + 3) -- (\ux + 2,\uy + 3)% + -- (\ux + 2,\uy + 2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urt]% +(\ux + 2,\uy + 2) -- (\ux + 2,\uy + 3) -- (\ux + 3,\uy + 3)% + -- (\ux + 3,\uy + 2) -- cycle; +%%-----middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Ulm]% +(\ux + 0,\uy + 1) -- (\ux + 0,\uy + 2) -- (\ux + 1,\uy + 2)% + -- (\ux + 1,\uy + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Umm]% +(\ux + 1,\uy + 1) -- (\ux + 1,\uy + 2) -- (\ux + 2,\uy + 2)% + -- (\ux + 2,\uy + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urm]% +(\ux + 2,\uy + 1) -- (\ux + 2,\uy + 2) -- (\ux + 3,\uy + 2)% + -- (\ux + 3,\uy + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Ulb]% +(\ux + 0,\uy + 0) -- (\ux + 0,\uy + 1) -- (\ux + 1,\uy + 1)% + -- (\ux + 1,\uy + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Umb]% +(\ux + 1,\uy + 0) -- (\ux + 1,\uy + 1) -- (\ux + 2,\uy + 1)% + -- (\ux + 2,\uy + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Urb]% +(\ux + 2,\uy + 0) -- (\ux + 2,\uy + 1) -- (\ux + 3,\uy + 1)% + -- (\ux + 3,\uy + 0) -- cycle; +} +%%------------------------- +\newcommand{\FlatDown}[2]{% +\pgfmathsetmacro{\ddx}{#1}% +\pgfmathsetmacro{\ddy}{#2}% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlt]% +(\ddx + 0,\ddy + 2) -- (\ddx + 0,\ddy + 3) -- (\ddx + 1,\ddy + 3)% + -- (\ddx + 1,\ddy + 2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Dmt]% +(\ddx + 1,\ddy + 2) -- (\ddx + 1,\ddy + 3) -- (\ddx + 2,\ddy + 3)% + -- (\ddx + 2,\ddy + 2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drt]% +(\ddx + 2,\ddy + 2) -- (\ddx + 2,\ddy + 3) -- (\ddx + 3,\ddy + 3)% + -- (\ddx + 3,\ddy + 2) -- cycle; +%%-----middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlm]% +(\ddx + 0,\ddy + 1) -- (\ddx + 0,\ddy + 2) -- (\ddx + 1,\ddy + 2)% + -- (\ddx + 1,\ddy + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Dmm]% +(\ddx + 1,\ddy + 1) -- (\ddx + 1,\ddy + 2) -- (\ddx + 2,\ddy + 2)% + -- (\ddx + 2,\ddy + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drm]% +(\ddx + 2,\ddy + 1) -- (\ddx + 2,\ddy + 2) -- (\ddx + 3,\ddy + 2)% + -- (\ddx + 3,\ddy + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Dlb]% +(\ddx + 0,\ddy + 0) -- (\ddx + 0,\ddy + 1) -- (\ddx + 1,\ddy + 1)% + -- (\ddx + 1,\ddy + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Dmb]% +(\ddx + 1,\ddy + 0) -- (\ddx + 1,\ddy + 1) -- (\ddx + 2,\ddy + 1)% + -- (\ddx + 2,\ddy + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Drb]% +(\ddx + 2,\ddy + 0) -- (\ddx + 2,\ddy + 1) -- (\ddx + 3,\ddy + 1)% + -- (\ddx + 3,\ddy + 0) -- cycle; +} +%%----------------------- +\newcommand{\FlatFront}{% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Flt]% +(0,2) -- (0, 3) -- (1,3) -- (1,2) -- cycle; +%% +\draw[line join=round,line cap=round,ultra thick,fill=\Fmt]% +(1,2) -- (1, 3) -- (2,3) -- (2,2) -- cycle; +%% +\draw[line join=round,line cap=round,ultra thick,fill=\Frt]% +(2,2) -- (2, 3) -- (3,3) -- (3,2) -- cycle; +%%-----middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Flm]% +(0,1) -- (0, 2) -- (1,2) -- (1,1) -- cycle; +%% +\draw[line join=round,line cap=round,ultra thick,fill=\Fmm]% +(1,1) -- (1, 2) -- (2,2) -- (2,1) -- cycle; +%% +\draw[line join=round,line cap=round,ultra thick,fill=\Frm]% +(2,1) -- (2, 2) -- (3,2) -- (3,1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Flb]% +(0,0) -- (0, 1) -- (1,1) -- (1,0) -- cycle; +%% +\draw[line join=round,line cap=round,ultra thick,fill=\Fmb]% +(1,0) -- (1, 1) -- (2,1) -- (2,0) -- cycle; +%% +\draw[line join=round,line cap=round,ultra thick,fill=\Frb]% +(2,0) -- (2, 1) -- (3,1) -- (3,0) -- cycle; +} +%%------------------------- +\newcommand{\FlatBack}[2]{% +\pgfmathsetmacro{\bx}{#1}% +\pgfmathsetmacro{\by}{#2}% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Blt]% +(\bx + 0,\by + 2) -- (\bx + 0,\by + 3) -- (\bx + 1,\by + 3)% + -- (\bx + 1,\by + 2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Bmt]% +(\bx + 1,\by + 2) -- (\bx + 1,\by + 3) -- (\bx + 2,\by + 3)% + -- (\bx + 2,\by + 2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Brt]% +(\bx + 2,\by + 2) -- (\bx + 2,\by + 3) -- (\bx + 3,\by + 3)% + -- (\bx + 3,\by + 2) -- cycle; +%%-----middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Blm]% +(\bx + 0,\by + 1) -- (\bx + 0,\by + 2) -- (\bx + 1,\by + 2)% + -- (\bx + 1,\by + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Bmm]% +(\bx + 1,\by + 1) -- (\bx + 1,\by + 2) -- (\bx + 2,\by + 2)% + -- (\bx + 2,\by + 1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Brm]% +(\bx + 2,\by + 1) -- (\bx + 2,\by + 2) -- (\bx + 3,\by + 2)% + -- (\bx + 3,\by + 1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Blb]% +(\bx + 0,\by + 0) -- (\bx + 0,\by + 1) -- (\bx + 1,\by + 1)% + -- (\bx + 1,\by + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Bmb]% +(\bx + 1,\by + 0) -- (\bx + 1,\by + 1) -- (\bx + 2,\by + 1)% + -- (\bx + 2,\by + 0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Brb]% +(\bx + 2,\by + 0) -- (\bx + 2,\by + 1) -- (\bx + 3,\by + 1)% + -- (\bx + 3,\by + 0) -- cycle; +} +%%------------------------- +\newcommand{\FlatLeft}[2]{% +\pgfmathsetmacro{\lx}{#1}% +\pgfmathsetmacro{\ly}{#2}% +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Llt]% +(\lx + 0,2) -- (\lx + 0, 3) -- (\lx + 1,3) -- (\lx + 1,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lmt]% +(\lx + 1,2) -- (\lx + 1, 3) -- (\lx + 2,3) -- (\lx + 2,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrt]% +(\lx + 2,2) -- (\lx + 2, 3) -- (\lx + 3,3) -- (\lx + 3,2) -- cycle; +%%-----middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Llm]% +(\lx + 0,1) -- (\lx + 0, 2) -- (\lx + 1,2) -- (\lx + 1,1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lmm]% +(\lx + 1,1) -- (\lx + 1, 2) -- (\lx + 2,2) -- (\lx + 2,1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrm]% +(\lx + 2,1) -- (\lx + 2, 2) -- (\lx + 3,2) -- (\lx + 3,1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Llb]% +(\lx + 0,0) -- (\lx + 0, 1) -- (\lx + 1,1) -- (\lx + 1,0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lmb]% +(\lx + 1,0) -- (\lx + 1, 1) -- (\lx + 2,1) -- (\lx + 2,0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Lrb]% +(\lx + 2,0) -- (\lx + 2, 1) -- (\lx + 3,1) -- (\lx + 3,0) -- cycle; +} +%%-------------------------- +\newcommand{\FlatRight}[2]{% +\pgfmathsetmacro{\rx}{#1}% %3 +\pgfmathsetmacro{\ry}{#2}% %0 +%%---top row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlt]% +(\rx + 0,2) -- (\rx + 0, 3) -- (\rx + 1,3) -- (\rx + 1,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rmt]% +(\rx + 1,2) -- (\rx + 1, 3) -- (\rx + 2,3) -- (\rx + 2,2) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrt]% +(\rx + 2,2) -- (\rx + 2, 3) -- (\rx + 3,3) -- (\rx + 3,2) -- cycle; +%%-----middle row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlm]% +(\rx + 0,1) -- (\rx + 0, 2) -- (\rx + 1,2) -- (\rx + 1,1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rmm]% +(\rx + 1,1) -- (\rx + 1, 2) -- (\rx + 2,2) -- (\rx + 2,1) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrm]% +(\rx + 2,1) -- (\rx + 2, 2) -- (\rx + 3,2) -- (\rx + 3,1) -- cycle; +%%----bottom row +\draw[line join=round,line cap=round,ultra thick,fill=\Rlb]% +(\rx + 0,0) -- (\rx + 0, 1) -- (\rx + 1,1) -- (\rx + 1,0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rmb]% +(\rx + 1,0) -- (\rx + 1, 1) -- (\rx + 2,1) -- (\rx + 2,0) -- cycle; +\draw[line join=round,line cap=round,ultra thick,fill=\Rrb]% +(\rx + 2,0) -- (\rx + 2, 1) -- (\rx + 3,1) -- (\rx + 3,0) -- cycle; +} +% \end{macrocode} +% +% \begin{macro}{\DrawRubikFlat} +% Draws a standard flat representation of the Rubik's +% cube (colours only) +% \begin{macrocode} +\newcommand{\DrawRubikFlat}{% + \FlatUp{0}{3}% + \FlatDown{0}{-3}% + \FlatLeft{-3}{0}% + \FlatFront% + \FlatRight{3}{0}% + \FlatBack{6}{0}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DrawRubikCubeFlat} +% Draws a Rubik's cube together with the three hidden faces +% (colours only) +% \begin{macrocode} +\newcommand{\DrawRubikCubeFlat}{% + \DrawRubikCube% + \FlatDown{0}{-3}% + \FlatLeft{-3}{0}% + \FlatBack{4}{1}% +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{ SideBar commands} +% +% SideBar commands draw narrow bars of colour indicating the +% side colours of each of the cubies forming the side of +% a given layer (face). +% +% \begin{macro}{\RubikSideBarWidth} +% \begin{macro}{\RubikSideBarLength} +% \begin{macro}{\RubikSideBarSep} +% These three commands allow the user to set the Width, Length +% and Separation parameters for the sidebar (in decimal values, +% where 1 is equivalent to the length of the side of a cubie). +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macrocode} +\newcommand{\RubikSideBarWidth}[1]{\pgfmathsetmacro{\bw}{#1}} +\newcommand{\RubikSideBarLength}[1]{\pgfmathsetmacro{\bl}{#1}} +\newcommand{\RubikSideBarSep}[1]{\pgfmathsetmacro{\bs}{#1}} +% \end{macrocode} +% We first set some default values +% \begin{macrocode} +\RubikSideBarWidth{0.3}% +\RubikSideBarLength{1}% +\RubikSideBarSep{0.3}% +% \end{macrocode} +% +% +% \subsubsection{ Allocating a colour to a single cubie sidebar} +% +% \begin{macro}{\side@barT} +% \begin{macro}{\side@barB} +% \begin{macro}{\side@barL} +% \begin{macro}{\side@barR} +% Internal commands. +% Full length face SideBars are really multiple instances of +% single cubie bars, +% each of which is drawn using one of four internal SideBar +% commands---one for each of the sides which we shall +% call Top, Bottom, Left, Right. +% Each SideBar command takes two arguments: one for cubie position +% \marg{$ 1 \mid 2 \mid 3$} and one for +% the colour-code \marg{$ R \mid O \mid Y \mid G \mid B \mid W \mid X $}. +% +% \textsc{example}: the following command allocates a colour to a single +% cubie sidebar on the Left of a Rubik face: +% \begin{quote} +% \cmd{\side@barL}\marg{cubie-position}\marg{colour-code} +% \end{quote} +% There are three cubie positions on each of the four sides +% of a face, and these +% are numbered 1 to 3 starting from the bottom left corner (1,1). +% The SideBar command also implements the set (or default) +% Length (\cmd{\bl}), Width (\cmd{\bw}) and Separation (\cmd{\bs}) +% values mentioned above. \cmd{\blh} = Half \cmd{\bl} = \cmd{\bl}/2. +% Note that the TikZ \cmd{\pgfmathsetmacro} commands (which do the maths) +% must be inside the TeX sidebar command in order to work. +% The start point of Draw command for each bar rectangle +% is botton Left corner of the bar =(\cmd{\dx},\cmd{\dy}) +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +\newcommand{\side@barL}[2]{% +%% #1 = cubie possn no, #2 = colour +\pgfmathsetmacro{\blh}{\bl*(0.5)}% +\pgfmathsetmacro{\dx}{0 - \bs - \bw}% +\pgfmathsetmacro{\dy}{#1-1+0.5-\blh}% +\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; +} +\newcommand{\side@barR}[2]{% +%% #1 = cubie possn no, #2 = colour +\pgfmathsetmacro{\blh}{\bl*(0.5)}% +\pgfmathsetmacro{\dx}{3 + \bs}% +\pgfmathsetmacro{\dy}{#1 -1+0.5-\blh}% +\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bl) + -- (\dx+\bw,\dy+\bl) -- (\dx+\bw,\dy) -- cycle; +} +\newcommand{\side@barT}[2]{% +%% #1 = cubie possn no, #2 = colour +\pgfmathsetmacro{\blh}{\bl*(0.5)}% +\pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}% +\pgfmathsetmacro{\dy}{3 +\bs}% +\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; +} +\newcommand{\side@barB}[2]{% +%% #1 = cubie possn no, #2 = colour +\pgfmathsetmacro{\blh}{\bl*(0.5)}% +\pgfmathsetmacro{\dx}{#1 -1+0.5-\blh}% +\pgfmathsetmacro{\dy}{0 -\bs-\bw}% +\draw[fill=#2] (\dx,\dy) -- (\dx,\dy + \bw) + -- (\dx+\bl,\dy+\bw) -- (\dx+\bl,\dy) -- cycle; +} +% \end{macrocode} +% +% +% \subsubsection{ Drawing a single cubie sidebar} +% +% \begin{macro}{\DrawRubikLayerSideX$_1$X$_2$X$_3$} +% This command draws the sidebars using the above \cmd{\sidebar} command. +% The X$_1$X$_2$X$_2$ parameters refer to the options Left, Middle, +% Right, Top, Equator, Bottom, x, y, as follows: +% \begin{quote} +% X$_1$ is an $x$ parameter: either $\langle L\mid M \mid R\rangle$ +% {\newline}X$_2$ is an $y$ parameter: either $\langle T\mid E \mid B\rangle$ +% {\newline}X$_3$ is an extra parameter: either $\langle x\mid y \rangle$, +% required by corner sidebars to indicate whether the sidebar was either +% above or below $\langle y \rangle$, or to the left or +% right $\langle x \rangle$ of the associated cubie. +% An $X_3$ parameter is not required for the sidebar of an edge cubie, since +% only one location is posible in these cases. +% \end{quote} +% For example, the following command +% \begin{quote} +% \cmd{\DrawRubikLayerSideLTy\{G\}} +% \end{quote} +% draws a Green sidebar above the Top Left cubie. +% \end{macro} +% +% \begin{macrocode} +%%---Left side +\newcommand{\DrawRubikLayerSideLTx}[1]{\side@barL{3}{#1}} +\newcommand{\DrawRubikLayerSideLEx}[1]{\side@barL{2}{#1}} +\newcommand{\DrawRubikLayerSideLE}[1]{\side@barL{2}{#1}} +\newcommand{\DrawRubikLayerSideLBx}[1]{\side@barL{1}{#1}} +%---Right side +\newcommand{\DrawRubikLayerSideRTx}[1]{\side@barR{3}{#1}} +\newcommand{\DrawRubikLayerSideREx}[1]{\side@barR{2}{#1}} +\newcommand{\DrawRubikLayerSideRE}[1]{\side@barR{2}{#1}} +\newcommand{\DrawRubikLayerSideRBx}[1]{\side@barR{1}{#1}} +%---Top side +\newcommand{\DrawRubikLayerSideLTy}[1]{\side@barT{1}{#1}} +\newcommand{\DrawRubikLayerSideMTy}[1]{\side@barT{2}{#1}} +\newcommand{\DrawRubikLayerSideMT}[1]{\side@barT{2}{#1}} +\newcommand{\DrawRubikLayerSideRTy}[1]{\side@barT{3}{#1}} +%---Bottom side +\newcommand{\DrawRubikLayerSideLBy}[1]{\side@barB{1}{#1}} +\newcommand{\DrawRubikLayerSideMBy}[1]{\side@barB{2}{#1}} +\newcommand{\DrawRubikLayerSideMB}[1]{\side@barB{2}{#1}} +\newcommand{\DrawRubikLayerSideRBy}[1]{\side@barB{3}{#1}} +% \end{macrocode} +% +% +% \subsubsection{ Drawing multiple cubie sidebars} +% +% \begin{macro}{\DrawRubikLayerSideT} +% \begin{macro}{\DrawRubikLayerSideB} +% \begin{macro}{\DrawRubikLayerSideL} +% \begin{macro}{\DrawRubikLayerSideR} +% These commands allow the drawing of 3 small sidebars along +% one particular side (Top, Bottom, Left, Right), as indicated +% by the appended T, B, L, R letter code. +% Each command takes three ordered colour arguments, which are ordered +% either from left to right (the T and B forms), or from top to bottom +% (the L and R forms) +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macrocode} +%%--Top side--- +\newcommand{\DrawRubikLayerSideT}[3]{% + \DrawRubikLayerSideLTy{#1}% + \DrawRubikLayerSideMTy{#2}% + \DrawRubikLayerSideRTy{#3}% +} +%%--Bottom side--- +\newcommand{\DrawRubikLayerSideB}[3]{% + \DrawRubikLayerSideLBy{#1}% + \DrawRubikLayerSideMBy{#2}% + \DrawRubikLayerSideRBy{#3}% +} +%%--Left side-------- +%% colours run vertically DOWN +\newcommand{\DrawRubikLayerSideL}[3]{% + \DrawRubikLayerSideLTx{#1}% + \DrawRubikLayerSideLEx{#2}% + \DrawRubikLayerSideLBx{#3}% +} +%%--Right side-------- +%% colours run vertically DOWN +\newcommand{\DrawRubikLayerSideR}[3]{% + \DrawRubikLayerSideRTx{#1}% + \DrawRubikLayerSideREx{#2}% + \DrawRubikLayerSideRBx{#3}% +} +% \end{macrocode} +% +% \begin{macro}{\DrawRubikLayerSideLR} +% This command draws six cubie sidebars, three on each side, drawn in (L, R) +% pairs. The command takes six colour arguments, ordered in pairs, +% as shown in the following example. +% \begin{quote} +%\begin{verbatim} +% \DrawRubikLayerSideLR{G} {G} +% {R} {B} +% {Y} {B} +%\end{verbatim} +% \end{quote} +% \begin{macrocode} +\newcommand{\DrawRubikLayerSideLR}[6]{% + \DrawRubikLayerSideLTx{#1}% + \DrawRubikLayerSideRTx{#2}% + \DrawRubikLayerSideLEx{#3}% + \DrawRubikLayerSideREx{#4}% + \DrawRubikLayerSideLBx{#5}% + \DrawRubikLayerSideRBx{#6}% +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{ NCube command} +% +% \textsc{history}: The essence of this command was originally developed by Peter Bartal +% as his command \cmd{\rubikcube} (see Bartal, +% 2011). We have modified it, as follows (June 2012): +% \newline\strut\hspace{\parindent}(1) adjusted to use the TikZ \cmd{\pgfmathsetmacro\{\}\{\}} command, +% \newline\strut\hspace{\parindent}(2) renamed to \cmd{\DrawNCubeAll}. +% +% \begin{macro}{\DrawNCubeAll} +% {\noindent}This command draws a solved NxNxN Rubik's cube from the RightUp viewpoint. +% All cubies on a given face have the same colour. +% The command takes four ordered arguments, as follows: +% \newline\strut\hspace{\parindent}\#1 = number of cubies ($n>0$) along each side, +% \newline\strut\hspace{\parindent}\#2, \#3, \#4 = colors of the visible faces (in X,Y,Z order); +% X=Right face colour, Y=Up face colour, Z=Front face colour. +% +% \begin{macrocode} +\newcommand{\DrawNCubeAll}[4]{% + \pgfmathsetmacro{\ncubes}{#1-1}% +%% need to subtract 1 from the given number of cubies per side +%% to avoid the origin of the initial cube to be displaced + \foreach \x in {0,...,\ncubes}{% + \foreach \y in {0,...,\ncubes}{% + \foreach \z in {0,...,\ncubes}{% + \cube@dxdydz{1}{#2}{#3}{#4}{\x}{\y}{\z}% + }}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\cube@dxdydz} +% This internal command is used only by the \cmd{\DrawNCubeAll} command. +% The original version of this command was developed by Peter Bartal (see Bartal, 2011). +% It was modified (2012) by RWD Nickalls (to implement a more +% intuitive X, Y, Z ordering of parameters), and also by Peter Grill (see below). +% +% The cube need not be in the origin, the distances of +% the Down-behind [L] corner from +% the origin are taken as parameters. +% The command takes 7 ordered arguments: +% \newline\strut\hspace{\parindent}1 - length of an edge +% \newline\strut\hspace{\parindent}2 - color of the X face (Right) (RWDN) +% \newline\strut\hspace{\parindent}3 - color of the Y face (Up) (RWDN) +% \newline\strut\hspace{\parindent}4 - color of the Z face (Front) (RWDN) +% \newline\strut\hspace{\parindent}5 - x-position in space +% \newline\strut\hspace{\parindent}6 - y-position in space +% \newline\strut\hspace{\parindent}7 - z-position in space +% +% \textsc{usage}: |\cube@dxdydz{1}{cX}{cY}{cZ}{x}{y}{z}| +% +% {\noindent}The original code +% |\pgfmathparse{#1+#5}\let\dy\pgfmathresult| +% {\newline} was changed to the more intuitive |\pgfmathsetmacro{\dx}{#1+#5}| +% (suggested by Peter Grill 2011). +% +% \textsc{changes}: RWD Nickalls (2012): +% (1) added the [line join=round,line cap=round] +% options to each of the TikZ `draw' commands, in order to improve +% the line joining (first two options); (2) adjusted the \cmd{\cube@dxdydz} macro +% to adopt the ordered XYZ face colour notation +% (by reassigning \#2, \#3, \#4). +% \begin{macrocode} +\newcommand{\cube@dxdydz}[7]{% + \pgfmathsetmacro{\dx}{#1+#5}% +%% calculates the 'displacement' (distance from the origin) of the +%% far corners of the cube along the x axis from the arguments + \pgfmathsetmacro{\dy}{#1+#6}% +%% calculates the 'displacement' (distance from the origin) of the +%% far corners of the cube along the y axis from the arguments + \pgfmathsetmacro{\dz}{#1+#7}% +%% calculates the 'displacement' (distance from the origin) of the +%% far corners of the cube along the z axis from the arguments +%% Draw FRONT face (using the X colour = #4) + \draw[line join=round,line cap=round,ultra thick,fill=#4]% + (#5,#6,\dz) -- (\dx,#6,\dz) -- (\dx,\dy,\dz) -- (#5,\dy,\dz) -- cycle; +%% The 'rectangle' command does not work with 3D coordinates, +%% so this is the way to draw the squres with space coordinates +%% Draw UP face (using the Y colour = #3) + \draw[line join=round,line cap=round,ultra thick,fill=#3]% + (#5,\dy,\dz) -- (\dx,\dy,\dz) -- (\dx,\dy,#7) -- (#5,\dy,#7) -- cycle; +%% Draw RIGHT face (using the X colour = #2) + \draw[line join=round,line cap=round,ultra thick,fill=#2]% + (\dx,#6,\dz) -- (\dx,#6,#7) -- (\dx,\dy,#7) -- (\dx,\dy,\dz) -- cycle; + } +% \end{macrocode} +% \end{macro} +% +% +% \subsection{ Drawing single cubies} +% +% \begin{macro}{\Cubiedx} +% \begin{macro}{\Cubiedy} +% These two commands set the value of the two length parameters +% \texttt{cx} and \texttt{cy}, and allow the user to vary the size +% (adjust \texttt{cy}) and horizontal viewpoint (adjust \texttt{cx}) +% of a single cubie (described in more detail in the \rubikcube\ +% package documentation). +% Note that we cannot use the names \texttt{dx}, \texttt{dy} since these have been +% used before (see above). However we use \texttt{dx}, \texttt{dy} in the command names +% since these will be more readily understood by the user. +% \begin{macrocode} +\newcommand{\Cubiedx}[1]{\pgfmathsetmacro{\cx}{#1}} +\newcommand{\Cubiedy}[1]{\pgfmathsetmacro{\cy}{#1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% We now set the default values (cx=cy=0.4) +% \begin{macrocode} +\Cubiedx{0.4} +\Cubiedy{0.4} +% \end{macrocode} +% +% +% \begin{macro}{\DrawCubieRU} +% \begin{macro}{\DrawCubieRD} +% \begin{macro}{\DrawCubieLU} +% \begin{macro}{\DrawCubieLD} +% These four commands draw a single cubie from the RightUp, RightDown, +% LeftUp, LeftDown viewpoint. The viewpoint is specified using an appended +% two-letter XY ordered viewpoint code: either RU, RD, LU, LD. +% These commands take three arguments, namely three different XYZ +% ordered colour codes (R,O,Y,G,B,W,X). +% \newline\textsc{format}: \cmd{\DrawCubieRU}\marg{colourX}\marg{colourY}\marg{colourZ} +% \newline\textsc{usage}: |\DrawCubieRU{G}{B}{W}| +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macrocode} +\newcommand{\DrawCubieRU}[3]{% +%% Front face (z) +\draw[line join=round,line cap=round,ultra thick,fill=#3]% + (0,0) -- (0, 1) -- (1, 1) -- (1,0) -- cycle; +%% Up face(y) +\draw[line join=round,line cap=round,ultra thick,fill=#2]% + (0,1) -- (\cx, 1+\cy) -- (1+\cx,1+\cy) -- (1,1) -- cycle; +%% Right face(x) +\draw[line join=round,line cap=round,ultra thick,fill=#1]% + (1,0) -- (1,1) -- (1+\cx,1+\cy) -- (1+\cx, \cy) -- cycle; +} +\newcommand{\DrawCubieRD}[3]{% +%% Front face (z) +\draw[line join=round,line cap=round,ultra thick,fill=#3]% + (0,0) -- (0, 1) -- (1, 1) -- (1,0) -- cycle; +%% Down face (y) +\draw[line join=round,line cap=round,ultra thick,fill=#2]% + (\cx,-\cy) -- (0, 0) -- (1,0) -- (1+\cx,-\cy) -- cycle; +%% Right face (x) +\draw[line join=round,line cap=round,ultra thick,fill=#1]% + (1,0) -- (1,1) -- (1+\cx,-\cy+1) -- (1+\cx, -\cy) -- cycle; +} +\newcommand{\DrawCubieLD}[3]{% +%% Front face (z) +\draw[line join=round,line cap=round,ultra thick,fill=#3]% + (0,0) -- (0, 1) -- (1, 1) -- (1,0) -- cycle; +%% Down face (y) +\draw[line join=round,line cap=round,ultra thick,fill=#2]% + (-\cx,-\cy) -- (0, 0) -- (1,0) -- (1-\cx,-\cy) -- cycle; +%% Left face (x) +\draw[line join=round,line cap=round,ultra thick,fill=#1]% + (-\cx,-\cy) -- (-\cx,-\cy+1) -- (0,1) -- (0,0) -- cycle; +} +\newcommand{\DrawCubieLU}[3]{% +%% Front face (z) +\draw[line join=round,line cap=round,ultra thick,fill=#3]% + (0,0) -- (0, 1) -- (1, 1) -- (1,0) -- cycle; +%% Up face (y) +\draw[line join=round,line cap=round,ultra thick,fill=#2]% + (-\cx,1+\cy) -- (1-\cx, 1+\cy) -- (1,1) -- (0,1) -- cycle; +%% Left face (x) +\draw[line join=round,line cap=round,ultra thick,fill=#1]% + (-\cx, \cy) -- (-\cx,\cy+1) -- (0,1) -- (0,0) -- cycle; +} +% \end{macrocode} +% +% +% \subsection{ Text cubies} +% +% \begin{macro}{\textCubieRU} +% \begin{macro}{\textCubieRD} +% \begin{macro}{\textCubieLU} +% \begin{macro}{\textCubieLD} +% These four commands draw a single `text' cubie from the RightUp, RightDown, +% LeftUp, LeftDown viewpoint. +% They are `text' forms of the DrawCubie' versions described above. +% Their size is scaled to be suitable for use with 10--12 point fonts. +% +% As before, the viewpoint is specified using an appended +% two-letter XY ordered viewpoint code: either RU, RD, LU, LD. +% These commands take three arguments, namely three different XYZ +% ordered colour codes (R,O,Y,G,B,W,X). +% \newline\textsc{format}: \cmd{\textCubieRU}\marg{colourX}\marg{colourY}\marg{colourZ} +% \newline\textsc{usage}: |\textCubieRU{G}{B}{W}| +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macrocode} +\newcommand{\textCubieRU}[3]{% +\begin{minipage}{0.66cm} +\centering +\begin{tikzpicture}[scale=0.5] +\Cubiedx{0.4}\Cubiedy{0.4} +\DrawCubieRU{#1}{#2}{#3} +\end{tikzpicture} +\end{minipage} +} +\newcommand{\textCubieRD}[3]{% +\begin{minipage}{0.66cm} +\centering +\begin{tikzpicture}[scale=0.5] +\Cubiedx{0.4}\Cubiedy{0.4} +\DrawCubieRD{#1}{#2}{#3} +\end{tikzpicture} +\end{minipage} +} +\newcommand{\textCubieLD}[3]{% +\begin{minipage}{0.66cm} +\centering +\begin{tikzpicture}[scale=0.5] +\Cubiedx{0.4}\Cubiedy{0.4} +\DrawCubieLD{#1}{#2}{#3} +\end{tikzpicture} +\end{minipage} +} +\newcommand{\textCubieLU}[3]{% +\begin{minipage}{0.66cm} +\centering +\begin{tikzpicture}[scale=0.5] +\Cubiedx{0.4}\Cubiedy{0.4} +\DrawCubieLU{#1}{#2}{#3} +\end{tikzpicture} +\end{minipage} +} +% \end{macrocode} +% +% +% \subsection{ Rotation commands --- face and slice} +% +% \textsc{notation}: We require a special notation to denote the +% various Rubik rotations (denoted +% by the stem rr). These rotations can be denoted either using a letter code +% say, \cmd{\rrR} for a Right face rotation, or by the equivalent hieroglyph +% denoted as \cmd{\rrhR} (Rubik rotation hieroglyph Right) etc. +% Commands such as \cmd{\RubikXXXX} typeset a pair of rr and rrh vertically. +% Commands such as \cmd{\textRubikXXXX} typeset the pair rr and rrh horizontally +% (ie a sort of `text' mode). +% +% The square hieroglyphs are built up in stages. We first create an internal +% command for drawing the square (\cmd{\DrawNotationBox}), and then draw the +% contents (lines, arrows, arcs of circles, and sometimes just text). +% (for the TikZ ARC command see TikZ pgfmanual2012 page p146 (\S 14.8)). +% +% The presence of small overfilled hboxes associated with these squares +% were originally checked using the ltugboat.cls, and all fixed mainly +% by setting the associated minipages $\rightarrow$ width = 0.6cm, +% and using TKZ scale=0.5. +% NOTE: do not use a trailing |%| after each |\end{tikzpicture}| +% as we actually need a small space to appear when used in text. +% +% +% \begin{macro}{\DrawNotationBox} +% This command draws the surrounding square box of all the hieroglyphs. +% Note that we start at (0,0) and draw to the final point +% in order to make a nice corner join. +% +% \begin{macrocode} +\newcommand{\DrawNotationBox}{% + \draw [thick] (0,0) -- (0,1) -- (1,1) -- (1,0) -- (0,0) -- (0,1)% +} +% \end{macrocode} +% \end{macro} +% +% We now define a number of points and line-segments inside the square +% (eg.; \cmd{\sd}, \cmd{\sh} \ldots\ etc.) which will be required +% for use in drawing the various lines and arrows. +% Some hieroglyphs contain either one circular arc, or two concentric arcs, +% and these arcs require both a center and a start point. +% +%\begin{macrocode} +\pgfmathsetmacro{\sd}{0.25} % horiz space +\pgfmathsetmacro{\sdd}{2*\sd} +\pgfmathsetmacro{\sddd}{3*\sd} +\pgfmathsetmacro{\sh}{0.6} % height +\pgfmathsetmacro{\sb}{0.2} % base +\pgfmathsetmacro{\sbh}{\sb + \sh} % UP +\pgfmathsetmacro{\scx}{\sdd+0.2} % Start of CircleX +\pgfmathsetmacro{\scy}{\sd*2/3} % Start of CircleY +\pgfmathsetmacro{\sqcx}{\scx-0.13} %% SQuare CenterX +\pgfmathsetmacro{\sqcy}{\scy+0.25} %% SQuare CenterY +% \end{macrocode} +% +% +% \subsubsection{ Rotation B} +% +% \begin{macro}{\rrB} +% \begin{macro}{\SquareB} +% \begin{macro}{\rrhB} +% \begin{macro}{\RubikB} +% \begin{macro}{\textRubikB} +% These commands all draw forms which denote the B rotation. +% Not visible from the front. +% \begin{macrocode} +\newcommand{\rrB}{\@rr{B}} +\newcommand{\SquareB}{\@SquareLetter{\rrB}} +\newcommand{\rrhB}{\raisebox{-0.25mm}{\SquareB}\,} +\newcommand{\RubikB}{\raisebox{\@hRubik}{\SquareB}\,} +\newcommand{\textRubikB}{\rrhB\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Bp} +% +% \begin{macro}{\rrBp} +% \begin{macro}{\SquareBp} +% \begin{macro}{\rrhBp} +% \begin{macro}{\RubikBp} +% \begin{macro}{\textRubikBp} +% These commands all draw forms which denote the Bp rotation. +% Not visible from the front. +% \begin{macrocode} +\newcommand{\rrBp}{\@rrp{B}} +\newcommand{\SquareBp}{\@SquareLetter{\rrBp}} +\newcommand{\rrhBp}{\raisebox{-0.25mm}{\SquareBp}\,} +\newcommand{\RubikBp}{\raisebox{\@hRubik}{\SquareBp}\,} +\newcommand{\textRubikBp}{\rrhBp\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Bw} +% +% \begin{macro}{\rrBw} +% \begin{macro}{\SquareBw} +% \begin{macro}{\rrhBw} +% \begin{macro}{\RubikBw} +% \begin{macro}{\textRubikBw} +% These commands all draw forms which denote the Bw rotation. +% Not visible from the front. +% \begin{macrocode} +%\newcommand{\rrBw}{\textbf{\textsf{Bw}}} +\newcommand{\rrBw}{\@rrw{B}} +\newcommand{\SquareBw}{\@SquareLetter{\rrBw}} +\newcommand{\rrhBw}{\raisebox{-0.25mm}{\SquareBw}\,} +\newcommand{\RubikBw}{\raisebox{\@hRubik}{\SquareBw}\,} +\newcommand{\textRubikBw}{\rrhBw\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Bwp} +% +% \begin{macro}{\rrBwp} +% \begin{macro}{\SquareBwp} +% \begin{macro}{\rrhBwp} +% \begin{macro}{\RubikBwp} +% \begin{macro}{\textRubikBwp} +% These commands all draw forms which denote the Bwp rotation. +% Not visible from the front. +% \begin{macrocode} +%\newcommand{\rrBwp}{\textbf{\textsf{Bwp}}} +\newcommand{\rrBwp}{\@rrwp{B}} +\newcommand{\SquareBwp}{\@SquareLetter{\rrBwp}} +\newcommand{\rrhBwp}{\raisebox{-0.25mm}{\SquareBwp}\,} +\newcommand{\RubikBwp}{\raisebox{\@hRubik}{\SquareBwp}\,} +\newcommand{\textRubikBwp}{\rrhBwp\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Bs} +% +% \begin{macro}{\rrBs} +% \begin{macro}{\SquareBs} +% \begin{macro}{\rrhBs} +% \begin{macro}{\RubikBs} +% \begin{macro}{\textRubikBs} +% These commands all draw forms which denote the Bs rotation. +% Not visible from the front. +% \begin{macrocode} +%\newcommand{\rrBs}{\textbf{\textsf{Bs}}} +\newcommand{\rrBs}{\@rrs{B}} +\newcommand{\SquareBs}{\@SquareLetter{\rrBs}} +\newcommand{\rrhBs}{\raisebox{-0.25mm}{\SquareBs}\,} +\newcommand{\RubikBs}{\raisebox{\@hRubik}{\SquareBs}\,} +\newcommand{\textRubikBs}{\rrhBs\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Bsp} +% +% \begin{macro}{\rrBsp} +% \begin{macro}{\SquareBsp} +% \begin{macro}{\rrhBsp} +% \begin{macro}{\RubikBsp} +% \begin{macro}{\textRubikBsp} +% These commands all draw forms which denote the Bsp rotation. +% Not visible from the front. +% \begin{macrocode} +%\newcommand{\rrBsp}{\textbf{\textsf{Bsp}}} +\newcommand{\rrBsp}{\@rrsp{B}} +\newcommand{\SquareBsp}{\@SquareLetter{\rrBsp}} +\newcommand{\rrhBsp}{\raisebox{-0.25mm}{\SquareBsp}\,} +\newcommand{\RubikBsp}{\raisebox{\@hRubik}{\SquareBsp}\,} +\newcommand{\textRubikBsp}{\rrhBsp\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Ba} +% +% \begin{macro}{\rrBa} +% \begin{macro}{\SquareBa} +% \begin{macro}{\rrhBa} +% \begin{macro}{\RubikBa} +% \begin{macro}{\textRubikBa} +% These commands all draw forms which denote the Ba rotation. +% Not visible from the front. +% \begin{macrocode} +%\newcommand{\rrBa}{\textbf{\textsf{Ba}}} +\newcommand{\rrBa}{\@rra{B}} +\newcommand{\SquareBa}{\@SquareLetter{\rrBa}} +\newcommand{\rrhBa}{\raisebox{-0.25mm}{\SquareBa}\,} +\newcommand{\RubikBa}{\raisebox{\@hRubik}{\SquareBa}\,} +\newcommand{\textRubikBa}{\rrhBa\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Bap} +% +% \begin{macro}{\rrBap} +% \begin{macro}{\SquareBap} +% \begin{macro}{\rrhBap} +% \begin{macro}{\RubikBap} +% \begin{macro}{\textRubikBap} +% These commands all draw forms which denote the Bap rotation. +% Not visible from the front. +% \begin{macrocode} +%\newcommand{\rrBap}{\textbf{\textsf{Bap}}} +\newcommand{\rrBap}{\@rrap{B}} +\newcommand{\SquareBap}{\@SquareLetter{\rrBap}} +\newcommand{\rrhBap}{\raisebox{-0.25mm}{\SquareBap}\,} +\newcommand{\RubikBap}{\raisebox{\@hRubik}{\SquareBap}\,} +\newcommand{\textRubikBap}{\rrhBap\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation D} +% +% \begin{macro}{\rrD} +% \begin{macro}{\SquareD} +% \begin{macro}{\rrhD} +% \begin{macro}{\RubikD} +% \begin{macro}{\textRubikD} +% These commands all draw forms which denote the D rotation. +% \begin{macrocode} +\newcommand{\rrD}{\textbf{\textsf{D}}} +%% +\newcommand{\SquareD}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick, ->] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}%% +} +\newcommand{\rrhD}{\raisebox{-0.333\height}{\SquareD}\,} +%% +\newcommand{\RubikD}{% +\begin{minipage}{0.6cm} +\centering +\SquareD\\ +\rrD +\end{minipage}% +} +\newcommand{\textRubikD}{\rrD\,\rrhD} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Dp} +% +% \begin{macro}{\rrDp} +% \begin{macro}{\SquareDp} +% \begin{macro}{\rrhDp} +% \begin{macro}{\RubikDp} +% \begin{macro}{\textRubikDp} +% These commands all draw forms which denote the Dp rotation. +% \begin{macrocode} +\newcommand{\rrDp}{\textbf{\textsf{D}$^\prime$}} +%% +\newcommand{\SquareDp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick, <-] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhDp}{\raisebox{-0.333\height}{\SquareDp}\,} +%% +\newcommand{\RubikDp}{% +\begin{minipage}{0.6cm} +\centering +\SquareDp\\ +\rrDp +\end{minipage}% +} +\newcommand{\textRubikDp}{\rrDp\,\rrhDp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Dw} +% +% \begin{macro}{\rrDw} +% \begin{macro}{\SquareDw} +% \begin{macro}{\rrhDw} +% \begin{macro}{\RubikDw} +% \begin{macro}{\textRubikDw} +% These commands all draw forms which denote the Dw rotation. +% \begin{macrocode} +\newcommand{\rrDw}{\textbf{\textsf{D\footnotesize{w}}}} +%% +\newcommand{\SquareDw}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick, ->] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick, ->] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhDw}{\raisebox{-0.333\height}{\SquareDw}\,} +%% +\newcommand{\RubikDw}{% +\begin{minipage}{0.6cm} +\centering +\SquareDw\\ +\rrDw +\end{minipage}% +} +\newcommand{\textRubikDw}{\rrDw\,\rrhDw} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Dwp} +% +% \begin{macro}{\rrDwp} +% \begin{macro}{\SquareDwp} +% \begin{macro}{\rrhDwp} +% \begin{macro}{\RubikDwp} +% \begin{macro}{\textRubikDwp} +% These commands all draw forms which denote the Dwp rotation. +% \begin{macrocode} +\newcommand{\rrDwp}{\textbf{\textsf{D\footnotesize{w}}$^\prime$}} +%% +\newcommand{\SquareDwp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick, <-] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick, <-] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhDwp}{\raisebox{-0.333\height}{\SquareDwp}\,} +%% +\newcommand{\RubikDwp}{% +\begin{minipage}{0.6cm} +\centering +\SquareDwp\\ +\rrDwp +\end{minipage}% +} +\newcommand{\textRubikDwp}{\rrDwp\,\rrhDwp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Ds} +% +% \begin{macro}{\rrDs} +% \begin{macro}{\SquareDs} +% \begin{macro}{\rrhDs} +% \begin{macro}{\RubikDs} +% \begin{macro}{\textRubikDs} +% These commands all draw forms which denote the Ds rotation. +% \begin{macrocode} +\newcommand{\rrDs}{\@rrs{D}} +%% +\newcommand{\SquareDs}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, ->] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick, ->] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhDs}{\raisebox{-0.333\height}{\SquareDs}\,} +%% +\newcommand{\RubikDs}{% +\begin{minipage}{0.6cm} +\centering +\SquareDs\\ +\rrDs +\end{minipage}% +} +\newcommand{\textRubikDs}{\rrDs\,\rrhDs} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Dsp} +% +% \begin{macro}{\rrDsp} +% \begin{macro}{\SquareDsp} +% \begin{macro}{\rrhDsp} +% \begin{macro}{\RubikDsp} +% \begin{macro}{\textRubikDsp} +% These commands all draw forms which denote the Dsp rotation. +% \begin{macrocode} +\newcommand{\rrDsp}{\@rrsp{D}} +%% +\newcommand{\SquareDsp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick, <-] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhDsp}{\raisebox{-0.333\height}{\SquareDsp}\,} +%% +\newcommand{\RubikDsp}{% +\begin{minipage}{0.6cm} +\centering +\SquareDsp\\ +\rrDsp +\end{minipage}% +} +\newcommand{\textRubikDsp}{\rrDsp\,\rrhDsp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Da} +% +% \begin{macro}{\rrDa} +% \begin{macro}{\SquareDa} +% \begin{macro}{\rrhDa} +% \begin{macro}{\RubikDa} +% \begin{macro}{\textRubikDa} +% These commands all draw forms which denote the Da rotation. +% \begin{macrocode} +\newcommand{\rrDa}{\@rra{D}} +%% +\newcommand{\SquareDa}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick, ->] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhDa}{\raisebox{-0.333\height}{\SquareDa}\,} +%% +\newcommand{\RubikDa}{% +\begin{minipage}{0.6cm} +\centering +\SquareDa\\ +\rrDa +\end{minipage}% +} +\newcommand{\textRubikDa}{\rrDa\,\rrhDa} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Dap} +% +% \begin{macro}{\rrDap} +% \begin{macro}{\SquareDap} +% \begin{macro}{\rrhDap} +% \begin{macro}{\RubikDap} +% \begin{macro}{\textRubikDap} +% These commands all draw forms which denote the Dap rotation. +% \begin{macrocode} +\newcommand{\rrDap}{\@rrap{D}} +%% +\newcommand{\SquareDap}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, ->] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick, <-] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhDap}{\raisebox{-0.333\height}{\SquareDap}\,} +%% +\newcommand{\RubikDap}{% +\begin{minipage}{0.6cm} +\centering +\SquareDap\\ +\rrDap +\end{minipage}% +} +\newcommand{\textRubikDap}{\rrDap\,\rrhDap} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation E} +% +% \begin{macro}{\rrE} +% \begin{macro}{\SquareE} +% \begin{macro}{\rrhE} +% \begin{macro}{\RubikE} +% \begin{macro}{\textRubikE} +% These commands all draw forms which denote the E rotation. +% \begin{macrocode} +\newcommand{\rrE}{\textbf{\textsf{E}}} +%% +\newcommand{\SquareE}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick, ->] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhE}{\raisebox{-0.333\height}{\SquareE}\,} +%% +\newcommand{\RubikE}{% +\begin{minipage}{0.6cm} +\centering +\SquareE\\ +\rrE +\end{minipage}% +} +\newcommand{\textRubikE}{\rrE\,\rrhE} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Ep} +% +% \begin{macro}{\rrEp} +% \begin{macro}{\SquareEp} +% \begin{macro}{\rrhEp} +% \begin{macro}{\RubikEp} +% \begin{macro}{\textRubikEp} +% These commands all draw forms which denote the Ep rotation. +% \begin{macrocode} +\newcommand{\rrEp}{\textbf{\textsf{E}$^\prime$}} +%% +\newcommand{\SquareEp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick, <-] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhEp}{\raisebox{-0.333\height}{\SquareEp}\,} +%% +\newcommand{\RubikEp}{% +\begin{minipage}{0.6cm} +\centering +\SquareEp\\ +\rrEp +\end{minipage}% +} +\newcommand{\textRubikEp}{\rrEp\,\rrhEp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation F} +% +% \begin{macro}{\rrF} +% \begin{macro}{\SquareF} +% \begin{macro}{\rrhF} +% \begin{macro}{\RubikF} +% \begin{macro}{\textRubikF} +% These commands all draw forms which denote the F rotation. +% \begin{macrocode} +\newcommand{\rrF}{\textbf{\textsf{F}}} +%% +\newcommand{\SquareF}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\scx, \scy) arc[radius=0.35, start angle=-60, delta angle=290]; +\end{tikzpicture}% +} +\newcommand{\rrhF}{\raisebox{-0.333\height}{\SquareF}\,} +%% +\newcommand{\RubikF}{% +\begin{minipage}{0.6cm} +\centering +\SquareF\\ +\rrF +\end{minipage}% +} +\newcommand{\textRubikF}{\rrF\,\rrhF} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Fp} +% +% \begin{macro}{\rrFp} +% \begin{macro}{\SquareFp} +% \begin{macro}{\rrhFp} +% \begin{macro}{\RubikFp} +% \begin{macro}{\textRubikFp} +% These commands all draw forms which denote the Fp rotation. +% \begin{macrocode} +\newcommand{\rrFp}{\textbf{\textsf{F}$^\prime$}} +%% +\newcommand{\SquareFp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, ->] (\scx, \scy) arc[radius=0.35, start angle=-60, delta angle=290]; +\end{tikzpicture}% +} +\newcommand{\rrhFp}{\raisebox{-0.333\height}{\SquareFp}\,} +%% +\newcommand{\RubikFp}{% +\begin{minipage}{0.6cm} +\centering +\SquareFp\\ +\rrFp +\end{minipage}% +} +\newcommand{\textRubikFp}{\rrFp\,\rrhFp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Fw} +% +% \begin{macro}{\rrFw} +% \begin{macro}{\SquareFw} +% \begin{macro}{\rrhFw} +% \begin{macro}{\RubikFw} +% \begin{macro}{\textRubikFw} +% These commands all draw forms which denote the Fw rotation. +% \begin{macrocode} +\newcommand{\rrFw}{\textbf{\textsf{F\footnotesize{w}}}} +%% +\newcommand{\SquareFw}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\scx, \scy) arc[radius=0.35, start angle=-60, delta angle=290]; +\draw [thick] (\sqcx,\sqcy) arc[radius=0.1, start angle=-60, delta angle=360]; +%\node (squareLab) at (0.5,0.5) {$o$}; +\end{tikzpicture}% +} +\newcommand{\rrhFw}{\raisebox{-0.333\height}{\SquareFw}\,} +%% +\newcommand{\RubikFw}{% +\begin{minipage}{0.6cm} +\centering +\SquareFw\\ +\rrFw +\end{minipage}% +} +\newcommand{\textRubikFw}{\rrFw\,\rrhFw} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Fwp} +% +% \begin{macro}{\rrFwp} +% \begin{macro}{\SquareFwp} +% \begin{macro}{\rrhFwp} +% \begin{macro}{\RubikFwp} +% \begin{macro}{\textRubikFwp} +% These commands all draw forms which denote the Fwp rotation. +% \begin{macrocode} +\newcommand{\rrFwp}{\textbf{\textsf{F\footnotesize{w}}$^\prime$}} +%% +\newcommand{\SquareFwp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, ->] (\scx, \scy) arc[radius=0.35, start angle=-60, delta angle=290]; +\draw [thick] (\sqcx,\sqcy) arc[radius=0.1, start angle=-60, delta angle=360]; +\end{tikzpicture}% +} +\newcommand{\rrhFwp}{\raisebox{-0.333\height}{\SquareFwp}\,} +%% +\newcommand{\RubikFwp}{% +\begin{minipage}{0.6cm} +\centering +\SquareFwp\\ +\rrFwp +\end{minipage}% +} +\newcommand{\textRubikFwp}{\rrFwp\,\rrhFwp} +%% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Fs} +% +% \begin{macro}{\rrFs} +% \begin{macro}{\rrhFs} +% \begin{macro}{\RubikFs} +% \begin{macro}{\textRubikFs} +% These commands draw forms of the Singmaster Fs slice rotation. +% We need to just make square with Fs in square; +% adjust box height using a \cmd{\rule}; +% adjust \cmd{\fboxsep} (default=3pt); +% adjust \cmd{\fboxrule} (default=0.4pt); +% bounded by \{\} so no need to reset to defaults. +% Not visible from the front. +% \begin{macrocode} +\newcommand{\rrFs}{\@rrs{F}} +\newcommand{\SquareFs}{\@SquareLetter{\rrFs}} +\newcommand{\rrhFs}{\raisebox{-0.25mm}{\SquareFs}\,} +\newcommand{\RubikFs}{\raisebox{\@hRubik}{\SquareFs}\,} +\newcommand{\textRubikFs}{\rrhFs\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Fsp} +% +% \begin{macro}{\rrFsp} +% \begin{macro}{\rrhFsp} +% \begin{macro}{\RubikFsp} +% \begin{macro}{\textRubikFsp} +% These commands draw forms of the Singmaster Fsp slice rotation. +% We need to just make square with Fsp in square; +% adjust box height using a \cmd{\rule}; +% adjust \cmd{\fboxsep} (default=3pt); +% adjust \cmd{\fboxrule} (default=0.4pt); +% bounded by \{\} so no need to reset to defaults. +% Not visible from the front. +% \begin{macrocode} +\newcommand{\rrFsp}{\@rrsp{F}} +\newcommand{\SquareFsp}{\@SquareLetter{\rrFsp}} +\newcommand{\rrhFsp}{\raisebox{-0.25mm}{\SquareFsp}\,} +\newcommand{\RubikFsp}{\raisebox{\@hRubik}{\SquareFsp}\,} +\newcommand{\textRubikFsp}{\rrhFsp\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Fa} +% +% \begin{macro}{\rrFa} +% \begin{macro}{\rrhFa} +% \begin{macro}{\RubikFa} +% \begin{macro}{\textRubikFa} +% These commands draw forms of the Singmaster Fa slice rotation. +% We need to just make square with Fa in square; +% adjust box height using a \cmd{\rule}; +% adjust \cmd{\fboxsep} (default=3pt); +% adjust \cmd{\fboxrule} (default=0.4pt); +% bounded by \{\} so no need to reset to defaults. +% Not visible from the front. +% \begin{macrocode} +\newcommand{\rrFa}{\@rra{F}} +\newcommand{\SquareFa}{\@SquareLetter{\rrFa}} +\newcommand{\rrhFa}{\raisebox{-0.25mm}{\SquareFa}\,} +\newcommand{\RubikFa}{\raisebox{\@hRubik}{\SquareFa}\,} +\newcommand{\textRubikFa}{\rrhFa\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Fap} +% +% \begin{macro}{\rrFap} +% \begin{macro}{\rrhFap} +% \begin{macro}{\RubikFap} +% \begin{macro}{\textRubikFap} +% These commands draw forms of the Singmaster Fap slice rotation. +% We need to just make square with Fap in square; +% adjust box height using a \cmd{\rule}; +% adjust \cmd{\fboxsep} (default=3pt); +% adjust \cmd{\fboxrule} (default=0.4pt); +% bounded by \{\} so no need to reset to defaults. +% Not visible from the front. +% \begin{macrocode} +\newcommand{\rrFap}{\@rrap{F}} +\newcommand{\SquareFap}{\@SquareLetter{\rrFap}} +\newcommand{\rrhFap}{\raisebox{-0.25mm}{\SquareFap}\,} +\newcommand{\RubikFap}{\raisebox{\@hRubik}{\SquareFap}\,} +\newcommand{\textRubikFap}{\rrhFap\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation L} +% +% \begin{macro}{\rrL} +% \begin{macro}{\SquareL} +% \begin{macro}{\rrhL} +% \begin{macro}{\RubikL} +% \begin{macro}{\textRubikL} +% These commands all draw forms which denote the L rotation. +% \begin{macrocode} +\newcommand{\rrL}{\textbf{\textsf{L}}} +%% +\newcommand{\SquareL}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\sd, \sb) -- (\sd, \sbh); +\draw [thick] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhL}{\raisebox{-0.333\height}{\SquareL}\,} +%% +\newcommand{\RubikL}{% +\begin{minipage}{0.6cm} +\centering +\SquareL\\ +\rrL +\end{minipage}% +} +\newcommand{\textRubikL}{\rrL\,\rrhL} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Lp} +% +% \begin{macro}{\rrLp} +% \begin{macro}{\SquareLp} +% \begin{macro}{\rrhLp} +% \begin{macro}{\RubikLp} +% \begin{macro}{\textRubikLp} +% These commands all draw forms which denote the Lp rotation. +% \begin{macrocode} +\newcommand{\rrLp}{\textbf{\textsf{L}$^\prime$}} +%% +\newcommand{\SquareLp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick,->] (\sd, \sb) -- (\sd, \sbh); +\draw [thick] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhLp}{\raisebox{-0.333\height}{\SquareLp}\,} +%% +\newcommand{\RubikLp}{% +\begin{minipage}{0.6cm} +\centering +\SquareLp\\ +\rrLp +\end{minipage}% +} +\newcommand{\textRubikLp}{\rrLp\,\rrhLp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Lw} +% +% \begin{macro}{\rrLw} +% \begin{macro}{\SquareLw} +% \begin{macro}{\rrhLw} +% \begin{macro}{\RubikLw} +% \begin{macro}{\textRubikLw} +% These commands all draw forms which denote the Lw rotation. +% \begin{macrocode} +\newcommand{\rrLw}{\textbf{\textsf{L\footnotesize{w}}}} +%% +\newcommand{\SquareLw}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\sd, \sb) -- (\sd, \sbh); +\draw [thick, <-] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhLw}{\raisebox{-0.333\height}{\SquareLw}\,} +%% +\newcommand{\RubikLw}{% +\begin{minipage}{0.6cm} +\centering +\SquareLw\\ +\rrLw +\end{minipage}% +} +\newcommand{\textRubikLw}{\rrLw\,\rrhLw} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Lwp} +% +% \begin{macro}{\rrLwp} +% \begin{macro}{\SquareLwp} +% \begin{macro}{\rrhLwp} +% \begin{macro}{\RubikLwp} +% \begin{macro}{\textRubikLwp} +% These commands all draw forms which denote the Lwp rotation. +% \begin{macrocode} +\newcommand{\rrLwp}{\textbf{\textsf{L\footnotesize{w}}$^\prime$}} +%% +\newcommand{\SquareLwp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick,->] (\sd, \sb) -- (\sd, \sbh); +\draw [thick,->] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhLwp}{\raisebox{-0.333\height}{\SquareLwp}\,} +%% +\newcommand{\RubikLwp}{% +\begin{minipage}{0.6cm} +\centering +\SquareLwp\\ +\rrLwp +\end{minipage}% +} +\newcommand{\textRubikLwp}{\rrLwp\,\rrhLwp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Ls} +% +% \begin{macro}{\rrLs} +% \begin{macro}{\SquareLs} +% \begin{macro}{\rrhLs} +% \begin{macro}{\RubikLs} +% \begin{macro}{\textRubikLs} +% These commands all draw forms which denote the Ls rotation. +% \begin{macrocode} +\newcommand{\rrLs}{\@rrs{L}} +%% +\newcommand{\SquareLs}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\sd, \sb) -- (\sd, \sbh); +\draw [thick] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick, <-] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhLs}{\raisebox{-0.333\height}{\SquareLs}\,} +%% +\newcommand{\RubikLs}{% +\begin{minipage}{0.6cm} +\centering +\SquareLs\\ +\rrLs +\end{minipage}% +} +\newcommand{\textRubikLs}{\rrLs\,\rrhLs} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Lsp} +% +% \begin{macro}{\rrLsp} +% \begin{macro}{\SquareLsp} +% \begin{macro}{\rrhLsp} +% \begin{macro}{\RubikLsp} +% \begin{macro}{\textRubikLsp} +% These commands all draw forms which denote the Lsp rotation. +% \begin{macrocode} +\newcommand{\rrLsp}{\@rrsp{L}} +%% +\newcommand{\SquareLsp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, ->] (\sd, \sb) -- (\sd, \sbh); +\draw [thick] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick, ->] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhLsp}{\raisebox{-0.333\height}{\SquareLsp}\,} +%% +\newcommand{\RubikLsp}{% +\begin{minipage}{0.6cm} +\centering +\SquareLsp\\ +\rrLsp +\end{minipage}% +} +\newcommand{\textRubikLsp}{\rrLsp\,\rrhLsp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation La} +% +% \begin{macro}{\rrLa} +% \begin{macro}{\SquareLa} +% \begin{macro}{\rrhLa} +% \begin{macro}{\RubikLa} +% \begin{macro}{\textRubikLa} +% These commands all draw forms which denote the La rotation. +% \begin{macrocode} +\newcommand{\rrLa}{\@rra{L}} +%% +\newcommand{\SquareLa}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\sd, \sb) -- (\sd, \sbh); +\draw [thick] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick, ->] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhLa}{\raisebox{-0.333\height}{\SquareLa}\,} +%% +\newcommand{\RubikLa}{% +\begin{minipage}{0.6cm} +\centering +\SquareLa\\ +\rrLa +\end{minipage}% +} +\newcommand{\textRubikLa}{\rrLa\,\rrhLa} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Lap} +% +% \begin{macro}{\rrLap} +% \begin{macro}{\SquareLap} +% \begin{macro}{\rrhLap} +% \begin{macro}{\RubikLap} +% \begin{macro}{\textRubikLap} +% These commands all draw forms which denote the Lap rotation. +% \begin{macrocode} +\newcommand{\rrLap}{\@rrap{L}} +%% +\newcommand{\SquareLap}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, ->] (\sd, \sb) -- (\sd, \sbh); +\draw [thick] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick, <-] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhLap}{\raisebox{-0.333\height}{\SquareLap}\,} +%% +\newcommand{\RubikLap}{% +\begin{minipage}{0.6cm} +\centering +\SquareLap\\ +\rrLap +\end{minipage}% +} +\newcommand{\textRubikLap}{\rrLap\,\rrhLap} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation M} +% +% \begin{macro}{\rrM} +% \begin{macro}{\SquareM} +% \begin{macro}{\rrhM} +% \begin{macro}{\RubikM} +% \begin{macro}{\textRubikM} +% These commands all draw forms which denote the M rotation. +% \begin{macrocode} +\newcommand{\rrM}{\textbf{\textsf{M}}} +%% +\newcommand{\SquareM}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\sd, \sb) -- (\sd, \sbh); +\draw [thick, <-] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhM}{\raisebox{-0.333\height}{\SquareM}\,} +%% +\newcommand{\RubikM}{% +\begin{minipage}{0.6cm} +\centering +\SquareM\\ +\rrM +\end{minipage}% +} +\newcommand{\textRubikM}{\rrM\,\rrhM} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Mp} +% +% \begin{macro}{\rrMp} +% \begin{macro}{\SquareMp} +% \begin{macro}{\rrhMp} +% \begin{macro}{\RubikMp} +% \begin{macro}{\textRubikMp} +% These commands all draw forms which denote the Mp rotation. +% \begin{macrocode} +\newcommand{\rrMp}{\textbf{\textsf{M}$^\prime$}} +%% +\newcommand{\SquareMp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\sd, \sb) -- (\sd, \sbh); +\draw [thick,->] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhMp}{\raisebox{-0.333\height}{\SquareMp}\,} +%% +\newcommand{\RubikMp}{% +\begin{minipage}{0.6cm} +\centering +\SquareMp\\ +\rrMp +\end{minipage}% +} +\newcommand{\textRubikMp}{\rrMp\,\rrhMp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation R} +% +% \begin{macro}{\rrR} +% \begin{macro}{\SquareR} +% \begin{macro}{\rrhR} +% \begin{macro}{\RubikR} +% \begin{macro}{\textRubikR} +% These commands all draw forms which denote the R rotation. +% \begin{macrocode} +\newcommand{\rrR}{\textbf{\textsf{R}}} +%% +\newcommand{\SquareR}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +%% draw three lines in the square, one with an arrow +\draw [thick] (\sd, \sb) -- (\sd, \sbh); +\draw [thick] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick, ->] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhR}{\raisebox{-0.333\height}{\SquareR}\,} +%% +\newcommand{\RubikR}{% +\begin{minipage}{0.6cm} +\centering +\SquareR\\ +\rrR +\end{minipage}% +} +\newcommand{\textRubikR}{\rrR\,\rrhR} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Rp} +% +% \begin{macro}{\rrRp} +% \begin{macro}{\SquareRp} +% \begin{macro}{\rrhRp} +% \begin{macro}{\RubikRp} +% \begin{macro}{\textRubikRp} +% These commands all draw forms which denote the Rp rotation. +% \begin{macrocode} +\newcommand{\rrRp}{\textbf{\textsf{R}$^\prime$}} +%% +\newcommand{\SquareRp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\sd, \sb) -- (\sd, \sbh); +\draw [thick] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick, <-] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhRp}{\raisebox{-0.333\height}{\SquareRp}\,} +%% +\newcommand{\RubikRp}{% +\begin{minipage}{0.6cm} +\centering +\SquareRp\\ +\rrRp +\end{minipage}% +} +\newcommand{\textRubikRp}{\rrRp\,\rrhRp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Rw} +% +% \begin{macro}{\rrRw} +% \begin{macro}{\SquareRw} +% \begin{macro}{\rrhRw} +% \begin{macro}{\RubikRw} +% \begin{macro}{\textRubikRw} +% These commands all draw forms which denote the Rw rotation. +% \begin{macrocode} +\newcommand{\rrRw}{\textbf{\textsf{R\footnotesize{w}}}} +%% +\newcommand{\SquareRw}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\sd, \sb) -- (\sd, \sbh); +\draw [thick, ->] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick, ->] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhRw}{\raisebox{-0.333\height}{\SquareRw}\,} +%% +\newcommand{\RubikRw}{% +\begin{minipage}{0.6cm} +\centering +\SquareRw\\ +\rrRw +\end{minipage}% +} +\newcommand{\textRubikRw}{\rrRw\,\rrhRw} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Rwp} +% +% \begin{macro}{\rrRwp} +% \begin{macro}{\SquareRwp} +% \begin{macro}{\rrhRwp} +% \begin{macro}{\RubikRwp} +% \begin{macro}{\textRubikRwp} +% These commands all draw forms which denote the Rwp rotation. +% \begin{macrocode} +\newcommand{\rrRwp}{\textbf{\textsf{R\footnotesize{w}}$^\prime$}} +%% +\newcommand{\SquareRwp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick] (\sd, \sb) -- (\sd, \sbh); +\draw [thick, <-] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick, <-] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhRwp}{\raisebox{-0.333\height}{\SquareRwp}\,} +%% +\newcommand{\RubikRwp}{% +\begin{minipage}{0.6cm} +\centering +\SquareRwp\\ +\rrRwp +\end{minipage}% +} +\newcommand{\textRubikRwp}{\rrRwp\,\rrhRwp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Rs} +% +% \begin{macro}{\rrRs} +% \begin{macro}{\SquareRs} +% \begin{macro}{\rrhRs} +% \begin{macro}{\RubikRs} +% \begin{macro}{\textRubikRs} +% These commands all draw forms which denote the Rs rotation. +% \begin{macrocode} +\newcommand{\rrRs}{\@rrs{R}} +%% +\newcommand{\SquareRs}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick,->] (\sd, \sb) -- (\sd, \sbh); +\draw [thick] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick,->] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhRs}{\raisebox{-0.333\height}{\SquareRs}\,} +%% +\newcommand{\RubikRs}{% +\begin{minipage}{0.6cm} +\centering +\SquareRs\\ +\rrRs +\end{minipage}% +} +\newcommand{\textRubikRs}{\rrRs\,\rrhRs} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Rsp} +% +% \begin{macro}{\rrRsp} +% \begin{macro}{\SquareRsp} +% \begin{macro}{\rrhRsp} +% \begin{macro}{\RubikRsp} +% \begin{macro}{\textRubikRsp} +% These commands all draw forms which denote the Rsp rotation. +% \begin{macrocode} +\newcommand{\rrRsp}{\@rrsp{R}} +%% +\newcommand{\SquareRsp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick,<-] (\sd, \sb) -- (\sd, \sbh); +\draw [thick] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick,<-] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhRsp}{\raisebox{-0.333\height}{\SquareRsp}\,} +%% +\newcommand{\RubikRsp}{% +\begin{minipage}{0.6cm} +\centering +\SquareRsp\\ +\rrRsp +\end{minipage}% +} +\newcommand{\textRubikRsp}{\rrRsp\,\rrhRsp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Ra} +% +% \begin{macro}{\rrRa} +% \begin{macro}{\SquareRa} +% \begin{macro}{\rrhRa} +% \begin{macro}{\RubikRa} +% \begin{macro}{\textRubikRa} +% These commands all draw forms which denote the Ra rotation. +% \begin{macrocode} +\newcommand{\rrRa}{\@rra{R}} +%% +\newcommand{\SquareRa}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick,<-] (\sd, \sb) -- (\sd, \sbh); +\draw [thick] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick,->] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhRa}{\raisebox{-0.333\height}{\SquareRa}\,} +%% +\newcommand{\RubikRa}{% +\begin{minipage}{0.6cm} +\centering +\SquareRa\\ +\rrRa +\end{minipage}% +} +\newcommand{\textRubikRa}{\rrRa\,\rrhRa} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Rap} +% +% \begin{macro}{\rrRap} +% \begin{macro}{\SquareRap} +% \begin{macro}{\rrhRap} +% \begin{macro}{\RubikRap} +% \begin{macro}{\textRubikRap} +% These commands all draw forms which denote the Rap rotation. +% \begin{macrocode} +\newcommand{\rrRap}{\@rrap{R}} +%% +\newcommand{\SquareRap}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick,->] (\sd, \sb) -- (\sd, \sbh); +\draw [thick] (\sdd,\sb) -- (\sdd, \sbh); +\draw [thick,<-] (\sddd, \sb) -- (\sddd, \sbh); +\end{tikzpicture}% +} +\newcommand{\rrhRap}{\raisebox{-0.333\height}{\SquareRap}\,} +%% +\newcommand{\RubikRap}{% +\begin{minipage}{0.6cm} +\centering +\SquareRap\\ +\rrRap +\end{minipage}% +} +\newcommand{\textRubikRap}{\rrRap\,\rrhRap} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation S} +% +% \begin{macro}{\rrS} +% \begin{macro}{\SquareS} +% \begin{macro}{\rrhS} +% \begin{macro}{\RubikS} +% \begin{macro}{\textRubikS} +% These commands all draw forms which denote the S rotation. +% Not visible from the front. +% \begin{macrocode} +\newcommand{\rrS}{\@rr{S}} +\newcommand{\SquareS}{\@SquareLetter{\rrS}} +\newcommand{\rrhS}{\raisebox{-0.25mm}{\SquareS}\,} +\newcommand{\RubikS}{\raisebox{\@hRubik}{\SquareS}\,} +\newcommand{\textRubikS}{\rrhS\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Sp} +% +% \begin{macro}{\rrSp} +% \begin{macro}{\SquareSp} +% \begin{macro}{\rrhSp} +% \begin{macro}{\RubikSp} +% \begin{macro}{\textRubikSp} +% These commands all draw forms which denote the Sp rotation. +% Not visible from the front. +% \begin{macrocode} +\newcommand{\rrSp}{\@rrp{S}} +\newcommand{\SquareSp}{\@SquareLetter{\rrSp}} +\newcommand{\rrhSp}{\raisebox{-0.25mm}{\SquareSp}\,} +\newcommand{\RubikSp}{\raisebox{\@hRubik}{\SquareSp}\,} +\newcommand{\textRubikSp}{\rrhSp\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Su} +% +% \begin{macro}{\rrSu} +% \begin{macro}{\rrhSu} +% \begin{macro}{\RubikSu} +% \begin{macro}{\textRubikSu} +% These commands draw forms of the Singmaster Su slice rotation. +% We also need to finetune the spacing +% between these `slice' hieroglyphs (especially Fs and Bs). +% \begin{macrocode} +\newcommand{\rrSu}{\textbf{\textsf{S\footnotesize{u}}}} +\newcommand{\rrhSu}{\rrhEp}% +\newcommand{\RubikSu}{% +\begin{minipage}{0.6cm} +\centering +\SquareEp\\ +\rrSu +\end{minipage}% +} +\newcommand{\textRubikSu}{\rrSu\,\rrhEp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Sup} +% +% \begin{macro}{\rrSup} +% \begin{macro}{\rrhSup} +% \begin{macro}{\RubikSup} +% \begin{macro}{\textRubikSup} +% These commands draw forms of the Singmaster Sup slice rotation. +% We also need to finetune the spacing +% between these `slice' hieroglyphs (especially Fs and Bs). +% \begin{macrocode} +\newcommand{\rrSup}{\textbf{\textsf{S\footnotesize{u}}$^\prime$}} +\newcommand{\rrhSup}{\rrhE}% +\newcommand{\RubikSup}{% +\begin{minipage}{0.6cm} +\centering +\SquareE\\ +\rrSup +\end{minipage}% +} +\newcommand{\textRubikSup}{\rrSup\,\rrhE} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Sd} +% +% \begin{macro}{\rrSd} +% \begin{macro}{\rrhSd} +% \begin{macro}{\RubikSd} +% \begin{macro}{\textRubikSd} +% These commands draw forms of the Singmaster Sd slice rotation. +% \begin{macrocode} +\newcommand{\rrSd}{\textbf{\textsf{S\footnotesize{d}}}} +\newcommand{\rrhSd}{\rrhE}% +\newcommand{\RubikSd}{% +\begin{minipage}{0.6cm} +\centering +\SquareE\\ +\rrSd +\end{minipage}% +} +\newcommand{\textRubikSd}{\rrSd\,\rrhE} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Sdp} +% +% \begin{macro}{\rrSdp} +% \begin{macro}{\rrhSdp} +% \begin{macro}{\RubikSdp} +% \begin{macro}{\textRubikSdp} +% These commands draw forms of the Singmaster Sdp slice rotation. +% \begin{macrocode} +\newcommand{\rrSdp}{\textbf{\textsf{S\footnotesize{d}}$^\prime$}} +\newcommand{\rrhSdp}{\rrhEp}% +\newcommand{\RubikSdp}{% +\begin{minipage}{0.6cm} +\centering +\SquareEp\\ +\rrSdp +\end{minipage}% +} +\newcommand{\textRubikSdp}{\rrSdp\,\rrhEp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Sl} +% +% \begin{macro}{\rrSl} +% \begin{macro}{\rrhSl} +% \begin{macro}{\RubikSl} +% \begin{macro}{\textRubikSl} +% These commands draw forms of the Singmaster Sl slice rotation. +% \begin{macrocode} +\newcommand{\rrSl}{\textbf{\textsf{S\footnotesize{l}}}} +\newcommand{\rrhSl}{\rrhM}% +\newcommand{\RubikSl}{% +\begin{minipage}{0.6cm} +\centering +\SquareM\\ +\rrSl +\end{minipage}% +} +\newcommand{\textRubikSl}{\rrSl\,\rrhM} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Slp} +% +% \begin{macro}{\rrSlp} +% \begin{macro}{\rrhSlp} +% \begin{macro}{\RubikSlp} +% \begin{macro}{\textRubikSlp} +% These commands draw forms of the Singmaster Slp slice rotation. +% \begin{macrocode} +\newcommand{\rrSlp}{\textbf{\textsf{S\footnotesize{l}}$^\prime$}} +\newcommand{\rrhSlp}{\rrhMp}% +\newcommand{\RubikSlp}{% +\begin{minipage}{0.6cm} +\centering +\SquareMp\\ +\rrSlp +\end{minipage}% +} +\newcommand{\textRubikSlp}{\rrSlp\,\rrhMp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Sr} +% +% \begin{macro}{\rrSr} +% \begin{macro}{\rrhSr} +% \begin{macro}{\RubikSr} +% \begin{macro}{\textRubikSr} +% These commands draw forms of the Singmaster Sr slice rotation. +% \begin{macrocode} +\newcommand{\rrSr}{\textbf{\textsf{S\footnotesize{r}}}} +\newcommand{\rrhSr}{\rrhMp}% +\newcommand{\RubikSr}{% +\begin{minipage}{0.6cm} +\centering +\SquareMp\\ +\rrSr +\end{minipage}% +} +\newcommand{\textRubikSr}{\rrSr\,\rrhMp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Srp} +% +% \begin{macro}{\rrSrp} +% \begin{macro}{\rrhSrp} +% \begin{macro}{\RubikSrp} +% \begin{macro}{\textRubikSrp} +% These commands draw forms of the Singmaster Srp slice rotation. +% \begin{macrocode} +\newcommand{\rrSrp}{\textbf{\textsf{S\footnotesize{r}}$^\prime$}} +\newcommand{\rrhSrp}{\rrhM}% +\newcommand{\RubikSrp}{% +\begin{minipage}{0.6cm} +\centering +\SquareM\\ +\rrSrp +\end{minipage}% +} +\newcommand{\textRubikSrp}{\rrSrp\,\rrhM} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Sf} +% +% \begin{macro}{\rrSf} +% \begin{macro}{\rrhSf} +% \begin{macro}{\RubikSf} +% \begin{macro}{\textRubikSf} +% These commands draw forms of the Singmaster Sf slice rotation. +% We need to just make square with Sf in square; +% adjust box height using a \cmd{\rule}; +% adjust \cmd{\fboxsep} (default=3pt); +% adjust \cmd{\fboxrule} (default=0.4pt); +% bounded by \{\} so no need to reset to defaults. +% Not visible from the front. +% \begin{macrocode} +\newcommand{\rrSf}{\textbf{\textsf{S\footnotesize{f}}}} +\newcommand{\SquareSf}{\@SquareLetter{\rrSf}} +\newcommand{\rrhSf}{\raisebox{-0.25mm}{\SquareSf}\,} +\newcommand{\RubikSf}{\raisebox{\@hRubik}{\SquareSf}\,} +\newcommand{\textRubikSf}{\rrhSf\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Sfp} +% +% \begin{macro}{\rrSfp} +% \begin{macro}{\rrhSfp} +% \begin{macro}{\RubikSfp} +% \begin{macro}{\textRubikSfp} +% These commands draw forms of the Singmaster Sfp slice rotation. +% We need to just make square with Sfp in square; +% adjust box height using a \cmd{\rule}; +% adjust \cmd{\fboxsep} (default=3pt); +% adjust \cmd{\fboxrule} (default=0.4pt); +% bounded by \{\} so no need to reset to defaults. +% Not visible from the front. +% \begin{macrocode} +\newcommand{\rrSfp}{\textbf{\textsf{S\footnotesize{f}}$^\prime$}} +\newcommand{\SquareSfp}{\@SquareLetter{\rrSfp}} +\newcommand{\rrhSfp}{\raisebox{-0.25mm}{\SquareSfp}\,} +\newcommand{\RubikSfp}{\raisebox{\@hRubik}{\SquareSfp}\,} +\newcommand{\textRubikSfp}{\rrhSfp\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Sb} +% +% \begin{macro}{\rrSb} +% \begin{macro}{\rrhSb} +% \begin{macro}{\RubikSb} +% \begin{macro}{\textRubikSb} +% These commands draw forms of the Singmaster Sb slice rotation. +% We need to just make square with Sb in square; +% adjust box height using a \cmd{\rule}; +% adjust \cmd{\fboxsep} (default=3pt); +% adjust \cmd{\fboxrule} (default=0.4pt); +% bounded by \{\} so no need to reset to defaults. +% Not visible from the front. +% \begin{macrocode} +\newcommand{\rrSb}{\textbf{\textsf{S\footnotesize{b}}}} +\newcommand{\SquareSb}{\@SquareLetter{\rrSb}} +\newcommand{\rrhSb}{\raisebox{-0.25mm}{\SquareSb}\,} +\newcommand{\RubikSb}{\raisebox{\@hRubik}{\SquareSb}\,} +\newcommand{\textRubikSb}{\rrhSb\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Sbp} +% +% \begin{macro}{\rrSbp} +% \begin{macro}{\rrhSbp} +% \begin{macro}{\RubikSbp} +% \begin{macro}{\textRubikSbp} +% These commands draw forms of the Singmaster Sbp slice rotation. +% We need to just make square with Sbp in square; +% adjust box height using a \cmd{\rule}; +% adjust \cmd{\fboxsep} (default=3pt); +% adjust \cmd{\fboxrule} (default=0.4pt); +% bounded by \{\} so no need to reset to defaults. +% Not visible from th front. +% \begin{macrocode} +\newcommand{\rrSbp}{\textbf{\textsf{S\footnotesize{b}}$^\prime$}} +\newcommand{\SquareSbp}{\@SquareLetter{\rrSbp}} +\newcommand{\rrhSbp}{\raisebox{-0.25mm}{\SquareSbp}\,} +\newcommand{\RubikSbp}{\raisebox{\@hRubik}{\SquareSbp}\,} +\newcommand{\textRubikSbp}{\rrhSbp\,} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation U} +% +% \begin{macro}{\rrU} +% \begin{macro}{\SquareU} +% \begin{macro}{\rrhU} +% \begin{macro}{\RubikU} +% \begin{macro}{\textRubikU} +% These commands all draw forms which denote the U rotation. +% \begin{macrocode} +\newcommand{\rrU}{\textbf{\textsf{U}}} +%% +\newcommand{\SquareU}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhU}{\raisebox{-0.333\height}{\SquareU}\,} +%% +\newcommand{\RubikU}{% +\begin{minipage}{0.6cm} +\centering +\SquareU\\ +\rrU +\end{minipage}%% +} +\newcommand{\textRubikU}{\rrU\,\rrhU} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Uw} +% +% \begin{macro}{\rrUw} +% \begin{macro}{\SquareUw} +% \begin{macro}{\rrhUw} +% \begin{macro}{\RubikUw} +% \begin{macro}{\textRubikUw} +% These commands all draw forms which denote the Uw rotation. +% \begin{macrocode} +\newcommand{\rrUw}{\textbf{\textsf{U\footnotesize{w}}}} +%% +\newcommand{\SquareUw}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick, <-] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +% +\newcommand{\rrhUw}{\raisebox{-0.333\height}{\SquareUw}\,} +%% +\newcommand{\RubikUw}{% +\begin{minipage}{0.6cm} +\centering +\SquareUw\\ +\rrUw +\end{minipage}%% +} +%% +\newcommand{\textRubikUw}{\rrUw\,\rrhUw} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Up} +% +% \begin{macro}{\rrUp} +% \begin{macro}{\SquareUp} +% \begin{macro}{\rrhUp} +% \begin{macro}{\RubikUp} +% \begin{macro}{\textRubikUp} +% These commands all draw forms which denote the Up rotation. +% \begin{macrocode} +\newcommand{\rrUp}{\textbf{\textsf{U}$^\prime$}} +%% +\newcommand{\SquareUp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, ->] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhUp}{\raisebox{-0.333\height}{\SquareUp}\,} +%% +\newcommand{\RubikUp}{% +\begin{minipage}{0.6cm} +\centering +\SquareUp\\ +\rrUp +\end{minipage}%% +} +\newcommand{\textRubikUp}{\rrUp\,\rrhUp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Uwp} +% +% \begin{macro}{\rrUwp} +% \begin{macro}{\SquareUwp} +% \begin{macro}{\rrhUwp} +% \begin{macro}{\RubikUwp} +% \begin{macro}{\textRubikUwp} +% These commands all draw forms which denote the Uwp rotation. +% \begin{macrocode} +\newcommand{\rrUwp}{\textbf{\textsf{U\footnotesize{w}}$^\prime$}} +%% +\newcommand{\SquareUwp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, ->] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick, ->] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhUwp}{\raisebox{-0.333\height}{\SquareUwp}\,} +%% +\newcommand{\RubikUwp}{% +\begin{minipage}{0.6cm} +\centering +\SquareUwp\\ +\rrUwp +\end{minipage}%% +} +\newcommand{\textRubikUwp}{\rrUwp\,\rrhUwp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Us} +% +% \begin{macro}{\rrUs} +% \begin{macro}{\SquareUs} +% \begin{macro}{\rrhUs} +% \begin{macro}{\RubikUs} +% \begin{macro}{\textRubikUs} +% These commands all draw forms which denote the Us rotation. +% \begin{macrocode} +\newcommand{\rrUs}{\@rrs{U}} +%% +\newcommand{\SquareUs}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick, <-] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhUs}{\raisebox{-0.333\height}{\SquareUs}\,} +%% +\newcommand{\RubikUs}{% +\begin{minipage}{0.6cm} +\centering +\SquareUs\\ +\rrUs +\end{minipage}% +} +\newcommand{\textRubikUs}{\rrUs\,\rrhUs} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Usp} +% +% \begin{macro}{\rrUsp} +% \begin{macro}{\SquareUsp} +% \begin{macro}{\rrhUs} +% \begin{macro}{\RubikUs} +% \begin{macro}{\textRubikUsp} +% These commands all draw forms which denote the Usp rotation. +% \begin{macrocode} +\newcommand{\rrUsp}{\@rrsp{U}} +%% +\newcommand{\SquareUsp}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, ->] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick, ->] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhUsp}{\raisebox{-0.333\height}{\SquareUsp}\,} +%% +\newcommand{\RubikUsp}{% +\begin{minipage}{0.6cm} +\centering +\SquareUsp\\ +\rrUsp +\end{minipage}% +} +\newcommand{\textRubikUsp}{\rrUsp\,\rrhUsp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Ua} +% +% \begin{macro}{\rrUa} +% \begin{macro}{\SquareUa} +% \begin{macro}{\rrhUa} +% \begin{macro}{\RubikUa} +% \begin{macro}{\textRubikUa} +% These commands all draw forms which denote the Ua rotation. +% \begin{macrocode} +\newcommand{\rrUa}{\@rra{U}} +%% +\newcommand{\SquareUa}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, <-] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick, ->] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhUa}{\raisebox{-0.333\height}{\SquareUa}\,} +%% +\newcommand{\RubikUa}{% +\begin{minipage}{0.6cm} +\centering +\SquareUa\\ +\rrUa +\end{minipage}% +} +\newcommand{\textRubikUa}{\rrUa\,\rrhUa} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotation Uap} +% +% \begin{macro}{\rrUap} +% \begin{macro}{\SquareUap} +% \begin{macro}{\rrhUap} +% \begin{macro}{\RubikUap} +% \begin{macro}{\textRubikUap} +% These commands all draw forms which denote the Uap rotation. +% \begin{macrocode} +\newcommand{\rrUap}{\@rrap{U}} +%% +\newcommand{\SquareUap}{% +\begin{tikzpicture}[scale=0.5] +\DrawNotationBox; +\draw [thick, ->] (\sb,\sddd) -- (\sbh, \sddd); +\draw [thick] (\sb,\sdd) -- (\sbh, \sdd); +\draw [thick, <-] (\sb,\sd) -- (\sbh, \sd); +\end{tikzpicture}% +} +\newcommand{\rrhUap}{\raisebox{-0.333\height}{\SquareUap}\,} +%% +\newcommand{\RubikUap}{% +\begin{minipage}{0.6cm} +\centering +\SquareUap\\ +\rrUap +\end{minipage}% +} +\newcommand{\textRubikUap}{\rrUap\,\rrhUap} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsection{ Rotation commands --- axis rotations} +% +% \subsubsection{ Rotations x and xp} +% +% \begin{macro}{\rrx} +% \begin{macro}{\rrhx} +% \begin{macro}{\Rubikx} +% These commands all draw forms which denote the x rotation. +% \begin{macrocode} +\newcommand{\rrx}{\textbf{\textsf{x}}} +\newcommand{\Rubikx}{\@xyzRubik{x}} +\newcommand{\rrhx}{\@xyzh{x}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\rrxp} +% \begin{macro}{\rrhxp} +% \begin{macro}{\Rubikxp} +% These commands all draw forms which denote the xp rotation. +% \begin{macrocode} +\newcommand{\rrxp}{\textbf{\textsf{x}$^\prime$}} +\newcommand{\Rubikxp}{\@xyzRubikp{x}} +\newcommand{\rrhxp}{\@xyzhp{x}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotations y and yp} +% +% \begin{macro}{\rry} +% \begin{macro}{\rrhy} +% \begin{macro}{\Rubiky} +% These commands all draw forms which denote the y rotation. +% \begin{macrocode} +\newcommand{\rry}{\textbf{\textsf{y}}} +\newcommand{\Rubiky}{\@xyzRubik{y}} +\newcommand{\rrhy}{\@xyzh{y}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\rryp} +% \begin{macro}{\rrhyp} +% \begin{macro}{\Rubikyp} +% These commands all draw forms which denote the yp rotation. +% \begin{macrocode} +\newcommand{\rryp}{\textbf{\textsf{y}$^\prime$}} +\newcommand{\Rubikyp}{\@xyzRubikp{y}} +\newcommand{\rrhyp}{\@xyzhp{y}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotations z and zp} +% +% \begin{macro}{\rrz} +% \begin{macro}{\rrhz} +% \begin{macro}{\Rubikz} +% These commands all draw forms which denote the z rotation. +% \begin{macrocode} +\newcommand{\rrz}{\textbf{\textsf{z}}} +\newcommand{\Rubikz}{\@xyzRubik{z}} +\newcommand{\rrhz}{\@xyzh{z}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\rrzp} +% \begin{macro}{\rrhzp} +% \begin{macro}{\Rubikzp} +% These commands all draw forms which denote the zp rotation. +% \begin{macrocode} +\newcommand{\rrzp}{\textbf{\textsf{z}$^\prime$}} +\newcommand{\Rubikzp}{\@xyzRubikp{z}} +\newcommand{\rrhzp}{\@xyzhp{z}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotations u and d} +% +% \begin{macro}{\rru} +% \begin{macro}{\rrhu} +% \begin{macro}{\Rubiku} +% These commands all draw forms which denote the u rotation. +% \begin{macrocode} +\newcommand{\rru}{\textbf{\textsf{u}}} +\newcommand{\Rubiku}{\@xyzRubik{u}} +\newcommand{\rrhu}{\@xyzh{u}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\rrd} +% \begin{macro}{\rrhd} +% \begin{macro}{\Rubikd} +% These commands all draw forms which denote the d rotation. +% \begin{macrocode} +\newcommand{\rrd}{\textbf{\textsf{d}}} +\newcommand{\Rubikd}{\@xyzRubik{d}} +\newcommand{\rrhd}{\@xyzh{d}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotations l and r} +% +% \begin{macro}{\rrl} +% \begin{macro}{\rrhl} +% \begin{macro}{\Rubikl} +% These commands all draw forms which denote the l rotation. +% \begin{macrocode} +\newcommand{\rrl}{\textbf{\textsf{l}}} +\newcommand{\Rubikl}{\@xyzRubik{l}} +\newcommand{\rrhl}{\@xyzh{l}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\rrr} +% \begin{macro}{\rrhr} +% \begin{macro}{\Rubikr} +% These commands all draw forms which denote the r rotation. +% \begin{macrocode} +\newcommand{\rrr}{\textbf{\textsf{r}}} +\newcommand{\Rubikr}{\@xyzRubik{r}} +\newcommand{\rrhr}{\@xyzh{r}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{ Rotations f and b} +% +% \begin{macro}{\rrf} +% \begin{macro}{\rrhf} +% \begin{macro}{\Rubikf} +% These commands all draw forms which denote the f rotation. +% \begin{macrocode} +\newcommand{\rrf}{\textbf{\textsf{f}}} +\newcommand{\Rubikf}{\@xyzRubik{f}} +\newcommand{\rrhf}{\@xyzh{f}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\rrb} +% \begin{macro}{\rrhb} +% \begin{macro}{\Rubikb} +% These commands all draw forms which denote the b rotation. +% \begin{macrocode} +\newcommand{\rrb}{\textbf{\textsf{b}}} +\newcommand{\Rubikb}{\@xyzRubik{b}} +\newcommand{\rrhb}{\@xyzh{b}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% -------------------------- +% End of this package +% -------------------------- +% \begin{macrocode} +%</rubikcube> +% \end{macrocode} +% +% +% +% +% \Finale +% +\endinput diff --git a/Master/texmf-dist/source/latex/rubik/rubikcube.ins b/Master/texmf-dist/source/latex/rubik/rubikcube.ins new file mode 100644 index 00000000000..5b5d6d5f45a --- /dev/null +++ b/Master/texmf-dist/source/latex/rubik/rubikcube.ins @@ -0,0 +1,76 @@ +%% rubikcube.dtx +%% Copyright 2014 RWD Nickalls (dick@nickalls.org) and A Syropoulos (asyropoulos@yahoo.com) +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work are RWD Nickalls and A Syropoulos +%% +%% +%% This work consists of the files rubikcube.dtx and rubikcube.ins +%% and the derived file rubikcube.sty. +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\batchfile{rubikcube.ins} +\input docstrip.tex + +\preamble + +----------------------------------------------------------------- + Authors: RWD Nickalls (dick@nickalls.org) + and Apostolos Syropoulos (asyropoulos@yahoo.com) + + Copyright 2014 RWD Nickalls and A Syropoulos + + + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3 of this license or (at your option) any + later version: <http://www.latex-project.org/lppl.txt> + + This work consists of the files listed in the README file. +----------------------------------------------------------------- + + This is a LaTeX/TikZ package for drawing Rubik cubes + Please report errors or suggestions for improvement to + + RWD Nickalls (dick@nickalls.org) + Apostolos Syropoulos (asyropoulos@yahoo.com) + + This package requires the basic TikZ package to be loaded already +------------------------------------------------------------------ +\endpreamble + +\keepsilent %%disables most of the screen output +%% \askforoverwritefalse %%enables automatic overwriting of .sty +\generate{\file{rubikcube.sty}{\from{rubikcube.dtx}{rubikcube}}} + +%%now write a screen message for the user +\obeyspaces +\Msg{*******************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the *} +\Msg{* following file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* rubikcube.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file *} +\Msg{* rubikcube.dtx through LaTeX. *} +\Msg{* For an index, process any filename.idx file by *} +\Msg{* makeindex -s gind.ist filename *} +\Msg{* For list of changes, process any filename.glo file *} +\Msg{* makeindex -s gglo.ist -o filename.gls filename.glo *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{*******************************************************} + +\endbatchfile +%%------------EOF--------------- diff --git a/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx b/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx new file mode 100644 index 00000000000..8ffc824499a --- /dev/null +++ b/Master/texmf-dist/source/latex/rubik/rubikrotation.dtx @@ -0,0 +1,987 @@ +% \iffalse meta-comment +% rubikrotation.dtx +% +% Authors: RWD Nickalls (dick@nickalls.org) +% and Apostolos Syropoulos (asyropoulos@yahoo.com) + +% Copyright 2014 RWD Nickalls + A Syropoulos +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3c of this license or (at your option) any +% later version. The latest version of this licence is in +% +% http://www.latex-project.org/lppl.txt +% +%<*readme> +% +% The rubikrotation 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{rubikrotation.sty}{\usepackage{rubikrotation}}{% + \GenericWarning{rubikrotation.dtx}{Package file rubikrotation.sty not found. + Documentation will be messed up!^^J + (Generate rubikrotation.sty by (La)TeXing rubikrotation.ins, and then^^J + process rubikrotation.dtx again)^^J}\stop +}% +\usepackage{ifpdf} +\usepackage{url} %% for references +\usepackage{graphicx} %% for the two pdf figs +%%\OnlyDescription +\EnableCrossrefs +\CodelineIndex +\CodelineNumbered +\RecordChanges +\setcounter{StandardModuleDepth}{1} +\begin{document} + \DocInput{rubikrotation.dtx} + \PrintChanges + \PrintIndex +\end{document} +%</driver> +% \fi +% +% +% +% \CheckSum{302} +% +%%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +% +% +% +% \title{The \textsf{rubikrotation} package} +% +% \author{ +% RWD Nickalls (dick@nickalls.org) \\ +% A Syropoulos (asyropoulos@yahoo.com) +% } +% \date{This file describes version \RRfileversion, last revised \RRfiledate} +% \maketitle +% +% \begin{abstract} +% The \rubikrotation\ package is an extension for the +% \textsf{rubikcube} package. It provides the \cmd{\RubikRotation} command which +% processes on-the-fly a sequence of Rubik rotation moves (using the Perl script +% \texttt{rubikrotation.pl}) and returns the new Rubik cube state. It implements +% some basic checking of the Rubik state, and also offers a command for displaying +% any errors (\cmd{\ShowRubikErrors}). +% This package requires access to the \TeX\ \texttt{write18} facility by using the +% \texttt{--shell-escape} commandline switch. +% The \textsf{rubikrotation} package has been road-tested on a Microsoft +% platform (with MikTeX and Strawberry Perl), on a Linux platform ({\TeX}Live and Mandriva), +% and on OpenIndiana (a Solaris platform). +% \end{abstract} +% +% +% \bigskip +% +% \tableofcontents +% +% \section{Introduction} +% +% The \rubikrotation\ package is a dynamic extension to the \textsc{rubikcube} package. +% It consists of a style option (\texttt{rubikrotation.sty}) and a +% Perl script (\texttt{rubikrotation.pl}). +% +% The primary role of the \rubikrotation\ package is to implement on-the-fly Rubik +% rotation sequences using the \cmd{\RubikRotation} command. Consequently, this +% package requires the use of the \texttt{--shell-escape} switch to allow +% commandline control of the Perl script, which is really the `engine' of this package. +% The \textsf{rubikrotation} package has been road-tested on a Microsoft +% platform (with MikTeX and Strawberry Perl\,\footnote{`Strawberry Perl' +% (\texttt{http://strawberryperl.com}) is a free Perl +% environment for MS Windows, designed to be as close as possible to the Perl +% environment of Unix/Linux systems.}) +% and on a Linux platform ({\TeX}Live and Mandriva). +% +% The following commands are made available by \texttt{rubikrotation.sty}. +% \begin{quote} +% \begin{verbatim} +% \RubikRotation{} +% \SaveRubikState +% \CheckRubikState +% \ShowRubikErrors +%\end{verbatim} +% \end{quote} +% Note that if the Perl script is not located in the local working directory, then +% some care is needed regarding placing it where your system can both find it and +% also run it. In this case, the setting up of a simple one or two-line configuration +% file may be useful or even necessary, depending on your system +% (see section on `installation' below). +% +% +% \section{Requirements} +% +% The \rubikrotation\ package requires the TikZ and the \textsc{rubikcube} packages. +% +% +% \section{Installation} +% +% \subsection{Generating the files} +% +% Place the file \texttt{rubikrotation.zip} into a temporary directory, and unzip it. +% This will generate the following files: +% \begin{verbatim} +% rubikrotation.ins +% rubikrotation.dtx +% rubikrotation.sty +% rubikrotation.pl +% rubikrotation.PDF +% example-rot1.tex +% example-rot1.PDF +% example-rot2.tex +% example-rot2.PDF +%\end{verbatim} +% The style option \texttt{rubikrotation.sty} is generated by running (pdf)\LaTeX\ on +% the file \texttt{rubikrotation.ins} as follows: +%\begin{verbatim} +% pdflatex rubikrotation.ins +%\end{verbatim} +% The documentation file (\texttt{rubikrotation.pdf}) was generated using the following +% steps: +% \begin{verbatim} +% pdflatex --shell-escape rubikrotation.dtx +% pdflatex --shell-escape rubikrotation.dtx +% makeindex -s gind.ist rubikrotation +% makeindex -s gglo.ist -o rubikrotation.gls rubikrotation.glo +% pdflatex --shell-escape rubikrotation.dtx +%\end{verbatim} +% + +% +% \subsection{Placing the files} +% \label{sec:placingfiles} +% +% Place the files either in the local working directory, or where your system +% will find them. For a Linux system with a standard \TeX\ Directory Structure (TDS), then: +% +%\medskip +%{\noindent}*.sty $\rightarrow$ +% \texttt{/usr/local/texlive/texmf-local/tex/latex/local/rubikrotation/} +%{\newline}*.cfg $\rightarrow$ +% \texttt{/usr/local/texlive/texmf-local/tex/latex/local/rubikrotation/} +%{\newline}*.pdf $\rightarrow$ \texttt{/usr/local/texlive/texmf-local/doc/rubikrotation/} +%{\newline}*.pl $\rightarrow$ \texttt{/usr/local/bin/} +% +% \medskip +% {\noindent}Finally, (depending on your system) update the \TeX\ file database using the +% \texttt{texhash} command. + +% +% \subsection{Configuration file} +% \label{sec:configfile} +% +% A plane text configuration file with the name \texttt{rubikrotation.cfg} (if one exists) +% will be read by the system. Such a file allows the user to +% adjust (a)~the filename of the Perl script (\texttt{rubikrotation.pl}) +% and (b)~the commandline code used by \texttt{rubikrotation.sty} for calling the +% Perl script. This sort of fine-tuning is sometimes convenient, and even necessary +% (depending on your system), for locating and running the Perl script. +% For example, on some systems it maybe preferable to use a different \textsc{path}, +% file name and/or a different commandline code to call the script. +% +% +% \DescribeMacro{\rubikperlname} +% \DescribeMacro{\rubikperlcmd} +% The configuration file is essentially a convenient software vehicle for feeding some +% additional \LaTeX\ code to the style option, and hence allow the contents of some +% commands to be adjusted and/or fine-tuned. +% For the \rubikrotation\ package there are two particular commands we may wish to adjust. +% The first is that defining the filename of the Perl script, namely +% \cmd{\rubikperlname}. The second is that defining the commandline call, +% namely \cmd{\rubikperlcmd}. +% The default definitions for these (detailed in Section~\ref{sec:usefulcommands}) +% are as follows: +%\begin{verbatim} +% \newcommand{\rubikperlname}{rubikrotation.pl} +% \newcommand{\rubikperlcmd}{perl \rubikperlname} +%\end{verbatim} +% +% +% For example, we might wish to test out a slightly modified Perl script, say +% with the name \texttt{rubikrotationV3.pl}. In this case we simply create, +% in the local working directory, a plane text configuration file +% (called \texttt{rubikrotation.cfg}) which includes the following line: +%\begin{verbatim} +%\renewcommand{\rubikperlname}{rubikrotationV3.pl} +%\end{verbatim} +% +% Alternatively, say, if the Perl script is being installed on a Linux platform, then +% it would be standard to install it in the directory \texttt{/usr/local/bin}. +% A convenient approach in this case, therefore, would be to indicate this new \textsc{path} +% by including the following line in the configuration file: +%\begin{verbatim} +%\renewcommand{\rubikperlname}{/usr/local/bin/rubikrotation.pl} +%\end{verbatim} +% and, since this would then be an essentially permanent feature, we would then +% place the configuration file with the style option in the +% \texttt{texmf-local/...} directory as described in section~\ref{sec:placingfiles} +% (placing files). Note that in this case, we have \textit{not} made the Perl script +% `executable', since the default commandline code is effectively +% \texttt{perl \rubikperlname}, and this works just as it is. +% +% However, if the Perl script \textit{is} made `executable', then +% a different commandline code will have to be used instead. +% For example, suppose the Perl script is made executable and renamed to just +% \texttt{rubikrotation} (ie with no filename extension), then we now have to +% omit the `perl' from the default commandline. Consequently, we now need to make +% two command changes, which we implement by including the following +% two lines in the configuration file: +%\begin{verbatim} +%\renewcommand{\rubikperlname}{/usr/local/bin/rubikrotation} +%\renewcommand{\rubikperlcmd}{\rubikperlname} +%\end{verbatim} +% +% +% \section{Usage} +% +% Load the packages \texttt{rubikcube.sty} +% and \texttt{rubikrotation.sty} in the \TeX\ file \textit{after} loading +% the TikZ package, as follows: +% \begin{verbatim} +% \usepackage{tikz} +% \usepackage{rubikcube,rubikrotation} +%\end{verbatim} +% and run (pdf)\LaTeX\ using the \texttt{--shell-escape} commandline switch +% (see following section). +% +% +% \subsection{Enabling the \TeX\ `shell' facility} +% +% In order to enable the \TeX\ `write18' facility (so it can run the Perl script) +% we will need to invoke (pdf)\LaTeX\ using the \texttt{--shell-escape} switch; say, as follows. +% \begin{verbatim} +% pdflatex --shell-escape filename.tex +%\end{verbatim} +% In practice, it is probably most convenient to run this via a +% bash/batch file---something like the following, both of which +% automatically show the graphic output: +% \begin{verbatim} +% pdflatex --shell-escape filename.tex +% xpdf filename.pdf +%\end{verbatim} +% or +% \begin{verbatim} +% latex --shell-escape filename.tex +% dvips filename.dvi +% gv filename.ps +%\end{verbatim} +% +% +% \subsection{Test files} +% +% Two example tex files (which demonstrate the use of the package commands) are +% included in the package, namely: +% \begin{verbatim} +% example-rot1.tex (shows 5 worked examples) +% example-rot2.tex (is a `test' file for experimenting with different commands) +%\end{verbatim} +% These need to be run using \texttt{--shell-escape} switch; for example: +% \begin{verbatim} +% pdflatex --shell-escape example-rot1.tex +%\end{verbatim} +% If the files give unexpected results, check-out the log file to see if the system +% has had any difficulties finding files etc. +% +% +% +% \section{Commands} +% +% The \textit{only} commands which \textit{must} be used inside a TikZ picture +% environment are the \cmd{\Draw...} commands (these are all provided by +% the \textsc{rubikcube} package), although most commands can be placed +% inside a TikZ environment if necessary. However, using commands outside the environment +% generally offers maximum flexibility, since the effects of commands used inside +% a TikZ picture environment are `local' to that picture environment, and are not +% therefore accessable outside the environment. +% +% The only command which must \textit{not} +% be inside a TikZ environment is the \cmd{\ShowRubikErrors} command +% (see the notes on this command below). +% +% +% \subsection{\cmd{\RubikRotation} command} +% +% \DescribeMacro{\RubikRotation} +% The \cmd{\RubikRotation}\marg{comma separated sequence} command processes +% a comma separated sequence of rotations, and returns the final state. +% For example, if we wanted to see the effect of the rotations +% \textbf{R, R, L, U, D} on a solved Rubik cube, we could use the +% following commands. +% \begin{verbatim} +% \begin{tikzpicture}[scale=0.7] +% \RubikCubeSolved +% \RubikRotation{R2,L,U,D} +% \DrawRubikCubeRU +% \end{tikzpicture} +%\end{verbatim} +% The \cmd{\RubikRotation} command results in \LaTeX\ first writing +% the current Rubik state to a text file (\texttt{rubikstate.dat}), +% and then calling the Perl program \texttt{rubikrotation.pl}. The Perl +% program then reads the current rubik state from the (\texttt{rubikstate.dat}) +% file, performs all the rotations, and then writes the new rubik state +% (and any error messages) to the file \texttt{rubikstateNEW.dat}, +% which is then input on-the-fly by the \LaTeX\ file and used to generate +% some graphic image of the cube. +% +% Note that the \cmd{\RubikRotation} command can be either inside +% or before the Tikz picture environment. In fact only the `\cmd{\Draw...}' +% commands (from the \textsc{rubikcube} package) actually need to be inside +% a TikZ picture environment. Consequently this makes for great flexibility. +% +% \subsubsection{Arguments prefixed with a *} +% +% If any of the comma separated arguments (strings) is prefixed with a * it is +% not processed as a rotation. This feature therefore allows a string argument +% to be used as a label, which can be very useful. +% For example, we can use the * feature to label the following +% sequence as generating the so-called +% `sixspot' configuration (described by Reid): +% \begin{verbatim} +% \RubikRotation{*sixspot,U,Dp,R,Lp,F,Bp,U,Dp} +%\end{verbatim} +% Alternatively, and probably more conveniently, we could simply use +% the name `sixspot' to define a new command, as follows (which therefore allows +% one to store lots of different rotation sequences by name alone): +% \begin{verbatim} +% \newcommand{\sixspot}{U,Dp,R,Lp,F,Bp,U,Dp} +%\end{verbatim} +% With this `newcommand' we are now able to generate the graphic (sixspot cube) +% much more easily using the following code: +% +% \medskip +% +% \begin{minipage}{6cm} +% \begin{verbatim} +% \begin{tikzpicture}[scale=0.7] +% \RubikCubeSolved +% \RubikRotation{\sixspot} +% \DrawRubikCubeRU +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% \begin{minipage}{3.4cm} +% \centering +% \ifpdf +% \includegraphics[height=3cm]{Rubikrot_doc_figA.pdf} +% \else +% \fi +% \end{minipage} +% +% +% \medskip +% +% In practice, it is quite useful to go one step further and include +% the \texttt{*} label feature as well in the newcommand, as follows: +% \begin{verbatim} +% \newcommand{\sixspot}{*sixspot,U,Dp,R,Lp,F,Bp,U,Dp} +%\end{verbatim} +% since this has the great advantage of making the particular +% rotation sequence identified by the label-name visible in the log file. +% For example, the following command, which uses the rotations \textbf{x2} +% and \textbf{y} to initially rotate the `solved' cube before applying +% the `sixspot' sequence of rotations, +% \begin{verbatim} +% \RubikRotation{x2,y,\sixspot} +%\end{verbatim} +% will then be represented in the log file as +% \begin{verbatim} +% ...command=rotation,x2,y,*sixspot,U,Dp,R,Lp,F,Bp,U,Dp +% ...arguments passed to `rotation' sub = x2 y *sixspot U Dp R Lp F Bp U Dp (n= 11) +% ...rotation x OK (= rrR + rrSr + rrLp) +% ...rotation x OK (= rrR + rrSr + rrLp) +% ...rotation y OK (= rrU + rrSu + rrDp) +% ...*sixspot is a label OK +% ...rotation U OK +% ...rotation Dp OK +% ...rotation R OK +% ...rotation Lp OK +% ...rotation F OK +% ...rotation Bp OK +% ...rotation U OK +% ...rotation Dp OK +%\end{verbatim} +% In this way, several named rotation sequences can be easily distinguished +% in the log file from adjacent rotation commands. +% +% +% \subsubsection{Random rotations} +% +% The \cmd{\RubikRotation} command can also be used to scramble the +% cube using a random sequence of rotations. If the first argument +% is the lowercase word `random' \textsc{and} the second argument +% is an integer $n$, ($1\leq n \leq 200$), then a random sequence +% of $n$ rotations will be performed; otherwise a default value +% of 50 is used (for example, if the second argument is not an integer). +% If $n > 200$ then the value $n=200$ will be used. +% +% For example, the following commands will scramble a solved cube using a +% sequence of 120 random rotations, and display the state in the form of +% a semi-flat cube. +% +% \medskip +% +% \begin{minipage}{5.5cm} +%\begin{verbatim} +% \RubikCubeSolved% +% \RubikRotation{random,120}% +% \begin{tikzpicture}[scale=0.5] +% \DrawRubikCubeFlat +% \end{tikzpicture} +%\end{verbatim} +% \end{minipage} +% \begin{minipage}{3.4cm} +% \centering +% \ifpdf +% \includegraphics[height=4cm]{Rubikrot_doc_figB.pdf} +% \else +% \fi +% \end{minipage} +% +% Note that in this particular example (above), only +% the \cmd{\Draw..} command is inside the TikZ picture environment---a useful +% method when more than one figure is being drawn. Note also, that when such +% commands are outside a TikZ picture environment, they should have a +% trailing \% to stop additional white space being included. +% +% \medskip +% +% The procedure is that all the possible rotations are first allocated +% a different number (integer) and collected into an array. Then a +% sequence of $n$ randomised numbers is generated and mapped to the array +% to generate the associated sequence of random rotations. +% The sequence used is detailed in the \texttt{.log} file. +% +% +% \subsection{\cmd{\SaveRubikState}} +% +% \DescribeMacro{\SaveRubikState} +% The command \cmd{\SaveRubikState}\marg{filename} saves the state (configuration) +% of the Rubik cube to the file \marg{filename} in the standard \cmd{\RubikFace...} +% format. Consequently such a file can then be input at a later stage so it can be +% drawn or processed in the usual way (inside the TikZ picture environment). +% +% For example, the following commands would save the so-called `sixspot' configuration +% (generated by the rotations \textbf{U, Dp, R, Lp, F, Bp, U, Dp}) +% to the file \verb!sixspot.tex!. +%\begin{verbatim} +% \RubikCubeSolved% +% \RubikRotation{*sixspot,U,Dp,R,Lp,F,Bp,U,Dp}% +% \SaveRubikState{sixspot.tex}% +%\end{verbatim} +% The form of the file \verb!sixspot.tex! will then be as follows---the +% filename (commented out) is automatically written to the top of the +% file for convenience. +%\begin{verbatim} +% % filename: sixspot.tex +% \RubikFaceUp{O}{O}{O}{O}{W}{O}{O}{O}{O}% +% \RubikFaceDown{R}{R}{R}{R}{Y}{R}{R}{R}{R}% +% \RubikFaceLeft{Y}{Y}{Y}{Y}{B}{Y}{Y}{Y}{Y}% +% \RubikFaceRight{W}{W}{W}{W}{G}{W}{W}{W}{W}% +% \RubikFaceFront{G}{G}{G}{G}{O}{G}{G}{G}{G}% +% \RubikFaceBack{B}{B}{B}{B}{R}{B}{B}{B}{B}% +%\end{verbatim} +% We can therefore access and draw this configuration later, when required, +% simply by inputting the file as follows: +%\begin{verbatim} +%\begin{tikzpicture} +% \input{sixspot.tex} +% \DrawRubikCubeFlat +%\end{tikzpicture} +%\end{verbatim} +% +% +% \subsection{\cmd{\CheckRubikState} command} +% +% \DescribeMacro{\CheckRubikState} +% Since it is easy to inadvertently define an invalid Rubik cube +% (eg enter an invalid number of, say, yellow cubies), this command +% checks the current colour state of all the cubies +% of a 3x3x3 Rubik cube, and shows the number of cubies of each colour. +% An ERROR: code is issued if the number of cubies having a given colour exceeds 6. +% The results are written to the the \texttt{.log} file, and displayed under +% the graphic if the \cmd{\ShowRubikErrors} command is used. +% +% One can check the current Rubik state (for errors) by issuing the command +%\begin{verbatim} +% \CheckRubikState% +%\end{verbatim} +% Note that such a check is implemented automatically with each \cmd{\RubikRotation} command. +% +% +% +% +% \subsection{\cmd{\ShowRubikErrors} command} +% +% \DescribeMacro{\ShowRubikErrors} +% +% Any errors which arise can be made visible using the +% command \cmd{\ShowRubikErrors}. +% This command places a copy of the `error' file (\texttt{rubikstateERRORS.dat}) +% underneath the image so you can see any errors if there are any---all this +% detail can also be found in the \texttt{.log} file. +% +% Consequently, this command must be placed \textit{after} a TikZ picture +% environment---it cannot be used inside a TikZ environment. In fact this command +% is probably best placed at the end of the document (if there are several such +% environments), where it will reveal all rotation errors generated while +% processing the document. +% +% +% \section{Files generated} +% +% +% Whenever the \cmd{\RubikRotation} or \cmd{\CheckRubikState} commands are used, +% three small temporary plain text files for holding data are generated as +% follows (they are refreshed with each \LaTeX\ run, and are not actively deleted). +% \begin{itemize} +% \item \LaTeX\ writes Rubik state data to the file \texttt{rubikstate.dat}. +% +% \item Perl reads the file \texttt{rubikstate.dat} and then writes +% the new rubik state to the file \texttt{rubikstateNEW.dat}. +% +% \item Perl also writes error data to the file \texttt{rubikstateERRORS.dat}. +% A copy of this file is displayed under the image when the command +% \cmd{\ShowRubikErrors} is used after (outside) the TikZ picture environment. +% +% \end{itemize} +% +% +% \section{General overview} +% +% When \LaTeX\ loads the \rubikrotation\ package the following steps are implemented. +% \begin{itemize} +% +% +% \item[1.] A check is made to see if \texttt{fancyvrb.sty} is loaded: if not +% then this package is loaded if it is available (this package is required +% for inputting the file \texttt{rubikstateERRORS.dat}). +% +% \item[2.] A check is made to see if a configuration file (\texttt{rubikrotation.cfg}) +% exists: if so then this file is input. +% +% \item[3.] The text file \texttt{rubikstateNEW.dat} is overwritten (if it exists): +% otherwise the file is created (this prevents an `old' file being used by \LaTeX). +% +% \item[4.] The plain text file \texttt{rubikstateERRORS.dat} is created. +% This file collects error messages generated by the Perl script. +% +% \end{itemize} +% +% +% When a \cmd{\RubikRotation} command is processed it first writes the current +% colour configuration of each face (the `rubik state') to the temporary file +% \texttt{rubikstate.dat} (to be read by the Perl script \texttt{rubikrotation.pl}). +% The \cmd{\RubikRotation} command also appends the keyword ` +% \texttt{checkrubik}' as well as a copy of the string of Rubik rotations. +% It then calls the Perl script \texttt{rubikrotation.pl}. +% +% For example, if we use the command \cmd{\RubikCubeSolved} +% followed by the command \verb!\RubikRotation{U,D,L,R}! then the associated +% \texttt{rubikstate.dat} file would be as follows: +% \begin{verbatim} +% % filename: rubikstate.dat +% up,W,W,W,W,W,W,W,W,W +% down,Y,Y,Y,Y,Y,Y,Y,Y,Y +% left,B,B,B,B,B,B,B,B,B +% right,G,G,G,G,G,G,G,G,G +% front,O,O,O,O,O,O,O,O,O +% back,R,R,R,R,R,R,R,R,R +% checkstate +% rotation,U,D,L,R +%\end{verbatim} +% Alternatively, if the \cmd{\RubikRotation} command was +% \verb!\RubikRotation{random, 45}! then the last line written to the file +% would be the string `\texttt{rotation,random,45}' +% A \cmd{\CheckRubikState} command triggers the same sequence of events except +% no `rotation' line is written. +% +% The action of the Perl program is controlled by the keywords (first argument of +% each line) associated with each line of the file \texttt{rubikstate.dat}. +% When control passes to Perl, the Perl program starts by loading the +% rubikstate (prompted by the keywords up, down, +% left, right, front, back). Next the program performs +% some basic checks (prompted by the key word `checkstate'), and then it processes +% the sequence of Rubik rotations (prompted by the keyword `rotation'). +% If, instead, the second argument of the `rotation' string is the keyword `random', and +% provided this is followed by a valid integer, say $n$, then the Perl program performs +% a sequence of $n$ random rotations. +% Finally, the Perl program writes the final `rubikstate' to the text file +% \texttt{rubikstateNEW.dat}. All error messages are written to the +% text file \texttt{rubikstateERRORS.dat} and also to the \LaTeX\ log file. +% +% Control then reverts to \LaTeX\ which then inputs the file +% \texttt{rubikstateNEW.dat}. If there are more \cmd{\RubikRotation} commands +% then this cycle repeats accordingly. Eventually a `\texttt{Draw...}' command +% of some form is reached and the final rubikstate is drawn in a TikZ picture +% environment. +% +% If the TikZ picture environment is followed by a \cmd{\ShowRubikErrors} command, +% then a `verbatim' copy of the \texttt{rubikstateERRORS.dat} file is displayed +% immediately under the graphic. Once the graphic is error-free, then the +% \cmd{\ShowRubikErrors} can be removed or commented out. +% +% +% +% ^^A ================================================== +% \StopEventually{\PrintIndex} +% +% +% +% \section{The code (\texttt{rubikrotation.sty})} +% +% \subsection{Package heading} +% +% \begin{macrocode} +%<*rubikrotation> +\def\RRfileversion{2.0}% +\def\RRfiledate{2014/01/20}% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{rubikrotation}[\RRfiledate\space (v\RRfileversion)] +% \end{macrocode} +% +% +% {\noindent}The package requires rubikcube.sty. Do not automatically +% load rubikcube.sty since this makes it difficult to errorcheck new +% versions (for the moment at least). +% \begin{macrocode} +\@ifpackageloaded{rubikcube}{}{% + \typeout{---rubikrotation requires the rubikcube package.}% + }% +% \end{macrocode} +% +% +% +% {\noindent}The \rubikrotation\ package requires access to the fancyvrb package +% for the \cmd{\VerbatimInput\{\}} command which we use for inputting and displaying +% the error file. +% \begin{macrocode} +\@ifpackageloaded{fancyvrb}{}{% + \typeout{---rubikrotation requires the fancyvrb package% + for VerbatimInput{} command.}% + \RequirePackage{fancyvrb}} +% \end{macrocode} +% \medskip +% +% +%\subsection{Some useful commands} +% \label{sec:usefulcommands} +% \begin{macro}{\rubikrotation} +% First we create a suitable logo +% \begin{macrocode} +\newcommand{\rubikrotation}{\textsf{rubikrotation}} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@comment} +% \begin{macro}{\@commentone} +% We require access to the percent character so we can write comments +% in files, including the log file. +% We first define percentchar for the write statement +% (From Abrahams PW, Berry K and Hargreaves KA (1990), ``TeX for the Impatient'', p~292; +% available from: CTAN.../info/impatient/) +% \begin{macrocode} +{\catcode`\%=12 \global\def\rubikpercentchar{%}}% +\newcommand{\@comment}{\rubikpercentchar\rubikpercentchar\space}% +\newcommand{\@commentone}{\rubikpercentchar}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\@print} +%% We need a simple print command for writing comments to a file. +% \begin{macrocode} +\newcommand{\@print}[1]{\immediate\write\outfile{#1}} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\rubikperlname} +% This holds the name of the Perl-5 script . It is used later to check +% whether the Perl script exists or not. A plain text configuration file +% \verb!rubikrotation.cfg! can be used to change the default name of the +% Perl script using a renewcommand. +% \begin{macrocode} +\newcommand{\rubikperlname}{rubikrotation.pl} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\rubikperlcmd} +% This holds the commandline code for calling the the Perl script. +% A plain text configuration file \verb!rubikrotation.cfg! can be used to +% change the default commandline code using a renewcommand. +% \begin{macrocode} +\newcommand{\rubikperlcmd}{perl \rubikperlname} +% \end{macrocode} +% \end{macro} +% +% +%\subsection{Configuration file} +% If a config file exists (rubikrotation.cfg) then input it here, +% ie \textit{after} defining the \cmd{\rubikperlname} and \cmd{\rubikperlcmd} +% commands and \textit{before} creating the \texttt{rubikstateERRORS.dat} file. +% \begin{macrocode} +\typeout{---checking for config file (rubikrotation.cfg)...} +\IfFileExists{rubikrotation.cfg}{% + \input{rubikrotation.cfg}% + }{\typeout{---no config file available}% +}% +% \end{macrocode} +% +% +% \subsection{Clean file rubikstateNEW.dat} +% +% {\noindent}We need to clean any existing (old) rubikstateNEW.dat file, +% since if the TeX shell switch is accidentally not used then Perl will +% not be CALLed and hence this file will not be renewed +% (ie an `old' image may be used). +% \begin{macrocode} +\typeout{---cleaning file rubikstateNEW.dat}% +\newwrite\outfile% +\immediate\openout\outfile=rubikstateNEW.dat% +\@print{\@comment rubikstateNEW.dat (by TeX)}% +\immediate\closeout\outfile% +% \end{macrocode} +% +% +% \subsection{rubikstateERRORS.dat} +% +% {\noindent}The \rubikrotation\ package requires the Perl program. +% We first open the file \texttt{rubikstateERRORS.dat} which is used +% by the Perl program (\texttt{rubikrotation.pl}) for writing its error +% messages to. This file is accessed and displayed by the command +% \cmd{\ShowRubikErrors}. +% +% \textsc{important note}: this file is created fresh each time LaTeX is run +% and hence the Perl program only appends data to it during the \LaTeX\ run, +% so this file just grows until either it is destroyed or recreated---a useful +% feature to keep since the file accumulates all error messages as the +% .tex file is processed. +% We can't make the Perl program create the file since the Perl program is only +% CALLed if we use a \cmd{\RubikRotation} or \cmd{\CheckRubikState} +% command (which we may not!)---so it has to be created (opened) here. +% +% The following code first opens the file, and then checks to see if +% the Perl program (\cmd{\rubikperlname}) exists; +% if the Perl prog does exist then all is OK, +% otherwise we write an error message to the file. +% \begin{macrocode} +\typeout{---creating file rubikstateERRORS.dat}% +\newwrite\outfile% +\immediate\openout\outfile=rubikstateERRORS.dat% +\@print{\@comment rubikstateERRORS.dat}% +\typeout{---checking for Perl script \rubikperlname...} + \IfFileExists{\rubikperlname}{% + \typeout{---\rubikperlname\space exists OK}% + }{\typeout{** ERROR: cannot find Perl program \rubikperlname}% + \@print{\@comment ** ERROR: cannot find Perl program \rubikperlname}}% +\immediate\closeout\outfile% +% \end{macrocode} +% +% +% \subsection{Setting up a newwrite and file-access for new files} +% +% Having set up all the primary files, we now need to set up a newwrite for +% all subsequent files openings (eg for rubikstate.dat and saving +% to arbitrary filenames by the \cmd{\SaveRubikState} command). Otherwise, we +% can easily exceed the LaTeX limit of 15. From here-on \TeX\ will use openout7 +% when opening and writing to files. We will implement new openings using +% the command \verb!\@openstatefile! (see below). +% \begin{macrocode} +\typeout{---setting up newwrite for rubikrotation to use...}% +\newwrite\outfile% +% \end{macrocode} +% +% +% \begin{macro}{\@openstatefile} +% \begin{macro}{\@closestatefile} +% We also need commands for easy file opening and and closing +% for new instances of the file \texttt{rubikstate.dat} etc. +% Note that for this we are therefore using the same outfile number as set up +% by the \verb!\newwrite...! above. +% \begin{macrocode} +\newcommand{\@openstatefile}{\immediate\openout\outfile=rubikstate.dat} +\newcommand{\@closestatefile}{\immediate\closeout\outfile} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \subsection{Saving the Rubik state} +% +% \begin{macro}{\@printrubikstate} +% This command writes the Rubik configuration (state) to +% the file \texttt{rubikstate.dat}, and is used by the \cmd{\RubikRotation} command. +% The file \texttt{rubikstate.dat} is read by the Perl program, and represents +% the state on which the new \cmd{\RubikRotation} command acts. +% Note that we append the key-word \texttt{checkstate} to the end of the file +% in order to trigger the Perl program to implement its \texttt{checkstate} subroutine. +% \begin{macrocode} +\newcommand{\@printrubikstate}{% + \@print{up,\Ult,\Umt,\Urt,\Ulm,\Umm,\Urm,\Ulb,\Umb,\Urb}% + \@print{down,\Dlt,\Dmt,\Drt,\Dlm,\Dmm,\Drm,\Dlb,\Dmb,\Drb}% + \@print{left,\Llt,\Lmt,\Lrt,\Llm,\Lmm,\Lrm,\Llb,\Lmb,\Lrb}% + \@print{right,\Rlt,\Rmt,\Rrt,\Rlm,\Rmm,\Rrm,\Rlb,\Rmb,\Rrb}% + \@print{front,\Flt,\Fmt,\Frt,\Flm,\Fmm,\Frm,\Flb,\Fmb,\Frb}% + \@print{back,\Blt,\Bmt,\Brt,\Blm,\Bmm,\Brm,\Blb,\Bmb,\Brb}% + \@print{checkstate}% +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{RubikRotation command} +% +% \begin{macro}{\RubikRotation} +% The \cmd{\RubikRotation}\marg{comma separated sequence} +% command (a)~writes the current Rubik state to the file +% \texttt{rubikstate.dat}, and then (b)~CALLs the Perl program. +% It also writes comments to the data file and also to the log file. +% \begin{macrocode} +\newcommand{\RubikRotation}[1]{\IfFileExists{\rubikperlname}{% + \typeout{---NEW rotation command------------------}% + \typeout{---command = RubikRotation{#1}}% + \typeout{---Perl script \rubikperlname\space exists OK}% + \typeout{---writing current Rubik state to file rubikstate.dat}% + \@openstatefile% open data file + \@print{\@comment filename: rubikstate.dat}% + \@printrubikstate% + \@print{rotation,#1}% + \@closestatefile% close data file + \typeout{---running Perl script}% + \immediate\write18{\rubikperlcmd}% + \typeout{---inputting NEW datafile (from Perl)}% + \input{rubikstateNEW.dat}% + \typeout{-----------------------------------------}% + }{\typeout{** ERROR: \rubikperlname\space does not exist}% +}} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{ShowRubikErrors command} +% +% \begin{macro}{\ShowRubikErrors} +% This command inputs the file \texttt{rubikstateERRORS.dat}. +% \begin{macrocode} +\newcommand{\ShowRubikErrors}{% + \typeout{---ShowRubikErrors: inputting file rubikstateERRORS.dat}% + \VerbatimInput{rubikstateERRORS.dat}} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{CheckRubikState command} +% +% \begin{macro}{\CheckRubikState} +% This command triggers the Perl program to implement +% some simple error checking of the Rubik configuration (state). +% This command (a)~writes the current Rubik state to the file +% \texttt{rubikstate.dat}, and then (b)~CALLs the Perl program. +% It also writes comments to the data file and also to the log file.. +% \begin{macrocode} +\newcommand{\CheckRubikState}{\IfFileExists{\rubikperlname}{% + \typeout{---NEW check command------------------}% + \typeout{---command = CheckRubikState}% + \typeout{---Perl script \rubikperlname\space exists OK}% + \typeout{---writing current Rubik state to file rubikstate.dat}% + \@openstatefile% opens data file + \@print{\@comment filename: rubikstate.dat}% + \@printrubikstate% + \@closestatefile% close data file + \typeout{---running Perl script}% + \immediate\write18{\rubikperlcmd}% + \typeout{---inputting NEW datafile (from Perl)}% + \input{rubikstateNEW.dat}% + \typeout{-----------------------------------------}% + }{\typeout{** ERROR: \rubikperlname\space does not exist}% +}} +% \end{macrocode} +% \end{macro} +% +% +% +% \subsection{SaveRubikState macro} +% +% \begin{macro}{\SaveRubikState} +% The command \cmd{\SaveRubikState}\marg{filename} saves the Rubik state +% to a file. Note that in order to actually write a LaTeX +% command to a file without a trailing space one must use the +% \cmd{\string} command (see the book ``TeX by Topic'', p~238). +% Note that this macro uses the two internal commands \cmd{\Rubik@comment} +% and \cmd{\Rubik@print}. \#1 is the output filename. +% We use several \cmd{\typeout} commands to write to the log file. +% \begin{macrocode} +\newcommand{\SaveRubikState}[1]{% +\typeout{---NEW save command------------------}% +\typeout{---command = SaveRubikState{#1}}% +\typeout{---saving Rubik state data to file #1}% +\immediate\openout\outfile=#1% +\@print{\@comment filename: #1\@commentone}% +\@print{\string\RubikFaceUp% + {\Ult}{\Umt}{\Urt}{\Ulm}{\Umm}{\Urm}{\Ulb}{\Umb}{\Urb}\@commentone}% +\@print{\string\RubikFaceDown% + {\Dlt}{\Dmt}{\Drt}{\Dlm}{\Dmm}{\Drm}{\Dlb}{\Dmb}{\Drb}\@commentone}% +\@print{\string\RubikFaceLeft% + {\Llt}{\Lmt}{\Lrt}{\Llm}{\Lmm}{\Lrm}{\Llb}{\Lmb}{\Lrb}\@commentone}% +\@print{\string\RubikFaceRight% + {\Rlt}{\Rmt}{\Rrt}{\Rlm}{\Rmm}{\Rrm}{\Rlb}{\Rmb}{\Rrb}\@commentone}% +\@print{\string\RubikFaceFront% + {\Flt}{\Fmt}{\Frt}{\Flm}{\Fmm}{\Frm}{\Flb}{\Fmb}{\Frb}\@commentone}% +\@print{\string\RubikFaceBack% + {\Blt}{\Bmt}{\Brt}{\Blm}{\Bmm}{\Brm}{\Blb}{\Bmb}{\Brb}\@commentone}% +\immediate\closeout\outfile% +\typeout{-----------------------------------------}% +}% +% \end{macrocode} +% \end{macro} +% +% +% -------------------------- +% End of this package +% -------------------------- +% \begin{macrocode} +%</rubikrotation> +% \end{macrocode} +% +% +% +% +% \Finale +% +\endinput + + + + + diff --git a/Master/texmf-dist/source/latex/rubik/rubikrotation.ins b/Master/texmf-dist/source/latex/rubik/rubikrotation.ins new file mode 100644 index 00000000000..3f1f2f1f354 --- /dev/null +++ b/Master/texmf-dist/source/latex/rubik/rubikrotation.ins @@ -0,0 +1,75 @@ +%% rubikrotation.ins +%% --- automatic overwriting of .sty is disabled------- +%% ========================================================= +%% Authors: RWD Nickalls (dick@nickalls.org) +%% and Apostolos Syropoulos (asyropoulos@yahoo.com) +%% Copyright January 20, 2014 RWD Nickalls + A Syropoulos +%% +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any +%% later version: <http://www.latex-project.org/lppl.txt> +%% +%% This work consists of the files listed in the README file. +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this work when run through +%% LaTeX. +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\batchfile{rubikrotation.ins} +\input docstrip.tex + +\preamble + +----------------------------------------------------------------- + Authors: RWD Nickalls (dick@nickalls.org) + and Apostolos Syropoulos (asyropoulos@yahoo.com) + Copyright January 2014 RWD Nickalls and A Syropoulos + + + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3c of this license or (at your option) any + later version: <http://www.latex-project.org/lppl.txt> + + This work consists of the files listed in the README file. +----------------------------------------------------------------- + + This is a LaTeX/TikZ package for drawing Rubik cubes + Please report errors or suggestions for improvement to + + RWD Nickalls (dick@nickalls.org) + Apostolos Syropoulos (asyropoulos@yahoo.com) + + This package requires the basic TikZ package to be loaded already +------------------------------------------------------------------ +\endpreamble + +\keepsilent %%disables most of the screen output +%% \askforoverwritefalse %%enables automatic overwriting of .sty +\generate{\file{rubikrotation.sty}{\from{rubikrotation.dtx}{rubikrotation}}} + +%%now write a screen message for the user +\obeyspaces +\Msg{*******************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the *} +\Msg{* following file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* rubikrotation.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file *} +\Msg{* rubikrotation.dtx through LaTeX. *} +\Msg{* For an index, process any filename.idx file by *} +\Msg{* makeindex -s gind.ist filename *} +\Msg{* For list of changes, process any filename.glo file *} +\Msg{* makeindex -s gglo.ist -o filename.gls filename.glo *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{*******************************************************} + +\endbatchfile +%%------------EOF--------------- |