From 542c5a785f8db8d4469e296c69c86bc030285f68 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 12 Jul 2017 23:23:45 +0900 Subject: add acromemory --- texmf-dist/source/latex/acromemory/acromemory.dtx | 918 +++++++++++++++++++++ texmf-dist/source/latex/acromemory/acromemory.ins | 59 ++ .../source/latex/acromemory/aeb_pro/aeb_pro.js | 106 +++ .../source/latex/acromemory/doc/acromemory_man.tex | 510 ++++++++++++ 4 files changed, 1593 insertions(+) create mode 100644 texmf-dist/source/latex/acromemory/acromemory.dtx create mode 100644 texmf-dist/source/latex/acromemory/acromemory.ins create mode 100644 texmf-dist/source/latex/acromemory/aeb_pro/aeb_pro.js create mode 100644 texmf-dist/source/latex/acromemory/doc/acromemory_man.tex (limited to 'texmf-dist/source') diff --git a/texmf-dist/source/latex/acromemory/acromemory.dtx b/texmf-dist/source/latex/acromemory/acromemory.dtx new file mode 100644 index 00000000..8770f3c3 --- /dev/null +++ b/texmf-dist/source/latex/acromemory/acromemory.dtx @@ -0,0 +1,918 @@ +% \iffalse +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% acromemory.sty package, %% +%% Copyright (C) 2006--2017 D. P. Story %% +%% dpstory@acrotex.net %% +%% %% +%% This program can redistributed and/or modified under %% +%% the terms of the LaTeX Project Public License %% +%% Distributed from CTAN archives in directory %% +%% macros/latex/base/lppl.txt; either version 1.2 of %% +%% the License, or (at your option) any later version. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{acromemory} +% [2017/02/23 v1.1 AcroMemory (dps)] +%<*driver> +\documentclass{ltxdoc} +\usepackage[colorlinks,hyperindex]{hyperref} +\pdfstringdefDisableCommands{\let\\\textbackslash}% +\EnableCrossrefs \CodelineIndex +\OnlyDescription % comment out for implementation details +\begin{document} + \GetFileInfo{acromemory.sty} + \title{The \texttt{AcroMemory} Package\texorpdfstring{\\}{: } + A member of the AeB Pro family} + \author{D. P. Story\\ + Email: \texttt{storyd@owc.edu}} + \date{processed \today} + \maketitle + \tableofcontents + \let\Email\texttt + \DocInput{acromemory.dtx} + \PrintIndex +\end{document} +% +% \fi +% \section{What is the AeB Pro Family?} +% Through the years, I have tried to make my AeB software +% ({Acro\negthinspace\TeX} eDucation Bundle) compatible with +% \textsf{pdftex} and \textsf{dvipdfm}; however, during that time, +% I've developed a number of techniques that require the use of +% Acrobat and distiller. Therefore, I have set off in a new direction and +% will be publishing a new line of {\LaTeX} packages, one that require the use +% of Acrobat. +% +% The current package, \textsf{AcroMemory}, requires the use of Acrobat Pro~7.0 or later. +% \section{Introduction} +% +% At the instigation of my erstwhile friend, J\"{u}ergen, I present to you \textsf{AcroMemory}, and +% for the life of me, I can't remember why. +% +% Oh, yes, \textsf{AcroMemory} is a memory game in which you find the matching tiles. There are two versions +% ---available as options of this package---for your enjoyment, +% \texttt{acromemory1} and \texttt{acromemory2} (the default). +% \begin{itemize} +% \item \texttt{acromemory1}: Here you have a single game board, a rectangular region divided +% by rows and columns. The total number of tiles should +% be even, each tile should have a matching twin. The +% game begins with all the tiles hidden. the user clicks a tile, +% then another. If the tiles do not match, they become become hidden again +% (you did remember the position of those tiles, didn't you?); otherwise, +% they remain visible and are now read-only. The game is complete when the user, with +% a lot of time on his/her hands, matches all tiles. There is a running tabulation kept +% on the number of tries. There is also a button which resets the game and randomizes the +% tiles. +% \item \texttt{acromemory2}: For this game you have two identical rectangular images subdivided in%to tiles +% (or slices) arrayed in rows and columns. The tiles for +% one of the two images has been randomly re-arranged. The object of the game is to find all the +% matching tiles by choosing a tiles from one image, and tile from the other image. As in the +% first case, if the selected tiles do not match, they are hidden after an short interval of time +% (you did remember the position of those tiles, didn't you?); otherwise, they remain visible and +% are now read-only. The game is over when all tiles are matched, when this occurs, end-of-game +% special effects occur that will dazzle the senses. There is an option to view a small image to +% help you locate the matching tiles on the non-randomized; useful if the image is complex. There +% is no reset button at this time, to play again, the user must close and open the document. +% \end{itemize} +% The demo files are \texttt{acromemory1.tex} and \texttt{acromemory2.tex}. These files show how to +% lay out the various elements of this package. +% +% \section{Creating the Image Tiles} +% +% There are a couple of ways you can package your image tiles: (1) place all tiles (all of identical size) +% into a single PDF and use the \texttt{iconfile} option to tell AcroMemory you are using this method; (2) +% each image file is a separate PDF. In the latter case, there is a naming convention that must be followed; +% the files must be named \texttt{\_01.pdf}, \texttt{\_02.pdf}, \dots, +% \texttt{\_10.pdf}, \texttt{\_11.pdf}, \dots. You'll note the consistent two digit +% numbering system is used. + +% For \texttt{acromemory2}, slicing of the image is at the very heart +% of this game. You can slice an image in to rectangular tiles using +% any of several applications: \textsf{Adobe Illustrator}, +% \textsf{Photoshop} and \textsf{ImageReady}, for example. But these are +% expensive applications and you have already bought \textsf{Acrobat Pro}. For this purpose, +% AeB Pro provides the \textsf{AcroSlicing} batch sequence. +% +% \begin{macrocode} +%<*package> +\RequirePackage{xkeyval} +% \end{macrocode} +% \begin{macro}{acromemory1} +% One playing board, where you try to match identical icons. +% \begin{macrocode} +\DeclareOptionX{acromemory1}{\acromemoryitrue} +% \end{macrocode} +% \end{macro} +% \begin{macro}{acromemory2} +% Two playing boards, one board randomized the other not. Try to find the matching icons, +% one from each of the two boards. +% \begin{macrocode} +\DeclareOptionX{acromemory2}{\acromemoryifalse} +% \end{macrocode} +% \end{macro} +% \begin{macro}{acromemory2} +% Two playing boards, one board randomized the other not. Try to find the matching icons, +% one from each of the two boards. +% \begin{macrocode} +\DeclareOptionX{iconfile}{\def\iconsInOneFile{true}} +\def\iconsInOneFile{false} +% \end{macrocode} +% \end{macro} +% \begin{macro}{includehelp} +% Only valid when \texttt{acromemory2} is taken, this option allows you to provide a +% figure showing the completed puzzle. +% \begin{macrocode} +\DeclareOptionX{includehelp}{\includehelptrue} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\newif\ifincludehelp \includehelpfalse +\newif\ifacromemoryi \acromemoryifalse +\ProcessOptionsX +\RequirePackage{graphicx} +\RequirePackage{comment} +\ifacromemoryi + \def\RanIdentifier{\@gobble} + \includecomment{acromemory1} + \excludecomment{acromemory2} + \excludecomment{needhelp} +\else + \def\RanIdentifier{R\@gobble} + \includecomment{acromemory2} + \excludecomment{acromemory1} + \ifincludehelp + \includecomment{needhelp} + \else + \excludecomment{needhelp} + \fi +\fi +% \end{macrocode} +% \section{Main Macro Code} +% When setting up your AcroMemory document, you need to provide this package with +% certain information, as listed below. +% \begin{macro}{\theTotalTiles} +% \begin{macro}{\theNumRows} +% \begin{macro}{\theNumCols} +% \begin{macro}{\theImportPath} +% \begin{macro}{\theIconExt} +% \begin{macro}{\theTeXImageWidth} +% \begin{macro}{\provideDimensions} +%\begin{itemize} +% \item \cs{theTotalTiles}: The total number of tiles in the game board. For example, +% \verb!\theTotalTiles{20}!. This parameter is required. +% \item \cs{theNumRows}: The number of rows in the game board. For example, +% \verb!\theNumRows{5}!. This parameter is required. +% \item \cs{theNumCols}: The number of columns in the game board. For example, +% \verb!\theNumCols{4}!. This parameter is required. +% \item \cs{theImportPath}: The import path to the basename of the image. The path +% should use the path specification as defined in the PDF Ref, and the file name should +% have no extension. For example, \verb!\theImportPath{myFig/myimages}!. Required. +% There is an optional argument that is typically used when the iconfile is in effect +% with the acromemory2 option, and an image of the game board is different from the +% path given by the optional argument; for example, +%\begin{verbatim} +% \theImportPath[dpsweb/dpsweb]{dpsweb/dpsweb_package} +%\end{verbatim} +% The required argument points the packaged icons, the optional argument points to +% a file showing the entire image +% \item \cs{theIconExt}: The extension of the image file(s), Required if different +% from \texttt{pdf}. +% \item \cs{theTeXImageWidth}: The scaled width of the rectangular game board. The +% game board will be rescaled so that its width is equal to the value specified +% by the argument of this command, e.g., \verb!\theTeXImageWidth{2in}!. +% \item\cs{provideDimensions}: If the dimension of the game board is known, the width +% and height can be entered with this command using the two parameters. For example, +% \verb!\provideDimensions{2in}{2.5in}! (width, height). +%\end{itemize} +% \begin{macrocode} +\def\theTotalTiles#1{\def\nTotalTiles{#1}} +\def\theNumRows#1{\def\nRows{#1}} +\def\theNumCols#1{\def\nCols{#1}} +\newcommand{\theImportPath}[2][]{% + \ifacromemoryi + \def\imageImportPath{#2} + \def\importpath{#2} + \else + \def\argi{#1}\ifx\argi\@empty + \def\imageImportPath{#2} + \def\importpath{#2} + \else + \def\imageImportPath{#1} + \def\importpath{#2} + \fi + \fi +} +\def\theIconExt#1{\def\iconsExt{#1}} +\def\iconsExt{pdf} +\def\theTeXImageWidth#1{\def\texImageWidth{#1}% + {\dimen0 = \texImageWidth \xdef\imageWidth{\strip@pt\dimen0 }}% +} +\newcommand{\provideDimensions}[3][]{% + \def\argi{#1}\ifx\argi\@empty + {\dimen0 = #2 \xdef\trueImageWidth{\strip@pt\dimen0 }% + \dimen0 = #3 \xdef\trueImageHeight{\strip@pt\dimen0 }}% + \else + \def\trueImageWidth{#1}\def\trueImageHeight{#2}% + \fi + \def\bProvideDimen{true}% +} +\def\bProvideDimen{false}% +\def\trueImageWidth{0}\def\trueImageHeight{0}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\bDebug} +% A debugging command. When executed in the preamble, more is written to the Acrobat console +% as the document is opened the first time, also, the icons are initially visible so you can +% see the layout, and quickly play the game. This was used in development extensively to help +% develop the JavaScript. +% \begin{macrocode} +\def\bDebug{\def\memDebug{true}} +\def\memDebug{false} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\helpImage} +% \begin{macro}{\rolloverHelpButton} +% \begin{macro}{\setHelpImageWidth} +% \begin{macro}{\theHelpCaption} +% When \texttt{acromemory2} options and the \texttt{includehelp} +% options are taken, these commands are available. The command +% \cs{helpImage} will contain an icon of the puzzle, and it width +% is set by the command \cs{setHelpImageWidth}. The image is normally +% hidden until the user rolls over the \cs{rolloverHelpButton}. The +% icons appears with an caption under it, the content of the caption +% can be entered using \cs{theHelpCaption}. +% \begin{macrocode} +\newcommand{\helpImage}[1][]{{% + \ifincludehelp{\setbox0 = \hbox{% + \includegraphics[draft,width=\helpImageWidth]% + {\imageImportPath}}%[\Ff\FfReadOnly] + \dimen0=\ht0 \advance\dimen0by14bp\ht0=\dimen0 + \pushButton[\BC{}\BG{}\S{S}#1]{memoryhelp}{\the\wd0}{\the\ht0}}\fi +}} +\newcommand{\rolloverHelpButton}[3][]{% + \ifincludehelp + \pushButton[\CA{Help}\BC{0 0 1}\BG{0.89 0.9 0.9} + \AA{\AAMouseEnter{\JS{% + var f = this.getField("memoryhelp");\r + oIcon = f.buttonGetIcon(1);\r + f.buttonPosition = position.iconTextV;\r + f.buttonSetIcon(oIcon,0);\r + f.buttonSetCaption({cCaption: "\helpCaption"});\r + f.textColor=color.blue;\r + }}% + \AAMouseExit{\JS{% + var f = this.getField("memoryhelp");\r + f.buttonPosition = position.iconOnly;\r + f.buttonSetIcon(nullIcon,0); + }}}#1]{checkhelp}{#2}{#3}% + \fi +} +\newcommand{\setHelpImageWidth}[1]{\def\helpImageWidth{#1}} +\def\helpImageWidth{1in} +\def\theHelpCaption#1{\def\helpCaption{#1}} +\theHelpCaption{A little help} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\messageBox} +% A message text field, as the user works the puzzle, the progress is reported +% to this field. +% \begin{macrocode} +\newcommand{\messageBox}[3][]{% + \textField[#1\Ff\FfMultiline]{MsgBox}{#2}{#3}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\playItAgain} +% For the \texttt{acromemory1} option, this button can be placed to reset +% the game board, the icons are rearranged hand hidden again. +% \begin{macrocode} +\newcommand{\playItAgain}[3][]{\ifacromemoryi{\small + \pushButton[\CA{Play again}#1\A{\JS{playagain();}}]% + {playAgain}{#2}{#3}}% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ulCornerHere} +% \begin{macro}{\LulCornerHere} +% \begin{macro}{\RulCornerHere} +% \begin{macro}{\reserveSpaceByDimension} +% \begin{macro}{\reserveSpaceByFile} +% This group of buttons appear together. \cs{ulCornerHere} is used to +% set the upper left corner of the game board in the case of the +% \texttt{acromemory1} option; while \cs{LulCornerHere} and \cs{RulCornerHere} +% do the same thing for the \texttt{acromemory2} option. One of the two commands +% \cs{reserveSpaceByDimension} or \cs{reserveSpaceByFile} immediately follow +% the `corner' commands. +% \begin{macrocode} +\def\ulCornerHere{\makebox[0pt][l]% + {\pushButton[\autoCenter{n}]{ulcorner}{0pt}{0pt}% + \pushButton[\autoCenter{n}\BC{}\BG{}\FB{true}\I{null}\TP{1}]{nullIconBtn}{0pt}{0pt}% + }} +\def\LulCornerHere{\makebox[0pt][l]% + {\pushButton[\autoCenter{n}]{Lulcorner}{0pt}{0pt}% + \pushButton[\autoCenter{n}\BC{}\BG{}\FB{true}\I{null}\TP{1}]{nullIconBtn}{0pt}{0pt}% + }} +\def\RulCornerHere{\makebox[0pt][l]% + {\pushButton[\autoCenter{n}]{Rulcorner}{0pt}{0pt}}} +% \end{macrocode} +% The two arguments are $\texttt{\#1} = \mbox{width}$ and $\texttt{\#2} = \mbox{height}$. +% \begin{macrocode} +\def\reserveSpaceByDimension#1#2{% + \hbox{\ifpreview\setlength\fboxrule{0.4pt}\setlength\fboxsep{0pt}% + \@tempdima=#1\advance\@tempdima by-\fboxrule + \@tempdimb=#2\advance\@tempdimb by-\fboxrule + \fbox{\parbox[t][\@tempdimb][t]{\@tempdima}{\kern0pt\hfill\vfill}}% + \else\parbox[t][#2][t]{#1}{\kern0pt\hfill\vfill}\fi}% +} +% \end{macrocode} +% The optional argument can be used to insert a file that has the same aspect ratio as +% the puzzle, the default is the one specified by the optional argument of +% \cs{theImportPath}, which, if not specified, is the same as the required argument +% of \cs{theImportPath} +% \begin{macrocode} +\newcommand{\reserveSpaceByFile}[1][\imageImportPath]% + {{\setbox0=\hbox{\includegraphics[draft,width=\texImageWidth]{#1}}% + \reserveSpaceByDimension{\wd0}{\ht0}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \section{Document JavaScript for \textsf{AcroMemory}} +% Most of the work of this package is done with document JavaScript, and here +% it is. +%\par\medskip\noindent +%\StopEventually{JavaScript listing suppressed, +% comment out \cs{OnlyDescription} at the beginning of this file to see +% the JavaScript.} +% \begin{macrocode} +\begin{insDLJS*}[_MemLoaded]{memjs} +\begin{newsegment}{AcroMemory 1: Global Data and Initialization} +// Global Data: +_MemLoaded=true; +var randomDPS = new Array(\nTotalTiles+1); +var imageNames = new Array(); +imageNames.push("null"); + +var dpsl = randomDPS.length; +var timeout = 10; +var shutdown, rAE; +var ok2Continue = true; +var nRows = \nRows; +var nCols = \nCols; +var nCorrect = 0; +var nAttempts = 0; + +for (i=1; i<=\nTotalTiles; i++) randomDPS[i]=i; +% \end{macrocode} +% We get the push button with a null icon (nullIconBtn) We get the null icon object +% from it. This technique eliminates the previous need for the Acrobat application when +% viewing the game. +% \changes{v1.1}{2017/02/23}{use f.buttonGetIcon to get null icon object} +% \begin{macrocode} +var f=this.getField("nullIconBtn"); +var nullIcon=f.buttonGetIcon(); +var debug = \memDebug; +\end{newsegment} + +\begin{acromemory1} +\begin{newsegment}{AcroMemory 2: Initialize Pic Names} +var nttl = \nTotalTiles/2; +for ( var i = 1; i <= nttl; i++) +{ + imageNames.push("pic"+i +".0"); + imageNames.push("pic"+i +".1"); +} +var currentChoice = ""; +var currentTile1 = 0; +var currentTile2 = 0; +var currentIconName = ""; +\end{newsegment} +\end{acromemory1} +\begin{acromemory2} +\begin{newsegment}{AcroMemory 2: Initialize Pic Names} +var nttl = \nTotalTiles; +for ( var i = 1; i <= nttl; i++) +{ + imageNames.push("pic."+i); +} +var LcurrentChoice = 0; +var LcurrentTile = 0; +var RcurrentChoice = 0; +var RcurrentTile = 0; +\end{newsegment} +\end{acromemory2} +\begin{newsegment}{AcroMemory 3: Bubble Sort} +// Clear DPS: + +function clearDPS() +{ + for ( var i=1; i<=\nTotalTiles; i++ ) + { + var f = this.getField("Mem\RanIdentifier button."+i); + f.buttonSetIcon(nullIcon); + } +} + +// Mixup DPS: +function mixupDPS() +{ + var i, rand; + for (i=1; i<= \nTotalTiles; i++) + { + var rand = Math.random(); + rand *= dpsl*dpsl; + rand = Math.ceil(rand); + rand = rand \% dpsl; + if (rand == 0 ) rand = 1; + temp = randomDPS[i]; + randomDPS[i]=randomDPS[rand]; + randomDPS[rand]=temp; + } +} + +// Show DPS: +function showDPS() +{ + for ( var i=1; i<=\nTotalTiles; i++ ) + { + var oIcon = this.getIcon(imageNames[randomDPS[i]]); + var f = this.getField("Mem\RanIdentifier button."+i); + f.buttonSetIcon(oIcon); + } +} + +// Sortout DPS: begin bubble sort +function sortoutDPS() +{ + outerLoop(randomDPS.length-1); +} +function outerLoop(i) +{ + if ( ok2Continue && (i >= 0) ) shutdown = app.setTimeOut("app.clearTimeOut(shutdown); innerLoop("+i+",1);", timeout); +} +function innerLoop(i,j) +{ + if ( j <= i ) + { + if (randomDPS[j-1] > randomDPS[j]) + { + var temp = randomDPS[j-1]; + randomDPS[j-1] = randomDPS[j]; + randomDPS[j] = temp; + var oIcon = this.getIcon(imageNames[randomDPS[j-1]]); + var f = this.getField("Mem\RanIdentifier button."+(j-1)); + f.buttonSetIcon(oIcon); + var oIcon = this.getIcon(imageNames[randomDPS[j]]); + var f = this.getField("Mem\RanIdentifier button."+j); + f.buttonSetIcon(oIcon); + } + j++ + if ( ok2Continue ) shutdown = app.setTimeOut("app.clearTimeOut(shutdown); innerLoop("+i+","+j+");", timeout); + } + else + { + i--; + outerLoop(i); + } +} +function randomizePuzzle() { + mixupDPS(); + for ( var i=1; i<=\nTotalTiles; i++) { + var g = this.getField("Mem\RanIdentifier button."+i); + var oIcon = this.getIcon(imageNames[randomDPS[i]]); + g.buttonSetIcon(oIcon,1); + if (debug) g.buttonSetIcon(oIcon,0); + } +} +\end{newsegment} +\begin{acromemory1} +\begin{newsegment}{AcroMemory 4: Tile Processing} +function selectTile() // right side randomly arranged +{ + var f = event.target; + var oIcon = f.buttonGetIcon(1); + f.buttonSetIcon(oIcon,0); + var fname = f.name; + var re1 = /Membutton\.(\d+)/; + var index = re1.exec(fname); + if (debug) console.println("index = " + index[1]); + var thisiconName = imageNames[randomDPS[index[1]]]; + if (debug) console.println("thisiconName = " + thisiconName); + var re = /pic(\d+)\.(\d)/; + var image = re.exec(thisiconName) + if (debug) console.println("selected: " + image[1] + "." + image[2]); + if ( currentChoice == "" ) { + currentChoice = fname; + currentTile1=image[1]; + currentTile2=image[2]; + currentIconName = thisiconName; + return; + } + if ( (image[1] == currentTile1) && (image[2] != currentTile2) ) + { // right choice + nCorrect++; + nAttempts++ + f.readonly = true; + var g = this.getField(currentChoice); + g.readonly = true; + reportProgress(nCorrect,nAttempts); + resetCounters(); + + } else { // wrong choice + nAttempts++ + reportProgress(nCorrect,nAttempts); + rAE = app.setTimeOut("resetAfterError(\""+currentChoice+"\",\""+fname+"\")", 1000); + resetCounters(); + } + +} +function resetCounters () +{ + currentChoice = ""; + currentTile1 = 0; + currentTile2 = 0; + currentIconName = ""; +} +function resetAfterError(l,r) +{ + try { app.clearTimeOut(rAE); } catch(e) {}; + var f = this.getField(l); + var g = this.getField(r); + if (!debug) g.buttonSetIcon(nullIcon,0); +// g.strokeColor=color.black; + if (!debug) f.buttonSetIcon(nullIcon,0); +// f.strokeColor=color.black; +} +function executePostGameEffects() {return;} +function playagain() +{ + for ( var i=1; i<=\nTotalTiles; i++) { + var g = this.getField("Membutton."+i); + g.buttonSetIcon(nullIcon,0); + } + g = this.getField("Membutton"); + g.readonly=false; + resetCounters(); + nCorrect = 0; + nAttempts = 0; + reportProgress(nCorrect,nAttempts); + randomizePuzzle(); +} +\end{newsegment} +\end{acromemory1} +\begin{acromemory2} +\begin{newsegment}{AcroMemory 4: Tile Processing} +function selectRandomTile(nCnt,n) // right side randomly arranged +{ + if ( RcurrentChoice != 0 ) return; + RcurrentChoice = nCnt; + RcurrentTile = n; + nAttempts++; + var f = event.target; + f.strokeColor = ["RGB", 0, .6, 0]; + var oIcon = f.buttonGetIcon(1); + f.buttonSetIcon(oIcon,0); + if ( LcurrentChoice != 0 ) { + if (debug) console.println("LcurrentChoice = " + LcurrentChoice + ", RcurrentChoice = " + RcurrentChoice); + if ( LcurrentChoice == nCnt ) {// right answer + // need to make right side hidden and readonly + // need to make this button readonly + var g = this.getField("MemLbutton."+LcurrentChoice); + g.strokeColor=color.transparent; + g.readonly = true; + f.strokeColor=color.transparent; + f.readonly = true; + if (++nCorrect == \nTotalTiles ) // game complete + executePostGameEffects(); + reportProgress(nCorrect,nAttempts); + resetCounters(); + } else { // wrong answer + // need to set current choices back to zero + reportProgress(nCorrect,nAttempts); + rAE = app.setTimeOut("resetAfterError("+LcurrentTile+","+RcurrentTile+")", 1000); + resetCounters(); + } + } +} +function selectNonRandomTile(nCnt,n) // left side, arranged in natural order +{ + if ( LcurrentChoice != 0 ) return; + LcurrentChoice = nCnt; + LcurrentTile = n; + var f = event.target; + f.strokeColor = ["RGB", 0, .6, 0]; + var oIcon = f.buttonGetIcon(1); + f.buttonSetIcon(oIcon,0); + if ( RcurrentChoice != 0 ) { + if (debug) console.println("LcurrentChoice = " + LcurrentChoice + ", RcurrentChoice = " + RcurrentChoice); + if ( RcurrentChoice == nCnt ) {// right answer + // need to make right side hidden and readonly + // need to make this button readonly + var g = this.getField("MemRbutton."+RcurrentTile); + g.strokeColor=color.transparent; + g.readonly = true; + f.readonly = true; + f.strokeColor=color.transparent; + if (++nCorrect == \nTotalTiles ) // game complete + executePostGameEffects(); + reportProgress(nCorrect,nAttempts); + resetCounters(); + } else { // wrong answer + // need to set current choices back to zero + reportProgress(nCorrect,nAttempts); + rAE = app.setTimeOut("resetAfterError("+LcurrentTile+","+RcurrentTile+")", 1000); + resetCounters(); + } + } +} +function resetCounters () +{ + LcurrentChoice = 0; + RcurrentChoice = 0; + LcurrentTile = 0; + RcurrentTile = 0; +} +function resetAfterError(l,r) +{ + try { app.clearTimeOut(rAE); } catch(e) {}; + var f = this.getField("MemLbutton."+l); + var g = this.getField("MemRbutton."+r); + if (!debug) g.buttonSetIcon(nullIcon,0); + g.strokeColor=color.black; + if (!debug) f.buttonSetIcon(nullIcon,0); + f.strokeColor=color.black; +} +function executePostGameEffects() { + sortoutDPS(); + var fL = this.getField("MemLbutton.1"); + var fR = this.getField("MemRbutton.1"); + var LulCorner = fL.rect; + var RulCorner = fR.rect; + var mWidth = LulCorner[2]-LulCorner[0]; + var mHeight = LulCorner[1]-LulCorner[3]; + var nCnt = 0; + for ( var i=0; i +% \end{macrocode} +% \Finale +\endinput diff --git a/texmf-dist/source/latex/acromemory/acromemory.ins b/texmf-dist/source/latex/acromemory/acromemory.ins new file mode 100644 index 00000000..9fb50c9a --- /dev/null +++ b/texmf-dist/source/latex/acromemory/acromemory.ins @@ -0,0 +1,59 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright 1999-2006 D. P. Story +%% +%% This file is part of the `AcroTeX eDucation Bundle'. +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 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.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\filedate{2006/11/06} +\def\batchfile{acromemory.ins} +% +\input docstrip +\ifx\generate\undefined + \Msg{**********************************************} + \Msg{*} + \Msg{* This installation requires docstrip} + \Msg{* version 2.4 or later.} + \Msg{*} + \Msg{* An older version of docstrip has been input} + \Msg{*} + \Msg{**********************************************} + \errhelp{Move or rename old docstrip.tex and get a newer one.} + \errmessage{Old docstrip in input path} + \batchmode + \csname @@end\endcsname\end +\fi + +\keepsilent +\askforoverwritefalse +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\preamble +\endpreamble +\generate +{% + \file{acromemory.sty}{\from{acromemory.dtx}{copyright,package}} +} + +\Msg{***************************************************************} +\Msg{*} +\Msg{* \space To finish the installation you have to copy the files } +\Msg{*} +\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX} +\Msg{*} +\Msg{***************************************************************} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput diff --git a/texmf-dist/source/latex/acromemory/aeb_pro/aeb_pro.js b/texmf-dist/source/latex/acromemory/aeb_pro/aeb_pro.js new file mode 100644 index 00000000..02b1e658 --- /dev/null +++ b/texmf-dist/source/latex/acromemory/aeb_pro/aeb_pro.js @@ -0,0 +1,106 @@ +/* + AEB Pro Document Assembly Methods + + Copyright (C) 2009 AcroTeX.Net + D. P. Story + http://www.acrotex.net + + Version 1.1 +*/ + +if ( typeof aebTrustedFunctions == "undefined") { + aebTrustedFunctions = app.trustedFunction( function ( doc, oFunction, oArgs ) + { + app.beginPriv(); + var retn = oFunction( oArgs, doc ) + app.endPriv(); + return retn; + }); +} +aebAddWatermarkFromFile = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return retn = doc.addWatermarkFromFile(oArgs); + app.endPriv(); +}); +aebImportIcon = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return retn = doc.importIcon(oArgs); + app.endPriv(); +}); +aebInsertPages = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + try { doc.insertPages(oArgs); } catch(e) {console.println("Error: " + e.toString());} + app.endPriv(); +}) +aebAppOpenDoc = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + try { var retn = app.openDoc(oArgs); } catch(e) {console.println("Error: " + e.toString());} + app.endPriv(); + return retn; +}) +aebImportSound = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return retn = doc.importSound(oArgs); + app.endPriv(); +}); +aebSaveAs = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + app.execMenuItem("Save"); + app.endPriv(); +}); +aebExtractPages = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return retn = doc.extractPages(oArgs); + app.endPriv(); +}); +aebMailDoc = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return retn = doc.mailDoc(oArgs); + app.endPriv(); +}); +aebImportDataObject = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return retn = doc.importDataObject(oArgs); + app.endPriv(); +}); +aebSignatureSign = app.trustPropagatorFunction( function ( oArgs, field ) +{ + app.beginPriv(); + return retn = field.signatureSign(oArgs); + app.endPriv(); +}); +aebSecurityHandlerLogin = app.trustPropagatorFunction( function ( oArgs, securityHandler ) +{ + app.beginPriv(); + return retn = securityHandler.login(oArgs); + app.endPriv(); +}); +aebSecurityGetHandler = app.trustPropagatorFunction( function ( oArgs, security ) +{ + app.beginPriv(); + return retn = security.getHandler(oArgs); + app.endPriv(); +}); +aebAppGetPath = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + var retn = app.getPath(oArgs); + app.endPriv(); + return retn; +}) +aebSignatureSetSeedValue = app.trustPropagatorFunction( function ( oArgs, field ) +{ + app.beginPriv(); + return retn = field.signatureSetSeedValue(oArgs); + app.endPriv(); +}); + diff --git a/texmf-dist/source/latex/acromemory/doc/acromemory_man.tex b/texmf-dist/source/latex/acromemory/doc/acromemory_man.tex new file mode 100644 index 00000000..fd8869d5 --- /dev/null +++ b/texmf-dist/source/latex/acromemory/doc/acromemory_man.tex @@ -0,0 +1,510 @@ +\documentclass{article} +\usepackage[fleqn]{amsmath} +\usepackage[ + web={centertitlepage,designv,forcolorpaper,usesf,tight,latextoc,pro}, + eforms, +% linktoattachments, + aebxmp +]{aeb_pro} +%\usepackage{aeb_mlink} +%\usepackage{myriadpro} +%\usepackage[usecmtt]{myriadpro} +\usepackage[altbullet]{lucidbry} +\usepackage{acroman} + +%\usepackage{myriadpro} +%\usepackage{acaslonpro} +%\usepackage{ajensonpro} +%\usepackage{minionpro} +%\usepackage{newsgothicstd} +%\usepackage{lucidbry} + +\university{\AcroTeX.Net\\The AeB Pro family} +\title{The AcroMemory Package\texorpdfstring{\\}{: }Manual of Usage} +\author{D. P. Story} +\email{dpstory@acrotex.net} +\subject{Documentation for AcroMemory, the memory game} +\keywords{Adobe Acrobat, JavaScript, AcroSlicing, game} +\copyrightStatus{True} +\copyrightNotice{Copyright (C) \the\year, D. P. Story} +\copyrightInfoURL{http://www.acrotex.net} + +\def\nhfootnote#1{\begin{NoHyper}\footnote{#1}\end{NoHyper}} + +\def\dps{$\hbox{$\mathfrak D$\kern-.3em\hbox{$\mathfrak P$}% + \kern-.6em \hbox{$\mathcal S$}}$} + + +\definePath\bgPath{"C:/Users/Public/Documents/ManualBGs/Manual_BG_Print_AeB.pdf"} +\begin{docassembly} +\addWatermarkFromFile({ + bOnTop:false, + cDIPath:\bgPath +}); +\executeSave(); +\end{docassembly} + +\begin{document} + +%\begingroup + +%\linewidth=\fullscreenwidth +%\advance\linewidth\oddsidemargin +%\setlength{\oddsidemargin}{0pt} +\maketitle + +%\endgroup + +\changelinkcolorto{black} + +\tableofcontents + +\changelinkcolorto{webgreen} + + +\section{What is the AeB Pro Family?} + + Through the years, I have tried to make my AeB software + ({Acro\negthinspace\TeX} eDucation Bundle) compatible with + \textsf{pdftex} and \textsf{dvipdfm}; however, during that time, + I've developed a number of techniques that require the use of + Acrobat and distiller. Therefore, I have set off in a new + direction and will be publishing a new line of {\LaTeX} packages, + ones that require the use of Acrobat.\nhfootnote{I will, however, + continue to develop the original AeB, never fear!} + +\newtopic The current package, \textsf{AcroMemory}, requires the use + of Acrobat Pro~7.0 or later. + +\section{Introduction} + +At the prompting and encouragement of my erstwhile friend, +J\"{u}rgen, I present to you \textsf{AcroMemory}, and for the life +of me, I can't remember why. + +Oh, yes, \textsf{AcroMemory} is a memory game in which you find the +matching tiles. There are two versions---available as options of +this package---for your enjoyment, \texttt{acromemory1} and +\texttt{acromemory2} (the default). +\begin{itemize} + \item \texttt{acromemory1}: Here you have a single game board, a + rectangular region divided by rows and columns. The total number + of tiles should be even, each tile should have a matching twin. + The game begins with all the tiles hidden. The user clicks a + tile, then another. If the tiles do not match, they become + hidden again (you did remember the position of those tiles, + didn't you?); otherwise, they remain visible and are now + read-only. The game is complete when the user, with a lot of time + on his/her hands, matches all tiles. There is a running + tabulation kept on the number of tries. There is also a button + which resets the game and randomizes the tiles. + + \item \texttt{acromemory2}: For this game you have two identical + rectangular images subdivided into tiles (or slices), which + are arrayed in rows and columns. The tiles for one of the + two images is randomly re-arranged. The object of the + game is to find all the matching tiles by choosing a tile + from one image and a tile from the other image. As in the + first case, if the selected tiles do not match, they are + hidden after a short interval of time (you did remember the + position of those tiles, didn't you?); otherwise, they + remain visible and are now read-only. The game is over when + all tiles are matched; when this occurs, end-of-game special + effects occur that will dazzle the senses. There is an + option to view a small image to help you locate the matching + tiles on the non-randomized; useful if the image is complex. + There is no reset button at this time, to play again, the + user must therefore close and open the document. +\end{itemize} +The demo files are \texttt{acromemory1\_1.tex}, +\texttt{acromemory1\_2.tex}, \texttt{acromemory2\_1.tex} and +\texttt{acromemory2\_2.tex}. These files show how to lay out the +various elements of this package. + +\newtopic\textbf{Requirements:} Acrobat~7 Professional. + +\section{Distribution and Installation}\label{installation} + +The distribution comes with the following files: +\begin{itemize} + + \item \texttt{acromemory.dtx}, \texttt{acromemory.sty} and \texttt{acromemory.ins}: + These are the program files. The file \texttt{acromemory.dtx} has additional documentation + with more technical details than this manual. + + \item The files \texttt{acromemory1\_1.tex}, + \texttt{acromemory1\_2.tex}, \texttt{acromemory2\_1.tex} and + \texttt{acromemory2\_2.tex}: The demo files for this package. + + \item \texttt{aeb\_pro.js}: A JavaScript file that contains + security restricted methods. + + \item The \textsf{AeB Slicing} Batch Sequence: This is a batch + sequence that slices a given image into a specified number of + rows and columns. The documentation file name is + \texttt{aebslicing\_sequ\_doc.pdf} and comes with the + distribution. Installation details for \textsf{AeB Slicing} + are contained in its documentation. + + \item Sample image files, \texttt{dinos} (for the + \texttt{acromemory1} option) and \texttt{dpsweb} (this time + for the \texttt{acromemory2} option), contained in their own folders. + +\end{itemize} + +\newtopic When you unzip \texttt{acromemory.zip}, the folder +\texttt{acromemory} will be created, the entire distribution will be +placed in this folder. This folder must be on your {\LaTeX} search +path and you need to refresh your file name database if you are +using a {\TeX} system, such as MIK\TeX, that has this database +scheme. At the top level will be the {\LaTeX} package and demo +files. The subfolders are +\begin{itemize} + \item \texttt{aeb\_pro}: In this folder is \texttt{aeb\_pro.js}, a + JavaScript file that needs to be installed on your hard drive. + Copy this file to the User's + \texttt{JavaScripts} folder. To find this folder, execute the + script +\begin{Verbatim}[xleftmargin=20pt,fontsize=\fontsize{9}{11}\selectfont] +app.getPath("user", "javascript"); +\end{Verbatim} +in the JavaScript Debugger Console window.\nhfootnote{Place the cursor +on the line containing this script and press the \texttt{Ctrl+Enter} +key.} The return value of this is the path to the +\texttt{JavaScripts} folder; for example, on my system it returns +\begin{Verbatim}[xleftmargin=20pt,fontsize=\fontsize{9}{11}\selectfont] +/C/Documents and Settings/dps/Application Data/ + Adobe/Acrobat/8.0/JavaScripts +\end{Verbatim} +For user's of Acrobat 10.1.1 (or later), the JavaScripts folder has moved, +see my blog article \textsl{\href{http://www.acrotex.net/blog/?p=737}{Acrobat Security Changes in 10.1.1 and +Acro\!\TeX}}. + +After placing \texttt{aeb\_pro.js}, restart Acrobat so it will read this file. + \item \texttt{dpsweb}: Image files used in \texttt{acromemory2\_1.tex} and \texttt{acromemory2\_2.tex}. + \item \texttt{dinos}: Image files used in \texttt{acromemory1\_1.tex} and \texttt{acromemory1\_2.tex}. +\end{itemize} + +\newtopic Follow the installation instructions for the \textsf{AcroSlicing} batch sequence. + +\section{Package Options} + +There are a few options of this package: +\begin{itemize} + \item \texttt{acromemory1} and \texttt{acromemory2}: As described earlier. The \texttt{acromemory2} option + is the default, so it need never be used, actually. + \item \texttt{iconfile}: There are two methods of delivering the slices of the game board(s) to this package: + \begin{enumerate} + \item The default method is to have one file for each sliced + image. There is a numbering system for the slices, the same system + used by \textsf{Aeb Slicing} batch sequence, is to number them + with a two digit number across rows:\smallskip + +\begin{Verbatim}[xleftmargin=20pt,fontsize=\fontsize{9}{11}\selectfont] +\texttt{\_01}, \texttt{\_02}, ... +\end{Verbatim} + + \item[]The demo files \texttt{acromemory1\_2.tex} and + \texttt{acromemory2\_2.tex} illustrate this method. + + \item All slices are placed in a single PDF in the same order just + described, that is listed by rows. There is an option in the + \textsf{AeB Slicing} batch sequence for ``packaging'' the + slices in this way. The demo files \texttt{acromemory1\_1.tex} + and \texttt{acromemory2\_1.tex} illustrate this method. + \end{enumerate} + The \textsf{AcroMemory} package expects, by default, the first method + described. By specifying the \texttt{iconfile} option, + \textsf{AcroMemory} will get the slices for the single PDF. + + \item \texttt{includehelp}: When building a file with the acromemory2 + option, you can also include a help image, a small picture of the game + board to help the user to match the randomized slices with the ones on + the non-randomized game board. Useful if the image is very complex. + The demo files \texttt{acromemory2\_1.tex} and + \texttt{acromemory2\_2.tex} both contain the necessary code for + producing the help feature, the commands only create the help feature + if the \texttt{includehelp} option is taken. +\end{itemize} + +\noindent\textbf{\color{red}Important.} You need to set the preferences of Acrobat as follows: +\begin{enumerate} + \item Start Acrobat, and select \texttt{Edit > Preferences} + \item Choose Trust Manager from the Categories panel on the left + \item Check the `Allow external content' check box +\end{enumerate} +\noindent The above settings allow the post-distillation assembly to take place. + +\section{Commands of the Package} + +This section describes the various commands available to you through +this package. This section can be skipped on first reading, most of +the commands are described less formally in subsequent sections. + +\newtopic The following commands are suitable for placement in the +preamble of your document. + +\begin{itemize} + \item \cs{theTotalTiles}: The total number of tiles in the game board. This parameter is required. + For example, \verb!\theTotalTiles{20}!. + \item \cs{theNumRows}: The number of rows in the game board. This parameter is required. + For example, \verb!\theNumRows{5}!. + \item \cs{theNumCols}: The number of columns in the game board. + This parameter is required. For example, \verb!\theNumCols{4}!. + \item \cs{theImportPath}: The import path to the base name of the image. The path + should use the path specification as defined in the \emph{PDF Reference}, and the file name should + have no extension. Required. For example,\smallskip +\begin{Verbatim}[xleftmargin=20pt,fontsize=\fontsize{9}{11}\selectfont] +\theImportPath{myFig/myimages} +\end{Verbatim} + + There is an optional argument that is typically used when the \texttt{iconfile} is in effect + with the \texttt{acromemory2} option, and an image of the game board is different from the + path given by the optional argument; for example, +\begin{verbatim} + \theImportPath[dpsweb/dpsweb]{dpsweb/dpsweb_package} +\end{verbatim} + The required argument points the packaged icons, the optional argument points to + a file showing the entire image. See \texttt{acromemory2\_1.tex} for an + example of this situation. + \item \cs{theIconExt}: The extension of the image file(s). Required if different + from \texttt{pdf}. (Acrobat can make the conversion to PDF.) + \item \cs{theTeXImageWidth}: The scaled width of the rectangular game board. The + game board will be rescaled so that its width is equal to the value specified + by the argument of this command, e.g., \verb!\theTeXImageWidth{2in}!. + \item\cs{provideDimensions}: If the dimension of the game board is known, the width + and height can be entered with this command using the two parameters. For example, + \verb!\provideDimensions{2in}{2.5in}! (width, height). +\item \cs{bDebug}: A debugging command. When executed in the + preamble, more is written to the Acrobat console as the document is + opened the first time, also, the icons are initially visible so you + can see the layout, and quickly play the game. This was used in + development extensively to help develop the JavaScript. + +\end{itemize} + +\newtopic The rest of the commands in this section are properly +placed in the body of the document. They are the elements of the +game board(s) and supporting elements. + +\newtopic\textbf{Game Board(s)} +\begin{itemize} +\item \cs{ulCornerHere}: Used with the \texttt{acromemory1} option, +this command sets the upper left corner of the game board. It is +followed by either of the two commands \cs{reserveSpaceByDimension} or +\cs{reserveSpaceByFile}. + +\item \cs{LulCornerHere}, \cs{RulCornerHere}: Used with the +\texttt{acromemory2} option, these commands set the upper left +corner of the two game boards, on the left and the other on the +right. Each of these two commands is immediately followed by one of +the two commands \cs{reserveSpaceByDimension} or +\cs{reserveSpaceByFile}. + +\item \cs{reserveSpaceByDimension}: If the size of the image is +known, you can reserve space for it by using this command. It has +two arguments: the first argument is the width of the image, the +second is the height. This command is useful for +\texttt{acromemory1} where the game board is made up of some many +rows and columns of tiles whose dimensions you know. + +\item \cs{reserveSpaceByFile}: This command does an +\cs{includegraphics} in draft mode to get the dimensions of the game +board. The required space is made for the rescaled image. The +optional argument can be used to insert a file that has the same +aspect ratio as the puzzle, the default is the one specified by the +optional argument of \cs{theImportPath}, which, if not specified, is +the same as the required argument of \cs{theImportPath}. +\end{itemize} + +\goodbreak +\newtopic\textbf{Supporting fields} +\begin{itemize} + +\item \cs{messageBox}: A message text field. As the user works the +puzzle, the progress is reported to this field. +\end{itemize} + +\newtopic The following button is only appropriate when the \texttt{acromemory1} +option is taken. + +\begin{itemize} +\item \cs{playItAgain}: For the \texttt{acromemory1} option, this +button can be placed to reset the game board, the icons are +rearranged and hidden again. +\end{itemize} + +\newtopic When \texttt{acromemory2} and the \texttt{includehelp} +options are taken, these commands are available. See the +\texttt{acromemory.dtx} documentation for indications of modifying +these commands. + +\begin{itemize} +\item \cs{helpImage}: The button that will contain an icon of the +puzzle. There is one optional argument used to modify the appearance +of the button. + +\item \cs{setHelpImageWidth}: Used to set the width of the +\cs{helpImage} button. The default width is 1 inch. For example, +\verb!\setHelpImageWidth{1.5in}!. + +\item \cs{theHelpCaption}: Use this command to set the caption of +the help image. For example, \verb!\theHelpCaption{I need help}!. + +Captions with accents and such, you need to use Unicode escape +sequences, \verb!\uXXXX!, where \texttt{XXXX} are four hexadecimal +digits. For example, the caption specified by +\begin{Verbatim}[xleftmargin=20pt,fontsize=\fontsize{9}{11}\selectfont] +\theHelpCaption{J\string\\u00FCrgen needs help} +\end{Verbatim} +will appear in the PDF document as `J\"{u}rgen needs help'. Notice the +\verb!\string\\! sequence that is needed from the {\LaTeX} source. + + +\item\cs{rolloverHelpButton}: The image is normally hidden until the +user rolls over the \cs{rolloverHelpButton}. The icon appears with a +caption under it, the content of the caption can be entered using +\cs{theHelpCaption}. This command has three parameters, one of which +is optional. The first (optional) parameter is used to change the +appearance of the button; the next two required parameters are the +width and height of the button. +\end{itemize} + + +\section{The \texttt{acromemory1} Option} + +In this game, there is only one game board with an even number of +tiles. Each tile has an identical twin, and all the tiles are +randomly rearranged. The object of the game is to find all the +matching pairs. See the demo files \texttt{acromemory1\_1.tex} and +\texttt{acromemory1\_2.tex} for examples of this game; the former +file uses the \texttt{iconfile} option, whereas the latter does not. +Both illustrate the \cs{reserveSpaceByDimension} and +\cs{provideDimensions}. See the comments in these files for more +details. + +The tiles for this game were created by a font that I have called +`Mini Pics Lil Dinos'. The source file for the creation of the +\texttt{myDinos.pdf}, the icon file, is \texttt{myDinos.tex}. In +this \texttt{tex} file, the \textsf{web} package is used to create +pages 2~inches by 2~inches. The \texttt{multido} package from +\textsf{PSTricks} was used to produce the pages. See +\texttt{myDinos.tex} for additional comments. + +To create your own icon file, you will need either a font set with +nice images on it, or you can be creative, perhaps using +\textsf{PSTricks} to create a series of figures. + +Given that you have created your icons in a single file, should you +wish to save each page to a separate file, you can execute the +following JavaScript in the console, while the icons file is open in +Acrobat.\smallskip +\begin{Verbatim}[xleftmargin=20pt,fontsize=\fontsize{9}{11}\selectfont] +var thisPath = /.*\//i.exec(this.path)[0]; +var filename = this.documentFileName.replace(/\.pdf$/i,""); +for (var i = 0; i < this.numPages; i++) { + var j = i+1; + var index = (j < 10 ) ? ("0"+j) : (""+j); + this.extractPages({ + nStart: i, + cPath: thisPath+filename+"_" + index +".pdf" + }); +} +\end{Verbatim} +The code is included in the file \texttt{myDinos.tex}. + + +\section{The \texttt{acromemory2} Option} + +This option was the original concept, it was only after I completed +the two game board version did I decide to do the classic one game +board version. This is why \texttt{acromemory2} is the default. The +\texttt{acromemory2} version was much more interesting and +challenging to create. + +For this option you don't have to have a fancy font, any +(interesting) picture will do. The first step is to decide how many +rows and columns you want and then slice the image appropriately. +This is why I wrote the \textsf{AeB Slicing} batch sequence. Read +the documentation for \textsf{AeB Slicing} and slice your picture. + +Not only do you need slices of your picture, you also need an \texttt{EPS} +of your picture. This is used by latex to leave room for the game board. +Acrobat can make the conversion for you, as follows: + +\newtopic\textbf{To convert your image to EPS} +\begin{enumerate} +\item Bring your image into Acrobat +\item Click the \texttt{File > Save As} menu item +\item In the Save As dialog box, choose \texttt{Encapsulated PostScript (*.eps)} from the Save as type list +\item Navigate to the folder containing your tiles, and click the \texttt{Save} button +\end{enumerate} + +\newtopic See the demo files \texttt{acromemory2\_1.tex} and +\texttt{acromemory2\_2.tex} for examples of this game; the former +file uses the \texttt{iconfile} option, whereas the latter does not. +Both illustrate the \cs{reserveSpaceByFile}. See the comments in +these files for more details. + +Use either of these two demo files as a template to create your own +memory game. Don't forget that the \textsf{web} package has options +to apply a background color or a graphic---this will jazz up your +memory game. + +\section{Assembly} + +Try compiling one of the demo files. You must have the AeB already +installed on your system, of course. Be sure to specify your dvi to +postscript converter, for most of you that will be dvips. For example, +the preamble of the demo docs, and later your own documents should +appear as follows:\smallskip +\begin{Verbatim}[xleftmargin=20pt,fontsize=\fontsize{9}{11}\selectfont] +\documentclass{article} +\usepackage[designv,nodirectory,dvips]{web} % <-- specify dvips or dvipsone +\usepackage[execJS]{eforms} +\usepackage{graphicx} +\usepackage{acromemory} +\end{Verbatim} + +\newtopic LaTeX your source file, then invoke your dvi-to-ps +converter to obtain a postscript file. +Now open Acrobat Distiller and distill the new postscript document. +If all goes well, Acrobat will start, if not already, and the newly +created PDF document will open in it. Notice that the hour glass +cursor appears; this means that the post-assembly process is +ongoing: You note the one or two little dots on the page (where the +game boards should be), these are the fields creates by the commands +\cs{ulCornerHere}, \cs{LulCornerHere} or \cs{RulCornerHere}. They +are soon replaced by the game board(s). Amazing, simply amazing! + +After the hour glass cursor changes, perhaps to the hand tool, be +sure to save your document, \emph{this is important}. By saving the +document, the game board does not have to be rebuilt every +time the file is opened. Once assembled and saved, the game can be +played on Adobe Reader 7.0 or later. + +\newtopic\textbf{\color{red}Tip.} Use the \textsf{PDF Optimizer}, under the \textsf{Advance} menu, to +reduce the size of the file.\nhfootnote{For Acrobat 10, \textsf{PDF Optimizer} is called the +\textsf{Optimized PDF} under the \textsf{File \texttt{>} SaveAs}; also, you can use the \textsf{Reduced Size PDF} +menu function} For example, the file size of \texttt{acromemory2\_2.pdf} +after distillation was 462\,KB, but after running the +PDF Optimizer on it, the file size was reduced to 85\,KB! + + +\section{Final comments} + +Use any of the demo files as a template to create your own memory +game. Don't forget (use your memory?) that the \textsf{web} package +has options to apply a background color or a graphic---this will +jazz up your memory game. + +I do hope you find this game package fun, and that you will be +creative in its use. Perhaps you can apply the techniques of this +package to create your own game package, there are many +possibilities. + +\newtopic Now, I simply must get back to my retirement! \dps + + + +\end{document} -- cgit v1.2.3