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/tex/latex/rubik/rubikrotation.sty | |
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/tex/latex/rubik/rubikrotation.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/rubik/rubikrotation.sty | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty b/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty new file mode 100644 index 00000000000..bbb8d0f1a43 --- /dev/null +++ b/Master/texmf-dist/tex/latex/rubik/rubikrotation.sty @@ -0,0 +1,160 @@ +%% +%% This is file `rubikrotation.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% rubikrotation.dtx (with options: `rubikrotation') +%% +%% ----------------------------------------------------------------- +%% 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 +%% ------------------------------------------------------------------ + +%%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} + + +\def\RRfileversion{2.0}% +\def\RRfiledate{2014/01/20}% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{rubikrotation}[\RRfiledate\space (v\RRfileversion)] +\@ifpackageloaded{rubikcube}{}{% + \typeout{---rubikrotation requires the rubikcube package.}% + }% +\@ifpackageloaded{fancyvrb}{}{% + \typeout{---rubikrotation requires the fancyvrb package% + for VerbatimInput{} command.}% + \RequirePackage{fancyvrb}} +\newcommand{\rubikrotation}{\textsf{rubikrotation}} +{\catcode`\%=12 \global\def\rubikpercentchar{%}}% +\newcommand{\@comment}{\rubikpercentchar\rubikpercentchar\space}% +\newcommand{\@commentone}{\rubikpercentchar}% +%% We need a simple print command for writing comments to a file. +\newcommand{\@print}[1]{\immediate\write\outfile{#1}} +\newcommand{\rubikperlname}{rubikrotation.pl} +\newcommand{\rubikperlcmd}{perl \rubikperlname} +\typeout{---checking for config file (rubikrotation.cfg)...} +\IfFileExists{rubikrotation.cfg}{% + \input{rubikrotation.cfg}% + }{\typeout{---no config file available}% +}% +\typeout{---cleaning file rubikstateNEW.dat}% +\newwrite\outfile% +\immediate\openout\outfile=rubikstateNEW.dat% +\@print{\@comment rubikstateNEW.dat (by TeX)}% +\immediate\closeout\outfile% +\typeout{---creating file rubikstateERRORS.dat}% +\newwrite\outfile% +\immediate\openout\outfile=rubikstateERRORS.dat% +\@print{\@comment rubikstateERRORS.dat}% +\typeout{---checking for Perl script \rubikperlname...} + \IfFileExists{\rubikperlname}{% + \typeout{---\rubikperlname\space exists OK}% + }{\typeout{** ERROR: cannot find Perl program \rubikperlname}% + \@print{\@comment ** ERROR: cannot find Perl program \rubikperlname}}% +\immediate\closeout\outfile% +\typeout{---setting up newwrite for rubikrotation to use...}% +\newwrite\outfile% +\newcommand{\@openstatefile}{\immediate\openout\outfile=rubikstate.dat} +\newcommand{\@closestatefile}{\immediate\closeout\outfile} +\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}% +} +\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}% +}} +\newcommand{\ShowRubikErrors}{% + \typeout{---ShowRubikErrors: inputting file rubikstateERRORS.dat}% + \VerbatimInput{rubikstateERRORS.dat}} +\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}% +}} +\newcommand{\SaveRubikState}[1]{% +\typeout{---NEW save command------------------}% +\typeout{---command = SaveRubikState{#1}}% +\typeout{---saving Rubik state data to file #1}% +\immediate\openout\outfile=#1% +\@print{\@comment filename: #1\@commentone}% +\@print{\string\RubikFaceUp% + {\Ult}{\Umt}{\Urt}{\Ulm}{\Umm}{\Urm}{\Ulb}{\Umb}{\Urb}\@commentone}% +\@print{\string\RubikFaceDown% + {\Dlt}{\Dmt}{\Drt}{\Dlm}{\Dmm}{\Drm}{\Dlb}{\Dmb}{\Drb}\@commentone}% +\@print{\string\RubikFaceLeft% + {\Llt}{\Lmt}{\Lrt}{\Llm}{\Lmm}{\Lrm}{\Llb}{\Lmb}{\Lrb}\@commentone}% +\@print{\string\RubikFaceRight% + {\Rlt}{\Rmt}{\Rrt}{\Rlm}{\Rmm}{\Rrm}{\Rlb}{\Rmb}{\Rrb}\@commentone}% +\@print{\string\RubikFaceFront% + {\Flt}{\Fmt}{\Frt}{\Flm}{\Fmm}{\Frm}{\Flb}{\Fmb}{\Frb}\@commentone}% +\@print{\string\RubikFaceBack% + {\Blt}{\Bmt}{\Brt}{\Blm}{\Bmm}{\Brm}{\Blb}{\Bmb}{\Brb}\@commentone}% +\immediate\closeout\outfile% +\typeout{-----------------------------------------}% +}% +\endinput +%% +%% End of file `rubikrotation.sty'. |