From 459f3ab214a7c0ef2439e77572f83e7c80858ee4 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 13 Jul 2017 12:02:21 +0900 Subject: add eq2db fitr jj-game --- texmf-dist/source/latex/eq2db/DB/eqQuiz.mdb | Bin 0 -> 208896 bytes .../latex/eq2db/Scripts/FDF_submit/eqEmail.asp | 176 ++ .../latex/eq2db/Scripts/FDF_submit/eqRecord.asp | 216 +++ .../latex/eq2db/Scripts/FDF_submit/eqText.asp | 120 ++ texmf-dist/source/latex/eq2db/doc/eq2dbman.tex | 1347 +++++++++++++++ texmf-dist/source/latex/eq2db/eq2db.dtx | 730 ++++++++ texmf-dist/source/latex/eq2db/eq2db.ins | 59 + .../latex/eq2db/examples/FDF_submit/quiz1.tex | 138 ++ .../latex/eq2db/examples/FDF_submit/quiz2.tex | 180 ++ .../latex/eq2db/examples/FDF_submit/quiz3.tex | 115 ++ .../latex/eq2db/examples/FDF_submit/quiz4.tex | 119 ++ texmf-dist/source/latex/fitr/fitr.dtx | 790 +++++++++ texmf-dist/source/latex/fitr/fitr.ins | 61 + .../latex/jj-game/designs/design_bahamas.def | 72 + .../latex/jj-game/designs/design_florida.def | 60 + .../latex/jj-game/designs/design_germany.def | 72 + .../source/latex/jj-game/designs/design_hornet.def | 63 + .../latex/jj-game/designs/design_iceland.def | 72 + .../latex/jj-game/designs/design_jeopardy.def | 82 + .../source/latex/jj-game/designs/design_norway.def | 70 + .../source/latex/jj-game/designs/design_qatar.def | 70 + .../source/latex/jj-game/designs/design_spain.def | 72 + texmf-dist/source/latex/jj-game/doc/jjg_man.tex | 1332 +++++++++++++++ texmf-dist/source/latex/jj-game/jj_game.dtx | 1747 ++++++++++++++++++++ texmf-dist/source/latex/jj-game/jj_game.ins | 63 + 25 files changed, 7826 insertions(+) create mode 100644 texmf-dist/source/latex/eq2db/DB/eqQuiz.mdb create mode 100644 texmf-dist/source/latex/eq2db/Scripts/FDF_submit/eqEmail.asp create mode 100644 texmf-dist/source/latex/eq2db/Scripts/FDF_submit/eqRecord.asp create mode 100644 texmf-dist/source/latex/eq2db/Scripts/FDF_submit/eqText.asp create mode 100644 texmf-dist/source/latex/eq2db/doc/eq2dbman.tex create mode 100644 texmf-dist/source/latex/eq2db/eq2db.dtx create mode 100644 texmf-dist/source/latex/eq2db/eq2db.ins create mode 100644 texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz1.tex create mode 100644 texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz2.tex create mode 100644 texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz3.tex create mode 100644 texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz4.tex create mode 100644 texmf-dist/source/latex/fitr/fitr.dtx create mode 100644 texmf-dist/source/latex/fitr/fitr.ins create mode 100644 texmf-dist/source/latex/jj-game/designs/design_bahamas.def create mode 100644 texmf-dist/source/latex/jj-game/designs/design_florida.def create mode 100644 texmf-dist/source/latex/jj-game/designs/design_germany.def create mode 100644 texmf-dist/source/latex/jj-game/designs/design_hornet.def create mode 100644 texmf-dist/source/latex/jj-game/designs/design_iceland.def create mode 100644 texmf-dist/source/latex/jj-game/designs/design_jeopardy.def create mode 100644 texmf-dist/source/latex/jj-game/designs/design_norway.def create mode 100644 texmf-dist/source/latex/jj-game/designs/design_qatar.def create mode 100644 texmf-dist/source/latex/jj-game/designs/design_spain.def create mode 100644 texmf-dist/source/latex/jj-game/doc/jjg_man.tex create mode 100644 texmf-dist/source/latex/jj-game/jj_game.dtx create mode 100644 texmf-dist/source/latex/jj-game/jj_game.ins (limited to 'texmf-dist/source') diff --git a/texmf-dist/source/latex/eq2db/DB/eqQuiz.mdb b/texmf-dist/source/latex/eq2db/DB/eqQuiz.mdb new file mode 100644 index 00000000..e7878b7d Binary files /dev/null and b/texmf-dist/source/latex/eq2db/DB/eqQuiz.mdb differ diff --git a/texmf-dist/source/latex/eq2db/Scripts/FDF_submit/eqEmail.asp b/texmf-dist/source/latex/eq2db/Scripts/FDF_submit/eqEmail.asp new file mode 100644 index 00000000..7defff99 --- /dev/null +++ b/texmf-dist/source/latex/eq2db/Scripts/FDF_submit/eqEmail.asp @@ -0,0 +1,176 @@ +<%@ LANGUAGE = VBScript%> +<% +' Copyright 2003 D. P. Story +' All Rights Reserved +' See eq2dbman.pdf for some documentation + +' NOTICE: 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 of the +' License, or (at your option) any later version. + +' This script is offered "as is", no guarantees are extended. +' eqRecord should be extensively tested on your own system +' until you are satisified with its functionality and +' reliability. +' +' Note: You need to edit one line below. Search this file for the line that +' contains the string "mySMTP". Replace this string with your SMTP server. + +Response.buffer = True + +Dim DebugTxt, DebugFDF +Dim ErcStatus : ErcStatus = "Problems Reported: " +Dim dotReplace : dotReplace = "_" +DebugTxt = False +DebugFDF = False + +' Send FDF file +If DebugTxt Then + Response.ContentType = "text/html" +Else + Response.ContentType = "application/vnd.fdf" +End If + +On error Resume Next + +Rem Create an FDF object +Set FdfAcx = Server.CreateObject("FdfApp.FdfApp") +Set FDFout = FdfAcx.FDFCreate + +Rem Parse Incoming Data +Set FDFin = FdfAcx.FDFOpenFromBuf (Request.BinaryRead(Request.TotalBytes)) + +Rem Declare some variables +Dim cBuf, cQuiz +Dim cTime : cTime = Now + +'\eqSubmit{http://localhost/scripts/eqMail.asp\#FDF}{eqQuiz}{Math101} + +Dim eqMail, cMailTo, cMailFrom, strMessage, eqTab, eqCR +eqTab = chr(9) +eqCR = chr(10) + +' Get Required info +cMailTo = FDFin.FDFGetValue("mailTo") +cMailFrom = cMailTo +cCourseName = FDFin.FDFGetValue("courseName") +cQuiz = FDFin.FDFGetValue("quizName") + +strMessage = "Course Information" +strMessage = strMessage & eqCR & eqTab & "Course Name: " & cCourseName +strMessage = strMessage & eqCR & eqTab & "Quiz: " & cQuiz +strMessage = strMessage & eqCR & eqTab & "TimeOfQuiz: " & cTime +strMessage = strMessage & eqCR & eqCR & "Student Results" + +Dim currentField, dbCurrentField, currentValue, parent +currentField = FDFin.FDFNextFieldName("") + +Do + ' check for dots + position = InStr(1,currentField, ".",0) + ' We save only fields that have hierarchial names: In particular, + ' we save fields with parent root of cQuiz or IdInfo. + If position <> 0 Then + parent = Trim(Mid(currentField,1,position-1)) + If (parent = cQuiz) or (parent = "IdInfo") Then + If DebugTxt Then Response.Write "currentField: " & currentField & "
" + ' strip off parent name, and replace "." with dotReplace + dbCurrentField = Replace(currentField, ".", dotReplace, position+1,-1,0) + If DebugTxt Then Response.Write "dbCurrentField: " & dbCurrentField & "
" + + On error Resume Next + currentValue = FDFin.FDFGetValue(currentField) + If DebugTxt Then Response.Write "currentValue: " & currentValue & "
" + If Err.Number <> 0 Then + ReportError(Err) + DebugMsg "Field Name: ",currentField + Err.Clear + Else + On error Resume Next + strMessage = strMessage & eqCR & eqTab & dbCurrentField & ": " & currentValue + End If + End If + End If + On error Resume Next + currentField = FDFin.FDFNextFieldName(currentField) + If currentField = "" Or Err.Number <> 0 Then Exit Do +Loop + +If DebugFDF Then cBuf = cBuf & " " & ErcStatus + +cBuf = "Quiz results successfully sent to your instructor!" +FDFout.FDFSetStatus cBuf + +' Send back to the browser +Response.BinaryWrite FDFout.FDFSaveToBuf + +FDFin.FDFClose +FDFout.FDFClose +Set FdfAcx = Nothing +Set FDFin = Nothing +Set FDFout = Nothing + +' Construct and send e-mail +' CDONTS +'Set eqMail = Server.CreateObject("CDONTS.NewMail") +'eqMail.To = cMailTo +'position = InStr(1,cMailFrom,",",0) +'If position <> 0 Then +' cMailFrom = Trim(Mid(cMailFrom,1,position-1)) +'End If +'eqMail.From = cMailFrom +'' eqMail.BCC = "dpstory@uakron.edu" +'eqMail.Subject = "Quiz Results: " & cQuiz & " of " & cCourseName +'eqMail.Body = strMessage +'eqMail.Send +'Set eqMail = Nothing + +' Construct and send e-mail +' CDOSYS +Set eqMail = Server.CreateObject("CDO.Message") +eqMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 +eqMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mySMTP" +eqMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 +eqMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 +' eqMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0 +eqMail.Configuration.Fields.Update + +eqMail.To = cMailTo +' See if there is a comma in the cMailFrom string, if yes, then we have multiple address +' that we are sending to. We extract the first e-mail address as the one we will put in +' the eqMail.From address. +position = InStr(1,cMailFrom,",",0) +If position <> 0 Then cMailFrom = Trim(Mid(cMailFrom,1,position-1)) +eqMail.From = cMailFrom +' Modify the subject to meet your needs +eqMail.Subject = "Quiz Results: " & cQuiz & " of " & cCourseName +eqMail.TextBody = strMessage +eqMail.Send +Set eqMail = Nothing + +If DebugTxt Then + Response.Write strMessage +End If + +Sub RecordError(field) + If Err.Number <> 0 And DebugFDF Then + ErcStatus = ErcStatus & " "&field&": " & Err.Description + End If + If Err.Number <> 0 And DebugTxt Then + Response.Write "Set Error: "&field&": " & Err.Description & "
" + End If + Err.Clear +End Sub + +Sub ReportError(ByRef localErr) + DebugMsg "Err.Description: ", localErr.Description + DebugMsg "Err.Number: ", localErr.Number + localErr.Clear +End Sub + +Sub DebugMsg(myText, myEval) + If DebugTxt Then Response.Write myText & myEval &"
" +End Sub +%> diff --git a/texmf-dist/source/latex/eq2db/Scripts/FDF_submit/eqRecord.asp b/texmf-dist/source/latex/eq2db/Scripts/FDF_submit/eqRecord.asp new file mode 100644 index 00000000..09dbd32f --- /dev/null +++ b/texmf-dist/source/latex/eq2db/Scripts/FDF_submit/eqRecord.asp @@ -0,0 +1,216 @@ +<%@ LANGUAGE = VBScript%> +<% +' Copyright 2003 D. P. Story +' All Rights Reserved +' See eq2dbman.pdf for some documentation + +' NOTICE: 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 of the +' License, or (at your option) any later version. + +' This script is offered "as is", no guarantees are extended. +' eqRecord should be extensively tested on your own system +' until you are satisified with its functionality and +' reliability. + +Response.buffer = True + +Dim DebugTxt, DebugFDF +Dim ErcStatus : ErcStatus = "Problems Reported: " +Dim dotReplace : dotReplace = "_" +DebugTxt = 0 +DebugFDF = 0 + +If DebugTxt Then + Response.ContentType = "text/html" +Else + Response.ContentType = "application/vnd.fdf" +End If + +On error Resume Next + +Rem Create an FDF object +Set FdfAcx = Server.CreateObject("FdfApp.FdfApp") +Set FDFout = FdfAcx.FDFCreate + +Rem Parse Incoming Data +Set FDFin = FdfAcx.FDFOpenFromBuf (Request.BinaryRead(Request.TotalBytes)) + +Rem Declare some variables +Dim cBuf, cDbName, cTableName, cQuiz +Dim cTime : cTime = Now + +' Get Required info +cDbName = FDFin.FDFGetValue("dbName") +cTableName = FDFin.FDFGetValue("dbTable") +cQuiz = FDFin.FDFGetValue("quizName") + +Rem Query the database +On error Resume Next +Set DataConn = Server.CreateObject("ADODB.Connection") +' DataConnConnecString = cDbName +DataConn.Open cDbName +Set RecSet = Server.CreateObject("ADODB.Recordset") +RecSet.CursorType = 1 +RecSet.LockType = 2 +RecSet.ActiveConnection = DataConn +RecSet.Source=cTableName +DataConn.BeginTrans +RecSet.Open + +If Err.Number <> 0 Then + If DebugTxt Then + Response.Write "Problems opening database
" + End If +End If + +RecSet.AddNew + +On error Resume Next +RecSet("quizName") = cQuiz +If Err.Number <> 0 Then + If DebugTxt Then + Response.Write "Problems storing quizName." &"
" + End If + Err.Clear +End If +If DebugTxt Then + Response.Write "dbName: " & cDbName & "
" + Response.Write "quizName = " & cQuiz &"
" +End If + +RecSet("TimeOfQuiz") = cTime +If Err.Number <> 0 Then + If DebugTxt Then + Response.Write "Problems storing time, possibly no TimeOfQuiz field" &"
" + End If + Err.Clear +End If + + +Dim currentField, dbCurrentField, currentValue, parent +currentField = FDFin.FDFNextFieldName("") + +Do + ' check for dots + position = InStr(1,currentField, ".",0) + ' We save only fields that have hierarchial names: In particular, + ' we save fields with parent root of cQuiz or IdInfo. + If position <> 0 Then + parent = Trim(Mid(currentField,1,position-1)) + If (parent = cQuiz) or (parent = "IdInfo") Then + If DebugTxt Then Response.Write "currentField: " & currentField & "
" + ' strip off parent name, and replace "." with dotReplace + dbCurrentField = Replace(currentField, ".", dotReplace, position+1,-1,0) + If DebugTxt Then Response.Write "dbCurrentField: " & dbCurrentField & "
" + + On error Resume Next + currentValue = FDFin.FDFGetValue(currentField) + If DebugTxt Then Response.Write "currentValue: " & currentValue & "
" + + If Err.Number <> 0 Then + ReportError(Err) + DebugMsg "Field Name: ",currentField + Err.Clear + currentValue = "" + Else + On error Resume Next + RecSet(dbCurrentField) = currentValue + If Err.Number <> 0 Then + If DebugTxt Then + Response.Write "dbCurrentField: " & dbCurrentField&"
" + Response.Write "currentValue: " & currentValue&"
" + Response.Write "Error Number: " & Err.Number&"
" + Response.Write "Descripton: " & Err.Description&"
" + Err.Clear + End If + If DebugFDF Then + StatusErcMsg = StatusErcMsg & " Could "_ + &" not Update the DB field, '"_ + &dbCurrentField&"', using "_ + &"the value from the form field, '"_ + ¤tField&"'." & Err.Description &" " + End If + ' Ignore the error + Err.Clear + End If + End If + End If + End If + On error Resume Next + currentField = FDFin.FDFNextFieldName(currentField) + If currentField = "" Or Err.Number <> 0 Then Exit Do +Loop + +If DataConn.Errors.Count > 0 Then + If DebugTxt Then + For each Error in DataConn.Errors + Response.Write "Error Number: " & Error.Number &"
" + Response.Write "Error Description: " & Error.Description &"
" + Next + End If + DataConn.CancelUpdate + DataConn.RollbackTrans + CancelTableList = CancelTableList &", " & tableName +Else + On error Resume Next + RecSet.Update + + If (Err.Number <> 0) OR (DataConn.Errors.Count > 0) Then + If DebugTxt Then + If Err.Number <> 0 Then Response.Write "Update Failed: " : ReportError(Err) + For each Error in DataConn.Errors + Response.Write "After update: Error Number: " & Error.Number &"
" + Response.Write "Error Description: " & Error.Description &"
" + Next + End If + DataConn.CancelUpdate + DataConn.RollbackTrans + cBuf = "There were some problems saving." + Else + DataConn.CommitTrans + cBuf = "Your quiz results were successfully saved at " & cTime & "." + End If +End If + +If DebugFDF Then cBuf = cBuf & " " & ErcStatus + +FDFout.FDFSetStatus cBuf + +' Send back to the browser +Response.BinaryWrite FDFout.FDFSaveToBuf + +RecSet.Close +Set RecSet = Nothing +DataConn.Close +Set DataConn = Nothing +FDFin.FDFClose +FDFout.FDFClose +Set FdfAcx = Nothing +Set FDFin = Nothing +Set FDFout = Nothing + +Sub RecordError(field) + If Err.Number <> 0 And DebugFDF Then + ErcStatus = ErcStatus & " "&field&": " & Err.Description + End If + If Err.Number <> 0 And DebugTxt Then + Response.Write "Set Error: "&field&": " & Err.Description & "
" + End If + Err.Clear +End Sub + +Sub ReportError(ByRef localErr) + + DebugMsg "Err.Description: ", localErr.Description + DebugMsg "Err.Number: ", localErr.Number + localErr.Clear + +End Sub + +Sub DebugMsg(myText, myEval) + If DebugTxt Then Response.Write myText & myEval &"
" +End Sub +%> diff --git a/texmf-dist/source/latex/eq2db/Scripts/FDF_submit/eqText.asp b/texmf-dist/source/latex/eq2db/Scripts/FDF_submit/eqText.asp new file mode 100644 index 00000000..f3f96006 --- /dev/null +++ b/texmf-dist/source/latex/eq2db/Scripts/FDF_submit/eqText.asp @@ -0,0 +1,120 @@ +<%@ LANGUAGE = VBScript%> +<% +' eqText.asp +' Copyright 2003 D. P. Story +' All Rights Reserved +' See eq2dbman.pdf for some documentation + +' NOTICE: 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 of the +' License, or (at your option) any later version. + +' This script is offered "as is", no guarantees are extended. +' eqRecord should be extensively tested on your own system +' until you are satisified with its functionality and +' reliability. + +Response.buffer = True + +Dim DebugTxt, DebugFDF +Dim ErcStatus : ErcStatus = "Problems Reported: " +Dim dotReplace : dotReplace = "_" +DebugTxt = False +DebugFDF = False + +' Send FDF file +If DebugTxt Then + Response.ContentType = "text/html" +Else + Response.ContentType = "application/vnd.fdf" +End If + +On error Resume Next + +Rem Create an FDF object +Set FdfAcx = Server.CreateObject("FdfApp.FdfApp") +Set FDFout = FdfAcx.FDFCreate + +Rem Parse Incoming Data +Set FDFin = FdfAcx.FDFOpenFromBuf (Request.BinaryRead(Request.TotalBytes)) + +Rem Declare some variables +Dim cBuf, cQuiz +Dim cTime : cTime = Now + +'\eqSubmit{http://localhost/scripts/eqText.asp\#FDF}{c:/Inet/DB/myLog.txt}{Math101} + +Dim cPathToTxtFile, dbRecord + +' Get Required info +cPathToTxtFile = FDFin.FDFGetValue("pathToTxtFile") +cCourseName = FDFin.FDFGetValue("courseName") +cQuiz = FDFin.FDFGetValue("quizName") + +' dbRecord is a tab delimited string of the quiz record +dbRecord = cCourseName & vbTab & cQuiz & vbTab & cTime + +Dim currentField, dbCurrentField, currentValue, parent +currentField = FDFin.FDFNextFieldName("") + +Do + ' check for dots + position = InStr(1,currentField, ".",0) + ' We save only fields that have hierarchial names: In particular, + ' we save fields with parent root of cQuiz or IdInfo. + If position <> 0 Then + parent = Trim(Mid(currentField,1,position-1)) + If (parent = cQuiz) or (parent = "IdInfo") Then + If DebugTxt Then Response.Write "currentField: " & currentField & "
" + ' strip off parent name, and replace "." with dotReplace + dbCurrentField = Replace(currentField, ".", dotReplace, position+1,-1,0) + If DebugTxt Then Response.Write "dbCurrentField: " & dbCurrentField & "
" + + On error Resume Next + currentValue = FDFin.FDFGetValue(currentField) + If DebugTxt Then Response.Write "currentValue: " & currentValue & "
" + If Err.Number <> 0 Then + ReportError(Err) + DebugMsg "Field Name: ",currentField + Err.Clear + Else + On error Resume Next + dbRecord = dbRecord & vbTab & dbCurrentField & ": " & currentValue + End If + End If + End If + On error Resume Next + currentField = FDFin.FDFNextFieldName(currentField) + If currentField = "" Or Err.Number <> 0 Then Exit Do +Loop + +If DebugFDF Then cBuf = cBuf & " " & ErcStatus + + +If DebugTxt Then + Response.Write "cPathToTxtFile: " & cPathToTxtFile & "
" + Response.Write "dbRecord: " & dbRecord & "
" +End If + +' Let's write to a log file +Dim logFileObj, logFile +Set logFileObj = CreateObject("Scripting.FileSystemObject") +Set logFile = logFileObj.OpenTextFile(cPathToTxtFile, 8, True) +logFile.WriteLine dbRecord +logFile.Close +Set logFileObj = Nothing + +cBuf = "Quiz results successfully saved!" +FDFout.FDFSetStatus cBuf + +' Send back to the browser +Response.BinaryWrite FDFout.FDFSaveToBuf + +FDFin.FDFClose +FDFout.FDFClose +Set FdfAcx = Nothing +Set FDFin = Nothing +Set FDFout = Nothing +%> diff --git a/texmf-dist/source/latex/eq2db/doc/eq2dbman.tex b/texmf-dist/source/latex/eq2db/doc/eq2dbman.tex new file mode 100644 index 00000000..201474bc --- /dev/null +++ b/texmf-dist/source/latex/eq2db/doc/eq2dbman.tex @@ -0,0 +1,1347 @@ +\RequirePackage[use=usebw]{spdef} +\documentclass{article} +\usepackage[fleqn]{amsmath} +\usepackage{graphicx,longtable,array} +%\usepackage[dvipsone,designvi,tight]{web} % dvipsone, dvips, pdftex, dvipdfm +\usepackage[designv,latextoc,forcolorpaper,centertitlepage]{web} +\usepackage[nodljs,execJS]{exerquiz} %,preview +\usepackage[altbullet]{lucidbry} +\usepackage{pifont} +\usepackage{fancyvrb} +%\usepackage{calc} + +\usepackage[active]{srcltx} + +%\setlongtables +\def\AEBBook{\textsl{{Acro\!\TeX} eDucation System Tools: {\LaTeX} for interactive PDF documents}} + +\hyphenation{Java-Script} + +\def\AcroT{Acro\!\TeX}\def\cAcroT{{\textcolor{blue}{\AcroT}}} +\def\AcroEB{\AcroT{} eDucation Bundle}\def\cAcroEB{\textcolor{blue}{\AcroEB}} +\def\AcroB{\AcroT{} Bundle}\def\cAcroB{\textcolor{blue}{\AcroB}} +\def\bUrl{http://www.math.uakron.edu/~dpstory} + +% Colors +\ifusebw +\universityColor{black} +\sectionColor{black} +\quesNumColor{black} +\tocColor{black} +\fi + +\makeatletter +\ifusebw +\def\@linkcolor{black} +\def\@citecolor{black} +\def\@filecolor{black} +\def\@urlcolor{black} +\fi +\let\bslash=\@backslashchar +%\renewcommand{\paragraph}{\@startsection{paragraph}{4}{0pt}{6pt}{-3pt}{\bfseries}} +\renewcommand{\paragraph} + {\@startsection{paragraph}{4}{0pt}{6pt}{-3pt} + {\normalfont\normalsize\bfseries}} +\renewcommand{\subparagraph} + {\@startsection{subparagraph}{5}{\parindent}{6pt}{-3pt}% + {\normalfont\normalsize\bfseries}} +\def\FitItIn{\eq@fititin} +\def\endredpoint{\FitItIn{{\large\ifusebw\color{black}\else\color{red}\fi$\blacktriangleleft$}}} +\def\chgCurrLblName#1{\def\@currentlabelname{#1}} +\makeatother + +\hypersetup{linktocpage} + +\def\cs#1{\texttt{\bslash#1}} +\newcommand\redpoint{\par\ifdim\lastskip>0pt\relax\vskip-\lastskip\fi +\vskip\medskipamount\noindent + \makebox[\parindent][l]{\large\ifusebw\color{black}\else\color{red}\fi$\blacktriangleright$}} +\newcommand\handpoint{\par\ifdim\lastskip>0pt\relax\vskip-\lastskip\fi +\vskip\medskipamount\noindent + \makebox[\parindent][l]{\large\ifusebw\color{black}\else\color{blue}\fi\ding{042}}} + +\def\anglemeta#1{$\langle\textit{\texttt{#1}}\rangle$} +\def\meta#1{\textit{\texttt{#1}}} +\let\pkg\textsf +\let\env\texttt +\let\opt\texttt +\let\app\textsf +\def\AEB{\textsf{AeB}} +\def\AcroTeX{Acro\!\TeX} +\def\HTML{HTML}\def\FDF{FDF} +\def\PDF{PDF}\def\URL{URL} +\let\amtIndent\leftmargini +\def\bNH{\begin{NoHyper}}\def\eNH{\end{NoHyper}} +\def\nhnameref#1{\bNH\nameref{#1}\eNH} +\def\nhNameref#1{\bNH\Nameref{#1}\eNH} +\def\nhurl#1{\bNH\url{#1}\eNH} +\def\grayV#1{\textcolor{gray}{#1}} +\def\darg#1{\{#1\}} +\def\parboxValign{t} +\renewcommand*{\backrefalt}[4]{% + See page\ifcase #1\or + ~#2.\else s~#2.\fi +} +\newenvironment{aebQuote} + {\list{}{\leftmargin\amtIndent}% + \item\relax}{\endlist} +\newcommand{\FmtMP}[2][0pt]{\mbox{}\marginpar{% + \raisebox{.5\baselineskip+#1}{% + \expandafter\parbox\expandafter[\parboxValign]% + {\marginparwidth}{\aebbkFmtMp#2}}}} +\def\aebbkFmtMp{\kern0pt\itshape\small + \ifusebw\color{gray}\else\color{blue}\fi + \raggedleft\hspace{0pt}} +\def\dps{$\mbox{$\mathfrak D$\kern-.3em\mbox{$\mathfrak P$}% + \kern-.6em \hbox{$\mathcal S$}}$} + +\title{\texorpdfstring{Acro\!\TeX}{AcroTeX} eDucation Bundle\texorpdfstring{\\}{: } + The \texorpdfstring{\pkg{eq2db}}{eq2db} Package} +\author{D. P. Story} +\subject{Manual of Usage for eq2db Distribution} +\keywords{AcroTeX, LaTeX, PDF, ASP, Database, Email, quizzes} + +\university{{\AcroT} Software Development Team} +%\university{THE UNIVERSITY OF AKRON\\ +% Theoretical and Applied Mathematics} +\email{dpstory@acrotex.net} +\version{2.0} +\copyrightyears{1999-\the\year} + +% \def\OpenToHere{\OpenAction{\JS{this.gotoNamedDest("Here")}}} +% \def\OpenHere{\hypertarget{Here}{\strut}}\OpenToHere + +\reversemarginpar + +\makeatletter +\let\web@copyright\@gobble +\let\web@revision\@gobble +\renewcommand\webdirectory +{% + \par\ifeqforpaper\else\minimumskip\fi\vspace{\stretch{1}}% + \begin{flushleft}\textbf{\large\web@directory}% + \vspace{-3pt} + \begin{itemize}\setlength{\itemsep}{-3pt}% + \bfseries + \item \leavevmode\hyperlink{webtoc}{\web@toc}% + \item Begin \hyperlink{\web@Start.1}{Documentation} + \item \href{aeb_man.pdf}{\AcroEB} + \item \textsf{\href{eformman.pdf}{eForm}} Support + \end{itemize} + \end{flushleft} +} +\def\maketitle@trailer@ul{\web@copyright\ \copyright\ \webcopyrightyears\ \webversion} +\def\maketitle@trailer@ll{\web@revision\ \@date} +\def\maketitle@trailer@ur{\url{http://www.acrotex.net}} +\def\maketitle@trailer@lr{\href{mailto:\webemail}{\webemail}} + +%\renewcommand\titlepageTrailer +%{% +% \web@copyright\ \copyright\ \webcopyrightyears\ \webversion +% \hfill\url{http://www.acrotex.net}\\ +% \web@revision\ \@date \hfill\href{mailto:\webemail}{\webemail} +%} +\makeatother + +\newcounter{exampleno} +\def\theexampleno{\arabic{exampleno}} +\newcommand\Example{\refstepcounter{exampleno}% +\paragraph*{Example.}} + +\begin{execJS}{execjs} +aebTrustedFunctions(this, aebAddWatermarkFromFile, { + bOnTop: false, + cDIPath: "C:/Users/Public/Documents/ManualBGs/Manual_BG_Print_AeB.pdf" +}) +aebTrustedFunctions(this, aebSaveAs, "Save") +\end{execJS} + + +\begin{document} + +\maketitle\tableofcontents + +\section{Introduction} + +\emph{Short Summary:} Converts a self-contained \pkg{exerquiz} \env{quiz} to one that is +submitted to a server-side script.\endredpoint + +\medskip +The \pkg{eq2eb} package is meant to be used with the \pkg{exerquiz} package, +one of the components of the \textbf{{Acro\!\TeX} eDucation Bundle} +(\texttt{ctan.org/pkg/acrotex}). The package redefines the `End Quiz' button +(of the \env{quiz} environment) appropriately so that when the user clicks +the `End Quiz' control, the results of the quiz are sent to a server-side +script. The \pkg{eq2db} Package has six options: +\begin{questions} +\item \texttt{\hyperref[eqRecordOption]{eqRecord}}: Save quiz data + to a database, such as Microsoft Access. (Supported for FDF submission.) +\item \texttt{\hyperref[eqEmailOption]{eqEmail}}: Email quiz data + to the instructor. (Supported for FDF and HTML submission.) +\item \texttt{\hyperref[eqTextOption]{eqText}}: Save quiz data + to a tab-delimited text file. Can then be opened and analyzed + using Microsoft Excel. (Supported for FDF and HTML submission.) +\item \texttt{\hyperref[customOption]{custom}}: A hook for developers + to use \texttt{eq2db} with their own script. +\item \texttt{\hyperref[taggedOption]{tagged}}: Write quiz data in an XML-like + data stream. +\item \texttt{submitAs=\meta{\upshape FDF|HTML|XML}}: (new in v2.0) The + \texttt{submitAs} option allows the document author to submit as FDF, + HTML, or XML. The scripts provided by this package are designed FDF + submittal and HTML submittal. Scripts for an XML submittal type are left + as an exercise. + + With regard to HTML submission, read Section~\ref{s:IntroHTMLSub} below. +\end{questions} + +For FDF submittal, accompanying each of the first three options listed above +is a server-side script. These are ASP pages written with \app{VBScript}. +A \app{Windows} server running Microsoft IIS is required; Adobe \textsl{FDF Toolkit} +is also required to be installed on the server. + +\subsection{Introduction to HTML submission}\label{s:IntroHTMLSub} + +My upcoming book (if it ever comes), \AEBBook~\cite{book:AEBB}, has a rather extensive chapter +titled ``Server-side Scripting and the \pkg{eq2db} Package.'' In the course +of writing that chapter, I decided to throw in the towel on the \textsl{FDF +Toolkit}, the mainstay for FDF submission, and to look at HTML submission. +Yes, PDF form data can be submitted as HTML form data. As result, I wrote a +number of scripts for general purpose PDF form documents and for quiz +documents (see Tables~\ref{table:QuizScripts1} and~\ref{table:QuizScripts2}); +identical functioning scripts were written for the \app{Windows} +server-platform using \app{ASP} and \app{VBScript} and for the \app{Linux} +server-platform using \app{PHP}. + +\paragraph*{{\AEB} demonstration websites.}\label{para:SSDemoPages}\leavevmode +These two websites were created to illustrate server-side concepts and examples brought up +in the book. The links on these pages demonstrate the two sets of scripts +listed in Tables~\ref{table:QuizScripts1} and~\ref{table:QuizScripts2}, and much more. +\begin{quote} +\nhurl{http://faculty.nwfsc.edu/web/math/storyd/dps/} +\end{quote} +The above Web page is on a \app{Windows} server hosted by Northwest Florida State +College (NWFSC). The server-side +script is written as ASP pages using VBScript. +\begin{quote} +\nhurl{http://www.acrotex.net/dps/} +\end{quote} +This Web page is on a \app{Linux} server hosted by {\AcroTeX.Net}. The +server-side script is written with PHP. + +A parallel development of all scripts is maintained for these two server +platforms. You are invited to navigate your Web browser to each of these +{\URL}s and experience forms submission from a {\PDF} document. + + +\section{The Distribution and Requirements} + +The \pkg{eq2db} Package is distributed with the following files: +\begin{questions} + \item \texttt{eq2dbman.pdf}: This document, the documentation for + the {\LaTeX} package \pkg{eq2db} and its related files. + \item \texttt{eq2db.dtx} and \texttt{eq2db.ins}: The {\LaTeX} package + with its installation file. + \item \textsf{eqRecord.asp}: An \textsf{ASP} script for saving \pkg{exerquiz} + quizzes to a data\-base. + \item \textsf{eqEmail.asp}: An \textsf{ASP} script for forwarding \pkg{exerquiz} + quizzes via e-mail. + \item \textsf{eqText.asp}: An \textsf{ASP} script for saving \pkg{exerquiz} + quizzes to a tab-delimited file. + \item \texttt{quiz1.tex}, \texttt{quiz2.tex}, \texttt{quiz3.tex}, + \texttt{quiz4.tex} (quizzes~1 and~2 demo use the \texttt{eqRecord} + option; \texttt{quiz3} demos \texttt{eqEmail}, and \texttt{quiz4} + demos \texttt{eqText}.) + \item \texttt{eqQuiz.mdb}: A Microsoft Access 2000 database is used + with the demostration files \texttt{quiz1.tex} and \texttt{quiz2.tex}. +\end{questions} + +The \pkg{eq2db} package requires the \pkg{exerquiz} package to create online +quizzes and to create supporting buttons and text fields. The \pkg{exerquiz} +package, in turn, assumes a number of packages; a listing of these can be +found in the documentation for the \AcroEB. + +\section{The \texttt{eqRecord} option}\label{eqRecordOption} + +In this section we describe how to create an online quiz that is to be +submitted to the server-side script \app{eqRecord.asp}\footnote{The script +\textsf{eqRecord.asp} comes with absolutely \emph{no guarantees}. Extensive +testing should be made on your own system to assure yourself script is +reliable enough to use in practice. Feel free to modify the script to suite +your needs.}. For this option, quiz results are saved to a database. The +\opt{eqRecord} option and its corresponding script \app{eqRecord.asp} require +that Adobe's \textsf{FDF Toolkit} is installed on +your \app{Windows} server\FmtMP[\baselineskip]{FDF Toolkit required}. + +\redpoint \texttt{quiz1.tex} and \texttt{quiz2.tex} are the demo +files for this option. + +\paragraph*{In the preamble.} +The steps to create a quiz to be submitted to +\textsf{eqRecord} are simple enough. First, the preamble of your +document should look something like this: +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small,commandchars=!()] +\documentclass{article} +\usepackage[designi]{web} +\usepackage{exerquiz} +\usepackage[eqRecord!grayV(,tagged)]{eq2db} +\end{Verbatim} +You may have other packages loaded, as well as other options for \pkg{web} +and \pkg{exerquiz}. The \pkg{eq2db} package was designed to be seamless in +the following sense: If the \pkg{eq2db} package is not loaded, then an +\pkg{exerquiz} \env{quiz} is self-contained, that is, it is not submitted to +a server-side script; if \pkg{eq2db} package is loaded, then the quizzes are +submitted to a server-side script. The \opt{tagged} option may be optionally +included in the option list of \pkg{eq2db}, shown in gray. + +\paragraph*{In the body.} Next, you write your \pkg{exerquiz} \env{quiz}: +\begin{equation} +\begin{minipage}{336pt} +\begin{Verbatim}[fontsize=\small] +\eqSubmit{http://www.example.edu/scripts/eqRecord.asp\#FDF} + {QuizIt}{Math101} +\begin{quiz*}{Quiz1} +Answer each of the following. Passing is 100\%. +\begin{questions} +\item ... +... +\item ... +\end{questions} +\end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz +\end{Verbatim} +\end{minipage}\label{display:BodyEqRec} +\end{equation} +Preceding the quiz is the \cs{eqSubmit} command, defined in the \pkg{exerquiz}, +it takes three parameters. +\begin{equation} +\begin{minipage}{225pt} +\begin{Verbatim}[fontsize=\small,commandchars=!()] +\eqSubmit{!meta(submitURL)}{!meta(dbName)}{!meta(dbTable)} +\end{Verbatim} +\end{minipage}\label{display:SubmitRec} +\end{equation} + +\subparagraph*{Description of the parameters.} The \cs{eqSubmit} command provides essential +information use by the server-side scripts. The parameters of \cs{eqSubmit} +are briefly described. +\begin{aebQuote}\rightskip0pt +\begin{description}\def\NH{\relax\hspace*{-\labelsep}}% +\item\NH\meta{submitURL} is the {\URL} to the script \texttt{eqRecord.asp\#FDF}. + Internally, the value of this parameter is saved in the text macro + \cs{eq@CGI}. Note that the name of the script \texttt{eqRecord.asp} has + \texttt{\#FDF} appended (the hash mark `\texttt{\#}' followed by the fragment + identifier {\FDF}\index{fragment identifier (FDF)@fragment identifier (FDF)}). + +\item\NH\meta{dbName} is the name of the database to use. My examples use + ODBC, with \texttt{QuizIt} as the DSN (data source name). + +\item\NH\meta{dbTable} is the name of the +table into which the data record is to be inserted (this is \texttt{Math101} +in the example above). +\end{description} +\end{aebQuote} +The three arguments of the command \cs{eqSubmit} are used to define the +values of \cs{db@Name}, \cs{db@Table} and \cs{eq@CGI}, respectively, the +values of which are used to populate the hidden fields. + +Assuming \textsf{eqRecord.asp} is installed on your web server, and the +\textsl{FDF Toolkit} has also been installed (see Section~\ref{settingup}), +we are ready to submit the quiz. + +\subsection{Field Values Processed by \textsf{eqRecord.asp}}\label{eqRfieldvalues} + +The \textsf{eqRecord} script processes two classes of field data: certain +``\hyperref[hardwired]{hard-wired}'' field data; and field data having a +\hyperref[hierarchalfields]{hierarchal} name with a root of either +\anglemeta{dbName} or \texttt{IdInfo}, e.g., \texttt{Quiz1.numQuestions} or +\texttt{IdInfo.Name.Last}. Details of each of these follow. + +\subsubsection{``Hard-wired'' Fields}\label{hardwired} + +When you compile your source document using the package +\pkg{eq2db} with the \texttt{eqRecord} option, the package +creates three hidden text fields, with field titles of +\texttt{dbName}, \texttt{dbTable} and \texttt{quizName}. These +hidden fields are created under the `End Quiz' button. At submit time, +these fields are populated and submitted. Below is an enumerated list +of these three fields with a brief description of each: +\begin{enumerate} + \item \texttt{dbName}: The name of the database to which the + data is to be saved. (I've been using ODBC to reference the database.) + \item \texttt{dbTable}: The name of the table within \texttt{dbName} where the data + is to be stored. + \item \texttt{quizName}: The name of the quiz or test. Name would uniquely characterize + the quiz/test the student has taken. +\end{enumerate} +The first two hidden fields are populated by the second and third arguments, +respectively, of \cs{eqSubmit}, as defined in +display~\eqref{display:SubmitRec}. The third piece of data, +\texttt{quizName}, is obtained from the first required argument of the +\env{quiz} environment. See the skeleton example in +display~\eqref{display:BodyEqRec}, there you'll see +\verb~\begin{quiz*}{Math101}~. The argument `\texttt{Math101}' is the quiz +name and is passed to the server-side script as the value of the +\texttt{quizName} hidden text field. + + +\subsubsection{Fields with Hierarchal Names}\label{hierarchalfields} + +Other than the fields described in \nameref{hardwired}, \textsf{eqRecord.asp} processes +only fields with hierarchal names that have a root name of \anglemeta{quizName} +(see \nhnameref{hardwired} on page~\pageref{hardwired}) or a root name of \texttt{IdInfo}. + +\paragraph*{\texttt{quizName} (\cs{currQuiz}):} \texttt{quizName} is the field title of one of the hidden fields, +its value is picked up as the first argument of the \env{quiz} +environment; the value is stored in the text macro \cs{currQuiz}. + +In addition to the ``hard-wired'' hidden fields described earlier, there are actually three +more hidden fields (under the `End Quiz' button) with root name \anglemeta{quizName}. These are +\begin{itemize} + \item \cs{currQuiz.numQuestions}: The number of questions in the quiz + \item \cs{currQuiz.numCorrect}: The number of correct questions + \item \cs{currQuiz.Responses}: a list of all the responses of the user +\end{itemize} +The values of these fields are also sent to \textsf{eqRecord.asp}. +There is a mechanism for creating more hidden fields the values of +which are sent to the script. The technique for doing this will be +discussed later. + +\paragraph*{\texttt{IdInfo}:}\chgCurrLblName{IdInfo}\label{para:IdInfo} As mentioned earlier, \textsf{eqRecord.asp} processes fields +that use a hierarchal naming convention, with root name of \anglemeta{quizName} or \texttt{IdInfo}. +Fields whose root name is \texttt{IdInfo} are meant to hold information about the person +taking the quiz: first name, last name, student number, etc. + +For example, you can create fields the user fills in for +self-identifi\-cation. In the preamble, you can define new commands: +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +% User's First Name +\newcommand\FirstName[2]{\textField{IdInfo.Name.First}{#1}{#2}} + +% User's Last Name +\newcommand\LastName[2]{\textField{IdInfo.Name.Last}{#1}{#2}} + +% User's SSN +\newcommand\SSN[2]{\textField[\MaxLen{11} + \AA{\AAKeystroke{AFSpecial_Keystroke(3);} + \AAFormat{AFSpecial_Format(3);} + }]{IdInfo.SSN}{#1}{#2}} +\end{Verbatim} +\noindent Note that I've defined these fields so that their names +follow a hierarchal name structure, with a root of +\texttt{IdInfo}. The two required arguments are the dimensions of +the text field being constructed. For example, +\verb+\FirstName{100bp}{10bp}+ creates a text field with a title of +\texttt{IdInfo.Name.First} which is \texttt{100bp} wide and \texttt{10bp} high. + +\redpoint See the demo file \texttt{quiz1.tex} for examples. + +\medskip\noindent +Additional \texttt{IdInfo} fields can be constructed. + +\subsection{Mapping PDF Field Names onto DB Field Names}\label{mappdf2db} + +\textsf{eqRecord.asp} is a quasi-general script for mapping the values of PDF fields +into corresponding fields in a database. The way \textsf{eqRecord} is set up, the +DB field name is derived from the PDF field name. For example, the value of the PDF field +\texttt{Quiz1.numQuestions} is stored in the DB under the DB field name of \texttt{numQuestions}. + +For field names such as \texttt{IdInfo.Name.Last}, we can't map +this into the DB field name \texttt{Name.Last} because for some +databases (notably, Microsoft Access) database field names +containing a `dot' are not legal. As a work around, +\textsf{eqRecord.asp} strips all dots from the field name, and +replaces them with the value of the VB Script variable +\texttt{dotReplace}. The definition of \texttt{dotReplace} in \textsf{eqRecord.asp} is +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +Dim dotReplace : dotReplace = "_" +\end{Verbatim} +\noindent That is, a `dot'(\texttt.) is replaced by an `underscore' (\texttt\_). + +\medskip\noindent +The table below illustrates the mapping of PDF field name onto database field +names. Suppose the \texttt{quizName} is \texttt{Quiz1}: + +\medskip +\begin{longtable}{>{\ttfamily}l>{\ttfamily}ll} +\multicolumn1{>{\bfseries}l}{PDF Field Name}&\multicolumn1{>{\bfseries}l}{DB Field Name}&\multicolumn1{>{\bfseries}l}{Required}\\\hline\endfirsthead +\multicolumn1{>{\bfseries}l}{PDF Field Name}&\multicolumn1{>{\bfseries}l}{DB Field Name}&\multicolumn1{>{\bfseries}l}{Required}\\\hline\endhead +quizName (e.g.,\,Quiz1) & quizName & Yes\\ +Quiz1.numQuestions & numQuestions & Yes\\ +Quiz1.numCorrect & numCorrect & Yes\\ +Quiz1.Responses & Responses & Yes\\ +IdInfo.Name.Last & Name\_Last& No\\ +IdInfo.Name.First& Name\_First & No\\ +IdInfo.SSN & SSN & No\\ +\multicolumn1l{N/A} & TimeOfQuiz & Yes\\ +\end{longtable} +\noindent The last entry needs comment: \textsf{eqRecord.asp} generates a time stamp when a quiz is processed. This time stamp +is stored in a field with a name of \texttt{TimeOfQuiz}. This is a required field in your database. + + +\subsection{Adding more Hidden Fields}\label{moreHiddenFields} + +When you add fields with a hierarchal name with a root of +\cs{currQuiz} or \texttt{IdInfo}---whether hidden or +not---the values of these fields will be submitted and processed +by \textsf{eqRecord.asp}. When you add fields in your document, +there should be a corresponding DB field to receive this data +(see Section~\ref{mappdf2db} for naming conventions). You can also +add hidden fields to transmit information about the quiz that the +user does not need to see. + +\Example Suppose you have a point value to each question and want to report +the point score (rather than the number missed). In this case, you would use +the \cs{PointsField} field instead of the \cs{ScoreField} (though you could +use both). + +\cs{PointsField} has a hierarchal name, but its root +does not begin with \cs{currQuiz}; consequently, the value +of this field is not submitted to \textsf{eqRecord.asp}. (The +value of this field is a string what is meant to be read by the +user; it reads, for example, ``Score: 16 out of 20''; we don't +want this string submitted anyway, we would want the point score +(16) and the total points (20) submitted.) We want to transmit the +points scored and the total number of points to the server-side +script. + +The \pkg{eq2db} package defines two helper commands for +creating hidden fields (these hidden fields are hidden under the +`End Quiz' button); these are \cs{addHiddenField} and +\cs{populate\-HiddenField}. + +Suppose we had a quiz, \texttt{Quiz1}, in which we wanted to +report points scored and total points. First, we need to add two +hidden fields, we'll call them \texttt{Quiz1.ptScore} and +\texttt{Quiz1.nPointTotal}; we create the hidden fields using +\cs{addHiddenField}: +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +\addHiddenTextField{Quiz1.ptScore}{} +\addHiddenTextField{Quiz1.nPointTotal}{\theeqpointvalue} +\end{Verbatim} +\noindent The first parameter is the title (name) of the field, +the second parameter is the default value. For the first line, no +default value is given; for the second line, a default value of +\cs{theeqpointvalue} is given. The counter \cs{eqpointvalue} +contains the total number of points for the quiz so we can insert +that value at \texttt{latex} compile-time. + +The value of the first field added, \texttt{Quiz1.ptScore}, is not +known until a user takes a quiz and submits results. The \pkg{eq2db} command +\cs{populateHiddenField} inserts the necessary +JavaScript that would populate the specified field. For example, +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +\populateHiddenField{Quiz1.ptScore}{ptScore} +\end{Verbatim} +The first parameter is the field name, the second is the value the field +is to hold when the user clicks on `End Quiz'. The command +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +\populateHiddenField{fieldname}{fieldvalue} +\end{Verbatim} +expands to, +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +this.getField("fieldname").value = fieldvalue; +\end{Verbatim} +which is the JavaScript for populating the field, +is inserted into the code just prior to the submission of the +data. + +\redpoint +See second quiz in the sample file \texttt{quiz1.tex} for +a complete example of creating a quiz with weight set for each +question, and for reporting the point score and total points. +\endredpoint + +\medskip\noindent The table below lists some variables (both \LaTeX{} and +JavaScript) that might be useful in extracting desired information from +quiz for submittal. + +\begin{longtable}{>{\ttfamily}l>{\PBS\raggedright}p{.55\linewidth}} +\multicolumn1{>{\bfseries}l}{Variable}&\multicolumn1{>{\bfseries}l}{Description}\\\hline\endfirsthead +\multicolumn1{>{\bfseries}l}{Variable}&\multicolumn1{>{\bfseries}l}{Description}\\\hline\endhead +Score & Score of the user with one point per problem. This value is always reported in the hidden text field +\texttt{quizName.numCorrect}. This is a JavaScript variable known when the user finishes the quiz. +This value is always reported in \texttt{quizName.numQuestions}, the hidden text field.\\ +\cs{thequestionno} & The number of questions in the current quiz. A \LaTeX{} macro; known at compile-time.\\ +Responses & A comma-delimited list of all responses of the user. A JavaScript variable known when +the user finishes the quiz. Always reported in the hidden field +\texttt{quizName.Responses}\\ +ptScore & The point score of the user's quiz. A JavaScript variable, known when the user finishes quiz.\\ +\cs{theeqpointvalue} & The total number of points in the current quiz. A \LaTeX{} macro, known at +compile-time.\\ +pcScore& The score expressed as a percent. A JavaScript variable known when the user finishes the quiz. \\ +quizGrade & The letter grade of the user's quiz. A JavaScript variable, known at ``run-time''. \\ +\cs{eqGradeScale} & The grade scale for the quiz. A \LaTeX{} macro, known at ``compile-time''.\\ +\end{longtable} + +%\redpoint Other useful variables---perhaps at developers request---will be +%added in the future. \endredpoint + + +\subsection{Setting Up}\label{settingup} + +In this section, we briefly discuss configuring your server and setting up +the demo files that accompany this distribution. + +\subsubsection{Configuring the Server} + +On the server side, in order for \textsf{eqRecord.asp} to run +correctly, Microsoft Internet Information Server (IIS), version +4.0 or greater, is needed. The script \textsf{eqRecord.asp} needs to be +placed where ASP scripts have execute permissions. + +The \textsf{eqRecord.asp} uses the \textsl{Adobe FDF Toolkit}\footnote{Currently located at the +\href{http://partners.adobe.com/public/developer/acrobat/devcenter.html}{Acrobat Family Developer Center}.}, version +6.0. Follow the directions for installation contained in the +accompanying documentation. + +Install \textsf{eqRecord.asp} in a folder (perhaps called +\texttt{Scripts}) designated to execute scripts. If you don't +have such a folder, then the following steps explain how to +create a virtual directory through IIS that points to this folder. + +\begin{enumerate} +\item Create a new folder on the system (\texttt{Scripts}, for example). Its +recommended location is inside the \texttt{Inetpub} folder. + +\item Place \textsf{eqRecord.asp} in this newly created folder. + +\item In the MMC snap-in for IIS, create a virtual directory by +right-clicking on the Default Web Site and selecting +\texttt{New\;>\;Virtual Directory}. + +\item Type ``Scripts'' (or whatever the name of the folder you +created in~Step~1) as the alias for the virtual directory, and +then link it to the physical directory you created in Step~1. + +\item Make sure that ``Script execution'' privileges are enabled. +If not, enable them. +\end{enumerate} + +\subsubsection{Set Up the Demo Files} + +Place the Access 2000 database, \texttt{QuizIt.mdb}, in a folder +that is accessible by the server, such as the root level of your +web server, or perhaps, a folder dedicated to database files. +Register the database with the ODBC Data Source Administrator as a +System DSN under the System Data Source Name of ``QuizIt''. + +Modify the first parameter of \cs{eqSubmit} in \texttt{quiz1.tex} +and compile (\texttt{latex}), then create \texttt{quiz1.pdf} using +\textsf{Acrobat Distiller}, \textsf{pdftex} or \textsf{dvipdfm}, +and place it on your server. Test by opening \texttt{quiz1.pdf} +in your web browser and taking a sample test. Good luck, I hope it works! + +\subsubsection{Comments on Demo Files}\label{demofiles} + +\paragraph*{\texttt{quiz1.tex}:} This file has two quizzes, +\texttt{Quiz1} and \texttt{Quiz2}. \texttt{Quiz1} has no frills, +the user enters his/her name and SSN, takes the quiz, and results +are saved to the \texttt{eqQuiz.mdb} Access database. +\texttt{Quiz2} is a bit more interesting as it demonstrates how to +assign points to each question, and how to report the results. The +techniques used in this quiz were discussed in +Section~\ref{moreHiddenFields}. + +\paragraph*{\texttt{quiz2.tex}:} The quizzes of \texttt{quiz1.tex} +did not check whether the user is enrolled in the class, and as +such, is allowed to take the quiz. The demo file +\texttt{quiz2.tex} demonstrates how to\dots +\begin{questions} + \item check whether the user has entered a valid SSN, that is, the + SSN of someone enrolled in the class, or is permitted to take the quiz + + \item set a deadline date to take the quiz + + \item set a time limit to take the quiz +\end{questions} +Other variations are possible. + + +\subsection{Accessing Results in the DB} + +The database that is to hold quiz results is placed on a +web-server and consequently, is not easily accessible by the +instructor. The ASP script \textsf{GenericDB}\footnote{\url{http://www.genericdb.com/}} developed by Eli Robillard, is +a tool that can be used to access the database through your web +browser. Using \textsf{GenericDB}, you can view, edit, update, add +new and delete database records---and it's free! Check it out! + + +\section{The \texttt{eqText} Option}\label{eqTextOption} + +In this section, we describe how to submit your data to a server-side script +that save the data to a tab-delimited text field. The \opt{submitAs} option +can be used with the \env{eqText} option. With \texttt{submitAs=FDF}, the +form data is submitted in the FDF format, the native form data format for +PDF, the target script should be \app{eqText.asp}. When +\texttt{submitAs=HTML} is used, the form data is submitted as ordinary HTML +form data, which can then be processed by any public domain script; +alternately, you can use one of the scripts in +Table~\ref{table:QuizScripts1}. These four scripts are available on the +CD-ROM that accompanies the book \AEBBook~\cite{book:AEBB}. + + +\begin{table}[htb]\centering +\begin{tabular}{r>{\ttfamily\raggedright}p{1.5in}} +\multicolumn{1}{>{\bfseries}r}{Option and return type}&% +\multicolumn{1}{>{\bfseries}l}{Script Files for \app{Windows} \& \app{Linux}}\\ +\texttt{eqText}, {\HTML} return&eqText\_h.asp +eqText\_h.php\tabularnewline[3pt] +\texttt{eqText}, {\FDF} return&eqText\_hf.asp\#FDF\penalty0 +eqText\_hf.php\#FDF +\end{tabular} +\caption{Scripts for \opt{eqText} \& \texttt{submitAs=HTML} options}\label{table:QuizScripts1} +\end{table} + + +\subsection{Submit as FDF} + +We describe how to create an online quiz that is +to be submitted to the server-side script +\textsf{eqText.asp}\footnote{The script \textsf{eqText.asp} comes +with absolutely \emph{no guarantees}. Extensive testing should be +made on your own system to assure yourself script is reliable +enough to use in practice.}. With this option, you save your quiz data to +a tab-delimited file. The \textsl{FDF Toolkit}\FmtMP[\baselineskip]{FDF Toolkit required} is required to be installed on the +\app{Windows} server. + +\redpoint The demo file for this option is \texttt{quiz4.tex}. + +\paragraph*{In the preamble.} Begin the document with the usual preamble for an +\pkg{exerquiz} document, but include the \pkg{eq2db} package with the +\opt{eqRecord} option. +\begin{equation} +\begin{minipage}{355pt} +\begin{Verbatim}[fontsize=\small,commandchars=!()] +\documentclass{article} +\usepackage{amsmath} +\usepackage[!grayV(!anglemeta(driver)),designi]{web} % driver: dvips, pdftex, xetex +\usepackage{exerquiz} +\usepackage[!grayV(submitAs=FDF,)eqText]{eq2db} +\end{Verbatim} +\end{minipage}\label{display:PreamEqText} +\end{equation} +Shown in gray are the \anglemeta{driver} and \opt{submitAs} options. The +\opt{pdflatex} and \opt{xelatex} applications are automatically detected, so +only \opt{dvips} needs to be specified if you are building your PDF with +\app{Acrobat Distiller}. The submission type is FDF by default, so +\opt{submitAs=FDF} need not be listed in the options of \pkg{eq2db}. + +\paragraph*{In the body.} The following is a rough outline of an \pkg{exerquiz} +quiz document that submits to \app{eqRecord.asp}, the preamble declarations of +display~\eqref{display:PreamEqText}. +\begin{equation} +\begin{minipage}{330pt} +\begin{Verbatim}[fontsize=\small] +\eqSubmit{http://www.example.edu/scripts/eqText.asp\#FDF} + {c:/Inetpub/Data/math101.txt}{Math101} +\begin{quiz*}{Quiz1} Answer each of the following. Passing +is 100\%. +\begin{questions} +\item ... +... +\item ... +\end{questions} +\end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz +\end{Verbatim} +\end{minipage}\label{display:eqTextTemplate} +\end{equation} +Notice that `\texttt{\#FDF}' is appended to the path, this informs the PDF viewer to expect +the server-side script to return FDF form data. + +\medskip +Preceding the quiz is the \cs{eqSubmit} command, defined in the \pkg{exerquiz}, +it takes three parameters. +\begin{equation} +\begin{minipage}{276pt} +\begin{Verbatim}[fontsize=\small,commandchars=!()] +\eqSubmit{!meta(submitURL)}{!meta(pathToTabFile)}{!meta(courseName)} +\end{Verbatim} +\end{minipage}\label{display:SubmitTxt} +\end{equation} +\subparagraph*{Description of the parameters.} The \cs{eqSubmit} command +provides essential information use by the server-side scripts. Its parameters +are briefly described. +\begin{description} +\item\meta{submitURL} is the {\URL} to the server-side script + \texttt{eqText.asp}. Internally, the value of this parameter is saved in + the text macro \cs{eq@CGI}. + +\item\meta{pathToTabFile} is the path to the tab-delimited file on the + server where the script is to save the data. On \app{Windows}, + \meta{pathToTabFile} is the physical (absolute) path to the file, on + \app{Linux} it can be a relative path (relative to the folder containing + the executing script). Internally, this value is saved in the text macro + \cs{db@Name}.\footnote{Choice for + the names of \cs{db@Name} and \cs{db@Table} were originally based on the + \texttt{eqRecord} option where data is saved to a database.}\xdef\fnNameChoice{\thefootnote} + +\item\meta{courseName} is the course name of the class taking the quiz. + Internally, this value is saved in the text macro + \cs{db@Table}.${}^\text{\fnNameChoice}$ +\end{description} + + +\subsubsection{Field Values Processed by \textsf{eqText.asp}}\label{eqTfieldvalues} + +The \textsf{eqText} script processes two classes of field data: +certain ``\hyperref[hardwiredText]{hard-wired}'' field data; and field data +having a \hyperref[hierarchalfieldsText] {hierarchal} name with a root of either +\anglemeta{dbName} or \texttt{IdInfo}, e.g., \texttt{Quiz1.numQuestions} or +\texttt{IdInfo.Name.Last}. Details of each of these follow. + +\paragraph*{``Hard-wired'' Fields.}\label{hardwiredText} +When you compile your source document with the package \pkg{eq2db} with the +\texttt{eqText} option, the package creates a number of hidden text fields. +These hidden fields are created under the `End Quiz' button. At submit time, +these fields are populated and submitted along with the quiz data. Below is +an enumerated list of these hidden fields with a brief description of each: +\begin{enumerate} + \item \texttt{pathToTxtFile}: The value of second argument of + \cs{eqSubmit} populates this text field. + \item \texttt{courseName}: The value of the third parameter of + \cs{eqSubmit} populates this text field. + \item \texttt{quizName}: The name of the quiz or test, this is + \cs{currQuiz}. Name should uniquely characterize the quiz/test the + student is taking. +\end{enumerate} +The first two hidden fields are populated by the second and third arguments, +respectively, of \cs{eqSubmit}, as defined in +display~\eqref{display:SubmitTxt}. The third piece of data, +\texttt{quizName}, is obtained from the first required argument of the +\env{quiz} environment. See the skeleton example in +display~\eqref{display:eqTextTemplate}, there you'll see +\verb~\begin{quiz*}{Math101}~. The argument `\texttt{Math101}' is the quiz +name and is passed to the server-side script as the value of the +\texttt{quizName} hidden text field. + +\paragraph{Fields with Hierarchal Names.}\label{hierarchalfieldsText} + +Other than the fields described in \nameref{hardwired}, \textsf{eqText.asp} processes +only fields with hierarchal names that have \cs{currQuiz} as a root name +(see \nhnameref{hardwired} above) or a root name of \texttt{IdInfo}. + +\subparagraph*{\texttt{quizName} (\cs{currQuiz}):} \texttt{quizName} is the +field title of one of the hidden fields, its value is picked up as the first +argument of the \env{quiz} environment; the value is stored in the text +macro \cs{currQuiz}. + +In addition to the ``hard-wired'' hidden fields described earlier, there are +actually five more hidden fields (under the \textsf{End Quiz} button) with +root name \cs{currQuiz}. These are, +\begin{itemize} + \item \cs{currQuiz.numQuestions}: The number of questions in the quiz. + \item \cs{currQuiz.numCorrect}: The number of correct questions. + \item \cs{currQuiz.Responses}: A list of all the responses of the user. + \item \cs{currQuiz.ptScore}: The point score the student received on + completion of the quiz. + \item \cs{currQuiz.nPointTotal}: The total number of points in the + quiz. +\end{itemize} +The values of these fields are also sent to the server-side script for the +\texttt{eqText} option. There is a mechanism for creating more hidden fields +the values of which are sent to the script. The technique for doing this is +discussed in \Nameref{moreHiddenFields}. + +\subparagraph*{\texttt{IdInfo}:}\label{spara:IdInfoText} +As mentioned earlier, the \textsf{eqText} scripts process fields that use a +hierarchal naming convention, with root name of \cs{currQuiz} or +\texttt{IdInfo}. Fields whose root name is \texttt{IdInfo} are meant to hold +information about the person taking the quiz: first name, last name, student +number, and so on. Refer to the paragraph titled \textbf{\nhnameref{para:IdInfo}} +on page~\pageref{para:IdInfo} for more information. + +\subsubsection{Setting up the Script} + +On the server side, in order for \textsf{eqText.asp} to run +correctly, Microsoft Internet Information Server (IIS), version +4.0 or greater, is needed. The script \textsf{eqText.asp} should +be placed where ASP scripts have execute permissions. + +\subsection{Submit as HTML} + +When the \opt{eqText} and \opt{submitAs=HTML} options are specified for +\pkg{eq2db}, the form data are submitted as ordinary HTML form data. For the +\opt{eqText} option, it is meant that the server-side script save the form +data as a tab-delimited file. You can develop your own script for doing this, +or you can use one of the scripts of Table~\ref{table:QuizScripts1}, +available on the CD-ROM of the book \AEBBook~\cite{book:AEBB}. The advantage of submitting as +HTML is that the \textsl{FDF Toolkit} is not needed, and the techniques for +writing a server-side script are well known. + +The preamble of your document should look something like the following. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\documentclass{article} +\usepackage[designi]{web} +\usepackage{exerquiz} +\usepackage[eqText,submatAs=html,tagged]{eq2db} +\end{Verbatim} +The \opt{tagged} option is recommended for the \opt{eqText} option but +no required. You may have other packages loaded, as well as other options for +\pkg{web} and \pkg{exerquiz}. The \pkg{eq2db} package was designed to be +seamless in the following sense: If the \pkg{eq2db} package is not loaded, +then an \pkg{exerquiz} quiz is self-contained, that is, it is not submitted +to a server-side script; if \pkg{eq2db} package is loaded, then the quizzes +are submitted to a server-side script. + +In addition to the introduction of the \pkg{eq2db} package in the preamble, +there are two more important commands: +\begin{equation} +\begin{minipage}{300pt} +\begin{Verbatim}[commandchars=!()] +\eqSubmit{!meta(submitURL)}{!meta(pathToTabFile)}{!meta(courseName)} +\rtnURL{!meta(returnURL)} +\end{Verbatim} +\end{minipage}\label{display:eqSubmitT} +\end{equation} +\cs{eqSubmit}, defined in \pkg{exerquiz}, is required; \cs{rtnURL}, defined +in \pkg{eq2db}, is required only when the return from the server is an +{\HTML} page, but is recommended. + +\paragraph*{Description of the parameters.} The \cs{eqSubmit} command provides essential +information use by the server-side scripts, \cs{rtnURL} provides a return +{\URL} that points to where the student should navigate after the quiz. +Their parameters, as indicated in display~\eqref{display:eqSubmitT}, are briefly described. +\begin{description} +\item\meta{submitURL} is the {\URL} of one of the server-side scripts in + Table~\ref{table:QuizScripts1}. Internally, the value of this parameter + is saved in the text macro \cs{eq@CGI}. + +\item\meta{pathToTabFile} is the path to the tab-delimited file on the + server where the script is to save the data. On \app{Windows}, + \meta{pathToTabFile} is the physical (absolute) path to the file, on + \app{Linux} it can be a relative path (relative to the folder containing + the executing script). Internally, this value is saved in the text macro + \cs{db@Name}.${}^\text{\fnNameChoice}$ + +\item\meta{courseName} is the course name of the class taking the quiz. + Internally, this value is saved in the text macro + \cs{db@Table}.${}^\text{\fnNameChoice}$ + +\item\meta{returnURL} is the {\URL} of the page the student should return + to after finishing the quiz. The value of \cs{rtnURL} is required when + the script returns an {\HTML} page, and is useful when the return is + {\FDF}. Internally, \cs{rtnURL} defines the text macro \cs{thisRtnURL} + to hold \meta{returnURL}. +\end{description} + +\paragraph*{The scripts.} The \meta{submitURL} points to the server-side script that is to process the form data. +The scripts of Table~\ref{table:QuizScripts1} were written for the upcoming book +{\AEBBook} and are available on the accompanying CD-ROM. Refer the book for the details of +implementing these scripts. + +\paragraph*{HTML versus FDF return.} The scripts of Table~\ref{table:QuizScripts1} are of two types: +HTML return and FDF return. In the first case, after the student has submitted his/her quiz, +the server-side script returns an HTML page to the browser window with an assessment of the +student's efforts on the quiz. In the second case, the script sends back an alert dialog box message saying +the data is received and saved; the quiz is self-marking for the student to review. +Details are laid out in {\AEBBook}~\cite{book:AEBB}. + +\section{The \texttt{eqEmail} Option}\label{eqEmailOption} + +In this section, we describe how to submit your data to a server-side script +that in turn sends an email message to a list of recipients, the body of the +messages contains the student's quiz results. The \opt{submitAs} option can +be used with the \env{eqEmail} option. With \texttt{submitAs=FDF}, the form +data is submitted in the FDF format, the native form data format for PDF, the +target script should be \app{eqEmail.asp}. When \texttt{submitAs=HTML} is +used, the form data is submitted as ordinary HTML form data, which can then +be processed by any public domain script; alternately, you can use one of the +scripts in Table~\ref{table:QuizScripts2}. These four scripts are available +on the CD-ROM that accompanies the book \AEBBook~\cite{book:AEBB}. + +\begin{table}[htb]\centering +\begin{tabular}{r>{\ttfamily\raggedright}p{1.5in}} +\texttt{eqEmail}, {\HTML} return&eqEmail\_h.asp\penalty0eqEmail\_h.php\tabularnewline[3pt] +\texttt{eqEmail}, {\FDF} return&eqEmail\_hf.asp\#FDF\penalty0 +eqEmail\_hf.php\#FDF +\end{tabular} +\caption{Scripts for \opt{eqEmail} \& \texttt{submitAs=HTML} options}\label{table:QuizScripts2} +\end{table} + + +\subsection{Submit as FDF} + +We describe how to create an online quiz that is +to be submitted to the server-side script +\app{eqEmail.asp}\footnote{The script \textsf{eqEmail.asp} comes +with absolutely \emph{no guarantees}. Extensive testing should be +made on your own system to assure yourself script is reliable +enough to use in practice. Feel free to modify the script to +suite your needs. If your improvements are noteworthy, please +allow me to incorporate them into the basic \textsf{eqEmail.asp} +for others to use. }. For this option, quiz results are e-mailed +to the instructor. The \textsl{FDF Toolkit} is required to be installed on the +\app{Windows} server\FmtMP[\baselineskip]{FDF Toolkit required}. + +\redpoint \texttt{quiz3.tex} is the demo file for this option. + +\medskip\noindent The steps to create a quiz to be submitted to +\textsf{eqEmail} are simple enough. First, the preamble of your +document should look something like this: +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +\documentclass{article} +\usepackage[designi]{web} +\usepackage{exerquiz} +\usepackage[eqEmail]{eq2db} +\end{Verbatim} +\noindent You may have other packages loaded, as well as other +options for \pkg{web} and \pkg{exerquiz}. The \pkg{eq2db} +package was designed to be seamless in the following sense: If the +\pkg{eq2db} package is not loaded, then an \pkg{exerquiz} +\env{quiz} is self-contained, that is, it is not submitted to a +server-side script; if \pkg{eq2db} package is loaded, then the +quizzes are submitted to a server-side script. + +Next, you write your \pkg{exerquiz} \env{quiz}: + +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +\eqSubmit{http://www.example.edu/scripts/eqEmail.asp\#FDF} + {dpspeaker@example.edu}{Math101} +\begin{quiz*}{Quiz1} Answer each of the following. Passing is 100\%. +\begin{questions} +\item ... +... +\item ... +\end{questions} +\end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz +\end{Verbatim} +Preceding the quiz is the \cs{eqSubmit} command, defined in the \pkg{exerquiz}. +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small,commandchars=!()] +\eqSubmit{!meta(submitURL)}{!meta(recipients)}{!meta(courseName)} +\end{Verbatim} +The first parameter is the URL to the server-side script, in the example +above, we have \texttt{http://www.example.edu/scripts/eqEmail.asp\#FDF} (note +the suffix of \texttt{\#FDF}); the second parameter, \meta{recipients}, +is the e-mail address of the person to receive the quiz results; the third +parameter, \meta{courseName} is the course name. In the above example, +the course name is \texttt{Math101}. + +\redpoint If meta{recipients} is a comma-delimited list of e-mail addresses, then +\textsf{eqEmail.asp} will parse the list, and use the first e-mail in the list in the +\texttt{From} field of the e-mail. Other email addresses in the list also receive copies +of the quiz results.\endredpoint + +\medskip +There is another parameter of importance. The first argument of +the \env{quiz} environment is the \texttt{quizName} of the quiz, this is +\texttt{Quiz1} in the above example. + +Assuming \textsf{eqEmail.asp} is installed on your web server, and +the \textsl{FDFToolkit} has also been installed (see +Section~\ref{settingup}), we are ready to submit the quiz. Below +is the body of one of my test e-mails I made using +\texttt{quiz3.pdf}: + +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +Course Information + Course Name: Math101 + Quiz: Quiz1 + TimeOfQuiz: 8/23/2003 8:12:40 PM + +Student Results + Name_First: Don + Name_Last: Story + SSN: 121212121 + Responses: Leibniz,2x e^(x^2),-1,-cos(x) + numCorrect: 4 + numQuestions: 4 +\end{Verbatim} +\noindent If you add more fields, as described in +Section~\ref{moreHiddenFields}, this information should be appended to +the body of the e-mail. + +\subsubsection{Field Values processed by \textsf{eqEmail.asp}} + +Actually, \textsf{eqEmail.asp} is a variation of +\textsf{eqRecord.asp} and many of the details of this section are +the same \hyperref[eqRfieldvalues]{Section~\ref*{eqRfieldvalues}}. + +The ``hard-wired'' fields are \texttt{mailTo}, \texttt{courseName} +and \texttt{quizName}. These fields are hidden under the `End +Quiz' button, and are populated at submit time. As in the \texttt{eqRecord} +option, the value of the \texttt{quizName} field comes from the argument of +the \env{quiz} environment: +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +\eqSubmit{http://www.example.edu/scripts/eqEmail.asp\#FDF} + {dpspeaker@example.edu}{Math101} +\begin{quiz*}{Quiz1} Answer each of the following. Passing is 100\%. +\begin{questions} +\item ... +... +\item ... +\end{questions} +\end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz +\end{Verbatim} +In this quiz, the field with name \texttt{quizName} will have a value of \texttt{Quiz1}. + +\medskip See paragraph ``\nameref{hierarchalfields}'', page~\pageref{hierarchalfields}, as well as +Section~\ref{moreHiddenFields} on page~\pageref{moreHiddenFields} for +the \texttt{eqRecord} option, the details are the same. + +\subsubsection{Setting up and Modifying the Script} + +On the server side, in order for \textsf{eqEmail.asp} to run +correctly, Microsoft Internet Information Server (IIS), version +4.0 or greater, is needed. The script \textsf{eqEmail.asp} should +be placed where ASP scripts have execute permissions. There are +two methods of sending e-mail: +\begin{questions} + \item \texttt{CDONTS}: This method (which is commented out by default) can be used on + an NT server. Uncomment if you want to use CDONTS, and comment out the CDOSYS code lines + that follow. + \item \texttt{CDOSYS}: This can be run on a Win2000 or WinXP server. +\end{questions} + +The script needs to be modified appropriate to your server, in particular, search down +in \texttt{eqEmail.asp} for the configuration line +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +eqMail.Configuration.Fields.Item + ("http://schemas.microsoft.com/cdo/configuration/smtpserver") + = "mySMTP" +\end{Verbatim} +\noindent replace \texttt{mySMTP} with your SMTP server. + +The subject heading of the returning e-mail has the following format: +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +Quiz Results: Quiz1 of Math101 +\end{Verbatim} +If you want another subject format, modify \texttt{eqMail.Subject} as +desired. + +\subsubsection{References} + +The following links were used as a reference in the development of the +\texttt{Email.asp} script. +\begin{itemize} + \item CDOSYS: + \begin{itemize} + \item \href{http://invisionportal.com/show_tutorial.asp?TutorialID=160}{Invision Portal} Tutorial: CDOSYS email tutorial + \item \href{http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_imessage_interface.asp} + {MSDN}: CDO for Windows 2000. The IMessage Interface. (Use MIE to view this page.) + \item \href{http://www.asp101.com/articles/john/cdosmtprelay/default.asp}{ASP 101} Sending Email Via an External SMTP Server Using CDO + \end{itemize} + \item CDONTS + \begin{itemize} + \item \href{http://www.juicystudio.com/tutorial/asp/cdonts.html}{Juicy Studio} The ASP CDONTS Component + \item \href{http://www.devasp.com/Samples/mail.asp}{DevASP} Sending Mail from ASP with CDONTS.NewMail Object + \end{itemize} +\end{itemize} + +\subsection{Submit as HTML} + +When the \opt{eqEmail} and \opt{submitAs=HTML} options are specified for +\pkg{eq2db}, the form data are submitted as ordinary HTML form data. For the +\opt{eqEmail} option, it is meant that the server-side script should take the +incoming form data, build an email the body of which reports the quiz +results, and send the message to a list of recipients. You can develop your +own script for doing this or you can use the scripts provide with the book +\AEBBook~\cite{book:AEBB}. The advantage of submitting as HTML is that the \textsl{FDF +Toolkit} is \emph{not needed}, and the techniques for writing a server-side +script are well known. + +The preamble of your document should look something like the following. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\documentclass{article} +\usepackage[designi]{web} +\usepackage{exerquiz} +\usepackage[eqEmail,submatAs=html]{eq2db} +\end{Verbatim} +The \opt{tagged} option is \emph{not recommended} for the \opt{eqEmail}. You +may have other packages loaded, as well as other options for \pkg{web} and +\pkg{exerquiz}. The \pkg{eq2db} package was designed to be seamless in the +following sense: If the \pkg{eq2db} package is not loaded, then an +\pkg{exerquiz} quiz is self-contained, that is, it is not submitted to a +server-side script; if \pkg{eq2db} package is loaded, then the quizzes are +submitted to a server-side script. + +In addition to the introduction of the \pkg{eq2db} package in the preamble, +there are two more important commands: +\begin{equation} +\begin{minipage}{300pt} +\begin{Verbatim}[commandchars=!()] +\eqSubmit{!meta(submitURL)}{!meta(recipients)}{!meta(courseName)} +\rtnURL{!meta(returnURL)} +\end{Verbatim} +\end{minipage}\label{display:eqSubmitE} +\end{equation} +\cs{eqSubmit}, defined in \pkg{exerquiz}, is required; \cs{rtnURL}, defined +in \pkg{eq2db}, is required only when the return from the server is an +{\HTML} page, but is recommended. + +\paragraph*{Description of the parameters.} The \cs{eqSubmit} command provides essential +information use by the server-side scripts, \cs{rtnURL} provides a return +{\URL} that points to where the student should go to next after the quiz. +Their parameters, as indicated in display~\eqref{display:eqSubmitE}, are briefly described. +\begin{description}\def\NH{\relax\hspace*{-\labelsep}}% +\item\NH\meta{submitURL} is the {\URL} of one of the server-side scripts in + Table~\ref{table:QuizScripts1}. Internally, the value of this parameter + is saved in the text macro \cs{eq@CGI}. + +\item\NH\meta{recipients} is a comma-delimited list of email addresses to + whom the quiz results are sent. For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +dpspeaker@talking.edu,taofdps@talking.edu +\end{Verbatim} +The first email address is picked off and used in the `From' field of the +email while the whole list is entered into the `To' field. Internally, this +value is saved in the text macro +\cs{db@Name}.${}^{\text{\fnNameChoice}}$ +\item\NH\meta{courseName} is the course name of the class taking the quiz. + Internally, this value is saved in the text macro + \cs{db@Table}.${}^{\text{\fnNameChoice}}$ + +\item\NH\meta{returnURL} is the {\URL} of the page the student should return + to after finishing the quiz. The value of \cs{rtnURL} is required when + the script returns an {\HTML} page, and is useful when the return is + {\FDF}. Internally, \cs{rtnURL} defines the text macro \cs{thisRtnURL} + to hold \meta{returnURL}. +\end{description} + +\paragraph*{The scripts.} The \meta{submitURL} points to the server-side script that is to process the form data. +The scripts of Table~\ref{table:QuizScripts2} were written for the upcoming book +\AEBBook~\cite{book:AEBB} and are available on the accompanying CD-ROM. Refer the book for the details of +implementing these scripts. + +\paragraph*{HTML versus FDF return.} The scripts of Table~\ref{table:QuizScripts2} are of two types: +HTML return and FDF return. From the student's point of view, his/her +experience is the same as the \opt{eqText} option with +\texttt{submitAs=HTML}. In the first case, after the student has submitted +his/her quiz, the server-side script, as sending out an email response to the +\anglemeta{recipients}, returns an HTML page to the browser window with an +assessment of the student's efforts on the quiz. In the second case, the +script sends back an alert dialog box message saying the data is received and +results are sent to the instructor (the \anglemeta{recipients}); the quiz is +self-marking for the student to review. Details are presented in \AEBBook~\cite{book:AEBB}. + + +\subsection{The \texttt{tagged} option}\label{taggedOption} + +When the student submits online quiz data to one of the server-side scripts, +just prior to submission, the hidden field \cs{currQuiz.Responses} is +populated with the student's answers. For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +Newton,2x,-1,-cos(x) +\end{Verbatim} +is how the responses field is populated, by default. This data gives no +indication of which are correct, how many points for each question, and so +on. + +To obtain more information about the quiz taken by the student and his +responses, you can specify the \opt{tagged} option. When this +option is taken, the quiz data is written as a ``XML-like'' string. Figure~\ref{fig:tagXML} is +an example of the data that populates the \cs{currQuiz.Responses} field and +which is sent to the server when the \opt{tagged} option is specified. + +\begin{figure}[htb] +\begin{minipage}{5.45in} +\begin{Verbatim}[fontsize=\small] + + + Newton + + + 2x + + + -1 + + + -cos(x) + + +\end{Verbatim} +\end{minipage}% +\caption{Example of a tagged XML string}\label{fig:tagXML} +\end{figure} + +Referring to Figure~\ref{fig:tagXML}, the XML string packs +more information in it than the default string. The quiz name is +\texttt{Quiz1}, the {\PDF} file the student used is \texttt{quiz1.pdf} and +there are four questions (\texttt{n=4}). The first question was a text +fill-in type, worth $3$ points, the student responded correctly. The second +question was a math fill-in worth $4$ points, he missed this one with an +answer of \texttt{2x}. + +The root element \texttt{results} contains child elements or +nodes called \texttt{question}. Each \texttt{question} node contains +information about one of the questions in the quiz. The \texttt{question} +node has several attributes, these attributes are seen in +Figure~\ref{fig:tagXML} above: +\begin{itemize} + \item \texttt{n} is the question number. This is not the question + number the user sees, but the value of an internal counter that + increments each time a new question is posed. + \item \texttt{type} is the type of question, possible values are + \texttt{"text"} (text response), \texttt{"math"} (math response), + \texttt{"mc"} (multiple choice), \texttt{"ms"} (multiple + selection), \texttt{"grp"} (grouped response), and \texttt{"essay"} + (multi-line text response). The latter is not graded by + \pkg{exerquiz} but simply transmitted to the server. + \item \texttt{ptype} is the problem (question) type, its value is + normally \texttt{"na"} for `not applicable'. This attribute is used + to describe the question in more detail within the XML. The value + of \texttt{ptype} is set within the {\LaTeX} source file with + \cs{QT\texttt{\darg{\meta{ptype}}}} command. + Placement of this command is just after the \cs{item} command + within the \env{questions} environment. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\item\PTs{4}\QT{limits} Compute $\lim_{n\to\infty}...$ +\end{Verbatim} +Now, the \texttt{ptype} attribute will read \texttt{ptype="limits"}. If +each problem is so tagged, the \texttt{ptype} attribute can be queried as +part of larger quiz management system to view a student's effort with +respect to all questions having the specified \texttt{ptype}. Such a system +was never implemented, but the attribute is available. +\item \texttt{points} is the number of points assigned to this question. +\item \texttt{credit} is the amount of partial credit the student earned + for this question. Questions types where this attribute can be nonzero + are \texttt{"mc"}, \texttt{"ms"}, \texttt{"text"} (in response to a + \cs{RespBoxTxtPC} question), and \texttt{"grp"}. +\item \texttt{correct} is normally \texttt{"0"} (a wrong answer) or + \texttt{"1"} (a correct answer); multiple selection (\texttt{"ms"}) and + grouped (\texttt{"grp"}) questions use an array of values for the + \texttt{correct} attribute, however. When calculating the score field + (\cs{ScoreField}), the problem is either right or wrong; however, the calculation + of the points field (\cs{PointsField}) takes into account the partial + credit so a problem may be partially correct. +\end{itemize} + +\paragraph*{Reconstructing the quiz.} Using the XML data as well as the +information provided by the \texttt{IdInfo} collection of fields, it is +possible to reproduce the {\PDF} document exactly as the student submitted +it. A demonstration file was developed for exactly this purpose and is +available on the CD-ROM that accompanies the \AEBBook~\cite{book:AEBB}. +The \app{Acrobat} application is required. + +\section{The \texttt{custom} Option}\label{customOption} + +This option allows a script developer to utilize the macros of the +\pkg{eq2db} Package to prepare an {\ifusebw\AcroT\else\cAcroT\fi} document to submit +to a custom script. Simple create a file named +\texttt{eq2dbcus.def} and include any custom creation of fields +you may need for your script. When you then take the \texttt{custom} option, +\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small] +\documentclass{article} +\usepackage[designi]{web} +\usepackage{exerquiz} +\usepackage[custom]{eq2db} +\end{Verbatim} +After the command definitions of \pkg{eq2db} are read, +\texttt{eq2dbcus.def} is input. The rest is up to you. + +\redpoint That's all for now! Hope you find the package +useful. Now I really must get back my retirement. \dps + +\addtocontents{toc}{\protect\vspace{2ex}} +\newpage +\markright{References} + +\begin{thebibliography}{[1]}\label{references} +\addcontentsline{toc}{section}{\protect\numberline{}References} + +\bibitem{book:AEBB}\hypertarget{references}{}% + \textsl{\AEBBook}, D. P. Story, in preparation. + +\end{thebibliography} + +\end{document} diff --git a/texmf-dist/source/latex/eq2db/eq2db.dtx b/texmf-dist/source/latex/eq2db/eq2db.dtx new file mode 100644 index 00000000..8911e10d --- /dev/null +++ b/texmf-dist/source/latex/eq2db/eq2db.dtx @@ -0,0 +1,730 @@ +% \iffalse +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Eq2DB.sty package, 2001-9-01 %% +%% Copyright (C) 2014 D. P. Story %% +%% dpstory@uakron.edu %% +%% %% +%% 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 of the %% +%% License, or (at your option) any later version. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{eq2db} +% [2016/01/02 v2.0 Save Exerquiz results to a Database, Email, or text file (dps)] +%<*driver> +\documentclass{ltxdoc} +\usepackage[colorlinks,hyperindex]{hyperref} +\makeatletter +\renewcommand{\paragraph}{\@startsection{paragraph}{4}{0pt}{6pt}{-3pt}{\bfseries}} +\makeatother +\pdfstringdefDisableCommands{\let\\\textbackslash}% +\EnableCrossrefs \CodelineIndex +\let\pkg\textsf +\let\env\texttt +\let\opt\texttt +\def\AEBBook{\textsl{{Acro\negthinspace\TeX} eDucation System Tools: + {\LaTeX} for interactive PDF documents}} +\begin{document} + \GetFileInfo{eq2db.sty} + \title{The \texttt{eq2db} Package} + \author{D. P. Story\\ + Email: \texttt{dpstory@uakron.edu}} + \date{processed \today} + \maketitle + \tableofcontents + \let\Email\texttt + \DocInput{eq2db.dtx} + \PrintIndex +\end{document} +% +% \fi +% \section{Introduction} +% +% The \pkg{eq2db} package is meant to be used with the \pkg{exerquiz} package, one +% of the components of the \textbf{{Acro\negthinspace\TeX} eDucation Bundle}. +% The package is used to convert a quiz created by the \env{quiz} environment +% of \pkg{exerquiz} to one that submits the quiz results to a server-side script. +% +% The package can be designed to submit PDF form data as FDF, HTML, or XML. In the latter +% case, there are no supporting scripts; for FDF and HTML, I've written simple scripts that +% can be used on the server-side. +% \begin{itemize} +% \item For FDF submittal, the FDF Toolkit is required. Server-side scripts for a Windows server are provided +% for the \opt{eqRecord}, \opt{eqEmail}, and \opt{eqText} options. Additional details are found +% in the \pkg{eq2db} documentation manual. +% +% \item For HTML submittal, I've written eight +% server-side scripts for both Windows and Linux servers are provided. +% The \opt{eqEmail} and \opt{eqText} options are supported. These are available from the +% CD-ROM of my yet-to-be-submitted book, \AEBBook. +% Refer to the \pkg{eq2db} documentation +% manual for additional details. +% \end{itemize} +% Whether you submit as FDF, HTML, or XML is determined by the \opt{submitAs} option. +% +% \section{Package Options} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% \begin{macrocode} +\RequirePackage{xkeyval} +\let\eq@optioncode\@empty +% \end{macrocode} +% \begin{macro}{eqRecord} +% An option to store exerquiz data in a database, see \hyperref[eqrecord]{eqRecord}. +% \begin{macrocode} +\DeclareOptionX{eqRecord}{\def\eq@optioncode{\input{eqrecord.def}}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{eqEmail} +% An option to email exerquiz data to an instructor, see \hyperref[eqemail]{eqEmail}. +% \begin{macrocode} +\DeclareOptionX{eqEmail}{\def\eq@optioncode{\input{eqemail.def}}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{eqText} +% Save exerquiz data to a tab-delimited text field, see \hyperref[eqtext]{eqText}. +% \begin{macrocode} +\DeclareOptionX{eqText}{\def\eq@optioncode{\input{eqtext.def}}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{taoas} +% Private option for TAOAS +% \begin{macrocode} +\DeclareOptionX{taoas}{\def\eq@optioncode{\input{taoas.def}}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{custom} +% A option so developers can create their own custom set up for their own script. +% \begin{macrocode} +\DeclareOptionX{custom}[eq2dbcus]{\def\eq@optioncode{\input{#1.def}}} +\def\eq@optioncode{\input{eq2dbcus.def}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{tagged} +% The exerquiz quiz results are put into a quasi-XML format. +% \begin{macrocode} +\let\eqdb@YES=y \let\eqdb@NO=n +\DeclareOptionX{tagged}{\let\eqdb@tagged\eqdb@YES} +\let\eqdb@tagged\eqdb@NO +% \end{macrocode} +% \end{macro} +% \begin{macro}{submitAs} +% Allow user to submit as FDF, HTML, or XML. The scripts provided by this package +% are designed FDF submittal. The other submittal types are offered for anyone wishing +% to use this package for submitting forms to personally developed server-side scripts. +% +% When submitting as HTML and using the \texttt{eqText} option, the distribution does supply a +% scripts \texttt{eqText\_html.asp} (windows) and \texttt{eqText\_html.ph}p (linux/unix). +% \begin{macrocode} +\define@choicekey*+{eq2db.sty}{submitAs}[\val\nr]{FDF,HTML,XML}[FDF]{% + \ifcase\nr\relax + \def\eqdb@submitType{FDF}\or + \def\eqdb@submitType{HTML}\or + \def\eqdb@submitType{XML}\else + \def\eqdb@submitType{FDF}\fi + }{\PackageWarning{eq2db}{Bad choice for submitAs, + permissible values are\MessageBreak FDF, HTML, and XML.\MessageBreak + Using the default FDF}% +} +\def\eqdb@submitType{FDF} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\ProcessOptionsX +% \end{macrocode} +% \begin{macrocode} +\RequirePackage{exerquiz} +% \end{macrocode} +% \section{Main Code} +% This code creates a way of hiding text fields. These fields are typically +% used to hold data that is sent to server-side script on submission. +% +%\medskip\noindent +% This is a token list to hold the list of hidden fields to be inserted into +% the document. We also provide a command for initializing the token list. +% \begin{macrocode} +\newtoks\addtohidden \addtohidden={} +% \end{macrocode} +%\medskip\noindent +% The macro \cs{eq@addHiddenTextFields} will be used to hold the accumulated +% hidden fields as we add another hidden field to the token list. +% \begin{macrocode} +\def\eq@addHiddenTextFields{} +% \end{macrocode} +% \begin{macro}{\addHiddenTextField} +% This macro adds a new hidden text field to the token list +% \cs{addtohidden}. The command takes three parameters, +% the first of which is optional. The command +% \cs{hiddenTextField} actually creates the text field. +%\paragraph*{Parameters:} +%\begin{verbatim} +%[#1] = parameter to modify the parameters of the text field +% #2 = field name of the field being constructed +% #3 = default value of the field +%\end{verbatim} +% \begin{macrocode} +\renewcommand\addHiddenTextField[3][]{% + \addtohidden=\expandafter{\eq@addHiddenTextFields + \llap{\hiddenTextField[#1]{#2}{#3}}}% + \edef\eq@addHiddenTextFields{\the\addtohidden}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\hiddenTextField} +% +% This command actually creates a hidden text field \texttt{10bp} wide +% and \texttt{10bp} high. It is used by \cs{addHiddenTextField}, but can +% be used be the macro author as well. The command takes three parameters, +% the first of which is optional. +%\paragraph*{Parameters:} +%\begin{verbatim} +%[#1] = parameter to modify the parameters of the text field +% #2 = field name of the field being constructed +% #3 = default value of the field +%\end{verbatim} +% \begin{macrocode} +\newcommand\hiddenTextField[3][]{\textField + [\DV{#3}\V{#3}\F2#1]{#2}{10bp}{10bp}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\populateHiddenField} +% Command for populating the value of a (hidden) text field at run time. This is executed +% by the `End Quiz' button. +%\paragraph*{Parameters:} +%\begin{verbatim} +% #1 = field name of the field +% #2 = field value. Strings need to be enclosed in double quotes +%\end{verbatim} +% \begin{macrocode} +\newtoks\populatehiddenfields \populatehiddenfields={} +\def\eq@populateHiddenFields{} +\def\eq@initializepopulate{\gdef\eq@populateHiddenFields{}% + \global\populatehiddenfields={}} +\renewcommand\populateHiddenField[2]{% + \populatehiddenfields=\expandafter{\eq@populateHiddenFields + this.getField("#1").value=#2;\jsR\jsT\jsT}% + \edef\eq@populateHiddenFields{\the\populatehiddenfields}% +} +\def\eq@clearHiddenFields{\global\let\eq@populateHiddenFields=\@empty + \global\let\eq@addHiddenTextFields=\@empty +} +% \end{macrocode} +% \end{macro} +% These hidden fields are created under the `End Quiz' button or link, and are populated +% when the user clicks on `End Quiz'. The following flag, set to \texttt{n} will be set +% to \texttt{y} when the fields are created, in this way, we can avoid creating them +% more than once. +% \begin{macrocode} +\let\basicFieldsSet\eqdb@NO +% \end{macrocode} +% \DescribeMacro{\rtnURL} For a non-FDF submittal, after the user submits, he must return to some +% web page. Use \cs{rtnURL} to pass the return url to the server-side script. The command +% \cs{definePath} is defined in \textsf{eforms}. Usage: +%\begin{verbatim} +% \rtnURL{http://www.math.uakron.edu/~dpstory} +%\end{verbatim} +% \begin{macrocode} +\providecommand{\rtnURL}{\definePath{\thisRtnURL}} +\let\thisRtnURL\@empty +% \end{macrocode} +% \paragraph*{Input option code.} Now input the chosen option. +% \begin{macrocode} +\eq@optioncode +% \end{macrocode} +% \section{Tagged Responses} +% An option for this package is \texttt{tagged}, when the document +% author takes this option, the quiz responses are sent out in an +% XML-like encoding. +% +% The JavaScript function \texttt{gatherTaggedQuizData} builds up a +% "tagged" response string, which contains various pieces of +% information about the quiz results. +% \begin{macrocode} +\ifx\eqdb@tagged\eqdb@YES +\begin{insDLJS}[gatherTaggedQuizData]{eqtagged}% +{Eq2db: Gather Tagged Data} +function gatherTaggedQuizData(currQuiz,filename,nQuestions) { + var hasGroupedResp=false; + var xmlResp=""; + var cResponses=""; + var eqCredit; + for ( var i=1; i <= nQuestions; i++) + { + if (typeof RightWrong[i] == "undefined") RightWrong[i]=0; + if (typeof Responses[i] == "undefined") { % +Responses[i]=""; eqCredit=0; } + if ( typeof ProbDist[i] == "undefined" ) ProbDist[i]=0; + if (typeof ProbType[i] == "undefined") ProbType[i]="na"; + else eqCredit=ProbDist[i]; +% eqCredit=(typeof ProbValue[i] == "number") ? 0 : % +%( ProbValue[i][0]==0 )? ProbValue[i][2] : ProbDist[i]; + hasGroupedResp=( (typeof ProbValue[i] == "object") && % +(ProbValue[i][0]==1) ); + cResponses += "" : ""+Responses[i][j]+""; + } + cResponses += % +" correct=\"["+RightWrong[i].slice(1)+"]\">"; + cResponses += ""+xmlResp+""; + } else { + cResponses += " points=\""+aPointType[i][0] + "\""; + cResponses += " credit=\""+eqCredit + "\""; + cResponses += " correct=\""+RightWrong[i]+"\">"; + cResponses += ""+Responses[i]+""; + } + break; + case "ms": + cResponses += " points=\""+aPointType[i][0] + "\""; + cResponses += " credit=\""+eqCredit + "\""; + if ( typeof RightWrong[i][2] == "undefined" ) { + cResponses += " correct=\"0\">"; + cResponses += ""; + } else { + var f=this.getField("mck."+currQuiz+"."+i); + var l=f.getArray().length; + RightWrong[i][2].length=l+1; + Responses[i].length=l+1; + RightWrong[i][2].shift(); + cResponses += % +" correct=\""+RightWrong[i].toSource()+"\">"; + xmlResp=""; + for ( var j=1; j < RightWrong[i][2].length; j++) { + if (typeof RightWrong[i][2][j] == "undefined") % +RightWrong[i][2][j]=0; + xmlResp += +( typeof Responses[i][j] == "undefined" ) ? % +"" : ""+Responses[i][j]+""; + } + cResponses += ""+xmlResp+""; + } + break; + default: + cResponses += " points=\""+aPointType[i][0] + "\""; + cResponses += " credit=\""+eqCredit + "\""; + cResponses += " correct=\""+RightWrong[i]+"\">"; + cResponses += ""+Responses[i]+""; + } + cResponses += ""; + } + cResponses += ""; + return cResponses; +} +\end{insDLJS} +\fi +% +% \end{macrocode} +% \section{eqRecord}\label{eqrecord} +% Save quiz results to a database. The \texttt{eqRecord} option is meant to +% be used with the ASP code \textsf{eqRecord.asp}. +% +% The form the macro \cs{eqSubmit} is +%\begin{verbatim} +%\eqSubmit{http://..../eqRecord.asp\#FDF} +% {database_name}{table_name} +%\end{verbatim} +% The first parameter is the URL to the \textsf{eqRecord.asp} script. The second is the +% DNS of the database. The third parameter is the name of the table into which the +% quiz data is to be stored. +% For example, +%\begin{verbatim} +%\eqSubmit{http://localhost/scripts/eqRecord.asp\#FDF} +% {eqQuiz}{Math101} +%\end{verbatim} +% As with \textsf{eqRecord}, the first parameter of the \texttt{quiz} environment is +% the name of the quiz begin taken. +%\begin{verbatim} +%\begin{quiz*}{Quiz1} +%... +%\end{quiz*} +%\end{verbatim} +% \begin{macrocode} +%<*eqrecord> +% \end{macrocode} +% \begin{macro}{\eq@insertHiddenFields} +% Create and add the hidden text fields for this option. The macro +% \cs{eq@insert\-Hid\-den\-Fields} is defined in \textsf{exerquiz} as +% empty. Now we redefine it for the purpose of inserting hidden text +% fields. +% \begin{macrocode} +\def\eq@insertHiddenFields{% + \ifx\basicFieldsSet\eqdb@NO + \addHiddenTextField{dbName}{}% + \addHiddenTextField{dbTable}{}% + \addHiddenTextField{quizName}{}% + \global\let\basicFieldsSet\eqdb@YES + \fi + \addHiddenTextField{\curr@quiz.numQuestions}{\thequestionno}% + \addHiddenTextField{\curr@quiz.numCorrect}{}% + \addHiddenTextField{\curr@quiz.Responses}{}% + \eq@addHiddenTextFields + \eq@clearHiddenFields +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\eq@URL} +% The JavaScript of the `End Quiz' button has a command \cs{eq@submitURL}, which has +% an empty definition for quizzes that are not to be submitted. We define this +% macro appropriately. We populate each of the hidden fields and submit. +% \begin{macrocode} +\def\eq@submitURL{% + this.getField("dbName").value="\db@Name";\jsR\jsT\jsT + this.getField("dbTable").value="\db@Table";\jsR\jsT\jsT + this.getField("quizName").value="\curr@quiz";\jsR\jsT\jsT + this.getField("\curr@quiz.numCorrect").value=Score;\jsR\jsT\jsT + var aPointType=new Array(\aPointType);\jsR\jsT\jsT +\ifx\eqdb@tagged\eqdb@YES + var cResponses=gatherTaggedQuizData("\currQuiz",% + this.documentFileName,\thequestionno);\jsR\jsT\jsT +\else + var cResponses=Responses.toString().substr(1);\jsR\jsT\jsT +\fi + this.getField("\curr@quiz.Responses").value=cResponses;\jsR\jsT\jsT + \eq@populateHiddenFields + var aSubmitFields=new Array("\curr@quiz","IdInfo",% + "dbName","dbTable","quizName");\jsR\jsT\jsT + \priorSubmitQuiz + this.submitForm(\eq@CGI,true,false,aSubmitFields);\jsR\jsT\jsT +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +% +% \end{macrocode} +% \section{eqEmail}\label{eqemail} +% \begin{macrocode} +%<*eqemail> +% \end{macrocode} +% Report results via e-mail. The \texttt{eqEmail} option is meant to +% be used with the ASP code \textsf{eqEmail.asp}. When the user +% submits his/her quiz, \textsf{eqEmail} builds an e-mail message +% the body of which are the quiz results, and sends it to the +% instructor. +% +% The form the macro \cs{eqSubmit} is\vskip6pt +%\begin{verbatim} +% \eqSubmit{http://..../eqEmail.asp\#FDF} +% {instr@someedu.edu}{course} +%\end{verbatim} +% The first parameter is the URL to the \textsf{eqEmail.asp} script. The second is the +% e-mail address to which the quiz results is to be sent. The third parameter is the +% course name. +% For example, +%\begin{verbatim} +% \eqSubmit{http://localhost/scripts/eqEmail.asp\#FDF} +% {dpstory@uakron.edu}{Math101} +%\end{verbatim} +% As with \textsf{eqRecord}, the first parameter of the \texttt{quiz} environment is +% the name of the quiz begin taken. +%\begin{verbatim} +% \begin{quiz*}{Quiz1} +% ... +% \end{quiz*} +%\end{verbatim} +% \begin{macro}{\eq@insertHiddenFields} +% Create and add the hidden text fields for this option. The macro +% \cs{eq@insert\-Hid\-den\-Fields} is defined in \textsf{exerquiz} as +% empty. Now we redefine it for the purpose of inserting hidden text +% fields. +% \begin{macrocode} +\def\htmlSubmitType{HTML} +\def\insertHTMLs{,"pdfFileName","rtnURL"} +\def\eq@insertHiddenFields{% + \ifx\basicFieldsSet\eqdb@NO + \addHiddenTextField{mailTo}{}% + \addHiddenTextField{courseName}{}% + \addHiddenTextField{quizName}{}% +% \end{macrocode} +% If submitting as HTML, we'll include \texttt{pdfFileName} and \texttt{rtnURL}. +% \begin{macrocode} + \ifx\eqdb@submitType\htmlSubmitType + \addHiddenTextField{pdfFileName}{} + \addHiddenTextField{rtnURL}{\thisRtnURL}\fi + \global\let\basicFieldsSet\eqdb@YES + \fi + \addHiddenTextField{\curr@quiz.ptScore}{} + \addHiddenTextField{\curr@quiz.nPointTotal}{\theeqpointvalue} + \addHiddenTextField{\curr@quiz.numQuestions}{\thequestionno}% + \addHiddenTextField{\curr@quiz.numCorrect}{}% + \addHiddenTextField{\curr@quiz.Responses}{}% + \eq@addHiddenTextFields + \eq@clearHiddenFields +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\eq@submitURL} +% The JavaScript of the `End Quiz' button has a command \cs{eq@submitURL}, which has +% an empty definition for quizzes that are not to be submitted. We define this +% macro appropriately. We populate each of the hidden fields and submit. +% \begin{macrocode} +\def\eq@submitURL{% + this.getField("mailTo").value="\db@Name";\jsR\jsT\jsT + this.getField("courseName").value="\db@Table";\jsR\jsT\jsT + this.getField("quizName").value="\curr@quiz";\jsR\jsT\jsT + this.getField("\curr@quiz.numCorrect").value=Score;\jsR\jsT\jsT + this.getField("\curr@quiz.ptScore").value=ptScore;\jsR\jsT\jsT +% \end{macrocode} +% When submitting as HTML, populate the field \texttt{pdfFileName}. +% \begin{macrocode} +\ifx\eqdb@submitType\htmlSubmitType + this.getField("pdfFileName").value=% + this.documentFileName;\jsR\jsT\jsT +\fi + var aPointType=new Array(\aPointType);\jsR\jsT\jsT +\ifx\eqdb@tagged\eqdb@YES + var cResponses=gatherTaggedQuizData("\currQuiz",% + this.documentFileName,\thequestionno);\jsR\jsT\jsT +\else + var cResponses=Responses.toString().substr(1);\jsR\jsT\jsT +\fi + this.getField("\curr@quiz.Responses").value=cResponses;\jsR\jsT\jsT + \eq@populateHiddenFields + var aSubmitFields=new Array("\curr@quiz","IdInfo",% + "mailTo","courseName","quizName"% +% \end{macrocode} +% If submitting as HTML, we include \cs{insertHTMLs} into the list +% of fields to submit. +% \begin{macrocode} +\ifx\eqdb@submitType\htmlSubmitType\insertHTMLs\fi);\jsR\jsT\jsT + \priorSubmitQuiz + this.submitForm({cURL: \eq@CGI,bEmpty: false,% + aFields: aSubmitFields,% + cSubmitAs: "\eqdb@submitType" });\jsR\jsT\jsT +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +% +% \end{macrocode} +% \section{eqText}\label{eqtext} +% \begin{macrocode} +%<*eqtext> +% \end{macrocode} +% Record the quiz results in a text tab delimited text file. The +% distribution provides three scripts: (1) \texttt{eqText.asp} submitting +% as FDF to a windows server; when submitting as HTML, (2) +% \texttt{eqText\_html.asp} (windows), and (3) \texttt{eqText\_html.ph}p +% (linux/unix). +% +% +% The form the macro \cs{eqSubmit} is\vskip6pt +%\begin{verbatim} +%\usepackage[eqText,tagged]{eq2db} +%\eqSubmit{http://..../eqText.asp\#FDF} +% {}{} +%\end{verbatim} +% The first parameter is the URL to the \textsf{eqText.asp} script. The second is the +% path on the server to where the text file is located. The third parameter is the +% course name. +% For example, +%\begin{verbatim} +% \eqSubmit{http://localhost/scripts/eqText.asp\#FDF} +% {c:/Inetpub/DB/qResults.txt}{Math101} +%\end{verbatim} +% For submitting as HTML +%\begin{verbatim} +% \usepackage[submitAs=html,eqText,tagged]{eq2db} +% \eqSubmit{http://..../eqText_h.asp} % for window servers +% {}{} +%or +% \eqSubmit{http://..../eqText_h.php} % for linux/unix servers +% {}{} +%\end{verbatim} +% As with \textsf{eqRecord}, the first parameter of the \texttt{quiz} environment is +% the name of the quiz begin taken. +%\begin{verbatim} +%\begin{quiz*}{Quiz1} +%... +%\end{quiz*} +%\end{verbatim} +% \begin{macro}{\eq@insertHiddenFields} +% Create and add the hidden text fields for this option. The macro +% \cs{eq@insert\-Hid\-den\-Fields} is defined in \textsf{exerquiz} as +% empty. Now we redefine it for the purpose of inserting hidden text +% fields. +% +% For HTML submittal, we define \DescribeMacro{\insertHTMLs}\cs{insertHTMLs}, additional fields to be +% submitted. +% \begin{macrocode} +\def\htmlSubmitType{HTML} +\def\insertHTMLs{,"pdfFileName","rtnURL"} +\def\eq@insertHiddenFields{% + \ifx\basicFieldsSet\eqdb@NO + \addHiddenTextField{pathToTxtFile}{}% + \addHiddenTextField{courseName}{}% + \addHiddenTextField{quizName}{}% +% \end{macrocode} +% If submitting as HTML, we'll include \texttt{pdfFileName} and \texttt{rtnURL}. +% \begin{macrocode} + \ifx\eqdb@submitType\htmlSubmitType + \addHiddenTextField{pdfFileName}{} + \addHiddenTextField{rtnURL}{\thisRtnURL}\fi + \global\let\basicFieldsSet\eqdb@YES + \fi + \addHiddenTextField{\curr@quiz.ptScore}{} + \addHiddenTextField{\curr@quiz.nPointTotal}{\theeqpointvalue} + \addHiddenTextField{\curr@quiz.numQuestions}{\thequestionno}% + \addHiddenTextField{\curr@quiz.numCorrect}{}% + \addHiddenTextField{\curr@quiz.Responses}{}% + \eq@addHiddenTextFields + \eq@clearHiddenFields +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\eq@submitURL} +% The JavaScript of the `End Quiz' button has a command \cs{eq@submitURL}, which has +% an empty definition for quizzes that are not to be submitted. We define this +% macro appropriately. We populate each of the hidden fields and submit. +% \begin{macrocode} +\def\eq@submitURL{% + this.getField("pathToTxtFile").value="\db@Name";\jsR\jsT\jsT + this.getField("courseName").value="\db@Table";\jsR\jsT\jsT + this.getField("quizName").value="\curr@quiz";\jsR\jsT\jsT + this.getField("\curr@quiz.numCorrect").value=Score;\jsR\jsT\jsT + this.getField("\curr@quiz.ptScore").value=ptScore;\jsR\jsT\jsT +% \end{macrocode} +% When submitting as HTML, populate the field \texttt{pdfFileName}. +% \begin{macrocode} +\ifx\eqdb@submitType\htmlSubmitType + this.getField("pdfFileName").value=% + this.documentFileName;\jsR\jsT\jsT +\fi + var aPointType=new Array(\aPointType);\jsR\jsT\jsT +\ifx\eqdb@tagged\eqdb@YES + var cResponses=gatherTaggedQuizData("\currQuiz",% +this.documentFileName,\thequestionno);\jsR\jsT\jsT +\else + var cResponses=Responses.toString().substr(1);\jsR\jsT\jsT +\fi + this.getField("\curr@quiz.Responses").value=cResponses;\jsR\jsT\jsT + \eq@populateHiddenFields + var aSubmitFields=new Array("IdInfo","\curr@quiz",% + "pathToTxtFile","courseName","quizName"% +% \end{macrocode} +% If submitting as HTML, we include \cs{insertHTMLs} into the list +% of fields to submit. +% \begin{macrocode} +\ifx\eqdb@submitType\htmlSubmitType\insertHTMLs\fi);\jsR\jsT\jsT + \priorSubmitQuiz + this.submitForm({cURL: \eq@CGI,bEmpty: true,% +aFields: aSubmitFields,cSubmitAs: "\eqdb@submitType" });\jsR\jsT\jsT +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +% +% \end{macrocode} +% \section{TAOAS} +% TAOAS (The AcroTeX Online Assessment System) is an online quiz system under development. +% It is not publicly available. +% \begin{macrocode} +%<*taoas> +% \end{macrocode} +% \begin{macro}{\eq@insertHiddenFields} +% Create and add the hidden text fields for this option. The macro +% \cs{eq@insert\-Hid\-den\-Fields} is defined in \textsf{exerquiz} as +% empty. Now we redefine it for the purpose of inserting hidden text +% fields. +% \begin{macrocode} +\def\eq@insertHiddenFields{% + \ifx\basicFieldsSet\eqdb@NO + \addHiddenTextField{dbName}{}% + \addHiddenTextField{dbTable}{}% + \addHiddenTextField{quizName}{}% + \addHiddenTextField{UserValid}{false}% + \addHiddenTextField{SID}{}% + \addHiddenTextField{randomID}{}% + \addHiddenTextField{fileName}{\jobname}% + \ifeq@noquizsolutions + \addHiddenTextField{requestSolutions}{false}% + \else + \addHiddenTextField{requestSolutions}{true}% + \fi + \global\let\basicFieldsSet\eqdb@YES + \fi +% \end{macrocode} +% (4/28/10) Added the field \texttt{Admin} (possible values \texttt{Yes}, \texttt{No}, or empty) +% \begin{macrocode} + \addHiddenTextField{Admin}{}% + \addHiddenTextField{\curr@quiz.numCorrect}{}% + \addHiddenTextField{\curr@quiz.numQuestions}{\thequestionno}% + \addHiddenTextField{\curr@quiz.ptScore}{}% + \addHiddenTextField{\curr@quiz.nPointTotal}{\theeqpointvalue} + \addHiddenTextField{\curr@quiz.Responses}{}% + \eq@addHiddenTextFields + \eq@clearHiddenFields +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\eq@submitURL} +% The JavaScript of the `End Quiz' button has a command \cs{eq@submitURL}, which has +% an empty definition for quizzes that are not to be submitted. We define this +% macro appropriately. We populate each of the hidden fields and submit. +% \begin{macrocode} +\def\eq@true{true} +\def\eq@submitURL{% + this.getField("dbName").value=dbName;\jsR\jsT\jsT + this.getField("dbTable").value="\db@Table";\jsR\jsT\jsT + this.getField("quizName").value="\curr@quiz";\jsR\jsT\jsT +% \end{macrocode} +% (05/03/10) When \cs{correctionsOn} is \texttt{false} (defined in the taoas package), +% the document is a survey, or some other document that does not require a score. +% So, we put in a large (in absolute value) negative number as a signal. The \texttt{manage.asp} +% and the \texttt{\_viewresults.asp} script files then look for a value of -1000 and replaces +% it in the Score field with \texttt{N/A}. +% \begin{macrocode} +\ifx\correctionsOn\eq@true + this.getField("\curr@quiz.numCorrect").value=Score;\jsR\jsT\jsT + this.getField("\curr@quiz.ptScore").value=ptScore;\jsR\jsT\jsT +\else + this.getField("\curr@quiz.numCorrect").value=-1000;\jsR\jsT\jsT + this.getField("\curr@quiz.ptScore").value=-1000;\jsR\jsT\jsT +\fi + var aPointType=new Array(\aPointType);\jsR\jsT\jsT +\ifx\eqdb@tagged\eqdb@YES + var cResponses=gatherTaggedQuizData("\currQuiz",% + this.documentFileName,\thequestionno);\jsR\jsT\jsT +\else + var cResponses=Responses.toString().substr(1);\jsR\jsT\jsT +\fi + this.getField("\curr@quiz.Responses").value=cResponses;\jsR\jsT\jsT + \eq@populateHiddenFields + var aSubmitFields=new Array("\curr@quiz","IdInfo",% + "randomID","dbName","dbTable","quizName","fileName",% + "requestSolutions");\jsR\jsT\jsT + \priorSubmitQuiz + this.submitForm(submitURL,true,false,aSubmitFields);\jsR\jsT\jsT +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +% +% \end{macrocode} +\endinput diff --git a/texmf-dist/source/latex/eq2db/eq2db.ins b/texmf-dist/source/latex/eq2db/eq2db.ins new file mode 100644 index 00000000..d050c34f --- /dev/null +++ b/texmf-dist/source/latex/eq2db/eq2db.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{2001/05/26} +\def\batchfile{eq2db.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{eq2db.sty}{\from{eq2db.dtx}{copyright,package}} + \file{eqrecord.def}{\from{eq2db.dtx}{copyright,eqrecord}} + \file{eqemail.def}{\from{eq2db.dtx}{copyright,eqemail}} + \file{eqtext.def}{\from{eq2db.dtx}{copyright,eqtext}} + \file{taoas.def}{\from{eq2db.dtx}{copyright,taoas}} +} +\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/eq2db/examples/FDF_submit/quiz1.tex b/texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz1.tex new file mode 100644 index 00000000..06bbaed4 --- /dev/null +++ b/texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz1.tex @@ -0,0 +1,138 @@ +% +% D. P. Story dpstory@uakron.edu +% The University of Akron +% +% Demo of using web/exerquiz to create a quiz, then process the +% user's responses using the Adobe FDF Toolkit. +% +\documentclass{article} +\usepackage{amsmath} +\usepackage[designi]{web} % dvips, pdftex, dvipsone, dvipdfm +\usepackage{exerquiz} +\usepackage[ImplMulti,indefIntegral]{dljslib} +\usepackage[eqRecord,tagged]{eq2db} + +\everyTextField{\BC{}\textFont{TiRo}\textSize{10}\textColor{0 0 1}} + +%\def\DSN{eqQuiz} +\def\DSN{PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE = c:/Inetpub/DB/eqQuiz.mdb;} %USER ID=;PASSWORD=; +\def\pathiiDB{/C/Inetpub/DB/eqQuiz.mdb} + +% \begin{insDLJS}[servePDF]{servePDF}{Serve PDF} +% var servePDF = true; +% var f = this.getField("UserValid"); +% if ( !f.value && this.external ) +% { +% app.alert("You are not authorized to view this PDF."); +% this.getURL("http://www.math.uakron.edu/~dpstory/tutorial/online/index.html",false); +% } +% \end{insDLJS} + +% \begin{execJS}{execjs} +% app.execMenuItem("Save"); +% \end{execJS} + +\useBeginQuizButton[\textColor{0 0 1}\CA{Begin}\AC{}\RC{}\rectW{}] +\useEndQuizButton[\textColor{0 0 1}\CA{End}\AC{}\RC{}\rectW{}] + +% Design the "Quiz": Have the user enter his/her name and SSN (and perhaps +% other data to identify the class. + +% User's First Name +\newcommand\FirstName[2]{\textField{IdInfo.Name.First}{#1}{#2}} %\V{First Name} + +% User's Last Name +\newcommand\LastName[2]{\textField{IdInfo.Name.Last}{#1}{#2}} %\V{Last Name}% + +% User's SSN +\newcommand\SSN[2]{\textField[\MaxLen{11} + \AA{\AAKeystroke{AFSpecial_Keystroke(3);} + \AAFormat{AFSpecial_Format(3);} + }]{IdInfo.SSN}{#1}{#2}} + +\begin{document} +\thispagestyle{empty} + +\begin{flushleft} +Quiz \#1 \hfill \underbar{First Name:\ \FirstName{100pt}{10pt}}\par +D. P. Story \hfill\underbar{\rlap{Last Name:}\phantom{First Name:}\ \LastName{100pt}{10pt}}\par +Math 101 \hfill \rlap{SSN:}\phantom{First Name:}\ \SSN{100pt}{10pt} +\end{flushleft} + +\newpage + +% Submit this quiz to the ASP, and save it in the Database eqQuiz, +% within eqQuiz, there is a table called Quiz1. +\eqSubmit{http://localhost/scripts/eqRecord.asp\#FDF}{\DSN}{Math101} + +\addHiddenTextField{UserValid}{false} + +\begin{quiz}*{Quiz1} Answer each of the following. Passing +is 100\%. + +\begin{questions} + +\item Name \emph{one} of the two people recognized as a founder of +Calculus.\par%\kern2pt +\RespBoxTxt{0}{0}{5}{Isaac Newton}{Newton}{I. Newton}% +{Gottfried Leibniz}{Leibniz}% +\CorrAnsButton{Isaac Newton or Gottfried Leibniz} + +\item $\displaystyle\frac{d}{dx} e^{x^2}=\RespBoxMath{2*x*e^(x^2)}{4}{.0001}01 %\hfill +\CorrAnsButton{2*x*e^(x^2)}$%\kern1bp\sqTallyBox + +\item $\cos(\pi) = \RespBoxMath{-1}{1}{.0001}24\CorrAnsButton{-1}$ + +\item $\displaystyle\int \sin(x)\,dx = +\RespBoxMath{-cos(x)}{4}{.0001}01[indefCompare]\CorrAnsButton{-cos(x)}$ +\end{questions} +\end{quiz}\quad\ScoreField\currQuiz\CorrButton\currQuiz + +\noindent +Answers: \AnswerField\currQuiz\hfill + +\newpage +\begin{flushleft} +Quiz \#2 \hfill Math 101 +\end{flushleft} + +% +% Set weights to each question, and report the points scored to the DB +% + +\eqSubmit{http://localhost/scripts/eqRecord.asp\#FDF}{\DSN}{Math101} % +% This are created when source file is compiled, their values are not known +\addHiddenTextField{Quiz2.ptScore}{} +\addHiddenTextField{Quiz2.nPointTotal}{\theeqpointvalue} + +% The values of these fields are known at 'run time', must populate them +\populateHiddenField{Quiz2.ptScore}{ptScore} + +\begin{quiz}*{Quiz2} +Using the discriminant, $b^2-4ac$, respond to each of the +following questions. + +\PTsHook{($\eqPTs^{\text{pts}}$)} + +\begin{questions} +\item\PTs{2} Is the quadratic polynomial $x^2-4x + 3$ irreducible? +\begin{answers}4 +\Ans0 Yes &\Ans1 No +\end{answers} +\item\PTs{2} Is the quadratic polynomial $2x^2 - 4x + 3 $ irreducible? +\begin{answers}4 +\Ans1 Yes &\Ans0 No +\end{answers} +\item\PTs{3} How many solutions does the equation $2x^2 - 3x - 2= 0$ have? +\begin{answers}4 +\Ans0 none &\Ans0 one &\Ans1 two +\end{answers} +\item\PTs{3} $\displaystyle\int_0^\pi \sin(x)\,dx = $\space +\RespBoxMath{2}{1}{.0001}{[0,1]}\CorrAnsButton{2} +\end{questions} +\end{quiz}\quad Points: \PointsField\currQuiz\CorrButton\currQuiz + +\noindent +Answers: \AnswerField\currQuiz + +\end{document} diff --git a/texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz2.tex b/texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz2.tex new file mode 100644 index 00000000..ab78eeca --- /dev/null +++ b/texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz2.tex @@ -0,0 +1,180 @@ +% +% D. P. Story dpstory@uakron.edu +% The University of Akron +% +% Demo of using web/exerquiz to create a quiz, then process the +% user's responses using the Adobe FDF Toolkit. +% +\documentclass{article} +\usepackage[designi]{web} % dvips, pdftex, xetex +\usepackage{exerquiz} +\usepackage[ImplMulti,indefIntegral]{dljslib} +\usepackage[eqRecord]{eq2db} + +\everyTextField{\BC{}\textFont{TiRo}\textSize{10}\textColor{0 0 1 rg}} + +% Set the deadline date +\newcommand\Deadline{8/10/2003} + +% set the time limit +\newcommand\TimeLimit{15} % measured in minutes + +% +% Document level JavaScript to check whether student has entered the IdInfo +% fields, and whether the student has a SSN of someone enrolled in the ``course''. +% The ClassRoster array lists the student IDs (SSN) of student ``enrolled''. +% +\begin{insDLJS}[checkIDs]{eqrecord}{JS for eqRecord} +var ok2Initialize = false; +var okToSubmit = false; +var ClassRoster = new Array(123456789, 111111111, 222222222, 987654321); +var TimeLimit = 60 * 1000 * \TimeLimit; +var StartingTime, RequiredEndingTime; +function checkIDs() { + var DeadlineDate = util.scand("mm/dd/yyyy", "\Deadline").valueOf(); + var TimeOfQuiz = new Date().valueOf(); + if ( TimeOfQuiz > DeadlineDate) { + app.alert("It is too late to take this quiz!"); + return false; + } + var f = this.getField("IdInfo.Name.First"); + if ( f.value.replace(/\s/g,"") == "" ) { + app.alert("Please enter your \"First Name\", then try again to initialize the quiz again."); + return false; + } + var f = this.getField("IdInfo.Name.Last"); + if ( f.value.replace(/\s/g,"") == "" ) { + app.alert("Please enter your \"Last Name\", then try again to initialize the quiz again."); + return false; + } + var f = this.getField("IdInfo.SSN"); + if ( f.value == "" ) { + app.alert("Please enter enter your \"SSN\", then try to initialize the quiz again."); + return false; + } + for (var i=0; i < ClassRoster.length; i++) + if ( f.value == ClassRoster[i] ) break; + if ( i == ClassRoster.length ) { + app.alert("You are not enrolled in this class and, therefore, will not be permitted to take the quiz!"); + return false + } + else { + StartingTime = new Date().valueOf(); + RequiredEndingTime = StartingTime + TimeLimit; + return true; + } +} +function checkTimeLimit() +{ + var FinishTime = new Date().valueOf(); + if ( FinishTime > RequiredEndingTime ) + { + app.alert("The time limit of \TimeLimit\space minutes has expired, your results will not be submitted, sorry!"); + return false; + } + else return true; +} +\end{insDLJS} + + +% Check IDs just before we initialize the quiz +\renewcommand\priorInitQuiz{if(checkIDs())} + +% Check the time limit just before we submit, if exceeded, we +% do not submit. +\renewcommand\priorSubmitQuiz{if(checkTimeLimit())} + +\useBeginQuizButton[\textColor{0 0 1}\CA{Begin}\AC{}\RC{}\rectW{}] +\useEndQuizButton[\textColor{0 0 1}\CA{End}\AC{}\RC{}\rectW{}] + +% Design the "Quiz": Have the user enter his/her name and SSN (and perhaps +% other data to identify the class. + +% User's First Name +\newcommand\FirstName[2]{\textField{IdInfo.Name.First}{#1}{#2}} %\V{First Name} + +% User's Last Name +\newcommand\LastName[2]{\textField{IdInfo.Name.Last}{#1}{#2}} %\V{Last Name}% + +% User's SSN +\newcommand\SSN[2]{\textField[\MaxLen{11} + \AA{\AAKeystroke{AFSpecial_Keystroke(3);} + \AAFormat{AFSpecial_Format(3);} + }]{IdInfo.SSN}{#1}{#2}} + + +\begin{document} +\thispagestyle{empty} + +\begin{flushleft} +Quiz~\#3 \hfill \underbar{First Name:\ \FirstName{100pt}{10pt}}\par +D. P. Story \hfill\underbar{\rlap{Last Name:}\phantom{First Name:}\ \LastName{100pt}{10pt}}\par +Math 101 \hfill \rlap{SSN:}\phantom{First Name:}\ \SSN{100pt}{10pt} +\end{flushleft} + +% Submit this quiz to the ASP, and save it in the Database eqQuiz, +% within eqQuiz, there is a table called Quiz1. +\eqSubmit{http://localhost/scripts/eqRecord.asp\#FDF}{eqQuiz}{Math101} +\begin{quiz}*{Quiz3} Answer each of the following. Passing +is 100\%. + +\begin{questions} + +\item Name \emph{one} of the two people recognized as a founder of +Calculus.\par%\kern2pt +\RespBoxTxt{0}{0}{5}{Isaac Newton}{Newton}{I. Newton}% +{Gottfried Leibniz}{Leibniz}% +\CorrAnsButton{Isaac Newton or Gottfried Leibniz} + +\item $\displaystyle\frac{d}{dx} e^{x^2}=\RespBox{2*x*e^(x^2)}{4}{.0001}{[0,1]} %\hfill +\CorrAnsButton{2*x*e^(x^2)}$%\kern1bp\sqTallyBox + +\item $\cos(\pi) = \RespBox{-1}{1}{.0001}24\CorrAnsButton{-1}$ + +\item $\displaystyle\int \sin(x)\,dx = +\RespBox{-cos(x)}{4}{.0001}{[0,1]}[indefCompare]\CorrAnsButton{-cos(x)}$ +\end{questions} +\end{quiz}\quad\ScoreField\currQuiz\CorrButton\currQuiz + +\noindent +Answers: \AnswerField\currQuiz\hfill + +\newpage +\begin{flushleft} +Quiz \#4 \hfill Math 101 +\end{flushleft} + +% +% You can remove the limitations of the first quiz by saying +% \renewcommand\priorInitQuiz{} +% \renewcommand\priorSubmitQuiz{} +% that is, redefined one or both to be empty. +% + +\eqSubmit{http://localhost/scripts/eqRecord.asp\#FDF}{eqQuiz}{Math101} + +\begin{quiz}*{Quiz4} +Using the discriminant, $b^2-4ac$, respond to each of the +following questions. +\begin{questions} +\item Is the quadratic polynomial $x^2-4x + 3$ irreducible? +\begin{answers}4 +\Ans0 Yes &\Ans1 No +\end{answers} +\item Is the quadratic polynomial $2x^2 - 4x + 3 $ irreducible? +\begin{answers}4 +\Ans1 Yes &\Ans0 No +\end{answers} +\item How many solutions does the equation $2x^2 - 3x - 2= 0$ have? +\begin{answers}4 +\Ans0 none &\Ans0 one &\Ans1 two +\end{answers} +\item $\displaystyle\int_0^\pi \sin(x)\,dx = $\space +\RespBox{2}{1}{.0001}{[0,1]}\CorrAnsButton{2} +\end{questions} +\end{quiz}\quad\ScoreField\currQuiz\CorrButton\currQuiz + +\noindent +Answers: \AnswerField\currQuiz + +\end{document} diff --git a/texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz3.tex b/texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz3.tex new file mode 100644 index 00000000..2e3e5abf --- /dev/null +++ b/texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz3.tex @@ -0,0 +1,115 @@ +% +% D. P. Story dpstory@uakron.edu +% The University of Akron +% +% Demo of using web/exerquiz to create a quiz, then process the +% user's responses using the Adobe FDF Toolkit. +% +\documentclass{article} +\usepackage{amsmath} +\usepackage[designi]{web} % dvips, pdftex, xetex +\usepackage{exerquiz} +\usepackage[ImplMulti,indefIntegral]{dljslib} +\usepackage[eqText,tagged]{eq2db} + +\everyTextField{\BC{}\textFont{TiRo}\textSize{10}\textColor{0 0 1 rg}} + +\useBeginQuizButton[\textColor{0 0 1}\CA{Begin}\rectW{}] +\useEndQuizButton[\textColor{0 0 1}\CA{End}\rectW{}] + +% Design the "Quiz": Have the user enter his/her name and SSN (and perhaps +% other data to identify the class. + +% User's First Name +\newcommand\FirstName[2]{\textField{IdInfo.Name.First}{#1}{#2}} %\V{First Name} + +% User's Last Name +\newcommand\LastName[2]{\textField{IdInfo.Name.Last}{#1}{#2}} %\V{Last Name}% + +% User's SSN +\newcommand\SSN[2]{\textField[\MaxLen{11} + \AA{\AAKeystroke{AFSpecial_Keystroke(3);} + \AAFormat{AFSpecial_Format(3);} + }]{IdInfo.SSN}{#1}{#2}} + +\begin{document} +\thispagestyle{empty} + +\begin{flushleft} +Quiz \#1 \hfill \underbar{First Name:\ \FirstName{100pt}{10pt}}\par +D. P. Story \hfill\underbar{\rlap{Last Name:}\phantom{First Name:}\ \LastName{100pt}{10pt}}\par +Math 101 \hfill \rlap{SSN:}\phantom{First Name:}\ \SSN{100pt}{10pt} +\end{flushleft} + +% Submit this quiz to the ASP, and save it to math101.txt +\eqSubmit{http://localhost/scripts/eqText.asp\#FDF}{c:/Inetpub/Data/math101.txt}{Math101} + +\begin{quiz}*{Quiz1} Answer each of the following. Passing +is 100\%. + +\begin{questions} + +\item Name \emph{one} of the two people recognized as a founder of +Calculus.\par%\kern2pt +\RespBoxTxt{0}{0}{5}{Isaac Newton}{Newton}{I. Newton}% +{Gottfried Leibniz}{Leibniz}% +\CorrAnsButton{Isaac Newton or Gottfried Leibniz} + +\item $\displaystyle\frac{d}{dx} e^{x^2}=\RespBox{2*x*e^(x^2)}{4}{.0001}{[0,1]} %\hfill +\CorrAnsButton{2*x*e^(x^2)}$%\kern1bp\sqTallyBox + +\item $\cos(\pi) = \RespBox{-1}{1}{.0001}24\CorrAnsButton{-1}$ + +\item $\displaystyle\int \sin(x)\,dx = +\RespBox{-cos(x)}{4}{.0001}{[0,1]}[indefCompare]\CorrAnsButton{-cos(x)}$ +\end{questions} +\end{quiz}\quad\ScoreField\currQuiz\CorrButton\currQuiz + + +\noindent +Answers: \AnswerField\currQuiz\hfill + +\newpage +\begin{flushleft} +Quiz \#2 \hfill Math 101 +\end{flushleft} + +% +% Set weights to each question, and report the points scored to the DB +% + +\eqSubmit{http://localhost/scripts/eqText.asp\#FDF}{c:/Inetpub/Data/math101.txt}{Math101} +\addHiddenTextField{Quiz2.ptScore}{} +% The values of these fields are known at 'run time', must populate them +\addHiddenTextField{Quiz2.nPointTotal}{\theeqpointvalue} +\populateHiddenField{Quiz2.ptScore}{ptScore} + +\begin{quiz}*{Quiz2} +Using the discriminant, $b^2-4ac$, respond to each of the +following questions. + +% This are created when source file is compiled, their values are not known +\PTsHook{($\eqPTs^{\text{pts}}$)} + +\begin{questions} +\item\PTs{2} Is the quadratic polynomial $x^2-4x + 3$ irreducible? +\begin{answers}4 +\Ans0 Yes &\Ans1 No +\end{answers} +\item\PTs{2} Is the quadratic polynomial $2x^2 - 4x + 3 $ irreducible? +\begin{answers}4 +\Ans1 Yes &\Ans0 No +\end{answers} +\item\PTs{3} How many solutions does the equation $2x^2 - 3x - 2= 0$ have? +\begin{answers}4 +\Ans0 none &\Ans0 one &\Ans1 two +\end{answers} +\item\PTs{3} $\displaystyle\int_0^\pi \sin(x)\,dx = $\space +\RespBox{2}{1}{.0001}{[0,1]}\CorrAnsButton{2} +\end{questions} +\end{quiz}\quad Points: \PointsField\currQuiz\CorrButton\currQuiz + +\noindent +Answers: \AnswerField\currQuiz + +\end{document} diff --git a/texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz4.tex b/texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz4.tex new file mode 100644 index 00000000..0f699aca --- /dev/null +++ b/texmf-dist/source/latex/eq2db/examples/FDF_submit/quiz4.tex @@ -0,0 +1,119 @@ +% +% D. P. Story dpstory@uakron.edu +% The University of Akron +% +% Demo of using web/exerquiz to create a quiz, then process the +% user's responses using the Adobe FDF Toolkit. +% +\documentclass{article} +\usepackage{amsmath} +\usepackage[designi]{web} % dvips, pdftex, xetex +\usepackage{exerquiz} +\usepackage[ImplMulti,indefIntegral]{dljslib} +\usepackage[eqEmail]{eq2db} + +\everyTextField{\BC{}\textFont{TiRo}\textSize{10}\textColor{0 0 1 rg}} + +\useBeginQuizButton[\textColor{0 0 1}\CA{Begin}\AC{}\RC{}\rectW{}] +\useEndQuizButton[\textColor{0 0 1}\CA{End}\AC{}\RC{}\rectW{}] + +% Design the "Quiz": Have the user enter his/her name and SSN (and perhaps +% other data to identify the class. + +% User's First Name +\newcommand\FirstName[2]{\textField{IdInfo.Name.First}{#1}{#2}} %\V{First Name} + +% User's Last Name +\newcommand\LastName[2]{\textField{IdInfo.Name.Last}{#1}{#2}} %\V{Last Name}% + +% User's SSN +\newcommand\SSN[2]{\textField[\MaxLen{11} + \AA{\AAKeystroke{AFSpecial_Keystroke(3);} + \AAFormat{AFSpecial_Format(3);} + }]{IdInfo.SSN}{#1}{#2}} + +\begin{document} +\thispagestyle{empty} + +\begin{flushleft} +Quiz \#1 \hfill \underbar{First Name:\ \FirstName{100pt}{10pt}}\par +D. P. Story \hfill\underbar{\rlap{Last Name:}\phantom{First Name:}\ \LastName{100pt}{10pt}}\par +Math 101 \hfill \rlap{SSN:}\phantom{First Name:}\ \SSN{100pt}{10pt} +\end{flushleft} + +% Submit this quiz to the ASP and send email to dpstory@example.edu +\eqSubmit{http://localhost/scripts/eqEmail.asp\#FDF}{dpstory@example.edu}{Math101} + +\begin{quiz}*{Quiz1} Answer each of the following. Passing +is 100\%. + +\begin{questions} + +\item Name \emph{one} of the two people recognized as a founder of +Calculus.\par%\kern2pt +\RespBoxTxt{0}{0}{5}{Isaac Newton}{Newton}{I. Newton}% +{Gottfried Leibniz}{Leibniz}% +\CorrAnsButton{Isaac Newton or Gottfried Leibniz} + +\item $\displaystyle\frac{d}{dx} e^{x^2}=\RespBox{2*x*e^(x^2)}{4}{.0001}{[0,1]} %\hfill +\CorrAnsButton{2*x*e^(x^2)}$%\kern1bp\sqTallyBox + +\item $\cos(\pi) = \RespBox{-1}{1}{.0001}24\CorrAnsButton{-1}$ + +\item $\displaystyle\int \sin(x)\,dx = +\RespBox{-cos(x)}{4}{.0001}{[0,1]}[indefCompare]\CorrAnsButton{-cos(x)}$ +\end{questions} +\end{quiz}\quad\ScoreField\currQuiz\CorrButton\currQuiz + + + +\noindent +Answers: \AnswerField\currQuiz\hfill +% Here is a button that opens the database, useful for testing +% Uncomment the next two lines, and edit the path + +\newpage +\begin{flushleft} +Quiz \#2 \hfill Math 101 +\end{flushleft} + +% +% Set weights to each question, and report the points scored to the DB +% + +\eqSubmit{http://localhost/scripts/eqEmail.asp\#FDF}{dpstory@example.edu}{Math101} + +\begin{quiz}*{Quiz2} +Using the discriminant, $b^2-4ac$, respond to each of the +following questions. + +\addHiddenTextField{\currQuiz.ptScore}{} +% The values of these fields are known at 'run time', must populate them +\addHiddenTextField{\currQuiz.nPointTotal}{\theeqpointvalue} +\populateHiddenField{\currQuiz.ptScore}{ptScore} + +% This are created when source file is compiled, their values are not known +\PTsHook{($\eqPTs^{\text{pts}}$)} + +\begin{questions} +\item\PTs{2} Is the quadratic polynomial $x^2-4x + 3$ irreducible? +\begin{answers}4 +\Ans0 Yes &\Ans1 No +\end{answers} +\item\PTs{2} Is the quadratic polynomial $2x^2 - 4x + 3 $ irreducible? +\begin{answers}4 +\Ans1 Yes &\Ans0 No +\end{answers} +\item\PTs{3} How many solutions does the equation $2x^2 - 3x - 2= 0$ have? +\begin{answers}4 +\Ans0 none &\Ans0 one &\Ans1 two +\end{answers} +\item\PTs{3} $\displaystyle\int_0^\pi \sin(x)\,dx = $\space +\RespBox{2}{1}{.0001}{[0,1]}\CorrAnsButton{2} +\end{questions} +\end{quiz}\quad Points: \PointsField\currQuiz\CorrButton\currQuiz + +\noindent +Answers: \AnswerField\currQuiz + +\end{document} diff --git a/texmf-dist/source/latex/fitr/fitr.dtx b/texmf-dist/source/latex/fitr/fitr.dtx new file mode 100644 index 00000000..eabd27e9 --- /dev/null +++ b/texmf-dist/source/latex/fitr/fitr.dtx @@ -0,0 +1,790 @@ +%\iffalse +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% fitr.sty package, 2016-04-04 %% +%% Copyright (C) 2012--2016 D. P. Story %% +%% dpstory@uakron.edu %% +%% %% +%% 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 of the %% +%% License, or (at your option) any later version. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%\NeedsTeXFormat{LaTeX2e}[1997/12/01] +%\ProvidesPackage{fitr} +% [2016/04/09 v1.2e Support for FitR destinations (dps)] +%<*driver> +\documentclass{ltxdoc} +\usepackage[colorlinks,hyperindex]{hyperref} +\usepackage{fancyvrb,array,calc} +%\pdfstringdefDisableCommands{\let\\\textbackslash} +%\EnableCrossrefs \CodelineIndex +\RecordChanges +\bgroup\ttfamily +\gdef\brpr#1{\char123\relax#1\char125\relax}\egroup +\def\ameta#1{\ensuremath{\langle\textsl{\texttt{#1}}\rangle}} +\def\meta#1{\textsl{\texttt{#1}}} +\def\SUB#1{\ensuremath{{}_{\mbox{\scriptsize\ttfamily#1}}}} +\def\cs#1{\texttt{\bslash#1}} +\DeclareRobustCommand{\tmspace}[3]{% + \ifmmode\mskip#1#2\else\kern#1#3\fi\relax} +\renewcommand{\,}{\tmspace+\thinmuskip{.1667em}} +\let\thinspace\, +\renewcommand{\!}{\tmspace-\thinmuskip{.1667em}} +\let\negthinspace\! +\renewcommand{\:}{\tmspace+\medmuskip{.2222em}} +\let\medspace\: +\newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}} +\renewcommand{\;}{\tmspace+\thickmuskip{.2777em}} +\let\thickspace\; +\newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}} +\makeatletter +\renewcommand{\paragraph} + {\@startsection{paragraph}{4}{0pt}{6pt}{-3pt} + {\normalfont\normalsize\bfseries}} +\renewenvironment{quote}[1][] + {\def\@rgi{#1}\ifx\@rgi\@empty + \let\rghtm\@empty\else\def\rghtm{\rightmargin\leftmargin}\fi + \list{}{\rghtm} %{\rightmargin\leftmargin}% + \item\relax} + {\endlist} +\makeatother +\begin{document} +\def\CMD#1{\textbackslash#1} + \GetFileInfo{fitr.sty} + \title{\textsf{fitr}: Creating \textsf{FitR} Destinations} + \author{D. P. Story\\ + Email: \texttt{dpstory@acrotex.net}} + \date{processed \today} + \maketitle + \tableofcontents + \let\Email\texttt + \renewenvironment{theglossary}{% + \let\efill\relax + \begin{itemize}}{\end{itemize}} + \value{GlossaryColumns}=1 + \DocInput{fitr.dtx} + \PrintIndex +\end{document} +% +% \fi +% \MakeShortVerb{|} +% \StopEventually{} +% +% \DoNotIndex{\def,\edef,\gdef,\xdef,\global,\long,\let} +% \DoNotIndex{\expandafter,\string,\the,\ifx,\else,\fi} +% \DoNotIndex{\csname,\endcsname,\relax,\begingroup,\endgroup} +% \DoNotIndex{\DeclareTextCommand,\DeclareTextCompositeCommand} +% \DoNotIndex{\space,\@empty,\special} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% +% \paragraph*{Introduction.} +% +% This package supports \textsf{dvips} and \textsf{dvipsone} utilities, +% and assumes the PDF creator is \textbf{Adobe Distiller}. It also supports +% the \textsf{pdflatex} (and lualatex) executable through the \texttt{pdftex} option; +% the options \texttt{dvipdfm}, \texttt{dvipdfmx}, and \texttt{xetex} support the +% corresponding executables. +% +% When using a dvi-ps-pdf work flow (with Distiller as the PDF creator), the +% package uses the \textbf{pdfmark} for the \textsf{FitR} view-type destination: +%\begin{verbatim} +% [ /Dest//View [ /FitR left bottom right top ]/DEST pdfmark +%\end{verbatim} +% For the \texttt{pdftex} option, we use \cs{pdfdest} a primitive of +% that utility: +%\begin{verbatim} +% \pdfdest name {} fitr +% width +% height +% depth +%\end{verbatim} +% For the \texttt{dvipdfm}, \texttt{dvipdfmx}, and \texttt{xetex} options, +% the problem of computing the \textsf{FitR} rectangle is a little trickier. +%\medskip\noindent +%The \textsl{PDF Reference} describes \textsf{FitR} as, +%\begin{quote} +% Display the page designated by page, with its contents +% magnified just enough to fit the rectangle specified by the +% coordinates \textsl{left}, \textsl{bottom}, \textsl{right}, and \textsl{top} entirely within the +% window both horizontally and vertically. +%\end{quote} +% This type of destination allows for the creation of a link or form button +% to zoom in on a rectangular region. +% +% \section{Options and Required Packages} +% \begin{macrocode} +\RequirePackage{xkeyval} +\RequirePackage{ifpdf}[2006/02/20] +\RequirePackage{ifxetex}[2006/08/21] +% \end{macrocode} +% \paragraph*{Driver options.} Three options, \DescribeMacro{dvips, dvipsone}\texttt{dvips} (the default) +% and \texttt{dvipsone}, both of which require \textbf{Adobe Distiller} +% as the PDF creator; the \DescribeMacro{pdftex}\texttt{pdftex} allows for the same functionality +% for the \textsf{pdflatex} executable. We also support \DescribeMacro{dvipdfm,dvipdfmx,xetex}\texttt{dvipdfm} +% and its extensions, \texttt{dvipdfmx} and \texttt{xetex}. +% +% \paragraph*{Preview options.} The \DescribeMacro{preview}\texttt{preview} +% option is a carry over from \textsf{eforms}. When selected, all form fields are outlined; useful when +% setting the location of fields in a dvi previewer. The other option is \texttt{viewMagWin} +% \DescribeMacro{viewMagWin} will show the viewing windows surrounding the target. This is the rectangle +% that will be jumped to. Use this option to adjust the size of the window to your needs. +% When either of the last two options has an exclamation point prior, that means to +% turn off the switch. You can conveniently use \texttt{viewMagWin} to see the viewing window, +% then change it to \DescribeMacro{!viewMagWin}\texttt{!viewMagWin} to remove the visible window. Cool. +% Similarly, you can turn off \texttt{preview} using \DescribeMacro{!preview}\texttt{!preview}. +% \begin{macrocode} +% \end{macrocode} +% We create the \cs{ifpreview} and \cs{ifviewMagWin}, and declare the options. +% \begin{macrocode} +\@ifundefined{ifpreview}{\newif\ifpreview \previewfalse}{} +\@ifundefined{ifviewMagWin}{\newif\ifviewMagWin \viewMagWinfalse}{} +\let\fitr@driver\@empty +\DeclareOptionX{pdftex}{\gdef\fitr@driver{pdftex}% + \PassOptionsToPackage{\fitr@driver}{hyperref}% + \PassOptionsToPackage{\fitr@driver}{eforms}% +} +\def\fitr@pdftex@driver{pdftex} +% \end{macrocode} +% Distiller based drivers. +% \begin{macrocode} +\DeclareOptionX{dvips}{\gdef\fitr@driver{dvips}% + \PassOptionsToPackage{\fitr@driver}{hyperref}% + \PassOptionsToPackage{\fitr@driver}{eforms}% +} +\def\fitr@dvips@driver{dvips} +\DeclareOptionX{dvipsone}{\gdef\fitr@driver{dvipsone}% + \PassOptionsToPackage{\fitr@driver}{hyperref}% + \PassOptionsToPackage{\fitr@driver}{eforms}% +} +\def\fitr@dvipsone@driver{dvipsone} +% \end{macrocode} +% \textsf{dvipdfm} and its variants. +% \begin{macrocode} +\newif \if@fitr@dvipdfm \@fitr@dvipdfmfalse +\DeclareOptionX{dvipdfm}{\gdef\fitr@driver{dvipdfm}% + \@fitr@dvipdfmtrue + \PassOptionsToPackage{\fitr@driver}{hyperref}% + \PassOptionsToPackage{\fitr@driver}{eforms}% +} +\def\fitr@dvipdfm@driver{dvipdfm} +\DeclareOptionX{dvipdfmx}{\gdef\fitr@driver{dvipdfmx}% + \@fitr@dvipdfmtrue + \PassOptionsToPackage{\fitr@driver}{hyperref}% + \PassOptionsToPackage{\fitr@driver}{eforms}% +} +\def\fitr@dvipdfmx@driver{dvipdfmx} +\DeclareOptionX{xetex}{\gdef\fitr@driver{xetex}% + \@fitr@dvipdfmtrue + \PassOptionsToPackage{\fitr@driver}{hyperref}% + \PassOptionsToPackage{\fitr@driver}{eforms}% +} +\def\fitr@xetex@driver{xetex} +% \end{macrocode} +% \begin{macrocode} +\DeclareOptionX{preview}{\previewtrue} +\DeclareOptionX{!preview}{\previewfalse} +\DeclareOptionX{viewMagWin}{\viewMagWintrue} +\DeclareOptionX{!viewMagWin}{\viewMagWinfalse} +% \end{macrocode} +% Before processing options, try for automatic driver detection. +% \begin{macrocode} +\@ifpackageloaded{web}{% + \ExecuteOptionsX{\eq@driver@name}% +}{% + \ifpdf\ExecuteOptionsX{pdftex}\else + \ifxetex\ExecuteOptionsX{xetex}\fi\fi +} +% \end{macrocode} +% Process the options +% \begin{macrocode} +\ProcessOptionsX +% \end{macrocode} +% \begin{macrocode} +\RequirePackage{xcolor} +\ifx\fitr@driver\@empty + \def\fitr@driver{dvips} + \def\fitr@loadPkgs{% + \RequirePackage[dvips]{hyperref} + \RequirePackage[dvips]{eforms}}% +\else + \def\fitr@loadPkgs{% + \RequirePackage{hyperref} + \RequirePackage{eforms}[2016/04/05]} +\fi +\fitr@loadPkgs +% \end{macrocode} +% Minimal packages \textsf{calc} and \textsf{eforms} (which inputs \textsf{hyperref}). +% \begin{macrocode} +\RequirePackage{calc} +% \end{macrocode} +% We also require \textsf{collectbox}, a cool way of collecting an argument which enables +% the use of verbatim text. Written by Martin Scharrer. +% \begin{macrocode} +\RequirePackage{collectbox} +% \end{macrocode} +% \section{The Main Code} +% Some scratch counters, lengths, boxes. +% \begin{macrocode} +\newcounter{magCnt} +\newbox\fitr@bbox +\newcount\fitr@height \newcount\fitr@width \newcount\fitr@depth +\newlength\fitr@length +% \end{macrocode} +% \begin{macro}{\get@fitr@dimen} +% \cs{get@fitr@dimen}\verb!{!\meta{content}\verb!}!: this command encloses \meta{content} +% in the box register \cmd{\fitr@bbox} (an \cs{hbox}) and transfers +% dimension info to the count registers \cmd{\fitr@height}, +% \cmd{\fitr@width}, and \cmd{\fitr@depth}, To typeset \meta{content} you must +% \cmd{\unhbox}\cmd{\fitr@bbox}. +% \begin{macrocode} +\def\get@fitr@dimen#1{% + \setbox\fitr@bbox=\hbox{#1}% + \fitr@height=\ht\fitr@bbox + \xdef\fitr@height@l{\the\ht\fitr@bbox}% + \fitr@width=\wd\fitr@bbox + \xdef\fitr@width@l{\the\wd\fitr@bbox}% + \fitr@depth=\dp\fitr@bbox + \xdef\fitr@depth@l{\the\dp\fitr@bbox}% + \setlength\fitr@length{\ht\fitr@bbox+\dp\fitr@bbox}% + \edef\fitr@@height{\the\fitr@length}% +} +% \end{macrocode} +% \end{macro} +% The following commands are some PostScript for the \textsf{dvips} executable. +% +% \paragraph*{dvips.} +% Uses \cmd{\fitr@bbox}; \texttt{\#1} is amount to widen box; \texttt{\#2} amount to heighten box. +% \begin{macrocode} +\def\fitr@urxury@fixup#1#2#3{} +\ifx\fitr@driver\fitr@dvips@driver +\headerps@out{/TeXtoPDF {65536 div DVImag mul} def % sp to pts +/SPtoDvips{TeXtoPDF PDFToDvips} def} % dp to dots +\def\FitRbboxB#1#2{% Uses \fitr@bbox + currentpoint 2 copy DvipsToPDF \the\fitr@depth\space TeXtoPDF add + neg vsize add 72 sub #2\space sub exch % y1 + DvipsToPDF 72 add #1\space sub exch % x1 + 4 2 roll exch DvipsToPDF \the\fitr@width\space + TeXtoPDF add 72 add #1\space add exch % x2 + DvipsToPDF \the\fitr@height \space TeXtoPDF sub + neg vsize add 72 sub #2\space add} % y2 +\else\ifx\fitr@driver\fitr@dvipsone@driver +% \end{macrocode} +% \paragraph*{dvipsone.} Uses \cmd{\fitr@bbox}; \texttt{\#1} is amount to widen box; \texttt{\#2} amount to heighten box. +% \begin{macrocode} +\special{!/TeXtoPDF {65536 div mag 1000 div mul} def +/PDFtoTeX {65536 mul mag 1000 div div} def} +\def\FitRbboxB#1#2{% + currentpoint 2 copy \the\fitr@depth\space add DvipsToPDF + neg PageHeight add 72 sub #2\space sub % y1 + exch DvipsToPDF 72 add #1\space sub exch % x1 + 4 2 roll exch \the\fitr@width\space add + DvipsToPDF 72 add #1\space add exch % x2 + \the\fitr@height\space sub DvipsToPDF neg + PageHeight add 72 sub #2\space add} % y2 +\else\ifx\fitr@driver\fitr@pdftex@driver +% \end{macrocode} +% \paragraph*{pdftex.} +% Uses \cmd{\fitr@bbox}; \texttt{\#1} is amount to widen box; +% \texttt{\#2} amount to heighten box. +% +% This version of \cs{FitRbbox} expands the bounding rectangle to +% the viewing window by increasing the dimensions of width, height +% and depth. It saves these values in the macros +% \cs{fitr@pdftex@view@width\string|height\string|depth}. +% \begin{macrocode} +\def\FitRbboxB#1#2{% + \fitr@length=#1bp + \fitr@length=2\fitr@length + \advance\fitr@length\wd\fitr@bbox + \edef\fitr@pdftex@view@width{\the\fitr@length}% + \fitr@length=#2bp + \advance\fitr@length\ht\fitr@bbox + \edef\fitr@pdftex@view@height{\the\fitr@length}% + \fitr@length=#2bp + \advance\fitr@length\dp\fitr@bbox + \edef\fitr@pdftex@view@depth{\the\fitr@length}% +} +\else\if@fitr@dvipdfm +% \end{macrocode} +% \paragraph*{dvipdfm/dvipdfmx/xetex.} The primitive \verb!\special{pdf: dest (name)...}! is used +% along with the primitive variables \texttt{@xpos} and \texttt{@ypos}. +% \begin{macrocode} +\def\FitRbboxB#1#2#3{% + \smash{\raisebox{-\fitr@depth@l-#2bp}% + {\makebox[0pt][l]{\hspace*{-#1bp}% +% \end{macrocode} +% The values of \texttt{@xpos} and \texttt{@ypos} correspond to the coordinates +% of the lower left corner. The values of \texttt{@urx\#3} and \texttt{@ury\#3} +% are calculated in \cs{fitr@urxury@fixup} as the coordinates of the upper right +% corner. +% \begin{macrocode} + \@pdfm@mark{dest (#3) % + [ @thispage /FitR @xpos @ypos @urx#3\space @ury#3\space ]}}}}% +} +% \end{macrocode} +% \cs{fitr@urxury@fixup} is placed just after \cs{fitr@bbox}. +% \begin{macrocode} +\def\fitr@urxury@fixup#1#2#3{% + \smash{\raisebox{\fitr@height@l+#2bp}% + {\makebox[0pt][l]{\hspace*{#1bp}% +% \end{macrocode} +% We raise up to the upper right corner of the content box and define +% \texttt{@urx\#3} and \texttt{@ury\#3} as the current values of +% \texttt{@xpos} and \texttt{@ypos}, +% \begin{macrocode} + \@pdfm@mark{obj @urx#3\space @xpos}% + \@pdfm@mark{obj @ury#3\space @ypos}}}}% +} +\fi\fi\fi\fi +% \end{macrocode} +% We use a short macro from \textsf{graphics} package. +% We do not require the \textsf{graphics} command +% so we redefine it under a different name. +% \begin{macrocode} +\def\fitr@defaultbp#1#2{% + \afterassignment\fitr@def@bp\dimen@#2bp\relax{#1}{#2}} +\def\fitr@def@bp#1\relax#2#3{% + \if!#1!% + \def#2{#3}% + \else + \dimen@.99626\dimen@ + \edef#2{\strip@pt\dimen@}% + \fi} +% \end{macrocode} +% The major command of this package is \cs{jdRect}. Its second required argument +% has several key-value pairs that are recognized. +% Options for the \cs{jdRect} command. +% +% \medskip\noindent\DescribeMacro{lift} is the amount of lift (performed by \cs{raisebox}. The vlue +% can be a positive or negative length. Positive to translate upward, negative to translate downward. +% The default is \texttt{0pt}. +% \begin{macrocode} +\define@key{fitr}{lift}[0pt]{{\setlength\@tempdima{#1}% + \xdef\fitr@temp@length{\the\@tempdima}}% + \edef\fitr@@lift{\fitr@temp@length}} +\def\fitr@@lift{0pt} +% \end{macrocode} +% \DescribeMacro{shift} the amount of horizontal shift, positive to the right, negative to the left. +% The default is \texttt{0pt} +% \begin{macrocode} +\define@key{fitr}{shift}[0pt]{{\setlength\@tempdima{#1}% + \xdef\fitr@temp@length{\the\@tempdima}}% + \edef\fitr@@shift{\fitr@temp@length}} +\def\fitr@@shift{0pt} +% \end{macrocode} +% \DescribeMacro{width}\DescribeMacro{height} are the dimensions of the bounding box +% for the button/view rectangle. These dimensions are ignored when the first optional +% parameter of \cmd{\jdRect} is nonempty. +% \begin{macrocode} +\define@key{fitr}{width}[0pt]{{\setlength\@tempdima{#1}% + \xdef\fitr@temp@length{\the\@tempdima}}% + \edef\fitr@@width{\fitr@temp@length}} +\def\fitr@@width{0pt} +\define@key{fitr}{height}[0pt]{{\setlength\@tempdima{#1}% + \xdef\fitr@temp@length{\the\@tempdima}}% + \edef\fitr@@height{\fitr@temp@length}} +\def\fitr@@height{0pt} +% \end{macrocode} +% \DescribeMacro{ref} is the reference point. Values are \texttt{t} (the default), +% \texttt{c} center, and \texttt{b} bottom. When the optional first parameter of +% \cmd{\jdRect} is nonempty, the default is \texttt{b}. +% \begin{macrocode} +\define@choicekey+{fitr}{ref}[\val\nr]{t,c,b}[t]% + {\edef\fitr@@refPt{\val}}{} +\def\fitr@@refPt{t} +% \end{macrocode} +% \DescribeMacro{adddestw}\DescribeMacro{adddesth} add additional length around +% the (internal) box. This larger rectangle is the view window. +% \begin{macrocode} +\define@key{fitr}{adddestw}[0]{% + \fitr@defaultbp{\fitr@@adddestw}{#1}} +\def\fitr@@adddestw{0} +\define@key{fitr}{adddesth}[0]{% + \fitr@defaultbp{\fitr@@adddesth}{#1}} +\def\fitr@@adddesth{0} +% \end{macrocode} +% \DescribeMacro{button} is a Boolean. If \texttt{true} (the default), \cmd{\jdRect} +% creates a push button around the content. When the user pushes the button, the viewer +% zooms in to the view window. Clicking again restores the previous view. When \texttt{button} +% is \texttt{false}, the button is not created, but the viewing window is. You can then jump to the +% viewing window with a separate link or button. +% \begin{macrocode} +\define@boolkey{fitr}{button}[true]{} +\KV@fitr@buttontrue +% \end{macrocode} +% \DescribeMacro{link} is an key, which if taken, a link rather than a push button, +% is created. The \texttt{link} key takes one of two values: \texttt{jmp}, \texttt{restore}. +% \begin{itemize} +% \item When \texttt{link=jmp}, a link is created that jumps to the destination determined by +% \texttt{dest}. This value is designed for external links for jumping to a rectangular region +% Use the key \texttt{nodest} to keep \cs{jdRect} from creating a destination at the link location. +% \item When \texttt{link=restore}, again, a link is created around the content, a restore last view +% action is associated with the link; clicking on it jumps back to the view at the time you jumped. +% \end{itemize} +% \begin{macrocode} +\define@choicekey+{fitr}{link}[\val\nr]{jmp,restore}[] + {\edef\fitr@@link{\nr}}{} +\let\fitr@@link\@empty +% \end{macrocode} +% \DescribeMacro{nodest}\texttt{nodest} is a Boolean, which if \texttt{true}, +% causes \cs{jdRect} not to generate a destination at the current link (or button). +% \begin{macrocode} +\define@boolkey{fitr}{nodest}[true]{} +\KV@fitr@nodestfalse +% \end{macrocode} +% \DescribeMacro{dest} When \texttt{button=true} (the default), the name of the destination +% is automatically generated, internally. When \texttt{button=false}, you need to specify +% a destination to reference in a separate link or push button. +% \begin{macrocode} +\define@key{fitr}{dest}[]{\def\fitr@@dest{#1}} +\let\fitr@@dest\@empty +% \end{macrocode} +% \begin{macrocode} +\define@choicekey+{fitr}{allowFX}[\val\nr]{true,false}[true]% + {\edef\fitr@allowFX{\val}}{} +\def\allowFXDefault{true} +\let\fitr@allowFX\@empty +% \end{macrocode} +% \paragraph{The main command.} +% \DescribeMacro{\jdRect} \cs{jdRect} (optionally) \underbar{j}umps to and/or sets +% a \underbar{d}estination of a \textsf{Fit\underbar{R\normalfont ect}}angle.\footnote{I had some problems naming this command.} +% This command is multi-functional. +% This is the default behavior (\texttt{button=true}). The command creates two +% rectangular regions (which can be viewed using the \texttt{preview} and \texttt{viewMagWin}). +% \begin{center}\setlength\fboxsep{0pt} +% \fbox{\parbox[c][.9in]{2.4in} +% {\vfill\hfil\fbox{\parbox[c][.5in]{2in}{\vfill\hfill}}\hfil\vfill}} +% \end{center} +% The inner-box represents the bounding rectangle of the push button (or link) that is created +% when \texttt{button=true} (or \texttt{link=jmp\string|restore}). The outer rectangle is the \emph{view window}, the window +% that is magnified to (the dimensions of this rectangle set by the four \textsf{FitR} +% parameters. Normally, the inner and outer rectangles are the same, unless the author +% specifies values of \texttt{adddestw} and \texttt{adddesth}. The picture above is that +% can be produced by setting +%\begin{verbatim} +% width=2in,height=.5in,adddestw=.2in,adddesth=.2in +%\end{verbatim} +% The inner rectangle may be seen by using the option \texttt{preview}, the outer once +% can be see by using the option \texttt{viewMagWin}. +% +% Now if \texttt{button=false}, \cs{jdRect} only sets the destination; +% it does not create the inner push button. A separate link or push button +% needs to be created to jump to the view window. +% +%\medskip\noindent Syntax for \cs{jdRect} has two forms: +%\begin{quote} +% \cs{jdRect[\meta{key-values}]} +%\end{quote} +% The above version is used to overlay a region with a button and view window. +% No content is specified, but is defined by specifying the \texttt{width} and \texttt{height}; +% it can be positioned using \texttt{shift} and \texttt{lift}. +% +% There is a \texttt{*}-version as well: +%\begin{quote} +% \cs{jdRect*[\meta{key-values}]}\verb!{!\meta{content}\verb!}! +%\end{quote} +% The second parameter \meta{content} is required when the \texttt{*} is present. +% This version is meant to enclose \meta{content} within the button and view window. +% \texttt{width} and \texttt{height} are ignored, but \texttt{shift} and \texttt{lift} are obeyed (though +% you may \texttt{shift} or \texttt{lift} the button/view window away from the content). +% \begin{macrocode} +\newcommand{\jdRect}{\begingroup + \@ifstar{\let\fitr@istar=1\set@rectjd}% + {\let\fitr@istar=0\set@rectjd}} +% \end{macrocode} +% For links, we use the link color of \textsf{hyperref}. The definition of +% \cmd{\ef@colorthislink} is in \textsf{eforms}. +% \begin{macrocode} +\@eqlinktxtcolor{\@linkcolor} +\newcommand{\fitr@bcode}{\ef@colorthislink}% +% \end{macrocode} +% Second stage in the expansion of \cmd{\jdRect}. +% \begin{macrocode} +\newcommand{\set@rectjd}[1][]{\def\fitr@jdrect@argi{#1}% +% \end{macrocode} +% We process the key-values before gathering the \cs{collectbox} +% so we can insert the link color, if this is a link! +% \begin{macrocode} + \edef\temp@exp{\noexpand\setkeys{fitr}{#1}}\temp@exp + \ifx\fitr@@link\@empty\let\fitr@bcode\relax\fi +% \end{macrocode} +% If this is \cs{jdRect*}, we collect the second argument using +% \cs{collectbox}, and move on to \cs{set@@rectjd}. +% \begin{macrocode} + \if\fitr@istar1% + \def\fitr@next{\collectbox[\fitr@bcode]{\set@@rectjd}}\else +% \end{macrocode} +% Otherwise, we just move on to \cs{set@@rectjd}. +% \begin{macrocode} + \def\fitr@next{\set@@rectjd}\fi\fitr@next +} +% \end{macrocode} +% The third and final stage in the expansion of \cs{jdRect} +% \begin{macrocode} +\def\set@@rectjd{% + \stepcounter{magCnt}\def\fitr@setBL{0pt}% + \ifx\fitr@@dest\@empty + \def\fitr@namedDest{fitrDestn\the\value{magCnt}}\else + \edef\fitr@namedDest{\fitr@@dest}\fi + \if\fitr@istar1\def\fitr@@refPt{b}\fi +% \end{macrocode} +% If the user specifies the \texttt{link} option, we cancel the \texttt{button} option. +% \begin{macrocode} + \ifx\fitr@@link\@empty\else\KV@fitr@buttonfalse\fi +% \end{macrocode} +% If content is explicitly passed in the optional second parameter +% we put it in a box and take its measurements. We'll insert the content +% instead of an empty filled \cs{parbox}. +% \begin{macrocode} + \if\fitr@istar1% + \edef\fitr@@width{\the\wd\collectedbox}% + \edef\fitr@setBL{\the\dp\collectedbox}% + \setlength{\fitr@length}{\ht\collectedbox+\dp\collectedbox}% + \edef\fitr@@height{\the\fitr@length}% + \fi +% \end{macrocode} +% Now, we fit the content into \cs{fitr@bbox} using \cs{get@fitr@dimen}. +% \begin{macrocode} + \ifx\fitr@@link\@empty + \ifKV@fitr@button\let\fitr@FLB@ction\fitr@OverlayJmpBtn\else +% \end{macrocode} +% \cs{Bbox} is defined in \textsf{eforms}. +% \begin{macrocode} + \@ifundefined{ef@Bbox}{\let\fitr@FLB@ction\Bbox}% + {\let\fitr@FLB@ction\ef@Bbox}\fi + \else\def\fitr@FLB@ction{\hfill\vfill\@gobbletwo}\fi +% \end{macrocode} +% And overlay the button/link/box +% \begin{macrocode} + \get@fitr@dimen{% + \parbox[\fitr@@refPt][\fitr@@height]{\fitr@@width}% + {\kern0pt\fitr@FLB@ction{\fitr@@width}{\fitr@@height}\kern0pt}% + }% +% \end{macrocode} +% Now place the button/box according to the user's options. +% \begin{macrocode} + \makebox[0pt][l]{\hspace*{\fitr@@shift}\smash{% + \raisebox{\fitr@@lift-\fitr@setBL}{% + \ifKV@fitr@nodest\else\setFitRDest{\fitr@@adddestw}% + {\fitr@@adddesth}{\fitr@namedDest}\fi + \unhbox\fitr@bbox\ifKV@fitr@nodest\else\fitr@urxury@fixup + {\fitr@@adddestw}{\fitr@@adddesth}{\fitr@namedDest}\fi + }}}% + \setlength{\fboxsep}{0pt}% +% \end{macrocode} +% We attempt to represent the bounding box of the view window. +% We display the bounding view window only if the \texttt{nodest} +% option was not taken, and the \cs{ifviewMagWin} is true. +% \begin{macrocode} + \ifKV@fitr@nodest\else\ifviewMagWin + \fitr@length=\fitr@@adddestw bp + \fitr@length=2\fitr@length + \addtolength{\fitr@length}{\fitr@@width}% + \edef\fitr@@width{\the\fitr@length}% + \fitr@length=\fitr@@adddesth bp + \fitr@length=2\fitr@length + \addtolength{\fitr@length}{\fitr@@height}% + \edef\fitr@@height{\the\fitr@length}% + \setlength\fitr@length{-\fitr@@adddestw bp}% + \addtolength\fitr@length{\fitr@@shift}% + \makebox[0pt][l]{\hspace*{\fitr@length}\smash{% + \setlength\fitr@length{\fitr@@lift-\fitr@setBL}% + \if\fitr@@refPt b% + \addtolength\fitr@length{-\fitr@@adddesth bp}\else + \if\fitr@@refPt t% + \addtolength\fitr@length{\fitr@@adddesth bp}% + \fi\fi + \raisebox{\fitr@length}% + {\fbox{\parbox[\fitr@@refPt][\fitr@@height]% + {\fitr@@width}{\kern0pt\hfill\vfill\kern0pt}}}}% + }% + \fi\fi +% \end{macrocode} +% If the user passes content through the optional first parameter, we +% typeset it to the right of the material above (which did not change +% the position of the current point. +% \begin{macrocode} + \if\fitr@@link0\let\fitr@FLB@ction\fitr@OverlayJmpLnk\else + \if\fitr@@link1\let\fitr@FLB@ction\fitr@OverlayRestoreLnk\else + \let\fitr@FLB@ction\relax\let\fitr@bcode\relax\fi\fi + \if\fitr@istar1\gdef\fitr@next{\fitr@FLB@ction{\BOXCONTENT}}\else + \let\fitr@next\relax\fi\fitr@next + \endgroup} +% \end{macrocode} +% The code for the \textbf{\textsf{FitR}} destination. +% \begin{macrocode} +\def\setFitRDest#1#2#3{% + \if@fitr@dvipdfm + \FitRbboxB{#1}{#2}{#3}% + \else + \ifx\fitr@driver\fitr@pdftex@driver + \FitRbboxB{#1}{#2}% +% \end{macrocode} +% We shift the rectangle \texttt{\#1bp} to the left without changing +% the current point. Then use the \textsf{pdftex} primitive \cs{pdfdest}. +% \begin{macrocode} + \makebox[0pt][l]{\hspace*{-#1bp}% + \pdfdest name {#3} fitr + width \fitr@pdftex@view@width\space + height \fitr@pdftex@view@height\space + depth \fitr@pdftex@view@depth\space + }% +% \end{macrocode} +% The \textbf{PostScript} code for the \textbf{\textsf{FitR}} destination, for the +% case of \texttt{dvips} and \texttt{dvipsone}. +% \begin{macrocode} + \else\literalps@out{% + [ /Dest/#3/View [ /FitR \FitRbboxB{#1}{#2} ]/DEST pdfmark}% + \fi\fi +} +% \end{macrocode} +% \paragraph*{Form fields.} The \textsf{eforms} package allows for what is +% called presets. We gather some useful options in one group, and pass them +% all together. \DescribeMacro{\overlayPresets}\cmd{\overlayPresets} sets +% some defaults for the push button that surrounding the content. +% \begin{macrocode} +\newcommand{\overlayPresets}{\H{I}\BG{}\BC{}\S{S}} +% \end{macrocode} +% The \cs{fitr@OverlayJmpBtn} is a \cs{pushButton} that is used internally. +% It calls document JavaScript \texttt{overlayJmpBtnAction()} for a mouse +% up action. +% \begin{macrocode} +\def\fitr@OverlayJmpBtn#1#2{% + \ifx\fitr@allowFX\@empty + \def\allowFXcode{bAllowFX=\allowFXDefault}\else + \def\allowFXcode{bAllowFX=\fitr@allowFX}\fi + \pushButton[\presets{\overlayPresets}\F{-\FPrint}\autoCenter{n} + \A{\JS{\allowFXcode;\r overlayJmpBtnAction(% +event,"\fitr@namedDest","\fitr@namedDest");}}]{\fitr@namedDest}{#1}{#2}} +% \end{macrocode} +% \begin{macrocode} + +\ifHy@colorlinks\def\overlayJmpLnkPresets{}\else + \def\overlayJmpLnkPresets{\Color{\@linkcolor}\W{1}} +\fi +%\def\overlayJmpLnkPresets{\Color{\@linkcolor}\W{1}}\fi +\def\fitr@OverlayJmpLnk#1{\setLink[% + \presets{\overlayJmpLnkPresets} + \A{\JS{overlayJmpLnkAction("\fitr@namedDest");}}]{#1}} +\def\fitr@OverlayRestoreLnk#1{\setLink[% + \presets{\overlayJmpLnkPresets} + \A{\JS{overlayRestoreLnkAction("\fitr@namedDest");}}]{#1}} +% \end{macrocode} +% +% \section{Document JavaScript} +% The document JavaScript for \textsf{fitr}. +% \begin{macrocode} +\begin{insDLJS}[_fitrLoaded]{fitr}{JS for the fitr Package} +var _fitrLoaded=true; +var restoreViewState; +var savedRestore=false; +var aSavedRestore=new Array(); +var bAllowFX=true; +% \end{macrocode} +% This is the function that the hidden overlayed button calls when the +% user clicks on it. +% \begin{macrocode} +function overlayJmpBtnAction(event,fname,dname) { + if (event.shift) shiftRestoreView(fname,dname); + else jumpToDest(fname,dname); +} +function shiftRestoreView(fname,dname) { + var bRestore=restoreView(fname,dname); +% \end{macrocode} +% \DescribeMacro{overlayRestoreHook} is a undefined function that the document +% author can define to create additional code that s/he want executed following +% the restore. +% \begin{macrocode} + if (bAllowFX) + try { overlayRestoreHook(event,bRestore); } catch(e) {} +} +% \end{macrocode} +% When the user clicks on the overlay button, \texttt{overlayJmpBtnAction()} +% calls \texttt{jumpToDest}. The function stores the current state before +% jumping. +% \begin{macrocode} +function jumpToDest(fname,dname) { + if ( typeof aSavedRestore[fname]=="undefined") + aSavedRestore[fname]=[false,{}]; + else { +% \end{macrocode} +% If \texttt{aSavedRestore[fname][0]} is true, that means we have zoomed +% into the expression, but have not zoomed out again. We'll go ahead and zoom out +% by calling \texttt{shiftRestoreView()}, which does just that. +% \begin{macrocode} + if (aSavedRestore[fname][0]) { + shiftRestoreView(fname,dname) +% \end{macrocode} +% When restoring, we return from this call; we don't want to +% jump to the destination, which is executed later. +% \begin{macrocode} + return; + } + } + if (!aSavedRestore[fname][0]){ + aSavedRestore[fname][1]=this.viewState; + aSavedRestore[fname][0]=true; + } +% \end{macrocode} +% Jump to the named destination. +% \begin{macrocode} + this.gotoNamedDest(dname); +% \end{macrocode} +% \DescribeMacro{overlayJmpHook} is a undefined function that the document +% author can define to create additional code that s/he want executed following +% the jump. +% \begin{macrocode} + if (bAllowFX) try { overlayJmpHook(event); } catch(e) {} +} +% \end{macrocode} +% When the user shift-clicks on the overlay button, \texttt{overlayJmpBtnAction()} +% calls \texttt{restoreView}. This function restores the view before the user +% magnified the view. +% \begin{macrocode} +function restoreView(fname,dname) { + if ( typeof aSavedRestore[fname]=="undefined") + aSavedRestore[fname]=[false,{}]; + if ( aSavedRestore[fname][0]){ + this.viewState=aSavedRestore[fname][1]; + aSavedRestore[fname][0]=false; + return true; + } + else return false; +} +% \end{macrocode} +% \texttt{overlayJmpLnkAction()} is used when the \texttt{link=jmp} key-value pair is +% specified. A link does not have a name, so we don't use an array of +% stored view state as we do for push buttons. We use a single variable +% for all links. +% \begin{macrocode} +function overlayJmpLnkAction(dname) { + if (!savedRestore){ + restoreViewState=this.viewState; + savedRestore=true; + } + this.gotoNamedDest(dname); +} +% \end{macrocode} +% \texttt{overlayRestoreLnkAction()} is used when the \texttt{link=restore} key-value pair is +% specified. We restore the previously saved view state. +% \begin{macrocode} +function overlayRestoreLnkAction(dname) { + if (savedRestore){ + this.viewState=restoreViewState; + savedRestore=false; + } +} +\end{insDLJS} +% \end{macrocode} +% \begin{macrocode} +% +% \end{macrocode} +%\Finale +\endinput diff --git a/texmf-dist/source/latex/fitr/fitr.ins b/texmf-dist/source/latex/fitr/fitr.ins new file mode 100644 index 00000000..5fb5a222 --- /dev/null +++ b/texmf-dist/source/latex/fitr/fitr.ins @@ -0,0 +1,61 @@ +%% +%% 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-2012 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{2016/04/04} +\def\batchfile{fitr.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{fitr.sty}{\from{fitr.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/jj-game/designs/design_bahamas.def b/texmf-dist/source/latex/jj-game/designs/design_bahamas.def new file mode 100644 index 00000000..98157e1b --- /dev/null +++ b/texmf-dist/source/latex/jj-game/designs/design_bahamas.def @@ -0,0 +1,72 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% JEOPARDY DESIGNS %% +%% %% +%% The AcroTeX Software Development Team (Copyright 2007) %% +%% %% +%% The Bahamas Color Scheme %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Diverse Color Definitions + +\definecolor{APBdarkgreen}{rgb}{0.00,0.33,0.28} +\definecolor{jj_banner_bg}{named}{APBdarkgreen} +\definecolor{jj_banner_txt}{named}{white} +\definecolor{jj_bg}{named}{OliveGreen} +\DeclareColors +{ + fillCells: lightgray, + fillBanner: jj_banner_bg, + textBanner: jj_banner_txt, + textBoard: jj_banner_txt, + fillInstructions: jj_bg, + fillGameBoard: jj_bg, + fillQuestions: jj_bg, + linkColor: Turquoise, + dollarColor: Turquoise, +} + +\APDollar +{ + Font: Helv, + TextColor: 0 0 0, % color of text for the gameboard cells + BorderColor: 0 0 0, % color of border for the gameboard cells + FillColor: .55 0.98 0.2, % the fill color for the gameboard cells +} + +\APHidden +{ + Font: Helv, + TextColor: 0 0 1, + BorderColor: 0 0 0, + FillColor: 0 1 0, +} + +\APRight +{ + Font: Helv, + TextColor: .996 .133 .133, +} + +\APWrong +{ + Font: Helv, + TextColor: 0 0 0, +} + +\APScore +{ + Font: Arial, + CellWidth: 2.25in, + FillColor: .827 .827 .827, +} + +% ------------------- graphical backgrounds ------------------------ +\jjgdesigngraphics +\defineInstructionPageGraphic{jjg_bg_3} +\defineGameboardPageGraphic{jjg_bg_3} +\defineQuestionPagesGraphic{} + diff --git a/texmf-dist/source/latex/jj-game/designs/design_florida.def b/texmf-dist/source/latex/jj-game/designs/design_florida.def new file mode 100644 index 00000000..0e3c1fc8 --- /dev/null +++ b/texmf-dist/source/latex/jj-game/designs/design_florida.def @@ -0,0 +1,60 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% JEOPARDY DESIGNS %% +%% %% +%% The AcroTeX Software Development Team (Copyright 2007) %% +%% %% +%% The FLORIDA Color Scheme %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Diverse Color Definitions + +\definecolor{jj_banner_bg}{named}{PineGreen} +\definecolor{jj_banner_txt}{named}{Yellow} + +\DeclareColors +{ + fillCells: lightgray, + fillBanner: jj_banner_bg, + textBanner: jj_banner_txt, + textBoard: jj_banner_txt, + fillInstructions: cornsilk, + fillGameBoard: cornsilk, + fillQuestions: cornsilk, +} + +\APDollar +{ + Font: Helv, + TextColor: 0.9 .8 .9, % color of text for the gameboard cells + BorderColor: 0.2 0.2 0.2, % color of border for the gameboard cells + FillColor: .25 0.51 .31 % the fill color for the gameboard cells +} +\APHidden +{ + Font: Helv, + TextColor: 0 0 1, + BorderColor: 0 0 0, + FillColor: .827 .827 .827 +} +\APRight +{ + Font: Helv, + TextColor: .996 .133 .133 +} + +\APWrong +{ + Font: Helv, + TextColor: .286 .533 .433 +} + +\APScore +{ + Font: Arial, + CellWidth: 2.25in, + FillColor: .827 .827 .827 +} diff --git a/texmf-dist/source/latex/jj-game/designs/design_germany.def b/texmf-dist/source/latex/jj-game/designs/design_germany.def new file mode 100644 index 00000000..2e8e5f7d --- /dev/null +++ b/texmf-dist/source/latex/jj-game/designs/design_germany.def @@ -0,0 +1,72 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% JEOPARDY DESIGNS %% +%% %% +%% The AcroTeX Software Development Team (Copyright 2007) %% +%% %% +%% The Germany Color Scheme %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Diverse Color Definitions + +\definecolor{APBdarkred}{rgb}{0.73,0.00,0.00} +\definecolor{APBdarkgray}{rgb}{0.35,0.36,0.44} + +\definecolor{jj_banner_bg}{named}{APBdarkred} +\definecolor{jj_banner_txt}{named}{white} +\definecolor{jj_bg}{named}{Yellow} + +\definecolor{APBdarkred}{rgb}{0.73,0.00,0.00} +\definecolor{APBdarkgray}{rgb}{0.35,0.36,0.44} + +\DeclareColors +{ + fillCells: APBdarkgray, + fillBanner: APBdarkred, + textBanner: jj_banner_txt, + textBoard: jj_banner_txt, + fillInstructions: jj_bg, + fillGameBoard: jj_bg, + fillQuestions: jj_bg, + linkColor: APBdarkred, + dollarColor: APBdarkred, +} + +\APDollar +{ + Font: Helv, + TextColor: 0 0 0, % color of text for the gameboard cells + BorderColor: 0 0 0, % color of border for the gameboard cells + FillColor: 0.97 0.65 0.00, % the fill color for the gameboard cells +} + +\APHidden +{ + Font: Helv, + TextColor: 0 0 1, + BorderColor: 0 0 0, + FillColor: 0 1 0, +} + +\APRight +{ + Font: Helv, + TextColor: .996 .133 .133, + FillColor: 0 1 0, +} + +\APWrong +{ + Font: Helv, + TextColor: 0 0 0, +} + +\APScore +{ + Font: Arial, + CellWidth: 2.25in, +} + diff --git a/texmf-dist/source/latex/jj-game/designs/design_hornet.def b/texmf-dist/source/latex/jj-game/designs/design_hornet.def new file mode 100644 index 00000000..edb03c48 --- /dev/null +++ b/texmf-dist/source/latex/jj-game/designs/design_hornet.def @@ -0,0 +1,63 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% JEOPARDY DESIGNS %% +%% %% +%% The AcroTeX Software Development Team (Copyright 2007) %% +%% %% +%% The HORNET Color Scheme %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\definecolor{jj_banner_bg}{named}{Yellow} +\definecolor{jj_banner_txt}{named}{black} +\definecolor{jj_bg}{rgb}{0.922, 0.973, 0.98} + +\DeclareColors +{ + fillCells: SkyBlue, + fillBanner: jj_banner_bg, + textBanner: jj_banner_txt, + textBoard: jj_banner_txt, + fillInstructions: jj_bg, + fillGameBoard: jj_bg, + fillQuestions: jj_bg, + linkColor: red, + dollarColor: red, +} + +\APDollar +{ + Font: Helv, + TextColor: 0 0 0, % color of text for the gameboard cells + BorderColor: 0 0 0, % color of border for the gameboard cells + FillColor: .235 0.718 .149, % the fill color for the gameboard cells +} + +\APHidden +{ + Font: Helv, + TextColor: 0 0 1, + BorderColor: 0 0 0, + FillColor: 0 1 0, +} + +\APRight +{ + Font: Helv, + TextColor: .996 .133 .133, +} + +\APWrong +{ + Font: Helv, + TextColor: 0 0 0, +} + +\APScore +{ + Font: Arial, + CellWidth: 2.25in, + FillColor: .827 .827 .827, +} diff --git a/texmf-dist/source/latex/jj-game/designs/design_iceland.def b/texmf-dist/source/latex/jj-game/designs/design_iceland.def new file mode 100644 index 00000000..9873d7e0 --- /dev/null +++ b/texmf-dist/source/latex/jj-game/designs/design_iceland.def @@ -0,0 +1,72 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% JEOPARDY DESIGNS %% +%% %% +%% The AcroTeX Software Development Team (Copyright 2007) %% +%% %% +%% The ICELAND Color Scheme %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\definecolor{jj_banner_bg}{named}{ProcessBlue} +\definecolor{jj_banner_txt}{named}{white} +\definecolor{jj_bg}{named}{lightgray} + + +\DeclareColors +{ + fillCells: SkyBlue, + fillBanner: ProcessBlue, + textBanner: jj_banner_txt, + textBoard: jj_banner_txt, + fillInstructions: jj_bg, + fillGameBoard: jj_bg, + fillQuestions: jj_bg, + linkColor: webblue, + dollarColor: webblue, +} + +\APDollar +{ + Font: Helv, + Size: 20, + TextColor: 0.95 .95 .95, % color of text for the gameboard cells + BorderColor: 0.2 0.2 0.2, % color of border for the gameboard cells + FillColor: .204 0.671 .753, % the fill color for the gameboard cells +} + +\APHidden +{ + Font: Helv, + TextColor: 0 0 1, + BorderColor: 0 0 0, +} + +\APRight +{ + Font: Helv, + TextColor: .996 .133 .133, +} + +\APWrong +{ + Font: Helv, + TextColor: .286 .533 .433, +} + +\APScore +{ + Font: Arial, + CellWidth: 2.25in, + FillColor: .827 .827 .827, +} + +% ------------------- graphical backgrounds ------------------------ +\jjgdesigngraphics +\defineInstructionPageGraphic{jjg_bg_2} +\defineGameboardPageGraphic{jjg_bg_2} +\defineQuestionPagesGraphic{} + + diff --git a/texmf-dist/source/latex/jj-game/designs/design_jeopardy.def b/texmf-dist/source/latex/jj-game/designs/design_jeopardy.def new file mode 100644 index 00000000..7e0dad4e --- /dev/null +++ b/texmf-dist/source/latex/jj-game/designs/design_jeopardy.def @@ -0,0 +1,82 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% JEOPARDY DESIGNS %% +%% %% +%% The AcroTeX Software Development Team (Copyright 2007) %% +%% %% +%% The JEOPARDY Color Scheme %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% Diverse Color Definitions + +\definecolor{jj_bg}{rgb}{0.92,0.67,0.1} +\definecolor{jj_banner_bg}{rgb}{0.067,0.325,0.62} +\definecolor{jj_banner_txt}{rgb}{0.92,0.67,0.1} +\definecolor{jj_instr_blue}{rgb}{0.1,0.48,0.922} +\definecolor{jj_instr_red}{rgb}{0.96,0.38,0.1} +\definecolor{jj_instr_author}{rgb}{0.38,0.38,0.38} + +\definecolor{jj_gb_title_bg}{rgb}{0.067,0.325,0.62} +\definecolor{jj_gb_title_txt}{rgb}{0.92,0.67,0.1} +\definecolor{jj_gb_cell_bg}{rgb}{0.1,0.48,0.922} +\definecolor{jj_gb_cell_bg_hidden}{rgb}{0.92,0.67,0.1} +\definecolor{jj_gb_cell_txt}{rgb}{0,0,0} +\definecolor{jj_gb_cell_txt_right}{rgb}{0.62,0.55,0.067} +\definecolor{jj_gb_cell_txt_wrong}{rgb}{0.96,0.38,0.12} +\definecolor{jj_gb_score_bg}{rgb}{0.87,0.87,0.87} + + +\DeclareColors +{ + fillCells: lightgray, + fillBanner: jj_banner_bg, + textBanner: jj_banner_txt, + textBoard: jj_banner_txt, + fillInstructions: jj_bg, + fillGameBoard: jj_bg, + fillQuestions: jj_bg, + dollarColor: red, + linkColor: red, +} + + +\APDollar +{ + Font: Helv, + TextColor: 0 0 0, % color of text for the gameboard cells + BorderColor: 0 0 0, % color of border for the gameboard cells + FillColor: 0.1 0.48 0.922 % the fill color for the gameboard cells +} +\APHidden +{ + Font: Helv, + TextColor: 0 0 0, + BorderColor: 0 0 0, + FillColor: 0.92 0.67 0.1 +} +\APRight +{ + Font: Helv, + TextColor: 0.62 0.55 0.067 +} +\APWrong +{ + Font: Helv, + TextColor: 0.96 0.38 0.12 +} +\APScore +{ + Font: Arial, + CellWidth: 2.25in, + FillColor: .87 .87 .87 +} + +% ------------------- graphical backgrounds ------------------------ +\jjgdesigngraphics +\defineInstructionPageGraphic{jeopardy_bg} +\defineGameboardPageGraphic{jeopardy_bg} +\defineQuestionPagesGraphic{} diff --git a/texmf-dist/source/latex/jj-game/designs/design_norway.def b/texmf-dist/source/latex/jj-game/designs/design_norway.def new file mode 100644 index 00000000..6cb1b6a3 --- /dev/null +++ b/texmf-dist/source/latex/jj-game/designs/design_norway.def @@ -0,0 +1,70 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% JEOPARDY DESIGNS %% +%% %% +%% The AcroTeX Software Development Team (Copyright 2007) %% +%% %% +%% The Norway Color Scheme %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Diverse Color Definitions + +\definecolor{jj_banner_bg}{named}{Blue} +\definecolor{jj_banner_txt}{named}{white} +\definecolor{jj_bg}{named}{Emerald} + +\DeclareColors +{ + fillCells: lightgray, + fillBanner: jj_banner_bg, + textBanner: jj_banner_txt, + textBoard: jj_banner_txt, + fillInstructions: jj_bg, + fillGameBoard: jj_bg, + fillQuestions: jj_bg, + linkColor: webblue, + dollarColor: webblue, +} + +\APDollar +{ + Font: Helv, + TextColor: 1 1 1, % color of text for the gameboard cells + BorderColor: 0 0 0, % color of border for the gameboard cells + FillColor: .25 0.38 .77, % the fill color for the gameboard cells +} + +\APHidden +{ + Font: Helv, + BorderColor: 0 0 0, + FillColor: 0 1 0, +} + +\APRight +{ + Font: Helv, + TextColor: .996 .133 .133, +} + +\APWrong +{ + Font: Helv, + TextColor: 0 0 0, +} + +\APScore +{ + Font: Arial, + CellWidth: 2.25in, + FillColor: .827 .827 .827, +} + +% ------------------- graphical backgrounds ------------------------ +\jjgdesigngraphics +\defineInstructionPageGraphic{jjg_bg_4} +\defineGameboardPageGraphic{jjg_bg_4} +\defineQuestionPagesGraphic{} diff --git a/texmf-dist/source/latex/jj-game/designs/design_qatar.def b/texmf-dist/source/latex/jj-game/designs/design_qatar.def new file mode 100644 index 00000000..7f3e9e96 --- /dev/null +++ b/texmf-dist/source/latex/jj-game/designs/design_qatar.def @@ -0,0 +1,70 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% JEOPARDY DESIGNS %% +%% %% +%% The AcroTeX Software Development Team (Copyright 2007) %% +%% %% +%% The Qatar Color Scheme %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Diverse Color Definitions + +\definecolor{qatar_moccasin}{rgb}{1,0.894,0.71} +\definecolor{qatar_golden}{rgb}{0.98,0.98,0.824} +\definecolor{qatar_blue}{rgb}{0.098,0.098,0.439} + +\definecolor{jj_banner_bg}{named}{Maroon} +\definecolor{jj_banner_txt}{named}{white} + +\DeclareColors +{ + fillCells: lightgray, + fillBanner: jj_banner_bg, + textBanner: jj_banner_txt, + textBoard: qatar_golden, + fillInstructions: qatar_moccasin, + fillGameBoard: qatar_golden, + fillQuestions: qatar_moccasin, + linkColor: qatar_blue, + dollarColor: qatar_blue, +} + +\APDollar +{ + Font: Helv, + TextColor: 0 0 0, % color of text for the gameboard cells + BorderColor: 0 0 0, % color of border for the gameboard cells + FillColor: 1 0.894 0.71, % the fill color for the gameboard cells +} + + +\APHidden +{ + Font: Helv, + TextColor: 0 0 1, + BorderColor: 0 0 0, + FillColor: 0 1 0, +} + +\APRight +{ + Font: Helv, + TextColor: 0.682 0.341 0, +} + +\APWrong +{ + Font: Helv, + TextColor: 0 0 0, +} + +\APScore +{ + Font: Helv, + CellWidth: 2.25in, + FillColor: .827 .827 .827, +} + diff --git a/texmf-dist/source/latex/jj-game/designs/design_spain.def b/texmf-dist/source/latex/jj-game/designs/design_spain.def new file mode 100644 index 00000000..e90dfa7c --- /dev/null +++ b/texmf-dist/source/latex/jj-game/designs/design_spain.def @@ -0,0 +1,72 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% JEOPARDY DESIGNS %% +%% %% +%% The AcroTeX Software Development Team (Copyright 2007) %% +%% %% +%% The SPAIN Color Scheme %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\definecolor{jj_banner_bg}{named}{Green} +\definecolor{jj_banner_txt}{named}{white} +\definecolor{jj_bg}{named}{GreenYellow} + + +\DeclareColors +{ + fillCells: lightgray, + fillBanner: jj_banner_bg, + textBanner: jj_banner_txt, + textBoard: jj_banner_txt, + fillInstructions: jj_bg, + fillGameBoard: jj_bg, + fillQuestions: jj_bg, + linkColor: Green, + dollarColor: Green, +} + +\APDollar +{ + Font: Helv, + Size: 20, + TextColor: 0 0 0, % color of text for the gameboard cells + BorderColor: 0 0 0, % color of border for the gameboard cells + FillColor: .465 0.818 .049, % the fill color for the gameboard cells +} + +\APHidden +{ + Font: Helv, + Champion: You are FuncTerrific!, + Size: 20, + TextColor: 0 0 1, + BorderColor: 0 0 0, + FillColor: 0 1 0, +} + +\APRight +{ + Font: Helv, + Size: 20, + TextColor: .996 .133 .133, +} + +\APWrong +{ + Font: Helv, + Size: 20, + TextColor: 0 0 0, +} + +\APScore +{ + Font: Arial, + Size: 20, + CellWidth: 2.25in, + Score: "Score: ", + FillColor: .827 .827 .827, +} + diff --git a/texmf-dist/source/latex/jj-game/doc/jjg_man.tex b/texmf-dist/source/latex/jj-game/doc/jjg_man.tex new file mode 100644 index 00000000..923921ec --- /dev/null +++ b/texmf-dist/source/latex/jj-game/doc/jjg_man.tex @@ -0,0 +1,1332 @@ +% makeindex < aebpro_man.idx > aebpro_man.ind + +\documentclass{article} +\usepackage{amsmath} +\usepackage[ + web={centertitlepage,designv,forcolorpaper,tight*,latextoc,pro}, + eforms, +% linktoattachments, +% attachments={../aeb_pro.dtx}, +% uselayers, + aebxmp +]{aeb_pro} +\usepackage{aeb_mlink} +\usepackage{graphicx,array,subfigure} +%\usepackage{myriadpro} +\usepackage[altbullet]{lucidbry} +\usepackage{pstricks,pstricks-add} +\usepackage{pst-node} + +%\usepackage{makeidx} +%\makeindex + +\usepackage{acroman} +\usepackage[active]{srcltx} + +\def\pstnodescale{72 72.27 div dup scale }% + +% \usepackage[active]{srcltx} + +\urlstyle{rm} + +\def\tutpath{doc/tutorial} +\def\tutpathi{tutorial} +\def\expath{../examples} + +\DeclareDocInfo +{ + university={\AcroTeX.Net}, + title={JJ\_Game Class}, + author={D. P. Story}, + email={dpstory@acrotex.net}, + subject={How to create Jeopardy-like game boards}, + talksite={\url{www.acrotex.net}}, + version={v3.1, 2016/11/24}, + keywords={Jeopardy, LaTeX, games}, + copyrightStatus=True, + copyrightNotice={Copyright (C) \the\year, D. P. Story}, + copyrightInfoURL={http://www.acrotex.net} +} +\nocopyright + +\def\dps{$\hbox{$\mathfrak D$\kern-.3em\hbox{$\mathfrak P$}% + \kern-.6em \hbox{$\mathcal S$}}$} + +\universityLayout{fontsize=Large,fontfamily=sffamily} +\titleLayout{fontsize=LARGE,fontfamily=sffamily} +\authorLayout{fontsize=Large,fontfamily=sffamily} +\tocLayout{fontsize=Large,color=aeb,fontfamily=sffamily} +\sectionLayout{indent=-62.5pt,fontsize=large,color=aeb} +\subsectionLayout{indent=-31.25pt,color=aeb,fontfamily=sffamily} +\subsubsectionLayout{indent=0pt,color=aeb,fontfamily=sffamily} +\subsubDefaultDing{\texorpdfstring{$\bullet$}{\textrm\textbullet}} + +%\pagestyle{empty} + +\makeatletter +\newcommand{\jjgCng}{\@ifstar{\@jjgCng}{\@jjgCng}}% +\newcommand{\@jjgCng}[1][]{\@gobbletwo} +%\newcommand{\jjgCng}{\@ifstar{\def\jjg@checked{*}\@jjgCng}{\def\jjg@checked{x}\@jjgCng}}% +%\newcommand{\@jjgCng}[1][]{% +% \if\jjg@checked*\def\jjg@marker{\textcolor{blue}{jjg 3.0}~\textcolor{red}{\ding{052}}\goodbreak}\else +% \def\jjg@marker{\textcolor{red}{jjg 3.0}}\fi +% \def\argi{#1}\ifx\argi\@empty +% \marginpar{\scriptsize\jjg@marker}% +% \else\marginpar{\scriptsize\jjg@marker\goodbreak\raggedright#1}\fi} +\makeatother + +\chngDocObjectTo{\newDO}{doc} +\begin{docassembly} +var titleOfManual="The JJ_Game Manual"; +var manualfilename="Manual_BG_Print_jjg.pdf"; +var manualtemplate="Manual_BG_Brown.pdf"; // Blue, Green, Brown +var _pathToBlank="C:/Users/Public/Documents/ManualBGs/"+manualtemplate; +var doc; +var buildIt=false; +if ( buildIt ) { + console.println("Creating new " + manualfilename + " file."); + doc = \appopenDoc({cPath: _pathToBlank, bHidden: true}); + var _path=this.path; + var pos=_path.lastIndexOf("/"); + _path=_path.substring(0,pos)+"/"+manualfilename; + \docSaveAs\newDO ({ cPath: _path }); + doc.closeDoc(); + doc = \appopenDoc({cPath: manualfilename, oDoc:this, bHidden: true}); + f=doc.getField("ManualTitle"); + f.value=titleOfManual; + doc.flattenPages(); + \docSaveAs\newDO({ cPath: manualfilename }); + doc.closeDoc(); +} else { + console.println("Using the current "+manualfilename+" file."); +} +var _path=this.path; +var pos=_path.lastIndexOf("/"); +_path=_path.substring(0,pos)+"/"+manualfilename; +\addWatermarkFromFile({ + bOnTop:false, + bOnPrint:false, + cDIPath:_path +}); +\executeSave(); +\end{docassembly} +%\def\bUrl{http://www.math.uakron.edu/~dpstory} +% +%\hypersetup{linktocpage} +% +%\makeatletter +%\let\web@copyright=\@gobble +%\makeatother +% +% +%%\makeatletter +%%\renewcommand{\@oddhead}{\normalfont\small\ifodd\c@page\rightmark\hfil\web@rightheader\else\hfil\fi} +%%\makeatother +% +\renewcommand\redpoint{\par\ifdim\lastskip>0pt\relax\vskip-\lastskip\fi +\vskip\medskipamount\noindent + \makebox[0pt][r]{\makebox[20pt][l]{\large\color{red}$\blacktriangleright$}}} + +\newcommand\bluepoint{\par\ifdim\lastskip>0pt\relax\vskip-\lastskip\fi +\vskip\medskipamount\noindent + \makebox[0pt][r]{\makebox[20pt][l]{\large\color{blue}\ding{42}}}} + +\newcommand{\NO}[1]{% +\pscircle(0,0){9pt} +\rput(0,0){#1} +} + +\def\cS#1#2{\textField[\Ff\FfReadOnly\textSize{10}\textFont{Arial}\uDV{FEFF#2}\uV{FEFF#2}\BC{}]{#1}{20bp}{11bp}} + +% +%\newcommand{\cs}[1]{\texttt{\char`\\#1}} +%\def\Y&Y{Y\kern-.2em{\footnotesize\&}\kern-.2emY} +%\def\parss{\par\smallskip} +%\def\dps{$\mbox{$\mathfrak D$\kern-.3em\mbox{$\mathfrak P$}% +% \kern-.6em \hbox{$\mathcal S$}}$} +% +% +% +\frenchspacing + +\def\jj{\textsf{jj\_game}} + +\begin{document} + + +\maketitle + +\changelinkcolorto{black} +\tableofcontents +\changelinkcolorto{webgreen} + +\section{Introduction} + +The ``\textcolor{red}JavaScript \textcolor{red}Jeopardy +\textcolor{red}Game'', a.k.a., \jj\ (\url{http://ctan.org/pkg/jj-game}), is a \LaTeX{} class file that +can be used to construct a Jeopardy-like game board and the +accompanying answers and questions. The \jj{} is capable of +constructing a game board for an arbitrary number of categories and +an arbitrary number of questions per category. + +There are options for users of \textsf{dvipsone} (from the now defunct \Y&Y), +\textsf{dvips}, \textsf{pdflatex}, \textsf{lualatex}, or \textsf{xelatex} to build a Jeopardy game. + +A Jeopardy game, as constructed by {\jj}, consists of three parts: the instructions, +the game board and the question pages. See figures~1, 2 and 3 below. + +\begin{figure}[ht] +\centering +\hskip-62.5pt +\begin{minipage}{\linewidth+62.5pt} +\parbox{.3\linewidth}{\includegraphics[width=\linewidth]{jj_instructions1} +\caption{Instructions Page}\label{fig:instrPage}}\hfill +\parbox{.3\linewidth}{\includegraphics[width=\linewidth]{jj_gameboard1} +\caption{Game Board Page}\label{fig:gameboard}}\hfill +\parbox{.3\linewidth}{\includegraphics[width=\linewidth]{jj_questions1} +\caption{Question Page}\label{fig:questions}} +\end{minipage} +\end{figure} + +Corresponding to each of these pages are environments and commands +that allow you create content for your Jeopardy quiz game and to designate the +color scheme to be used. + +After reading your detailed instructions, the contestant arrives at +the game board page. The contestant chooses a category and a +question in that category (``I'll take `Candles and Wicks' for +200''). When the contestant clicks on the cell, the game jumps to +the question page (``Which end of the candle do you light? What +is\dots''\footnote{The author is making a vague and rather poor play +on words with Wiccan. pooh.}) corresponding to that choice and a +question is posed. + +A question can be multiple choice, math fill-in or text fill-in. In +the case of the fill-in type questions, the \pkg{exerquiz} package is +needed. After the contestant answers the question, the game returns +to the game board page, and the score is updated. + +Should the contestant reach the goal set by the \texttt{Goal} +property of the \cs{GameDesign} command, when the contestant has +finished answering all questions, a hidden field under that banner +of the game board appears with a short message, as defined by the +\texttt{Champion} property of \cs{GameDesign} command. + +There is no reset button, so if you want to play again, just close the game, +and reopen it. Do not save the game before it closes, this will save the form +data and when you open it again, the initial state of the game will not be +restored. + +You should be aware of the following features, which are meant to +discourage contestants from looking at the questions by paging +through the PDF or attempting to edit earlier responses. +\begin{itemize} +\item When a question page is opened, the cell in the + game board that corresponds to that page is blanked out. When + the contestant returns to the game board, that cell is no longer + clickable, hence, the contestant cannot legally answer that + question. When a contestant is on a question page illegally, a + nasty message appears in an alert box if the contestant answers + the question on that page. +\item If the contestant answers the question legally, then later returns + to that same question page and tries to edit the question + (perhaps because it was missed earlier), a (less than nasty) + message appears saying that you cannot change your answer. +\end{itemize} + +I do hope there will be people out in Cyberland who will use {\jj} +and construct some interesting games for us to enjoy. + +\medskip\noindent +Now, I simply must get back to my retirement. \dps + +\section{Preliminaries} + +%\subsection{Unpackaging the Class}\label{unpack} + +%Several modern {\TeX} systems download package and install them with little or no pain; this +%is the easiest way to do it. You can find the {\jj} package at + +%To unpack the \texttt{jj\_game.dtx}, `\texttt{latex}' the installation +%file \texttt{jj\_game.ins}. If you use \textsf{Acrobat 5.0}, open the file +%\texttt{jj\_game.ins} in your favorite editor and change the line +%\begin{Verbatim} +%\def\AcrobatOption{Acrobativ} % Acrobativ or Acrobatv +%\end{Verbatim} +%to +%\begin{Verbatim} +%\def\AcrobatOption{Acrobatv} % Acrobativ or Acrobatv +%\end{Verbatim} +%then do a `\texttt{latex jj\_game.ins}'. +% +%When you distill with the \textsf{Acrobat Distiller~5.0}, the +%document level JavaScripts needed to operate this game are +%automatically inserted when the game is opened in \textsf{Acrobat} +%for the first time. See the section \Nameref{s:buildgame} for +%more details. + +\subsection{Requirements} + +The new {\jj} class now uses many of the standard package files from AeB +(\cAcroEB); in particular, the AeB components used are \pkg{web}, +\pkg{insdljs} and \pkg{eforms}. The \pkg{exerquiz} package can optionally +be used as well to pose math and text fill-in questions. Therefore, AeB should already be installed +(\url{http://ctan.org/pkg/acrotex}). + + +The {\jj} class usse the very fine package \texttt{xkeyval} (2006/11/18 +v2.5f or later),\footnote{Located at +CTAN:/tex-archive/macros/latex/contrib/xkeyval}, and the equally nice package +\texttt{xcolor} (2005/11/25 v2.08 or +later),\footnote{CTAN:/tex-archive/macros/latex/contrib/xcolor} if available +on the system. The \texttt{comment} package is also used.\footnote{CTAN: +/tex-archive/macros/latex/contrib/comment} The \pkg{graphicx} package is needed if +you wish to insert graphical backgrounds. + +\newtopic\noindent +Requirements based on driver applications: +\begin{itemize} + +\item \app{pdflatex}, \app{lualatex}, and \app{xelatex}: {\jj} class works + with these two applications that that write a document in PDF. Some of + the features---the \texttt{forcredit} and \texttt{pro} options---of + {\jj} are not available to these applications. + +\item \app{dvips} and \app{dvipsone}: In these two cases, it is assumed that PDF is +creating \app{Acrobat Distiller}, not \app{Ghostscript}; in this case, the +\texttt{forcredit} option (see `\mlnameref{forcreditOption}', +page~\pageref*{forcreditOption}) is available. If the document author has +Acrobat 7.0 Pro (or later), the \texttt{pro} option (see +`\nameref{proOption}', page~\pageref*{proOption}) can be used as +well. + +\end{itemize} +Once the game is built, Adobe Reader 5.0 or later is sufficient to +enjoy the wonderfulness of the time-consuming pass time that is +Jeopardy. If the document author used the \texttt{pro} option, Adobe +Reader 7.0 or later is required. + + +\subsection{Listing of Sample Files} + +The sample files are good templates for designing your own game: +\begin{itemize} + \item \texttt{jjg\_test.tex}: The original demo file from the first version + of this class. + \item \texttt{jg\_ca.tex}: A Jeopardy quiz game constructed for and distributed + to a College Algebra class for extra credit. + \item \texttt{jjg\_custom.tex}: An example of a custom design. + \item \texttt{pro/jjg\_pro\_ca.tex}: Same as \texttt{jg\_ca.tex} but uses the \pkg{aeb\_pro} + package (with layers) with the \texttt{forcredit} option of \jj. (\app{dvips}/\penalty0\app{Distiller} workflow required) +\end{itemize} +The first three files can be successfully build with +\app{dvips}/\penalty0\app{Distiller}, \app{pdflatex}, \app{lualatex}, and \app{xelatex}. + + +\section{Options} + +The options of this class are listed below. In some cases, you are referred to +other sections of this manual for further details. +\begin{itemize} +\item Driver Options: {\jj} recognizes four drivers. Choose only one. +\begin{itemize} +\item \texttt{dvips}: The dvi-to-ps converter that comes with many \TeX\ + systems. The Adobe Acrobat Distiller must be used to convert from + Postscript to PDF. + +\item \texttt{dvipsone}: The dvi-to-ps converter by \Y&Y.\footnote{Now + out of business, but this author still uses it.} In this case, the + Adobe Acrobat Distiller must be used to convert from Postscript to + PDF. + +\item \texttt{pdftex}: The tex-to-pdf converter. The distiller is not + needed in this case. + +\item \texttt{luatex}: The tex-to-pdf converter. The distiller is not + needed in this case. + +\item \texttt{xetex}: The tex-to-pdf converter. The distiller is not + needed in this case. + +\item \texttt{dvipdfm} and \texttt{dvipdfmx}: Less used dvi-to-pdf + converters. The distiller is not needed in this case. +\end{itemize} +In the cases of \texttt{pdftex}, \texttt{luatex}, and \texttt{xetex}, \pkg{\jj} performs automatic driver detection +so none of these need to be actually specified in the option list of \pkg{\jj}. If you use +the \texttt{dvips} driver, specify it in the \texttt{jj\_game.cfg} file, as explained on the next page. + +%\item \verb+\documentclass[dvips,foils]{jj_game}+\\ This class seems to +%work well with \jj. There is a switch, \verb+\iffoils+, that you +%can use if you want to switch between a formatting that does not +%use \texttt{foils}, and \texttt{foils}. + +\item \texttt{debug}: In the developmental stage, you can use the +\texttt{debug} option that will give you more information in the log +about what is going on. + +\item \texttt{double}: The face values of all cells are doubled. +(Double JavaScript Jeopardy!) Use it if you have time, energy and motivation +to write two Jeopardy games. + +\item \texttt{final}: After you have completed your +{\jj}, you can, optionally, build it one more time with +the \texttt{final} option. This option removes the menu, the +toolbar, the GUI interface of the Acrobat Viewer; all that is left +is your game. + + +\item \texttt{pro}: The \texttt{pro} option is available only with +the \texttt{dvips} or \texttt{dvipsone} driver. You are required to +use the AeB Pro package. This package requires that you use Acrobat +7.0 Pro (or later) and to create you PDF using Acrobat Distiller. +For the pro option, the questions are placed in OCGs (optional +content groups, or simply layers). See `\nameref{proOption}' on +page~\pageref*{proOption}. + +\item \texttt{forcredit}: This option brings in some security measures +that helps the instructor set up a Jeopardy game that can be used +for (extra) credit in the classroom. See the section titled +\nameref{forcreditOption} on page~\pageref*{forcreditOption}. + +\item \texttt{design=\ameta{design\_name}}: There are a limited number of +predefined designs. The values of the design parameter are +\texttt{jeopardy}, \texttt{florida}, \texttt{iceland}, +\texttt{hornet}, \texttt{qatar}, \texttt{norway}, \texttt{bahamas}, +and \texttt{spain}. These are in addition to the default color design scheme. + +\item \texttt{nodesigngraphics}: Some of the designs specified by +the \texttt{design} option have graphical backgrounds. To use a +specific design without the designed graphical background, use the +\texttt{nodesigngraphics}. In the preamble, you can optionally +specify your own graphical background using the graphical background +insert commands, see \Nameref{graphicsBGs}. + +\item \texttt{lang=\ameta{\upshape{english|german}}}: The Jeopardy game has some +language strings, most notably, the semi-humorous messages that +appear after the player responds to one of the questions. The +\texttt{lang} option allows these common strings to appear in +\texttt{german}. The default is \texttt{english}. When the \texttt{german} +option is in effect, a crude euro symbol is typeset instead of the +dollar, and the euro symbol is used in the score board as well. + +\item \texttt{allowpeeking}: The normal behavior of the game is that +if the contestant looks ahead at a question, then the tile on the +game board corresponding to the question viewed is hidden. The +contestant is not allowed to answer that question. Use this switch +to remove this feature of the game. + +\item \texttt{twoplayer}: At the request of a user, I've created a \texttt{twoplayer} option; +useful for classroom participation. See \Nameref{tpj} for details. + +\end{itemize} + +\newtopic\noindent +An example of usage of some of these options is +\begin{Verbatim}[xleftmargin=\amtIndent] +\documentclass[dvips,forcredit,lang=german, + design=florida]{jj_game} +\end{Verbatim} +You can also set your favorite driver as the default. Edit the file +\texttt{\jj.cfg} that comes with the distribution and place in it, for +example, the command +\begin{Verbatim}[xleftmargin=\amtIndent] +\ExecuteOptions{dvips} +\end{Verbatim} +\noindent(This sets \textsf{dvips} as the default driver.) In this case +the above example becomes +\begin{Verbatim}[xleftmargin=\amtIndent] +\documentclass[forcredit,lang=german,design=florida]{jj_game} +\end{Verbatim} +Specifying a driver as an optional parameter in the +\cs{documentclass} declaration will override whatever default set in +the \texttt{\jj.cfg} file. + +%\newtopic\noindent +%\textbf{\textcolor{red}{Option Removed:}} Previous versions (prior +%to version 3.0) of {\jj} class had a \texttt{foils} option. As far +%as I know, no one used this option, so I am removing it. + +% Changes +% Removed support for foils +% Now uses web package, with templates +% eforms, comment + + + +\section{Designing the Game and Posing the Questions} + +The following sections outline the design of the game. If you +don't specify a particular part of the design of the game, then a +default value will be substituted. + +The sample file \texttt{jj\_test.tex} represents a prototype game +that you can modify. + +\subsection{Stuff for the Preamble} + +There is potentially a lot of stuff that goes into the design of the +game. Again, all have default values, but there are some required +design parameters. + +\subsubsection{Banners and Backgrounds} + +Throughout the document, there are many colors living in {\LaTeX} space +that are under the control of the document author. Most all colors +can be set through the argument of the \cs{DeclareColors} command. + +\redpoint \cs{DeclareColors}: The argument of \cs{DeclareColors} +consist of key-value pairs. These key-values are in the JavaScript +style, key and value are separated by `\verb*!: !', the space is +required to follow the colon. The key references some color aspect +of the game, the value is named color. A color of +\texttt{transparent} is also recognized. The following is a +\cs{DeclareColors} structure listing all possible keys, with some +named color values.{\small +\begin{Verbatim} +\DeclareColors +{ + fillCells: lightgray, % background for cells + fillBanner: PineGreen, % color of banner + textBanner: Yellow, % color of text in banner + textBoard: Yellow, % color of text in categories on game board + fillInstructions: cornsilk, % background of the instructions page(s) + fillGameBoard: cornsilk, % background of the game board page + fillQuestions: cornsilk, % background of the questions pages + dollarColor: blue, % color of the heading of questions page + linkColor: red, % color of any hypertext links used +} +\end{Verbatim} +}% +If \cs{DeclareColors} is not present in the preamble, or if present, if the keys are not fully populated, +the default values are used. + +See \hyperref[colorscheme]{Section~\ref*{colorscheme}}, +beginning page~\pageref*{colorscheme}, for a visual representation of +these colors. + +\redpoint \cs{titleBanner}: On the instructions page, see +\hyperref[fig:instrPage]{Figure~\ref*{fig:instrPage}}, +page~\pageref*{fig:instrPage}, there is a banner heading. The text of this +banner is set by \cs{titleBanner} +\bVerb\takeMeasure{\string\titleBanner\darg{\ameta{Banner Text}}}% +\begin{dCmd}[commandchars=!()]{\bxSize} +\titleBanner{!ameta(Banner Text)} +\end{dCmd} +\eVerb +This command is required, though if not set, the default text will appear, +``You are the Winner!''. For example +\begin{Verbatim} +\titleBanner{The \TeX\ Game!} +\end{Verbatim} +You can format the banner text using \cs{bannerTextFont} by redefining it. Its default +definition is +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand{\bannerTextFont}{\sffamily\huge} +\end{Verbatim} +There are other banners in the Jeopardy game, the ones on the questions pages. +The text for these banners are the categories of question you declare +in the \cs{GameDesign} command, discussed in the next section. The +\cs{bannerTextFont} effects these banners as well. + +Finally, there is \cs{bannerTextControl} used for finer positioning of the banner text. +The default definition is +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand{\bannerTextControl}[1]{#1} +\end{Verbatim} +This can be redefined for whatever purpose. Normally it is not needed. But, for example +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand{\bannerTextControl}[1]{\raisebox{3pt}{#1}} +\end{Verbatim} +The above example raises the banner text \texttt{3pt}. + +\subsubsection{Game Design}\label{gamedesign} + +\redpoint \cs{GameDesign}: In order to design a game, you must +have categories and questions in each category. The +\cs{GameDesign} is the macro that is used for this purpose. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\GameDesign +{ + Cat: \TeX, % list the categories + Cat: \LaTeX, % " + Cat: Classes \&~Packages, % " + NumQuestions: 3, % number questions per category + Goal: {3,500}, % set a goal, just for fun + GoalPercentage: 0, % goal as a percentage of money + CellWidth: 1in, % cell width + CellHeight: .5in, % cell height + ExtraWidth: 0pt, % additional width if needed + ExtraHeight: .2in, % additional height if needed + Champion: You are a Champion! % this text appears if goal is met +} +\end{Verbatim} +The key-value pairs can appear in any order. + +\newtopic\noindent +\textbf{Required Keys: } The \texttt{Cat} and +\texttt{NumQuestions} keys are required, though this is not +enforced. + +\newtopic\noindent +\textbf{Format for key-value paires.} The format is `\texttt{\ameta{key}: +\ameta{value}}'. Multiple key-values are separated by a comma (,). If the +value contains a comma, enclose the value in braces, as I did above with the +\texttt{Goal}. The last item can have an optional comma (,). + +Each key, except \texttt{Cat}, has a default value. The values of +these keys may need to be adjusted depending on the number of +categories, number of questions, and font size. + +\bluepoint The value of \texttt{Cat} has an optional argument, you +can say +\begin{Verbatim}[xleftmargin=\amtIndent] +Cat: [\small] Classes \&~Packages, +\end{Verbatim} +The value of the optional argument is inserted just before the +``Classes \&~Packages'' in the category heading of the game board. +In this case, its size is reduced to fit into the bounding +rectangle. + +\bluepoint The parmeter \texttt{GoalPercentage} needs comment. You +can set the goal by setting the percentage of the total money in +the game; i.e., \texttt{GoalPercentage: 90}, sets the goal to 90\% +of the total money. If \texttt{GoalPercentage} is present in the +\cs{GameDesign}, and its value differs from the default value of +zero (\texttt0), then the value of the \texttt{Goal} parameter, +if present, is discarded, and a new goal is calculated based on +the percentage of the total money, which is a function of the +number of categories, the number of questions per category, and +whether the \texttt{double} option has been invoked. + +\medskip +The {\jj} class takes these entries and computes the values for \cs{paperheight}, +\cs{paperwidth} and \cs{textheight}. + +I've used some code from Radhakrishnan C V's \textsf{pdfscreen}. In +that regard, you can, however, use \cs{marginsize} to set the +margins around the page, the default is +\begin{Verbatim}[xleftmargin=\amtIndent] +\marginsize{.25in}{.25in}{.25in}{.25in} +\end{Verbatim} + +We now turn to defining the attributes of the Acrobat form fields +that appear in the game. + +In the next few paragraphs, covering the appearance attributes of +the fields corresponding to \cs{APHidden}, \cs{APDollar}, +\cs{APRight}, \cs{APWrong} and \cs{APScore}, colors are specified in +the RGB color space; for example \texttt{0.98 0.92 0.73}. Note that +unlike the color package of {\LaTeX}, the numbers are separated by +spaces not commas. Also, the keys that begin with the word ``Fill'' +(e.g., \texttt{FillColor}) recognize the word \texttt{transparent} +as a value, in this case, there is no background color for that +field. + +\redpoint There is a hidden text field in the banner above the game board that is +revealed when the game is over (all questions are answered) and +the goal, set in \cs{GameDesign}, is met. The \cs{APHidden} +controls the appearance of this hidden banner. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\APHidden +{ + Champion: You are a Champion!, % this text appears if goal met + Font: TiRo, % font to be used + Size: 20, % size of the font + TextColor: 0 0 1, % color of the text + BorderColor: 0 0 0, % border color + FillColor: 0.98 0.92 0.73, % background color +} +\end{Verbatim} +The Champion key can be placed in the \cs{GameDesign} structure; +this is more convenient for creating pre-packaged designs +(such as \texttt{design=jeopardy} and \texttt{design=florida}). + +\redpoint \cs{APDollar}: The \cs{DesignGame} just sets basic +parameters, it does nothing towards defining color. For that, I +have the \cs{APDollar} macro. This macro sets the attributes of the +numbers that appear as the game cells on the game board. +\begin{Verbatim}[fontsize=\small,xleftmargin=\amtIndent] +\APDollar +{ + Font: TiRo, % font to be use for the numbers + Size: 20, % size of font + TextColor: 0 0 1, % color for the numbers + BorderColor: 0 0 0, % color of border + FillColor: 1 .35 1, % the fill color for the cell face +} +\end{Verbatim} +The above are all the defaults. The \cs{APDollar} +macro does not have to appear, unless you want to change one of +the defaults. + +\redpoint \cs{APRight} and \cs{APWrong}: Under the face of the +cells are two hidden text fields, one for a ``Right'' answer, one +for a ``Wrong'' answer. The two macros \cs{APRight} and \cs{APWrong} +have the same key-value arguments. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\APRight{ + Font: TiRo, Size: 20, TextColor: 0 0 1, Message: Right!} + +\APWrong{ + Font: TiRo, Size: 20, TextColor: 1 0 0, Message: Wrong!} +\end{Verbatim} +The default value for the \texttt{Message} parameter is +``\texttt{Right!}'' (``\texttt{Wrong!}''), but these can be changed with +\cs{correctText} (\cs{incorrectText}). For German, for example, you can put +in the preamble \verb+\correctText{Richtig!}+ (\verb+\incorrectText{Falsch!}+), +this command lends itself to customization. + +\redpoint \cs{APScore}: There is a text field, set by the command +\cs{ScoreBoard}, to keep track of the score. The following macro +designs the appearance attributes for the score board. +\begin{Verbatim}[fontsize=\footnotesize] +\APScore{ + Font: TiRo, % font to be used + Size: 20, % font size to be used + TextColor: 0 0 1, % text color + BorderColor: 0 0 0, % border color + FillColor: 0.98 0.92 0.73, % background color + CellHeight: \the\cellHeight, % default same as cells (usually not specified) + CellWidth: \the\cellWidth, % default same as cells (usually not specified) + AutoPlacement: true, % auto placement of score, values: true or false + Score: "", % score text + Currency: "$", % currency + align: r, % horizonal align: l (left), c (center), r (right) +} +\end{Verbatim} + + +\bluepoint To get a currency of a EURO or some other currency symbol, use +Unicode; in the case of the EURO, use \verb!Currency: "\string\\u20AC"!. +When the \texttt{lang} option is set to \texttt{german}, the EURO +automatically becomes the default currency symbol. + +The following is a listing of some of the common currency signs. Keep in mind, that +these must be escaped like so \verb!Currency: "\string\\00A5"! (Yen Sign). +\begin{center} +\begin{tabular}{lll||lll} +Description & Unicode & Symbol & Description & Unicode & Symbol \\\hline +Dollar Sign & \cs{u0024}& \cS{Dollar}{0024} & Lira Sign & \cs{u20A4} &\cS{Lira}{20A4}\\ +Pound Sign & \cs{u00A3}& \cS{Pound}{00A3} & Peseta Sign & \cs{u20A7} &\cS{Pesta}{20A7}\\ +Currency Sign & \cs{u00A4}& \cS{Currency}{00A4} & New Sheqel Sign & \cs{u20AA} &\cS{Sheqel}{20AA}\\ +Yen Sign & \cs{u00A5}& \cS{Yen}{00A5} & Dong Sign & \cs{u20AB} & \cS{Dong}{20AB}\\ +French Franc & \cs{u20A3}& \cS{Franc}{20A3} & Euro Sign & \cs{u20AC} &\cS{Euro}{20AC}\\ +\end{tabular} +\end{center} +The Font key needs to have a value of a font that contains the currency symbol. For example, +\texttt{TiRo} and \texttt{Arial} (the open type font versions) both have these currency symbols. + +Some currency symbols, and I don't know which are appended to the end of the number. Use +\bVerb\takeMeasure{\string\prependCurrency}% +\begin{dCmd}[commandchars=!()]{\bxSize} +\prependCurrency +\appendCurrency +\end{dCmd} +\eVerb +The first, which is the default, prepends the currency sign to the number, whereas, +the command \cs{appendCurrency} appends it to the end of the number. Execute these in the preamble. + +\bluepoint The \texttt{align} parameter horizontally aligns the +contestant's current total in the text field. Permissible values are +\texttt{l} (for left aligned), \texttt{c} (for centered), and +\texttt{r} (for right aligned, the default). + +\bluepoint Then \texttt{AutoPlacement} is \texttt{true}, the \cs{ScoreBoard} is +centered directly under the game board. If \texttt{false}, then +you have to provide a placement for the \cs{ScoreBoard}. In this case, use the macro +\cs{PlaceScoreBoard}: +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\PlaceScoreBoard{\vfill\hspace{\rulewidth}\hspace{\extraWidth}% + \medskip\ScoreBoard} +\end{Verbatim} +This places the score board at the bottom of the page, aligned +with the left edge of the game board. + +\subsection{The Stuff in the Body of the Document} + +Now that we've finished laying out the design of the game, we are ready to +actually pose the questions. This is done in the body of the document, +following \verb!\begin{document}!, don't you know. First come the instructions, +the contestant can't play the game without instructions! + +\subsubsection{The Instructions} + +The first page of the game consists of the instructions. Place the +instructions in the \texttt{instructions} environment. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{instructions} +!ameta(instructions go here) %!rm perhaps a graphic as well +... +\end{instructions} +\end{Verbatim} + +The \verb+\end{instructions}+ ends the page, and inserts the +game board on the next page. + +Should you need more than one page of instructions, use +\cs{insertJJTitleBanner}. This command will start a new page and +place the title banner at the top of the page. + +\subsubsection{The Questions} + +Following the instructions environment comes the question and +multiple choice alternatives. For this, there is a \texttt{Category} +environment, within which is placed a series of \texttt{Question} +environments. The number of questions per category must be the same +as declared as the value of \texttt{NumQuestions} in the +\cs{GameDesign} macro. + +The format is as follows: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{Category}{!ameta(category_name)} +\begin{Question}[!ameta(num_of_columns)] +!ameta(Text of the question) +\Ans0 ... % a wrong answer +\Ans1 ... % the right answer +\Ans0 ... % another wrong answer +\end{Question} +\end{Category} +.......... +.......... +\end{Verbatim} +The number of categories must be the same as was listed in macro +\cs{GameDesign}. +The \ameta{category\_name} is required; it is used to send +messages to the log about whether you are listing the categories +in the correct order. It doesn't have to be exactly the same as +was defined in \cs{GameDesign}. + +\bluepoint The macro \cs{Ans} typesets the answers, it takes one +argument. An argument of `\texttt0', e.g., \cs{Ans0}, means that +answer is wrong, an argument of `\texttt1', e.g., \cs{Ans1}, means +the answer is the correct one. + +\bluepoint The default behavior is a column listing of the answers. You can +have a tabular format by specifying an optional number in the +brackets, \ameta{num\_of\_columns}. + +% jman says add a two column example + +Beginning with version 3.0 of {\jj}, you can now pose +fill-in questions, in addition to multiple choice questions. Use +\cs{RespBoxMath} for math fill-in questions and \cs{RespBoxTxt} for +text fill-in questions. See the manual \texttt{aeb\_man.pdf}, the manual +of usage for the \cAcroEB. + +Enclose the two commands \cs{RespBoxMath} and \cs{RespBoxTxt} in a special +environment, \texttt{oAnswer}. This environment redefines the actions of these +two standard \textsf{exerquiz} commands. + +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\begin{Question} + If $f(x) = 2x^2 + x $, what is $f(2x)$? + \begin{oAnswer} + \begin{equation*} + f(2x)=\RespBoxMath{2*(2x)^2 + 2*x}{4}{.0001}{[1,2]} + \end{equation*} + \end{oAnswer} +\end{Question} +\end{Verbatim} + +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\begin{Question} + He was the first president of the United States? Who was\dots + \begin{oAnswer} + \RespBoxTxt{2}{1}{3}{George Washington} + {G. Washington}{Geo. Washington} + \end{oAnswer} +\end{Question} +\end{Verbatim} +Do not use the optional argument for the \texttt{Question} environment, it is +not needed for fill-in questions. + +\redpoint The questions page consist of three parts: (1) The banner that +states the category for this question; (2) the currency heading +which typically says ``\textcolor{blue}{For \$100:}''; and (3) the question. + +There are two other commands that can be used to change the +appearance of the questions page. +\bVerb\takeMeasure{\string\currencyHeading\darg{\ameta{currencyHeading}}}% +\begin{dCmd}[commandchars=!()]{\bxSize} +\currencyHeading{!ameta(currencyHeading)} +\aboveCurrencySkip{!ameta(skip)} +\end{dCmd} +\eVerb The \cs{currencyHeading} heading is a command that can be used to change the text that sets up +the question for the page, The default value is +\begin{Verbatim}[xleftmargin=\amtIndent] +\currencyHeading{\bfseries For~\$\theCurrencyAmt:} +\end{Verbatim} +where \cs{theCurrencyAmt} is a command that expands to the correct amount (of currency) for +this question. Use this command in the preamble to redefine the text. For \texttt{lang=german}, +this text is automatically redefined. + +\cs{aboveCurrencySkip} adjusts the amount of vertical space between the page banner, and the currency +heading. The default is +\begin{Verbatim}[xleftmargin=\amtIndent] +\aboveCurrencySkip{0pt} +\end{Verbatim} + +\newtopic\noindent And that's all there is to it! + +\section{Building the Game}\label{s:buildgame} + +For people using \textsf{pdftex} or \textsf{dvipdfm}, there is no +special processing. Just `\textsf{pdflatex}-it' or `\textsf{dvipdfm}-it', +and you are ready to play! + +For \textsf{dvipsone} and \textsf{dvips}, some additional steps +are necessary. The \jj{} class uses Document Level JavaScripts to +control the game as it progresses. + +For users of \textsf{Acrobat~5.0} or later, the document level +JavaScript is automatically inserted when the game is open in +\textsf{Acrobat} for the first time following distillation, provided +the \textsf{PDF} was saved back into the same folder as the source +file. (It is in this folder that \TeX{} has written the DLJS in the +form of an \textsf{FDF} file.) + +Finally, do a `\texttt{Save As}\dots' from \textsf{Acrobat} to +save the DLJS that have just been inserted. You are now ready to play! + +\section{Jeopardy for Credit} + +This section outlines the support implemented to enable the Jeopardy games produced +by {\jj} to be offered up for credit in a relatively secure environment. + +\subsection{AeB No Go Pro} + +Should you wish to offer a Jeopardy game for class credit or extra +credit, you need to include \cs{contestantName} to allow the ``contestant'' to +enter his/her name. +\bVerb\takeMeasure{\string\contestantName\darg{\ameta{length}}\darg{\ameta{width}}}% +\begin{dCmd}[commandchars=!()]{\bxSize} +\contestantName{!ameta(length)}{!ameta(width)} +\end{dCmd} +\eVerb +where \ameta{length} and \ameta{width} are the height and width of the text +field. See item \ding{194} of \hyperref[instructionsPage]{Figure~\ref*{instructionsPage}}, +page~\pageref*{instructionsPage}. + +\CmdLoc Place this command within the \texttt{instructions} environment. + +An example of usage: +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\textcolor{red}{\textbf{Name:}} + \underbar{\contestantName{1.5in}{11bp}} +\end{Verbatim} +In the preamble you can use \cs{afterGameBoardInsertion} to insert material just below +the game board and score board. Whereas this is a general purpose command, you can +use it to insert a print button +\begin{Verbatim}[xleftmargin=\amtIndent] + \afterGameBoardInsertion{\medskip\gameboardPrintButton} +\end{Verbatim} +The command \cs{gameboardPrintButton} creates three form fields, a +print-this-page button, a read only text field with the contestant's +name pre-filled (remember, contestant entered her/his name in the +instructions page), and a read only text field that documents when +the contestant first opened the Jeopardy game. There is an optional +argument for \cs{gameboardPrintButton}, this is a standard argument +for changing the appearance of the button (see eForms manual). + +The three fields have labels that appear in front of the fields, these labels +can be changed using the following commands: +\bVerb\takeMeasure{\string\contestantNameLabel\darg{\ameta{label for contestant name field}}}% +\begin{dCmd}[commandchars=!()]{\bxSize} +\printButtonCaption{!ameta(caption on button)} +\printButtonLabel{!ameta(button label)} +\contestantNameLabel{!ameta(label for contestant name field)} +\timestampLabel{!ameta(label for time stamp field)} +\timeStampFormat{!ameta(util.printd formatting string)} +\end{dCmd} +\eVerb +Use \cs{printButtonCaption} to change the text that appears on the +button face, called the button caption.\footnote{This label will be part of the button, it is not part of +{\LaTeX} space, so no formatting is used here.} The argument of +\cs{timeStampFormat} is the formatting string of the +\texttt{util.printd()} method, see the documentation on that method +from the \emph{JavaScript for Acrobat API Reference}. + +The defaults are, respectively, +\begin{Verbatim}[xleftmargin=\amtIndent] +\printButtonCaption{Print} +\printButtonLabel{Print this page:} +\contestantNameLabel{Student:} +\timestampLabel{Time stamp:} +\timeStampFormat{mm-dd-yy, H:MM:ss.} +\end{Verbatim} +All the above commands are available for all the drivers. + +Should you wish to offer up a Jeopardy game for class credit, the +document needs to be secured. If you have Acrobat, version 5.0 or +later, you can give the document a no-printing attribute to prevent +the students from printing the document and handing it around. Wait, +they need to print the game board and hand it in! So setting the +document on no-printing does not help. + +How can we print the game board page, yet not allow the students +to print the questions? The answer to this question is in \Nameref{proOption}. + +\subsection{AeB Pro} + +The techniques described in this section assume the use of the new +AeB Pro (Acro\,\TeX{} eDucation Bundle Professional). The +requirement for AeB Pro is the document author, that's you, must use +Acrobat Pro, version 7 or later, and must create PDF using Acrobat +Distiller. If you are not one of these types, read no further; +however, it's okay if you read on, maybe the AeB Pro and its +applications will intrigue you enough to convert to the use of Acrobat Pro and +its little brother Distiller. + +\subsubsection{The \texttt{forcredit} Option}\label{forcreditOption} + +When you take the \texttt{forcredit} option and are using AeB +Pro,\footnote{If you are not using AeB Pro, this option does +nothing.} JavaScript code is added to the document that prevents the +student (contestant :-) from continuing on to the game board page +(or any of the questions page) without first identifying themselves +in the text field created by the \cs{contestantName} command. + +This ``annoyance factor'' guarantees the student has identified +himself before playing the game; hence, no excuses when they +turn in the game board with the name hand written in. + +This is just one more piece of the puzzle to the problem of Jeopardy +for credit, but it does not solve the printing problem. See the next +section for that. + +\subsubsection{The \texttt{pro} Option}\label{proOption} + +The \texttt{pro} option brings in the use of layers from AeB +Pro.\footnote{Adobe refers to layers as optional content groups +(OCG).} Layers are content that are placed in different groups. The +groups can be turned on (made visible) or off (made hidden). + +The content of each of the question pages is placed in its own +layer and made hidden. If you scroll to a question page, the +question is not visible, as it is still in a hidden state. When you +arrive on the page \emph{legally} via choosing a cell from the game +board, the layer for that question is made visible. + +The layers are given a ``no-print even if visible'' +attribute,\footnote{Yes, layers, and AeB Pro can do that!} so if the +student prints the document, the layers do not print! + +Adobe Reader and Acrobat have a Layers Navigation Panel through +which layers can be made visible, but {\jj} through AeB Pro locks +the layers. A locked layer means that the document consumer cannot +change the state (visible, hidden) of the layer through the user +interface. The state of a locked layer can be changed, however, +through JavaScript API, and that is exactly what {\jj} does! + +When the \texttt{pro} option is used, Adobe Reader 7.0 or later is +required to view the layers (some JavaScript methods are used that +are first defined in version 7). To prevent people viewing the game +who do not have at least version 7, you can use the command +\cs{requiresVersion} from AeB Pro. In the preamble of your game place +\begin{Verbatim}[xleftmargin=\amtIndent] +\requiresVersion{7} +\end{Verbatim} +See the documentation of \cs{requiresVersion} for further details, +and related commands that may be useful. When someone opens the +document that does not have at least version 7, either the document +is closed immediately and an alert box is issued, or if the document +is viewed in a browser, an alert message is displayed, and the user +in redirected to another page on the Internet. + +This scheme is not air tight, it can be gotten around, but I'm not +telling. + +\section{Two Player Jeopardy!}\label{tpj} + +When the \texttt{twoplayer} option is taken, two score boards are +created and the two contestants alternate play. The two contestants +are labeled `Player 1' and `Player 2', the border of the score board +is highlighted to indicate whose turn it is. +There is also a check box with a red dot in it to indicated whose +turn it is. The game plays the same, except the +results of each contestant are tabulated in their respective score +board. The rest of this section describes customizations. + +In addition to the key-values of \cs{APScore} discussed earlier, see +\nameref{gamedesign}, page~\pageref*{gamedesign}, +the following key-values are specific to the \texttt{twoplayer} option. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\APScore { + tpScaledCellWidth: .5, + tpHighlightBorderColor: 1 0 0 +} +\end{Verbatim} +When the \texttt{twoplayer} option is used, \textsf{jj\_game} multiplies the \emph{value} of \texttt{CellWidth} +(as specified in \cs{APScore}) by \texttt{tpScaledCellWidth}; if the resultant value is less than the \cs{cellWidth} +(the width of the cells in the game board), \cs{cellWidth} is used for the width of the \texttt{twoplayer} score boards; +otherwise, the resultant value is used. The default value is \texttt{.5}. + +The key \texttt{tpHighlightBorderColor} specifies the highlight color; the color that is used to paint the boundary +of the score board of the player whose turn it is. This value is also used to color the check box, the other indicator +of whose turn it is. The value \texttt{tpHighlightBorderColor} is a three component value in RGB color space; the +default is \texttt{1 0 0} (red). Note that there are \emph{no commas} between the component values. + +The \textsf{jj\_game} creates a switch \cs{ifjjgtwoplayer} to signal the \texttt{twoplayer} option. This switch may +be used, for example when specifying the value of \texttt{CellWidth} in \cs{APScore}: + +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\APScore { + Size: 0, + tpScaledCellWidth: 1, + CellWidth: \ifjjgtwoplayer\cellWidth+20pt\else2in\fi, +} +\end{Verbatim} +In the above, for two player mode, we set the cell width of the score fields to be the \cs{cellWidth} +of the cells on the game board plus \texttt{20pt}; otherwise, the width is set to \texttt{2in}. +We also set \texttt{tpScaledCellWidth} to 1 so the calculated width of the two player score fields +will be \verb!\cellWidth+20pt! and not half this value, which is what it would be if +\texttt{tpScaledCellWidth} maintains its default value of .5.\footnote{Actually, if \texttt{tpScaledCellWidth} +were .5, the width of the score fields will be \cs{cellWidth}, see the description of +\texttt{tpScaledCellWidth} above.} + +\newtopic The \cs{setTwoPlayerOptions} command allows you to specify some other twoplayer key-values. + +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\setTwoPlayerOptions { + player1: Player 1, + player2: Player 2, + playerFmt: \sffamily\small, + checkbox: true +} +\end{Verbatim} +When in two player mode, there are two score fields. Beneath these fields are \emph{contestant labels}. The values +of \texttt{player1} and \texttt{player2} are used to specify these labels. (The default values are shown in +the example above.) The playerFmt key is a convenient way of specifying the formatting for the contestant +labels. The default is \verb!\sffamily\small!. Finally, there are two check boxes that appear, in addition to +the two score fields, that indicate the turn. The default is that these check boxes appear, if you say, +\texttt{checkbox: false}, the check boxes are not created. + + +\section{Additional Customizations} + +This section includes many commands for customizing +the look of a Jeopardy game. + +\subsection{Customize those Text Strings} + +In addition to the many strings already documented earlier in this +manual, there are a few others. These strings are either AcroForm +strings or JavaScript strings, so accents must use octal coding or +unicode. For example, use \verb!\string\344! or \verb!\string\u00E4! +(version 7.0 or later) for \"{a}. + +The following strings appear either as text on a button face or as a message +in an alert box. The meaning of each command should be clear. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\correctText{Right!} +\incorrectText{False!} +\enterNamePlease{Please, enter your name on the first + page before you begin the game!} +\illegalAccessMsg{You are peeking at this question. Choose a + question from the game board first! You may want to start + the game over now!} +\illegalAnswerTwiceMsg{Changing your answer is not allowed!} +\end{Verbatim} +New values of these commands must be entered into the preamble. + +There are some strings specific to the \texttt{twoplayer} option: + +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\playeriWinnerMsg{\jjg@playeri\space is the winner!} +\playeriiWinnerMsg{\jjg@playerii\space is the winner!} +\gameTiedMsg{It is all tied up! You are equally matched!} +\bothLosersMsg{You two either are not trying, + or you do not know anything about the subject!} +\end{Verbatim} +The commands \cs{jjg@playeri} and \cs{jjg@playerii} hold the contestant labels, +as defined by the values of \texttt{player1} and \texttt{player2} of \cs{setTwoPlayerOptions}. +New values of these commands must be entered into the preamble. + + +\subsection{Graphical Backgrounds}\label{graphicsBGs} + +Beginning with version 3.0 of \jj, graphical backgrounds can be inserted into +the Jeopardy game. The basic command for doing this is \cs{template}. +The \cs{template} command is defined in the Web package. An example +of its usage is +\begin{Verbatim} +\template{myCoolGraphic} +\end{Verbatim} +where \texttt{myCoolGraphic} is a graphic, an EPS file if the driver +is dvips or dvipsone, or a PDF graphic for pdftex. Generally, any +graphic the driver supports. Place the \cs{template} command +between pages, the graphic will be insert in the next page. + +However, to make things even easier, {\jj} defines three commands: +\bVerb\takeMeasure{\string\defineInstructionPageGraphic\darg{\ameta{graphic}}}% +\begin{dCmd}[commandchars=!()]{\bxSize} +\defineInstructionPageGraphic{!ameta(graphic)} +\defineGameboardPageGraphic{!ameta(graphic)} +\defineQuestionPagesGraphic{!ameta(graphic)} +\end{dCmd} +\endgroup +\CmdLoc Place in the preamble of the document. + +\CmdDescription The \cs{defineInstructionPageGraphic} command inserts the +graphic for the instruction page(s). The \cs{defineGameboardPageGraphic} command +inserts the graphic for the game board page. +Finally, \cs{defineQuestionPagesGraphic} inserts the graphic for the question +pages. See the \textcolor{blue}{AeB Manual} for more details on the use of templates. + +The \textsf{web} package manages the templates of the document. Web +will resize the graphic to fit the dimensions of the page; as a +result, any graphical design may be slightly or greatly distorted. A +slight distortion may be acceptable, but a large distortion is not. + +\redpoint The file \texttt{jeopardy\_demo} demonstrates the work of +Simon Singer and J\"{u}rgen Gilg, both of Germany. In that game, +there are four categories and five questions per category. The game +was built and the positioning of the various elements of the game +(banners, gameboard, score field, etc.) are then known. Simon +brought each of the three types of pages (instruction, game board, +and question) into Adobe Photoshop and designed graphics that fit +exactly around the various elements. Using these graphics for the +game then yielded the results you see in the Jeopardy game +\texttt{jeopardy\_demo.pdf}. Very swave! + +You may be satisfied with a colorful background, a simple graphic as +a background, or something based on a high skill level, such as what +is demonstrated by Simon Singer and J\"{u}rgen Gilg. In the end, it +is all up to you. + +\section{Color Summary}\label{colorscheme} + +In this section, a visual presentation of the colors that can be set +through the various commands. + +\begin{figure}[ht] +\begin{pspicture}(-2,0)(10,8.5) +\rput[lb](0,0){\includegraphics[scale=0.35]{jj_instructions}} +\psline[linecolor=red]{->}(-0.7,7.25)(0,8) +\rput(-1,7){\NO{1}} +\psline[linecolor=red]{->}(-0.7,6.25)(1.5,7.3) +\rput(-1,6){\NO{2}} +\psline[linecolor=red]{->}(-0.6,5)(2.5,4.8) +\rput(-1,5){\NO{3}} +\end{pspicture} +\caption{Instructions Page}\label{instructionsPage} +\end{figure} + +\paragraph{Explanations} +\labelsep20pt\itemsep18pt +\begin{itemize} +\item[\NO{1}] This is the background color of the Instruction page. + +\textbf{Setup:} \texttt{fillInstructions: myColor} in the \cs{DeclareColors} command +\item[\NO{2}] These are the colors of the title banner of the Instruction page. + +\textbf{Setup:} In the \cs{DeclareColors} command, use \texttt{fillBanner: myColor} for the banner background and + \texttt{textBanner: myColor} for the banner text + +\item[\NO{3}] This is a little special to integrate the user's name to identify who's the one that takes the game. + +\textbf{Setup:} \verb!\underbar{\contestantName{1.5in}{11bp}}! +\end{itemize} + +\begin{figure}[ht] +\begin{pspicture}(-2,0)(10,8.5) +\rput[lb](0,0){\includegraphics[scale=0.35]{jj_gameboard}} +\psline[linecolor=red]{->}(-0.7,7.25)(0,8) +\rput(-1,7){\NO{4}} +\psline[linecolor=red]{->}(-0.7,6.25)(0.6,7.3) +\rput(-1,6){\NO{5}} +\psline[linecolor=red]{->}(-0.6,5)(0.6,4.8) +\psline[linecolor=red]{->}(-0.6,5)(0.6,5.8) +\rput(-1,5){\NO{6}} +\psline[linecolor=red]{->}(-0.6,4)(3,6) +\rput(-1,4){\NO{7}} +\psline[linecolor=red]{->}(-0.6,3)(3,2.75) +\rput(-1,3){\NO{8}} +\psline[linecolor=red]{->}(-0.6,2)(2.5,1.9) +\rput(-1,2){\NO{9}} +%\psgrid +\end{pspicture} +\caption{Gameboard Page}\label{gameboardPage} +\end{figure} + +\paragraph{Explanations} +\labelsep20pt\itemsep18pt +\begin{itemize} +\item[\NO{4}] This is the background color of the Game Board page. + +\textbf{Setup:} \texttt{fillGameBoard: myColor} in the \cs{DeclareColors} command. +\item[\NO{5}] These are the colors of the game board Categories. + +\textbf{Setup:} In the \cs{DeclareColors} command, use \texttt{fillBanner: myColor} for the category +background and \texttt{textBanner: myColor} for the category text. + +\textbf{Note:} This is named equal to the instructions page and possible to be set locally. +\item[\NO{6}] These are the colors of the game board Cells \textbf{after} the questions are taken. + +\textbf{Setup:} \texttt{TextColor: 0 0 0, BorderColor}: 0 0 0, for +the cell text and border color in the \cs{APRight} and \cs{APWrong} +commands. The background color is set up using the +\texttt{fillCells} in the \cs{DeclareColors} command. + +\textbf{Note:} Here the colors are defined in the rgb color scheme. +\item[\NO{7}] These are the colors of the game board Cells \textbf{before} the questions are taken. + + +\textbf{Setup:} For the \cs{APDollar} command, use +\texttt{TextColor: 0 0 0, BorderColor: 0 0 0, FillColor: 0.92 +0.67 0.1} for the cell text, border and background color, respectively. + +\textbf{Note:} Here the colors are defined in the rgb color scheme. +\item[\NO{8}] These are the colors of the Score field. + +\textbf{Setup:} \texttt{BorderColor: 0 0 0, FillColor: 0.92 0.67 0.1} for the Score border and background color in the \cs{APScore} command. + +\textbf{Note:} The text color of the score is setup in the colors of the \cs{APRight} and \cs{APWrong} commands, so that the user may quickly see, if she/he is in positive or negative score. A minus is additionally setup if the user lost more points than she/he won. + +The customer can choose an individual currency as well. +\item[\NO{9}] This is a print option, to print out the game board, after the game is finished. This may be useful for teachers, to collect the individual results of her/his students. That's the reason, why in the instructions page the name was forced to be filled in. Now the name is as well on the print out. + +This is automatically setup when the \texttt{forcredit} option for the {\jj} class is taken. +\end{itemize} + +\begin{figure}[ht] +\begin{pspicture}(-2,0)(10,8.5) +\rput[lb](0,0){\includegraphics[scale=0.35]{jj_questions}} +\psline[linecolor=red]{->}(-0.7,7.25)(0,8) +\rput(-1,7){\NO{10}} +\psline[linecolor=red]{->}(-0.7,6.25)(0.6,7.3) +\rput(-1,6){\NO{11}} +\psline[linecolor=red]{->}(-0.6,5)(0.6,6) +\rput(-1,5){\NO{12}} +\psline[linecolor=red]{->}(-0.6,4)(0.4,4) +\rput(-1,4){\NO{13}} +\end{pspicture} +\caption{Questions Page}\label{questionPage} +\end{figure} +\paragraph{Explanations} +\labelsep20pt\itemsep18pt +\begin{itemize} +\item[\NO{10}] This is the background color of the Questions page. + +\textbf{Setup:} \texttt{fillQuestions: myColor} in the \cs{DeclareColors} command +\item[\NO{11}] These are the colors of the questions Categories. + +\textbf{Setup:} In the \cs{DeclareColors} command, use \texttt{fillBanner: myColor} for the questions category background and + \texttt{textBanner: myColor} for the questions category text. + +\textbf{Note:} This is named equal to the banner of the instructions page and possible to be set locally. +\item[\NO{12}] This is a referring text to the taken question score. + +\textbf{Setup:} \texttt{dollarColor:\,myColor} for the referring text color +in the \cs{DeclareColors} command. + +\textbf{Note:} Text changes can be done with the command: + +\verb!\currencyHeading{\bfseries For~\$\theCurrencyAmt:}! +\item[\NO{13}] This is the color of the links (answer possibilities). + +\textbf{Setup:} \texttt{linkColor: myColor} for the link color in the \cs{DeclareColors} command +\end{itemize} + + +\end{document} diff --git a/texmf-dist/source/latex/jj-game/jj_game.dtx b/texmf-dist/source/latex/jj-game/jj_game.dtx new file mode 100644 index 00000000..2d2b2db7 --- /dev/null +++ b/texmf-dist/source/latex/jj-game/jj_game.dtx @@ -0,0 +1,1747 @@ +% \iffalse +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% jj_game.cls class file, %% +%% Copyright (C) 2000-2016 D. P. Story %% +%% dpstory@uakron.edu %% +%% %% +%% 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 of the %% +%% License, or (at your option) any later version. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\NeedsTeXFormat{LaTeX2e}[1997/12/01] +%\ProvidesClass{jj_game}[2016/11/24 v3.1 jj_game Class (dps)] +%<*driver> +\documentclass{ltxdoc} +\usepackage[colorlinks,hyperindex=false]{hyperref} +%\pdfstringdefDisableCommands{\let\\\textbackslash}% +\OnlyDescription % comment out for implementation details +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\InputIfFileExists{aebdocfmt.def}{\PackageInfo{jj_game}{Inputting aebdocfmt.def}} + {\def\IndexOpt{\DescribeMacro}\def\IndexKey{\DescribeMacro}\let\setupFullwidth\relax + \PackageInfo{jj_game}{aebdocfmt.def cannot be found}} +\begin{document} +\def\CMD#1{\textbackslash#1} +\let\pkg\textsf +\let\opt\texttt +%\addtolength{\marginparwidth}{3pt} + \GetFileInfo{jj_game.cls} + \title{\pkg{jj\_game}\texorpdfstring{\\}{:} A {\LaTeX} class to construct Jeopardy-like Games} + \author{D. P. Story\\ + Email: \texttt{dpstory@uakron.edu}} + \date{processed \today} + \maketitle + \tableofcontents + \let\Email\texttt + \DocInput{jj_game.dtx} +\IfFileExists{\jobname.ind}{\newpage\setupFullwidth\par\PrintIndex}{\paragraph*{Index} The index goes here.\\Execute + \texttt{makeindex -s gind.ist -o jj\_game.ind jj\_game.idx} on the command line and recompile + \texttt{jj\_game.dtx}.} +\IfFileExists{\jobname.gls}{\PrintChanges}{\paragraph*{Change History} The list of changes goes here.\\Execute + \texttt{makeindex -s gglo.ist -o jj\_game.gls jj\_game.glo} on the command line and recompile + \texttt{jj\_game.dtx}.} +\end{document} +% +% \fi +% +% \MakeShortVerb{|} +% \InputIfFileExists{aebdonotindex.def}{\PackageInfo{jj_game}{Inputting aebdonotindex.def}} +% {\PackageInfo{jj_game}{cannot find aebdonotindex.def}} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% \section{Declare Options} +% \begin{macrocode} +\RequirePackage{xkeyval} +% \end{macrocode} +% Add \pkg{ifpdf} and \pkg{ifxetex} for automatic driver detection. +% \changes{v3.1}{2016/11/24}{Add automatic driver detection for \string\pkg{ifpdf} and \string\pkg{ifxetex}} +% \changes{v3.1}{2016/11/24}{Added support for \opt{xetex} driver. There are numerous changes to get +% the positioning of the form fields correct. Changes are characterized by uses of \string\cs{ifxetex} +% and \string\cs{efKern}.} +% \begin{macrocode} +\RequirePackage{ifpdf}[2006/02/20] +\RequirePackage{ifxetex}[2006/08/21] +\newcounter{jjgdriver} +% \end{macrocode} +% Here is the list of supported drivers:\IndexOpt{dvips}\IndexOpt{pdftex}\IndexOpt{xelex}\IndexOpt{luatex} +% \texttt{pdftex}, \texttt{luatex}, and \texttt{xetex} are automatically detected and need not be specified. +% Other less used drivers are also supported. +% \begin{macrocode} +\DeclareOptionX{pdftex}{\setcounter{jjgdriver}{0} + \def\jjgdriver{\@gobble}} +\DeclareOptionX{luatex}{\setcounter{jjgdriver}{0} + \def\jjgdriver{\@gobble}} +\DeclareOptionX{dvips}{\setcounter{jjgdriver}{1} + \def\jjgdriver{dvips}\PassOptionsToPackage{dvips}{web}} +\DeclareOptionX{dvipsone}{\setcounter{jjgdriver}{1} + \def\jjgdriver{dvipsone}\PassOptionsToPackage{dvipsone}{web}} +\DeclareOptionX{dvipdfm}{\setcounter{jjgdriver}{2} + \def\jjgdriver{dvipdfm}\PassOptionsToPackage{dvipdfm}{web}} +\DeclareOptionX{dvipdfmx}{\setcounter{jjgdriver}{2} + \def\jjgdriver{dvipdfmx}\PassOptionsToPackage{dvipdfmx}{web}} +\DeclareOptionX{xetex}{\setcounter{jjgdriver}{2} + \def\jjgdriver{\@gobble}} +% \end{macrocode} +% \begin{macrocode} +\DeclareOptionX*{\PassOptionsToClass{\CurrentOption}{article}} +% \end{macrocode} +% Used for debugging: +% Where's the bug?\IndexOpt{debug} +% \begin{macrocode} +\newif\ifdebug \debugfalse +\DeclareOptionX{debug}{\debugtrue} +% \end{macrocode} +% This option \IndexOpt{final}\opt{final} removes window ui and other things. +% \begin{macrocode} +\newif\iffinal \finalfalse +\DeclareOptionX{final}{\finaltrue} +% \end{macrocode} +% Play \textbf{Double Jeopardy!}\IndexOpt{double} Double the amounts, double the fun! +% \begin{macrocode} +\newif\ifdouble \doublefalse +\def\scaleFactor{1} +\DeclareOptionX{double}{\doubletrue\def\scaleFactor{2}} +% \end{macrocode} +% We implement a two player game\IndexOpt{twoplayer}, by first declaring \texttt{twoplayer} as an option. +% \changes{v3.0h}{2008/11/16}{Added \texttt{twoplayer} option, as well as additional properties for +% setting up the option.} +% \begin{macrocode} +\newif\ifjjgtwoplayer\jjgtwoplayerfalse +\def\twoplayerGame{false} +\DeclareOptionX{twoplayer}{\jjgtwoplayertrue\def\twoplayerGame{true}} +% \end{macrocode} +% Inputs the \IndexOpt{pro}\texttt{pro} code: uses layers, distiller 7.0 or later is required. +% If the \texttt{pro} option is taken, then allow peeking as layers are used to hide the questions. +% \begin{macrocode} +\DeclareOptionX{pro}{\let\jjgInputProCode\jjg@InputProCode + \ExecuteOptionsX{allowpeeking} + \AtBeginDocument{\@ifundefined{xBld}{\PackageError{jj_game} + {You have specified the `pro' option, but\MessageBreak + the aeb_pro package is not loaded with its\MessageBreak + `uselayers' option}{See jjg_pro_ca.tex as an example of + the correct loading\MessageBreak + of aeb_pro}}{}}} +\def\jjg@InputProCode{\InputIfFileExists{jjgpro.def}% + {\ClassWarning{jj_game}{Inputting code for pro option} + \ClassWarningNoLine{jj_game}{AeB Pro required with uselayers + option}}{\ClassWarning{jjg_game}{Cannot find jjgpro.def. + \MessageBreak Reinstall or refresh your file name database.}}} +\let\jjgInputProCode\relax +\AtEndOfClass{\jjgInputProCode} +% \end{macrocode} +% For credit play\IndexOpt{forcredit}. Enables a Jeopardy game to be handed in for credit. Adds security measures so +% student cannot cheat. Works best when the \texttt{pro} option is used. +% \begin{macrocode} +\DeclareOptionX{forcredit}{% + \let\jjImportForCreditCode\jj@ImportForCreditCode} +% \end{macrocode} +% The normal behavior\IndexOpt{allowpeeking} of the game is that if the contestant looks ahead at a question, +% then the tile on the game board corresponding to the question viewed is hidden. +% The contestant is not allowed to answer that question. Use \opt{allowpeeking} option to remove +% this feature of the game. +% \changes{v3.0c}{2007/10/29}{ +% Added the \texttt{allowpeeking} option} +% \begin{macrocode} +\DeclareOptionX{allowpeeking}{\jjnopeekingfalse} +\newif\ifjjnopeeking \jjnopeekingtrue +% \end{macrocode} +% \begin{macrocode} +\let\jjImportForCreditCode\relax +\def\jj@ImportForCreditCode{\@ifpackageloaded{aeb_pro} + {\InputIfFileExists{jjcredit.def} + {\ClassWarning{jj_game}{Inputting forcredit code} + \ClassWarningNoLine{jj_game}{Don't forget to use + \string\contestantName\MessageBreak + and \string\gameboardPrintButton}} + {\ClassWarning{jj_game}{Cannot find jjcredit.def}}} + {\ClassWarningNoLine{jj_game} + {The forcredit option requires the aeb_pro package}}} +% \end{macrocode} +% Several pre-defined designs are accessible through \IndexOpt{design}\opt{design} option. Design +% choices are \texttt{jeopardy}, \texttt{florida}, \texttt{iceland}, \texttt{hornet}, \texttt{qatar}, \texttt{norway}, +% \texttt{germany}, \texttt{bahamas}, \texttt{spain}. +% \begin{macrocode} +\let\jjg@madedesignselection0 +\define@choicekey+{jj_game.cls}{design}{jeopardy,florida,iceland,% + hornet,qatar,norway,germany,bahamas,spain,custom}{% + \ifx\jjg@madedesignselection0\def\jj@design@choice{#1}% + \AtEndOfClass{\jjInputDesignChoice}% + \global\let\jjg@madedesignselection1 + \def\jjg@useddesign{design}\else + \ClassWarning{jj_game}{Do not use both design + and customdesign\MessageBreak + at the same time.\MessageBreak + Using the \jjg@useddesign\space selection}\fi} +{\ClassWarning{jj_game}{Bad choice for design, permissible values + are jeopardy, florida, iceland, hornet, qatar, norway, % + germany, bahamas, spain. Try again}} +\def\jjInputDesignChoice{% + \InputIfFileExists{design_\jj@design@choice.def}% + {\ClassWarning{jj_game}{Inputting design choice \jj@design@choice}}% + {\ClassWarning{jj_game}{Cannot find the file + design_\jj@design@choice.def}}% +} +% \end{macrocode} +% Allow the user to create his own design\IndexOpt{customdesign}. The file \verb!design_\jj@design@choice.def! then is input. +% \begin{macrocode} +\define@key{jj_game.cls}{customdesign}{% + \ifx\jjg@madedesignselection0\def\jj@design@choice{#1}% + \AtEndOfClass{\jjInputDesignChoice}% + \global\let\jjg@madedesignselection1 + \def\jjg@useddesign{customdesign}\else + \ClassWarning{jj_game}{Do not use both design and customdesign + \MessageBreak at the same time.\MessageBreak + Using the \jjg@useddesign\space selection}\fi} +% \end{macrocode} +% When the \texttt{nodesigngraphics}\IndexOpt{nodesigngraphics} option is taken, +% the effects of the commands\medskip +%\begin{verbatim} +% \defineInstructionPageGraphic +% \defineGameboardPageGraphic +% \defineQuestionPagesGraphic +%\end{verbatim} +%are cancelled out. +% \begin{macrocode} +\DeclareOptionX{nodesigngraphics}{\let\jjgdesigngraphics\endinput} +\let\jjgdesigngraphics\relax +% \end{macrocode} +% Language \opt{lang}\IndexOpt{lang} option, languages supported are \texttt{english} and \texttt{german} options. +% \begin{macrocode} +\define@choicekey+{jj_game.cls}{lang}[\val\nr]{english,german} +{\xdef\jjLangOpt{\nr}}{\ClassWarning{jj_game} + {Bad choice for lang, permissible values are english and german. + Try again.}} +\def\jjLangOpt{0} +% \end{macrocode} +% +% Look for configuration file +% +% \begin{macrocode} +\ifpdf\ExecuteOptionsX{pdftex}\else + \ifxetex\ExecuteOptionsX{xetex}\else +% \end{macrocode} +% For backward compatibility, we \cs{let} \cs{ExecuteOptions} to +% \cs{ExecutedOptionsX}, saving and restoring as we go. +% \begin{macrocode} + \let\ExecuteOptions@SAVE\ExecuteOptions + \let\ExecuteOptions\ExecuteOptionsX + \InputIfFileExists{jj_game.cfg}{} + {\@ifundefined{l@tex@@@@driver}{\ExecuteOptionsX{dvips}} + {\ExecuteOptionsX{dvipsone}}}% + \let\ExecuteOptions\ExecuteOptions@SAVE + \fi\fi +% \end{macrocode} +% \subsection{Process Options} +% \begin{macrocode} +\ProcessOptionsX +% \end{macrocode} +% \section{Load the article class} +% We model the \pkg{jj\_game} class after the \pkg{article} class. +% \begin{macrocode} +\LoadClass{article}[2014/09/29] +% \end{macrocode} +% \section{Required Packages} +% We do not pass the driver options \texttt{pdftex}, \texttt{luatex}, or \texttt{xetex} to \pkg{web}, because that +% package detects these drivers as well. +% \begin{macrocode} +\edef\x{\noexpand + \RequirePackage[\jjgdriver,usetemplates,dvipsnames]{web}}\x +\RequirePackage[execJS]{eforms}[2016/08/29] +\RequirePackage{verbatim} +\RequirePackage{comment} +\RequirePackage{calc} +% \end{macrocode} +% If user has chosen the \texttt{final} option, we use hyperref to set the viewer window; +% otherwise we set \verb!\let\JJinitSetup\relax!. The user who is using +% \texttt{aeb\_pro} with \texttt{jj\_game} can use the extensive controls in that package. +% \begin{macrocode} +\iffinal + \def\JJinitSetup{% + \hypersetup{% + pdfmenubar=false, + pdftoolbar=false, + pdffitwindow=true, + pdfcenterwindow=true, + pdfwindowui=false% + } + } +\else + \let\JJinitSetup\relax +\fi +\AtEndOfClass{\JJinitSetup} +% \end{macrocode} +% Process the language option, the default is english +% \begin{macrocode} +\ifcase\jjLangOpt\relax + \includecomment{JJLangEnglish} + \excludecomment{JJLangGerman} +\or + \includecomment{JJLangGerman} + \excludecomment{JJLangEnglish} + \AtEndOfClass{\germanLocalization} +\fi +\@ifundefined{jjImportForCreditCode} + {\excludecomment{JJForCredit}} + {\includecomment{JJForCredit}} +% \end{macrocode} +% \cs{germanLocalization} consists of some definitions that specialize +% certain strings of \texttt{jj\_game}. +% \begin{macrocode} +\def\germanLocalization{% + \currencyHeading{\bfseries For~\EUR\theCurrencyAmt:}% + \correctText{Richtig!}\incorrectText{Falsch!}% + \def\jb@sepStyle{2}\def\jb@currStyle{0}% + \def\APScore@Currency@def{"\string\\u20ac"}% + \printButtonCaption{Drucken}% + \printButtonLabel{Diese Seite drucken}% + \contestantNameLabel{Student}% + \timestampLabel{Zeitstempel}% + \timeStampFormat{dd/mm/yy, H:MM:ss.}% + \enterNamePlease{Bitte geben Sie Ihren Namen auf + der ersten Seite ein, bevor Sie das Spiel beginnen!} + \def\jb@Score{"Punkte "} + \illegalAccessMsg{Sie haben gespickelt! Bitte w\string\344hlen + Sie erst eine Frage vom Spielbrett, bevor Sie umbl\string\344ttern - + diese Antwort wird nicht gewertet! \string\326ffnen Sie das + PDF erneut und spielen Sie dieses Mal ohne zu spickeln.} + \illegalAnswerTwiceMsg{\string\304ndern Ihrer Antwort + ist nicht erlaubt!} + +} +% \end{macrocode} +% Default color definitions for the Jeopardy game. These will be used +% if no colors are specified. +% \begin{macrocode} +\definecolor{defaultfillCells}{rgb}{0.98,0.92,0.73} +\def\defaultfillCells{defaultfillCells} +\definecolor{defaultfillBanner}{rgb}{0.5,0,0.5} +\def\defaultfillBanner{defaultfillBanner} +\definecolor{defaulttextBanner}{rgb}{1,1,0} % yellow +\def\defaulttextBanner{defaulttextBanner} +\definecolor{defaulttextBoard}{rgb}{1,1,0} % yellow +\def\defaulttextBoard{defaulttextBoard} +\definecolor{defaultfillInstructions}{rgb}{0.98,0.92,0.73} +\def\defaultfillInstructions{defaultfillInstructions} +\definecolor{defaultfillGameBoard}{rgb}{1,0.8,0.6} +\def\defaultfillGameBoard{defaultfillGameBoard} +\definecolor{defaultfillQuestions}{rgb}{1,0.8,0.6} +\def\defaultfillQuestions{defaultfillQuestions} +\def\defaultDollarColorAmt{blue} +\def\defaultLinkColor{webgreen} +\definecolor{jj_banner_bg}{named}{defaultfillBanner} +\definecolor{jj_banner_txt}{named}{defaulttextBanner} +\def\jj@transparent{transparent} +% \end{macrocode} +% \begin{macro}{\bannerTextFont} +% \begin{macro}{\titleBanner} +% Commands for defining the banner text and font. +% \begin{macrocode} +\newcommand{\bannerTextFont}{\sffamily\huge} +\def\bannerTextColor{\ifx\textBanner\jj@transparent + \else\color{\textBanner}\fi} +\def\titleBanner#1{\def\@titleBanner{#1}} +\titleBanner{You are the Winner!} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macro}{\insertJJTitleBanner} +% The title banner is displayed on the first page, the text of the first page +% is the content of the \texttt{instructions} environment. If you want more than +% one page of instructions, begin an new page with \cs{newpage}, then insert +% \cs{insertJJTitleBanner} to get the start up banner to appear. +% \begin{macrocode} +\def\insertJJTitleBanner{\newpage\jb@Banner{\@titleBanner}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\includeFootBanner} +% \begin{macro}{\authorURL} +% Use \cs{includeFootBanner} to get a matching banner at the foot of the first page. +% The banner contains the author's name and university. Use \cs{author} and \cs{university} +% from the web package to properly populate this command. Use it in the preamble. +% \begin{macrocode} +\newcommand{\includeFootBanner}{% + \renewcommand{\@oddfoot} + {% + \ifnum\thepage=1\relax + \colorbox{jj_banner_bg}{\makebox[\linewidth-2\fboxsep]{% + \href{\jjgauthorURL}% + {\textcolor{jj_banner_txt}{\webauthor\ \copyright\ \the\year}}% + \hfill\textcolor{jj_banner_txt}{\webuniversity}}}\else\hfil\fi + }% +} +\newcommand{\authorURL}[1]{\def\jjgauthorURL{#1}} +\authorURL{http://www.example.com} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \section{The Main Code} +% Much of the code below was adapted from the web package. +% \begin{macrocode} +\newdimen\jb@paperheight +\newdimen\jb@tmpdimb +\jb@paperheight=\paperheight +\newdimen\@Leftmargin \@Leftmargin=0cm +\newdimen\@Rightmargin \@Rightmargin=0cm +\newdimen\@Topmargin \@Topmargin=0in +\newdimen\@Bottommargin \@Bottommargin=0in +\parindent0pt +\setlength\headheight{0pt} +\setlength\headsep {0pt} +\setlength\footskip {0pt} +\hoffset=0pt +\voffset=0pt +\pagestyle{empty} +\def\InitLayout{% + \setlength{\textwidth}{\paperwidth} + \addtolength{\textwidth}{-\@Leftmargin} + \addtolength{\textwidth}{-\@Rightmargin} + \setlength{\textheight}{\paperheight} + \addtolength{\textheight}{-\@Topmargin} + \addtolength{\textheight}{-\@Bottommargin} + \addtolength{\textheight}{-\headheight} + \addtolength{\textheight}{-\headsep} + \addtolength{\textheight}{-\footskip} + \setlength{\oddsidemargin}{\@Leftmargin} + \addtolength{\oddsidemargin}{-1in} + \setlength{\evensidemargin}{\@Leftmargin} + \addtolength{\evensidemargin}{-1in} + \setlength{\topmargin}{\@Topmargin} + \addtolength{\topmargin}{-1in} + \setlength{\textscreenwidth}{\paperwidth} +} +\def\screensize#1#2{% + \paperheight=#1% + \paperwidth=#2 + \web@set@paper + \InitLayout +} +\def\marginsize#1#2#3#4{% + \@Leftmargin=#1 + \@Rightmargin=#2 + \@Topmargin=#3 + \@Bottommargin=#4 + \InitLayout +} +% \end{macrocode} +% The default margin size +% \begin{macrocode} +\marginsize{.25in}{.25in}{.25in}{.25in} +\newcount\rownum \rownum=1 % These registers keep track of the row and +\newcount\colnum \colnum=0 % column of the quizboard +\newcount\corMsgnum \corMsgnum=0 % These registers keep track of the +\newcount\errMsgnum \errMsgnum=0 % error messages +\newcount\jb@n +\newcount\jb@m +\newtoks\jb@rowtoks +\newcounter{newletter} +\newdimen\cellHeight \cellHeight=1in +\newdimen\cellWidth \cellWidth=.5in +\newdimen\tablewidth +\newdimen\tableheight +\newcount\numCategories \numCategories=5 +\newcount\numQuestions \numQuestions=5 +\newdimen\rulewidth \rulewidth=1bp +\newdimen\extraHeight \extraHeight=.2in +\newdimen\extraWidth \extraWidth=0pt +% \end{macrocode} +% Calculate the size of the screen page. +% \begin{macrocode} +\def\calcPaperSize{% +% \end{macrocode} +% Calculate paperwidth and \cs{tablewidth} +% \begin{macrocode} + \tablewidth=\numCategories\cellWidth + \advance\tablewidth by \rulewidth + \advance\tablewidth by \numCategories\rulewidth + \paperwidth=\tablewidth + \advance\paperwidth by\@Leftmargin % two times margin + \advance\paperwidth by\@Rightmargin % two times margin + \advance\paperwidth by2\extraWidth % need more width +% \end{macrocode} +% Calculate paperheight and \cs{tableheight} +% \begin{macrocode} + \tableheight=\numQuestions\cellHeight + \advance\tableheight by\cellHeight % banner + \advance\tableheight by2\rulewidth % two rules for banner + \advance\tableheight by\numQuestions\rulewidth + \paperheight=\tableheight + \advance\paperheight by\cellHeight % score + \advance\paperheight by\@Topmargin + \advance\paperheight by\@Bottommargin + \advance\paperheight by\topskip + \advance\paperheight by\extraHeight + \screensize{\paperheight}{\paperwidth} +} +\def\verbatimwrite{\bgroup\catcode``=0 \@bsphack + \let\do\@makeother\dospecials + \catcode`\^^M\active \catcode`\^^I=12 + \def\verbatim@processline{% + \immediate\write\verbatim@out + {\the\verbatim@line}}% + \verbatim@start} +\def\endverbatimwrite{\@esphack\egroup} +% \end{macrocode} +% \subsection{Create Design Commands} +% \begin{macrocode} +\def\jb@linkColor{\defaultLinkColor} +% \end{macrocode} +% \begin{macrocode} +\def\jj@setChoice#1#2{% this choice, default + \ifx#1\@empty#2\else#1\fi} +\def\jj@updateChoice#1#2{% this choice, current choice + \ifx#1\@empty\xdef#1{#2}\else\xdef#2{#1}\fi} +% \end{macrocode} +% \begin{macro}{\convertToSetKeys} +% We use the \textsf{xkeyval} package to parse the key, but we have a twist: The key-values are +% given in the form of object properties \texttt{:}. The command +% \cs{@convertColoniiEqual} does the work. The way \cs{convertToSetKeys} is used is +% is shown below: +%\begin{verbatim} +%\define@key{dps}{fname}{\def\dpsfname{#1}} +%\define@key{dps}{mname}{\def\dpsmname{#1}} +%\define@key{dps}{lname}{\def\dpslname{#1}} +%\def\setName#1{% +% \convertToSetKeys{dps}{#1}} +%... +%\setName { +% fname: D., +% mname: P., +% lname: Story +%} +%\end{verbatim} +% where \cs{setName} is some command, \texttt{\#1} is the name of the +% \textsf{xkeyval} family to be used, and \texttt{\#2} are the +% \texttt{:} pairs. +% \begin{macrocode} +\newtoks\jb@tmptoks \jb@tmptoks={} +\def\jjgdummy{dummy} +\def\convertToSetKeys#1#2{% + \def\thisxkvFamily{#1}\def\jjg@scratch{}\jb@tmptoks={}% + \@convertColoniiEqual#2,dummy:dummy,\@nil +} +\def\@convertColoniiEqual#1:#2,#3\@nil{% + \def\jj@rgii{#2}\ifx\jj@rgii\jjgdummy + \edef\jj@next{\noexpand\setkeys{\thisxkvFamily}{\the\jb@tmptoks}}% + \else\jb@tmptoks=\expandafter{\jjg@scratch,#1=#2}% + \edef\jjg@scratch{\the\jb@tmptoks}% + \def\jj@next{\@convertColoniiEqual#3\@nil}\fi\jj@next +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\DeclareColors} +% Macro to set the design parameters for LaTeX colors +% \begin{macrocode} +\define@key{declcolors}{fillCells}[\defaultfillCells]% + {\def\fillCells{#1}} +\define@key{declcolors}{fillBanner}[\defaultfillBanner]% + {\def\fillBanner{#1}} +\define@key{declcolors}{textBanner}[\defaulttextBanner]% + {\def\textBanner{#1}} +\define@key{declcolors}{textBoard}[\defaulttextBoard]% + {\def\textBoard{#1}} +\define@key{declcolors}{fillInstructions}[\defaultfillInstructions]% + {\def\fillInstructions{#1}} +\define@key{declcolors}{fillGameBoard}[\defaultfillGameBoard]% + {\def\fillGameBoard{#1}} +\define@key{declcolors}{fillQuestions}[\defaultfillQuestions]% + {\def\fillQuestions{#1}} +\define@key{declcolors}{dollarColor}[\defaultDollarColorAmt]% + {\def\dollarColor{#1}} +\define@key{declcolors}{linkColor}[\defaultLinkColor]% + {\def\@linkcolor{#1}} +\setkeys{declcolors}{fillCells,fillBanner,textBanner,textBoard,% + fillInstructions,fillGameBoard,fillQuestions,dollarColor,linkColor}% +\def\DeclareColors#1{\convertToSetKeys{declcolors}{#1}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\APDollar} +% Macro to set the design parameters for the Dollar tile, this is the tile seen +% on the game board showing the monetary amounts of each question. The name of +% this tile is \verb!\the\rownum\the\colnum!, corresponding to the row and column +% position of the tile in the game board. +% \begin{macrocode} +\def\APDollar@Font@def{TiRo}\def\APDollar@Size@def{20} +\def\APDollar@TextColor@def{0 0 1}\def\APDollar@BorderColor@def{0 0 0} +\def\APDollar@FillColor@def{1 0.35 1} +\define@key{apdollar}{Font}[\APDollar@Font@def]{\def\APDollar@Font{#1}} +\define@key{apdollar}{Size}[\APDollar@Size@def]{\def\APDollar@Size{#1}} +\define@key{apdollar}{TextColor}[\APDollar@TextColor@def]% + {\def\APDollar@TextColor{#1}} +\define@key{apdollar}{BorderColor}[\APDollar@BorderColor@def]% + {\def\APDollar@BorderColor{#1}% + \ifx\APDollar@BorderColor\jj@transparent\gdef\APD@llarBorder{}\else + \xdef\APD@llarBorder{\APDollar@BorderColor}\fi +} +\define@key{apdollar}{FillColor}[\APDollar@FillColor@def]% + {\def\APDollar@FillColor{#1}% + \ifx\APDollar@FillColor\jj@transparent\gdef\APD@llarFill{}\else + \xdef\APD@llarFill{\APDollar@FillColor}\fi +} +\def\APD@llar{/\APDollar@Font\space\APDollar@Size\space Tf + \APDollar@TextColor\space rg} +\setkeys{apdollar}{Font,Size,TextColor,BorderColor,FillColor} +\def\APDollar#1{\convertToSetKeys{apdollar}{#1}} +\APDollar{} +% \end{macrocode} +% \end{macro} +% A crude euro symbol that can be typeset in \TeX. +% \begin{macrocode} +\newcommand\EUR{% +{\sffamily C% +\makebox[0pt][l]{\kern-.70em\mbox{--}% +}% +\makebox[0pt][l]{\kern-.68em\raisebox{.25ex}{--}}}\,% +} +% \end{macrocode} +% \begin{macro}{\APHidden} +% This collection of key-values set the appearance of the text field whose name +% is \texttt{GrandPoohbah}. It is a hidden text field above the game board +% extending across the list of categories. If the player attains the goal, +% the \texttt{GrandPoohbah} field becomes visible showing the \texttt{Champion} message. +% \begin{macrocode} +\def\APHidden@Font@def{TiRo}\def\APHidden@Size@def{20} +\def\APHidden@TextColor@def{0 0 1}\def\APHidden@BorderColor@def{0 0 0} +\def\APHidden@FillColor@def{0.98 0.92 0.73} +\def\Champion@def{You are a Champion!} +\define@key{aphidden}{Champion}[\Champion@def]{\def\jb@Champion{#1}} +\define@key{aphidden}{Font}[\APHidden@Font@def]{\def\APHidden@Font{#1}} +\define@key{aphidden}{Size}[\APHidden@Size@def]{\def\APHidden@Size{#1}} +\define@key{aphidden}{TextColor}[\APHidden@TextColor@def]% + {\def\APHidden@TextColor{#1}} +\define@key{aphidden}{BorderColor}[\APHidden@BorderColor@def]% + {\def\APHidden@BorderColor{#1}% + \ifx\APHidden@BorderColor\jj@transparent\gdef\APHidd@nBorder{}\else + \xdef\APHidd@nBorder{\APHidden@BorderColor}\fi +} +\define@key{aphidden}{FillColor}[\APHidden@FillColor@def]% + {\def\APHidden@FillColor{#1}% + \ifx\APHidden@FillColor\jj@transparent\gdef\APHidd@nFill{}\else + \xdef\APHidd@nFill{\APHidden@FillColor}\fi +} +\def\APHidd@n{/\APHidden@Font\space\APHidden@Size\space Tf + \APHidden@TextColor\space rg} +\setkeys{aphidden}{Champion,Font,Size,TextColor,BorderColor,FillColor} +\def\APHidden#1{\convertToSetKeys{aphidden}{#1}} +\APHidden{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\APRight} +% Use this command to set the key-value pairs for the appearance of the push button +% whose name is \verb!\the\rownum\the\colnum R!. When the player answers the question +% correctly, this field, initially hidden, becomes visible with a message of congratulations, +% the default message is \texttt{Right!} +% \begin{macrocode} +\def\APRight@Font@def{TiRo}\def\APRight@Size@def{20} +\def\APRight@TextColor@def{0 0 1}\def\APRRight@Msg@def{Right!} +\def\correctText#1{\gdef\@APRightMsg{#1}}\correctText{Right!} +\define@key{apright}{Font}[\APRight@Font@def]{\def\APRight@Font{#1}} +\define@key{apright}{Size}[\APRight@Size@def]{\def\APRight@Size{#1}} +\define@key{apright}{TextColor}[\APRight@TextColor@def]% + {\def\@APRightTextColor{#1}} +\define@key{apright}{Message}[\APRRight@Msg@def]{\def\@APRightMsg{#1}} +\def\@APRight{/\APRight@Font\space\APRight@Size\space Tf + \@APRightTextColor\space rg}% +\setkeys{apright}{Font,Size,TextColor,Message} +\def\APRight#1{\convertToSetKeys{apright}{#1}} +\APRight{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\APWrong} +% Use this command to set the key-value pairs for the appearance of the push button +% whose name is \verb!\the\rownum\the\colnum W!. When the player answers the question +% incorrectly, this field, initially hidden, becomes visible with a message, +% the default message is \texttt{Wrong!} +% \begin{macrocode} +\def\APWrong@Font@def{TiRo}\def\APWrong@Size@def{20} +\def\APWrong@TextColor@def{0 0 1}\def\APRWrong@Msg@def{Wrong!} +\def\incorrectText#1{\gdef\@APWrongMsg{#1}}\incorrectText{Wrong!} +\define@key{apwrong}{Font}[\APWrong@Font@def]{\def\APWrong@Font{#1}} +\define@key{apwrong}{Size}[\APWrong@Size@def]{\def\APWrong@Size{#1}} +\define@key{apwrong}{TextColor}[\APWrong@TextColor@def]% + {\def\@APWrongTextColor{#1}} +\define@key{apwrong}{Message}[\APRWrong@Msg@def]{\def\@APWrongMsg{#1}} +\def\@APWrong{/\APWrong@Font\space\APWrong@Size\space Tf + \@APWrongTextColor\space rg} +\setkeys{apwrong}{Font,Size,TextColor,Message} +\def\APWrong#1{\convertToSetKeys{apwrong}{#1}} +\APWrong{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\GameDesign} +% Use this command to set the key-value pairs for designing the game board. Setting +% these values are required for each game. There are default values, but the key-values +% that are required to be filled is are \texttt{Cat}, and \texttt{NumQuestions}. The number of Cat entries +% determines the number of categories, and \texttt{NumQuestions} determines the number of questions +% in each category. +% \begin{macrocode} +\define@key{gamedesign}{Cat}{\global\advance\numCategories by1 + \jb@Cat#1,} +\define@key{gamedesign}{CellWidth}[1in]{\global\cellWidth=#1\relax} +\define@key{gamedesign}{CellHeight}[.5in]{\global\cellHeight=#1\relax} +\define@key{gamedesign}{NumQuestions}[5]{\global\numQuestions=#1\relax} +\define@key{gamedesign}{Goal}[3500]{\def\jb@Goal{#1}} +\define@key{gamedesign}{GoalPercentage}[0]{\def\jb@GoalPercentage{#1}} +\define@key{gamedesign}{ExtraHeight}[.2in]{\global\extraHeight=#1\relax} +\define@key{gamedesign}{ExtraWidth}[0pt]{\global\extraWidth=#1\relax} +\define@key{gamedesign}{Champion}[\Champion@def]{\def\jb@Champion{#1}} +\setkeys{gamedesign}{CellWidth,CellHeight,NumQuestions,Goal,% + GoalPercentage,ExtraHeight,ExtraWidth,Champion} +% \end{macrocode} +% Here is the code for \cs{GameDesign}, after gathering the key-value pairs for +% the \texttt{gamedesign} family. We set the \texttt{Goal} (if \texttt{GoalPercentage} is specified), +% then, based on the parameters, we calculate the page size for this game board. +% \begin{macrocode} +\def\GameDesign#1{\global\numCategories=0\relax + \convertToSetKeys{gamedesign}{#1}% + \ifdebug + \typeout{^^JClass jj_game Info:} + \typeout{Number of Categories: \the\numCategories} + \typeout{Number of Questions per Category: \the\numQuestions^^J} + \fi +% \end{macrocode} +%\begin{verbatim} +% Let n = numQuestions, m = numCategories +% 100*n*(n+1)/2 = 50*n*(n+1) = total for one category +% 50*m*n*(n+1) = total money; +% 100*m*n*(n+1) = total money for double jeopardy +%\end{verbatim} +% \begin{macrocode} + \jb@n = \numQuestions + \advance\jb@n by 1 + \multiply\jb@n by\numQuestions + \multiply\jb@n by50 % total money/category + \multiply\jb@n by\numCategories % total money + \ifdouble + \multiply\jb@n by2 % total money, double jj + \fi + \ifdebug + \typeout{Total Money: \the\jb@n} + \fi + % See if GoalPercentage differs from the default value + \xdef\jb@tmp{\csname 0\endcsname}% + \xdef\jb@temp{\csname\jb@GoalPercentage\endcsname}% + \ifx\jb@tmp\jb@temp + \else + \ifdebug + \typeout{Goal Percentage Specified: \jb@GoalPercentage} + \fi + \multiply\jb@n by\jb@GoalPercentage + \divide\jb@n by100 + \def\jb@Goal{\the\jb@n} + \fi + \xdef\Goal{\jb@Goal} + \ifdebug + \typeout{Goal: \Goal^^J} + \fi + \calcPaperSize + \jjCancelOutAeBProCatalog + \jjImportForCreditCode +} +\def\jjCancelOutAeBProCatalog{\iffinal\let\aeb@SetCatalog\@empty\fi} +\def\jb@Cat{\@ifnextchar[{\jb@item}{\jb@item[] }}% +\gdef\jb@item[#1]#2,{% + \expandafter\gdef\csname Category\the\numCategories\endcsname + {\forpbx{#1#2}}% + \expandafter\gdef\csname category\the\numCategories\endcsname{#2}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\APScore} +% The \cs{APScore} command sets the key-value pairs for designing the score board. There +% are three score boards: for a single player, the name of the field is \texttt{Total}; +% for the two player game, the names of the fields are \texttt{Total0} and \texttt{Total1}. +% \begin{macrocode} +\def\jb@Score{""} +\def\jb@align@left{l} +\def\jb@align@center{c} +\def\jb@align@right{r} +\def\APScore@Font@def{TiRo} +\def\APScore@Size@def{20} +\def\APScore@TextColor@def{0 0 1} +\def\APScore@BorderColor@def{0 0 0} +\def\APScore@FillColor@def{0.98 0.92 0.73} +\def\APScore@CellHeight@def{\the\cellHeight} +\def\APScore@CellWidth@def{\the\cellWidth} +\def\APScore@AutoPlacement@def{true} +\def\APScore@Score@def{""} +\def\APScore@Currency@def{""} +\def\APScore@align@def{r} +\def\jb@align{r} +% +% twoplayer properties +% +\def\APScore@tp@ScaledCellWidth@def{.5} +\let\APScore@tp@ScaledCellWidth\@empty +\def\APScore@tp@HighlightBorderColor@def{1 0 0} +% +\define@key{apscore}{Font}[\APScore@Font@def]{\def\APScore@Font{#1}} +\define@key{apscore}{Size}[\APScore@Size@def]{\def\APScore@Size{#1}} +\define@key{apscore}{TextColor}[\APScore@TextColor@def]% + {\def\APScore@TextColor{#1}} +\define@key{apscore}{BorderColor}[\APScore@BorderColor@def]% + {\def\APScore@BorderColor{#1}% + \ifx\APScore@BorderColor\jj@transparent\gdef\@APScoreBorder{}\else + \xdef\@APScoreBorder{\APScore@BorderColor}\fi +} +\define@key{apscore}{FillColor}[\APScore@FillColor@def]% + {\def\APScore@FillColor{#1}% + \ifx\APScore@FillColor\jj@transparent\gdef\@APScoreFill{}\else + \xdef\@APScoreFill{\APScore@FillColor}\fi +} +\define@key{apscore}{CellHeight}[\APScore@CellHeight@def]% + {\def\@APScorecellHeight{#1}} +\define@key{apscore}{CellWidth}[\APScore@CellWidth@def]% + {\def\@APScorecellWidth{#1}} +\define@boolkey{apscore}{AutoPlacement}[true]{} +\define@key{apscore}{Score}[\APScore@Score@def]{\def\jb@Score{#1}} +\define@key{apscore}{Currency}[\APScore@Currency@def]% + {\def\jb@Currency{#1}} +\define@key{apscore}{align}[\APScore@align@def]{\def\jb@align{#1}} +% +% twoplayer properties +% +\define@key{apscore}{tpScaledCellWidth}% + [\APScore@tp@ScaledCellWidth@def]% + {\def\@APtpScaledCellWidth{#1}} +\define@key{apscore}{tpHighlightBorderColor} + [\APScore@tp@HighlightBorderColor@def]% + {\def\@APtpHighlightBorderColor{#1}} +\def\@APScore{/\APScore@Font\space\APScore@Size\space Tf + \APScore@TextColor\space rg}% +% +\setkeys{apscore}{Font,Size,TextColor,BorderColor,FillColor,% + CellHeight,CellWidth,AutoPlacement,Score,Currency,align,% + tpScaledCellWidth,tpHighlightBorderColor} +% +\def\APScore#1{\convertToSetKeys{apscore}{#1}% + \ifKV@apscore@AutoPlacement + \gdef\@PlaceScoreBoard{\@@PlaceScoreBoard} + \gdef\PlaceScoreBoard##1{% + \message{^^J\expandafter\string\csname APScore\endcsname: + `AutoPlacement: true', the use of \string\PlaceScoreBoard\space + is not valid in this case!^^J^^J}}% + \else + \gdef\@PlaceScoreBoard{\@@@PlaceScoreBoard\@gobble}% + \fi + \gdef\jb@Quad{2}% + \ifx\jb@align\jb@align@left\gdef\jb@Quad{0}% + \else\ifx\jb@align\jb@align@center\gdef\jb@Quad{1}% + \else\ifx\jb@align\jb@align@right\gdef\jb@Quad{2}% + \fi\fi\fi +} +\APScore{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\PlaceScoreBoard} +% A command for the user to place the location of the score board. +% \begin{macrocode} +\def\@@PlaceScoreBoard#1{#1} +\long\def\PlaceScoreBoard#1{\def\@@@PlaceScoreBoard{#1}} +\PlaceScoreBoard{{\centering\vbox{\ScoreBoard}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setTwoPlayerOptions} +% The following are key-value definitions for the two player game +% \begin{macrocode} +\define@key{twoplayerKeys}{player1}[Player 1]{\def\jjg@playeri{#1}} +\define@key{twoplayerKeys}{player2}[Player 2]{\def\jjg@playerii{#1}} +\define@key{twoplayerKeys}{playerFmt}[\sffamily\small]% + {\def\jjg@playerFmt{#1}} +\define@boolkey{twoplayerKeys}{checkbox}[true]{} +\setkeys{twoplayerKeys}{player1,player2,playerFmt,checkbox} +\newcommand{\setTwoPlayerOptions}[1]{% + \convertToSetKeys{twoplayerKeys}{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\Rect#1{\pdf@rect{\textcolor{\@linkcolor}{#1}}} +\def\({\noexpand\(}\def\){\noexpand\)} +\def\Bbox#1#2{% + \vbox to#2{\hbox to#1{\hfill}\vfill}% +} +\def\hmark#1{\hypertarget{#1}{}} +% \end{macrocode} +% \begin{macro}{\bannerTextControl} +% Use \cs{bannerTextControl} to tweak the positioning of the banner text. +% \begin{macrocode} +\newcommand{\bannerTextControl}[1]{#1} +% \end{macrocode} +% \end{macro} +% Construct the running banners +% \begin{macrocode} +\def\jb@Banner#1{\vspace*{-\topskip}\hbox{\rlap{\ifx\fillBanner + \jj@transparent\else\color{\fillBanner}\fi + \setbox0=\hbox{\bannerTextFont\strut}\jb@tmpdimb=\ht0 + \advance\jb@tmpdimb by6pt \jb@tmpdima=\dp0 \advance\jb@tmpdima by4pt + {\ifx\fillBanner\jj@transparent\else + \vrule height\jb@tmpdimb depth\jb@tmpdima width\textwidth\fi}}% + \vbox{\noindent\centering\bannerTextFont\bannerTextColor% + \strut\bannerTextControl{#1}}}\bigskip} +% \end{macrocode} +% +% \subsection{Construct form fields} +% This appearance is the opening face. Show dollar amounts. Clicking +% jumps to the corresponding question. +% \begin{macrocode} +\def\dollarAP{% +{\ifdouble\advance\rownum by\rownum\fi\xdef\@dollarAmt{\the\rownum00}}% +\rlap{\pushButton[% + \H{P}\W{1}\S{S}\DA{\APD@llar}\BC{\APD@llarBorder} + \BG{\APD@llarFill}\CA{\@dollarAmt} + \A{/S/GoTo/D (Q\the\rownum\the\colnum) \jjAdditionalCellJSActions} +]{\the\rownum\the\colnum}{\cellWidth}{\cellHeight}}} +% \end{macrocode} +% This appearance simply says Right! It appears if the user answers the +% question correctly. +% \begin{macrocode} +\def\rightAP{\rlap{\efKern{0pt}{1bp}\pushButton[% + \F{\FHidden}\H{N}\S{S}\BG{}\DA{\@APRight}\CA{\@APRightMsg} +]{\the\rownum\the\colnum R}{\cellWidth}{\cellHeight}}} +% \end{macrocode} +% This appearance simply says Wrong! It appears if the user answers the +% question incorrectly. +% \begin{macrocode} +\def\wrongAP{\rlap{\efKern{0pt}{2bp}\pushButton[% + \F{\FHidden}\H{N}\S{S}\BG{}\DA{\@APWrong}\CA{\@APWrongMsg} +]{\the\rownum\the\colnum W}{\cellWidth}{\cellHeight}}} +% \end{macrocode} +% \begin{macrocode} +\def\jb@nDec{0} +\def\jb@sepStyle{0} +\def\jb@negStyle{0} +\def\jb@currStyle{2} +\def\jb@Currency{""} +\def\jb@bCurrencyPrepend{true} +% \end{macrocode} +% \begin{macro}{\prependCurrency} +% \begin{macro}{\appendCurrency} +% Use these to prepend, the default, or append a currency symbol, if any. These +% will appear in the \cs{ScoreBoard}. +% \begin{macrocode} +\newcommand{\prependCurrency}{\def\jb@bCurrencyPrepend{true}} +\newcommand{\appendCurrency}{\def\jb@bCurrencyPrepend{false}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macro}{\ScoreBoard} +% This is the text field for the score board. In two player mode, there are +% two score boards, and in single player mode, there is only one. +% \begin{macrocode} +\def\AAVAction{event.target.textColor = event.value < 0 ? + "RGB \@APWrongTextColor".split(" ") : + "RGB \@APRightTextColor".split(" ");\r + this.dirty=false;} +\def\AAFAction{AFNumber_Format\(\jb@nDec, \jb@sepStyle, \jb@negStyle, + \jb@currStyle, \jb@Currency, \jb@bCurrencyPrepend\); + event.value = \jb@Score\space + event.value;\r + this.dirty=false;} +\let\jjgplayerihook\@empty +\let\jjgplayeriihook\@empty +\def\ScoreBoard{\ifjjgtwoplayer +\setlength{\@tempdima}{\@APScorecellWidth}% +\setlength{\@tempdima}{% + (\@APScorecellWidth)*\ratio{\@APtpScaledCellWidth\space pt}{1pt}}% +\ifdim\@tempdima<\cellWidth +\@tempdima=\cellWidth\fi + \edef\BboxWidth{\the\@tempdima}% +\setlength{\@tempdima}{\@APScorecellHeight/2-4bp}% + \edef\BboxHeight{\the\@tempdima}% +\ifKV@twoplayerKeys@checkbox +\raisebox{\BboxHeight}{\checkBox[\Ff{\FfReadOnly}% + \textColor{\@APtpHighlightBorderColor\space rg}\BC{}% + \symbolchoice{circle}]{ckboxPlayer0}{10bp}{10bp}{On}}\fi\space +\parbox[t]{\BboxWidth\ifxetex+4bp\fi}{\jjgplayerihook +\textField[% + \H{N}\Q{\jb@Quad}\W{3}\S{I}\BC{\@APScoreBorder}\BG{\@APScoreFill}% + \DA{\@APScore}\autoCenter{n}\AA{\AAValidate{\AAVAction}% + \AAFormat{\AAFAction}}]{Total0}{\BboxWidth\ifxetex-4bp\fi}% + {\@APScorecellHeight\ifxetex-4bp\fi}\\[-3pt] +\makebox[\linewidth][c]{\jjg@playerFmt\jjg@playeri}}\efKern{3pt}{0bp}\space +\parbox[t]{\BboxWidth\ifxetex+4bp\fi}{% +\textField[% + \H{N}\Q{\jb@Quad}\W{3}\S{I}\BC{\@APScoreBorder}\BG{\@APScoreFill}% + \DA{\@APScore}\autoCenter{n}\AA{\AAValidate{\AAVAction}% + \AAFormat{\AAFAction}}% +]{Total1}{\BboxWidth\ifxetex-4bp\fi}% + {\@APScorecellHeight\ifxetex-4bp\fi}\jjgplayeriihook\\[-3pt] +\makebox[\linewidth][c]{\jjg@playerFmt\jjg@playerii}} +\ifKV@twoplayerKeys@checkbox +\raisebox{\BboxHeight}{\checkBox[\Ff{\FfReadOnly}% + \textColor{\@APtpHighlightBorderColor\space rg}\BC{}% + \symbolchoice{circle}]{ckboxPlayer1}{10bp}{10bp}{On}}\fi +\else\efKern{0pt}{-3bp}\textField[% + \H{N}\Q{\jb@Quad}\W{3}\S{I}\BC{\@APScoreBorder}% + \BG{\@APScoreFill}\DA{\@APScore}\autoCenter{n}% + \AA{\AAValidate{\AAVAction}\AAFormat{\AAFAction}}% +]{Total}{\@APScorecellWidth\ifxetex-4bp\fi}% + {\@APScorecellHeight\ifxetex-4bp\fi}% +\fi} +% \end{macrocode} +% \end{macro} +% The pdf contents of a number rectangle: Three widgets superimposed +% \begin{macrocode} +\def\cell{\global\advance\colnum1 \ifnum\colnum>\numCategories + \global\colnum=1 \global\advance\rownum1 \fi + \moveleft.5\cellWidth\hbox{\efKern{0pt}{-1bp}\dollarAP + \efKern{0pt}{-1bp}\rightAP\efKern{0pt}{-1bp}\wrongAP}}% +% \end{macrocode} +% This provides the background color behind the banner +% \begin{macrocode} +\def\bgb{\ifxetex\rule{0pt}{\cellHeight+.6bp}\smash{\PoohBahBanner}\else + \PoohBahBanner\fi\smash{\rlap{\ifx\fillBanner\jj@transparent\else + \ifxetex\setlength{\tablewidth}{\tablewidth}% + \setlength{\cellHeight}{\cellHeight\ifxetex+.4pt\fi}\fi + \color{\fillBanner}{\vrule width\tablewidth height\cellHeight}\fi}}} +% \end{macrocode} +% This provides the background color behind the number board. +% \begin{macrocode} +\def\bgc{\smash{\rlap{{\ifx\fillCells\jj@transparent\else + \color{\fillCells}\vrule width\tablewidth height\cellHeight\fi}}}} +% \end{macrocode} +% The hidden banner set by \cs{APHidden} with the final message for the +% contestant attaining the goal. +% \begin{macrocode} +\def\PoohBahBanner{\rlap{\ifxetex\advance\tablewidth-6bp\else + \advance\tablewidth-2bp\hskip1bp\fi +\textField[% + \Q{1}\autoCenter{n}\F{\FHidden}\W{3}\S{I}\BC{\APHidd@nBorder}% + \BG{\APHidd@nFill}\DA{\APHidd@n}% + \DV{\jb@Champion}\V{\jb@Champion}% +]{GrandPoohbah}{\tablewidth}{\cellHeight}}} +% \end{macrocode} +% \begin{macrocode} +\def\forpbx#1{\vbox to\cellHeight{% + \hsize=\cellWidth\centering\vfill\strut\ifx\textBoard\jj@transparent + \else\color{\textBoard}\fi#1\strut\vfill}} +\def\gameCategories{% + \jb@n=0 + \jb@rowtoks={\bgb}% + \loop\ifnum\jb@n<\numCategories\advance\jb@n by1 + \jb@tmptoks=\expandafter{% + \expandafter&\csname Category\the\jb@n\endcsname&}% + \edef\jb@temp{\the\jb@rowtoks\the\jb@tmptoks}% + \jb@rowtoks=\expandafter{\jb@temp}% + \repeat + \edef\jb@temp{\the\jb@rowtoks}% + \jb@rowtoks=\expandafter{\jb@temp\cr\\ }% +\the\jb@rowtoks} + +% Hack a loop structure so I can do a double loop +\long\def\oloop #1\orepeat{% + \def\oiterate{#1\relax % Extra \relax + \expandafter\oiterate\fi}% + \oiterate + \let\outeriterate\relax +} +\let\orepeat=\fi +% \end{macrocode} +% \begin{macrocode} +\def\gamebody{% + \jb@rowtoks={}% + \jb@m=\numQuestions + \edef\jb@temp{}% + \oloop\advance\jb@m-1\ifnum\jb@m>0 + \getrow + \orepeat + \the\jb@rowtoks} +% \end{macrocode} +% \begin{macrocode} +\def\getrow{% + \jb@n=\numCategories + \edef\jb@temp{\the\jb@rowtoks}% + \jb@rowtoks=\expandafter{\jb@temp\bgc}% + \loop\advance\jb@n-1\ifnum\jb@n>0 + \edef\jb@temp{\the\jb@rowtoks}% + \jb@rowtoks=\expandafter{\jb@temp&\cell&}% + \repeat + \edef\jb@temp{\the\jb@rowtoks}% + \jb@rowtoks=\expandafter{\jb@temp\cr\\ }% +} +% \end{macrocode} +% \subsection{Construct Game Board} +% The \cs{GameBoard} is as the name suggests is the game board. We set up a +% tabular environment, then insert the \cs{gameCategories}, followed by +% the \cs{gamebody}. +% \begin{macrocode} +\def\GameBoard{\vspace*{-\topskip}% +\begingroup + % set up \halign environment + \tabskip0pt\offinterlineskip\parskip0pt\parindent0pt + \def\\{\noalign{\hrule height\rulewidth}}% + \hbox to\textwidth\bgroup\hfill + \vbox\bgroup\hsize=\tablewidth\hmark{GameBoard}% + \halign{##\vrule width\rulewidth + &&\hbox to\cellWidth{\hss\vbox to\cellHeight{\vss##\vss}\hss}% + &\vrule width\rulewidth##\cr\noalign{\hrule height\rulewidth}% + % Begin entering data into the different cells + \gameCategories + \gamebody + }% + \egroup\hfill + \egroup +\endgroup\ifxetex\ifjjgtwoplayer\kern-1bp\else + \kern2bp\fi\fi +% \end{macrocode} +% Insert ScoreBoard +% \begin{macrocode} +\@PlaceScoreBoard{{\centering\vbox{\ScoreBoard}}}% +\par\JJ@afterGameBoardInsertion} +\let\JJ@afterGameBoardInsertion\@empty +% \end{macrocode} +% \begin{macro}{\afterGameBoardInsertion} +% Use this command to insert material below the score board (hence below the game board). +% \begin{macrocode} +\newcommand{\afterGameBoardInsertion}[1]{% + \def\JJ@afterGameBoardInsertion{#1}} +% \end{macrocode} +% \end{macro} +% +% \subsection{Begin Asking Questions} +% +% \begin{environment}{instructions} +% The Instructions on first page. +% \begin{macrocode} +\def\instructions +{% + \instructionPageTemplate + \ifx\fillInstructions\jj@transparent\else + \textBgColor{\fillInstructions}\fi + \jb@Banner{\@titleBanner}\par\parskip6pt +} +\def\endinstructions{\newpage} +% \end{macrocode} +% \end{environment} +% \begin{macrocode} +\let\Question\relax +% \end{macrocode} +% \begin{environment}{Questions} +% The \texttt{Questions} environment contains the \texttt{Category} environment +% which, in turn, contains the \texttt{Questions} environments. +% \begin{macrocode} +\def\Questions{\newpage\parskip0pt\relax\global\jb@n=0\relax + \gameboardPageTemplate + \ifx\fillGameBoard\jj@transparent\else + \textBgColor{\fillGameBoard}\fi\GameBoard + \newpage\ifx\fillQuestions\jj@transparent\else + \textBgColor{\fillQuestions}\fi + \rownum=0 \colnum=1 % initialize counters + \questionPagesTemplate +} +\def\endQuestions{% + \ifnum\jb@n=\numCategories\else + \typeout{Number of categories is not correct!} + \fi + \newpage} +% \end{macrocode} +% \end{environment} +% \begin{environment}{Category} +% The \texttt{Category} environment is nested within the \texttt{Questions} environment. +% \begin{macrocode} +\def\Category#1{ + \def\currentCategory{#1}\global\advance\jb@n by1 \global\jb@m=0 + \ifdebug + \typeout{^^JBegin Processing Category \the\jb@n: \currentCategory} + \typeout{If '\currentCategory' is different from} + \typeout{'\csname category\the\jb@n\endcsname', + then your categories are out of order!} + \fi} +\def\endCategory{ + \ifdebug + \ifnum\jb@m=\numQuestions + \else + \typeout{In the '\currentCategory' category, + the number of questions is not correct!} + \fi + \typeout{End Processing Category \the\jb@n: + \the\jb@m\space of \the\numQuestions\space Questions} + \fi +} +% \end{macrocode} +% \end{environment} +% \begin{macrocode} +\let\jjAdditionalJSActions\@empty +\def\jjAdditionalCellJSActions{\Next{\JS{% + var pushCell\the\rownum\the\colnum = true;\r + makeNameReadOnly();}}} +\let\bJJGInsertLayer\@empty +\let\eJJGInsertLayer\@empty +% \end{macrocode} +% \begin{macro}{\theCurrencyAmt} +% \begin{macrocode} +\def\theCurrencyAmt{{\count0=\the\rownum00\relax + \multiply\count0by\scaleFactor\relax\the\count0\relax}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\aboveCurrencySkip} +% \begin{macrocode} +\def\aboveCurrencySkip#1{\def\jj@aboveCurrencySkip{#1}} +\aboveCurrencySkip{0pt} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\currencyHeading} +% \begin{macrocode} +\newcommand{\currencyHeading}[1]{\def\jj@currencyHeading{#1}} +\currencyHeading{\bfseries For~\$\theCurrencyAmt:} +% \end{macrocode} +% \end{macro} +% \begin{environment}{Question} +% The environment for posing a question. It must appear within a \texttt{Category} environment. +% \begin{macrocode} +\def\Question{\newpage\global\advance\jb@m by1 + \global\advance\rownum1 \ifnum\rownum>\numQuestions \global\rownum=1 + \global\advance\colnum1 \fi + \global\advance\corMsgnum1 \ifnum\corMsgnum=8 \global\corMsgnum=1 \fi + \edef\peekingOpenAction{\ifjjnopeeking/H true/S/Hide% + /T (\the\rownum\the\colnum)\else\JS{;}\fi}% + \ifcase\thejjgdriver + \immediate\pdfobj{<< /O << + \peekingOpenAction\space\jjAdditionalJSActions >> >> } + \edef\ThisPage{/AA \the\pdflastobj\space 0 R} + \global\pdfpageattr=\expandafter{\ThisPage}% + \or + \literalps@out{% + [ {ThisPage} << /AA << /O << + \peekingOpenAction\space\jjAdditionalJSActions >> >> >> + /PUT pdfmark}% + \or + \@pdfm@mark{put @thispage << /AA << /O << + \peekingOpenAction\space\jjAdditionalJSActions >> >> >>}% + \fi + \jb@Banner{\csname category\the\colnum\endcsname}% + \begingroup + \vskip\jj@aboveCurrencySkip + \parskip2pt + \setcounter{newletter}{0}% + \hmark{Q\the\rownum\the\colnum}\bJJGInsertLayer% + \@ifnextchar[% + {\let\Ans\Question@tabular\def\endQuestion{\end{tabular}% + \eJJGInsertLayer\endgroup\newpage}\getBracArg}% + {\let\Ans\Question@list\def\jb@numCols{1}\gdef\aeb@numCols{1}% + \noindent\textcolor{\dollarColor}{\jj@currencyHeading}\space + \ignorespaces% + \def\endQuestion{\end{list}\eJJGInsertLayer\endgroup\newpage}}% +} +% \end{macrocode} +% \end{environment} +% \begin{macrocode} +\def\getBracArg[#1]{\def\jb@numCols{#1}\gdef\aeb@numCols{#1}\noindent% + \textcolor{\dollarColor}{\jj@currencyHeading}\space\ignorespaces} +% \end{macrocode} +% \cs{jjgtmplength} is a scratch length register that can be used to calculate lengths. +% \begin{macrocode} +\newlength{\jjgtmplength} +% \end{macrocode} +% \begin{macrocode} +\newlength\jb@width \settowidth{\jb@width}{\normalfont(d)} +\newdimen\jb@tmpdima +\newlength\jb@tmplength +\providecommand\PBS[1]{\let\jb@temp=\\#1\let\\=\jb@temp} +\def\makelink#1{% +\setLink[\A{\JS{qbrespond(#1,\the\rownum,\the\colnum);} + \Next{/S/GoTo/D (GameBoard)}} + ]{\makebox[\jb@width]{\normalfont(\hfil\alph{newletter}\hfil)\hfill}}} +% \end{macrocode} +% \begin{macro}{\setMClabelsep} +% \changes{v3.0}{2006/18/06} +% { +% Added control over the separation between the MC label and subsequent text: +% \cs{setMClabelsep} and \cs{resetMClabelsep}. +% } +% \begin{macro}{\resetMClabelsep} +% \begin{macro}{\eq@hspanner} +% \begin{macro}{\eq@hspanner@default} +% Added control over the separation between the MC label and subsequent text: +% \cs{setMClabelsep} and \cs{resetMClabelsep}. +% \begin{macrocode} +\def\eq@hspanner{\ } +\def\eq@hspanner@default{\ } +\def\eq@lw@l{\eq@l@l\eq@hspanner} +\def\setMClabelsep#1{\def\eq@hspanner{#1}} +\def\resetMClabelsep{\let\eq@hspanner\eq@hspanner@default} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macrocode} +\newskip\aboveanswersSkip +\setlength\aboveanswersSkip{3pt} +\def\Question@list{\vskip\aboveanswersSkip +\begin{list}{}% +{\usecounter{newletter} + \let\Ans=\JJ@Ans@list + \settowidth{\jb@tmplength}{\normalfont(d)}% + \settowidth{\labelwidth}{\normalfont(d)\eq@hspanner}% + \setlength{\parsep}{0pt}\setlength{\itemindent}{0pt}% + \setlength{\listparindent}{\parindent}% + \setlength{\leftmargin}{\labelwidth}% + \setlength{\labelsep}{0pt}% +}\Ans}% +\def\JJ@Ans@list#1{\stepcounter{newletter}\item[\makelink{#1}\hfill]}% + +\def\Question@tabular{% + \vskip\aboveanswersSkip + \setcounter{newletter}{0}% + \let\Ans=\JJ@Ans@tabular + \jb@tmpdima=\linewidth \divide\jb@tmpdima by\jb@numCols + \vskip\partopsep + \noindent\normalbaselines\tabcolsep=0pt + \begin{tabular}{*{\jb@numCols}{p{\jb@tmpdima}}}% +\Ans} +\def\JJ@Ans@tabular#1{\leavevmode\stepcounter{newletter}% + \PBS\raggedright + \settowidth{\jb@tmplength}{\normalfont(d)\eq@hspanner}% + \hangindent=\jb@tmplength\hangafter=1 % + \makelink{#1}\eq@hspanner\ignorespaces +} +% \end{macrocode} +% \begin{environment}{oAnswer} +% If \textsf{exerquiz} is input, then you can pose fill in questions. Enclose +% the standard exerquiz fill in commands \cs{RespBoxMath} and \cs{RespBoxTxt} +% \begin{macrocode} +\newenvironment{oAnswer} +{% + \gdef\oField{oQ\the\rownum\the\colnum}% + \gdef\curr@quiz{oQ\the\rownum\the\colnum}% + \def\currQuiz{oQ\the\rownum\the\colnum}% + \let\@qzsolndest\@empty + \stepcounter{questionno}% + \let\eqQuizType=s\gdef\eqPTs{1}\global\let\eqQT=\eq@na + \let\solution=\solution@sq + \let\endsolution=\endsolution@sq + \global\let\Ans=\Question@list +% \end{macrocode} +% \changes{v3.1}{2016/11/23}{Added \string\cs{sq@IDTxtField} to conform to new exerquiz standards} +% (2016/11/23) Added \cs{sq@IDTxtField} to conform to new \textsf{exerquiz} standards. +% \begin{macrocode} + \gdef\endQuestion{\endgroup\newpage}\sq@IDTxtField +}{} +% \end{macrocode} +% \end{environment} +% We need to redefine the action of \cs{RespBoxMath} and \cs{RespBoxTxt} so they behave like you +% would expect with \texttt{jj\_game}. +% \begin{macrocode} +\def\JJ@@RespBoxMathActions +{% + \AA{\AAKeystroke{if(event.willCommit) {\r\t + var retn = \processJSfunc(\rbArgs,\compareJSfunc);\r + if ( retn != null ) {\r\t + qbrespond(retn,\the\rownum,\the\colnum)\r\t + this.gotoNamedDest("GameBoard");\r + } + }}% + \AAFormat{\eqFormatArg}% + \AAOnFocus{\JS{var retn = null;}}% + } +} +\def\JJ@@RespBoxTxtActions +{% + \AA{\AAKeystroke{if(event.willCommit) {\r\t + retn = ProcRespTxt(\rbTxtAlt);\r + if ( retn != null ) {\r\t + qbrespond(retn,\the\rownum,\the\colnum)\r\t + this.gotoNamedDest("GameBoard");\r + } + }}% + \AAOnFocus{\JS{var retn = null;}} + }% +} +\def\redefineRespBoxActions{% + \let\@@RespBoxMathActions\JJ@@RespBoxMathActions + \let\@@RespBoxTxtActions\JJ@@RespBoxTxtActions} +% \end{macrocode} +% \begin{macro}{\gameboardPrintButton} +% \begin{macro}{\printButtonEOL} +% \begin{macro}{\printButtonCaption} +% \begin{macro}{\printButtonLabel} +% \begin{macro}{\contestantNameLabel} +% \begin{macro}{\timestampLabel} +% We define a button to print the game board page, and a lot of +% helper commands that allow the author to this button field. +% \begin{macrocode} +\newcommand{\printButtonCaption}[1]{\def\jj@printButtonCaption{#1}} +\printButtonCaption{Print} +\newcommand{\printButtonLabel}[1]{\def\jj@printButtonLabel{#1}} +\printButtonLabel{Print this page:} +\newcommand{\contestantNameLabel}[1]{\def\jjg@contestantNameLabel{#1}} +\contestantNameLabel{Student:} +\newcommand{\timestampLabel}[1]{\def\jjg@timestampLabel{#1}} +\timestampLabel{Time stamp:} +\newcommand{\printButtonEOL}[1]{\def\jjg@printButtonEOL{#1}} +\printButtonEOL{\\[1ex]} +\newcommand{\gameboardPrintButton}[1][] +{% + \jj@printButtonLabel\space\pushButton[\CA{\jj@printButtonCaption} + \A{\JS{% + var pp = this.getPrintParams();\r + pp.firstPage=this.pageNum;\r + pp.lastPage=this.pageNum;\r + pp.pageHandling = pp.constants.handling.shrink;\r + var fv = pp.constants.flagValues;\r + pp.flags |= (fv.suppressCenter | fv.suppressRotate);\r + this.print(pp);}}#1]{printit}{}{11bp}\quad + \jjg@contestantNameLabel\space\textField[\BC{}\Ff\FfReadOnly + ]{jjContestantNameprint}{1.5in}{11bp}\jjg@printButtonEOL + \jjg@timestampLabel\space\textField[\BC{}\Ff\FfReadOnly + ]{timestamp}{1.5in}{11bp}% +}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\contestantName} +% A convenience macro that can be used to enter the contestant's name. +% \begin{macrocode} +\newcommand{\contestantName}[3][\BC{}\AA{\AAKeystroke{% + if ( event.willCommit ) {\r\t + var f = this.getField("jjContestantNameprint");\r\t + if ( f != null ) f.value = event.value;\r + } + }}]{\textField[#1]{jjContestantName}{#2}{#3}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\timeStampFormat} +% The format for the time stamp. The format is that of the formatting string for the +% Acrobat JavaScript method \texttt{util.printd()}. +% \begin{macrocode} +\newcommand{\timeStampFormat}[1]{\def\jjTimeStampFormat{#1}} +\timeStampFormat{mm-dd-yy, H:MM:ss.} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\AtBeginDocument{\redefineRespBoxActions} +% \end{macrocode} +% \begin{macro}{\enterNamePlease} +% When the forcredit option is used, an alert box opens when the contestant +% did not sign in. This is the message presented on that box. +% \begin{macrocode} +\newcommand{\enterNamePlease}[1]{\def\jjEnterNamePlease{#1}} +\enterNamePlease{Please, enter your name on the first + page before you begin the game!} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\defineInstructionPageGraphic} +% \begin{macro}{\defineGameboardPageGraphic} +% \begin{macro}{\defineQuestionPagesGraphic} +% Convenience commands for inserting graphics backgrounds on the instructions page, +% the game board page and on the question pages. The single parameter is the basename +% of a graphic file supported by the driver. +% \begin{macrocode} +\let\jjInstructionPageBG\relax +\let\jjGameBoardPageBG\relax +\let\jjQuestionPagesBG\relax +\newcommand{\defineInstructionPageGraphic}[1]{% + \def\jjInstructionPageBG{#1}} +\newcommand{\defineGameboardPageGraphic}[1]{\def\jjGameBoardPageBG{#1}} +\newcommand{\defineQuestionPagesGraphic}[1]{\def\jjQuestionPagesBG{#1}} +\newcommand{\instructionPageTemplate}{% + \@ifundefined{jjInstructionPageBG}{}{% + \edef\expand@templatename{\noexpand\template{\jjInstructionPageBG}}% + \expand@templatename}} +\newcommand{\gameboardPageTemplate}{% + \@ifundefined{jjGameBoardPageBG}{}{% + \edef\expand@templatename{\noexpand\template{\jjGameBoardPageBG}}% + \expand@templatename}} +\newcommand{\questionPagesTemplate}{% + \@ifundefined{jjQuestionPagesBG}{}{% + \edef\expand@templatename{\noexpand\template{\jjQuestionPagesBG}}% + \expand@templatename}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\illegalAccessMsg} +% \begin{macro}{\illegalAnswerTwiceMsg} +% Messages that appear in alert boxes when contestant acts illegally. +% \begin{macrocode} +\newcommand{\illegalAccessMsg}[1]{\def\jjIllegalAccessMsg{#1}} +\illegalAccessMsg{You are peeking at this question. + Choose a question from the game board first! + You may want to start the game over now!} +\newcommand{\illegalAnswerTwiceMsg}[1]{\def\jjIllegalAnswerTwiceMsg{#1}} +\illegalAnswerTwiceMsg{Changing your answer is not allowed!} +\newcommand{\playeriWinnerMsg}[1]{\def\jjplayeriWinner{#1}} +\playeriWinnerMsg{\jjg@playeri\space is the winner!} +\newcommand{\playeriiWinnerMsg}[1]{\def\jjplayeriiWinner{#1}} +\playeriiWinnerMsg{\jjg@playerii\space is the winner!} +\newcommand{\gameTiedMsg}[1]{\def\jjgameTied{#1}} +\gameTiedMsg{It is all tied up! You are equally matched!} +\newcommand{\bothLosersMsg}[1]{\def\jjbothlosers{#1}} +\bothLosersMsg{You two either are not trying, or + you do not know anything about the subject!} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \section{JavaScript Support} +% \begin{macrocode} +\begin{insDLJS*}[qbrespond]{jjgdljs} +\begin{newsegment}{JJG: JavaScript to Control Jeopardy} +var _processLink=true; +var twoplayerGame=\twoplayerGame; +var whichPlayer=0; +if ( twoplayerGame ) { + var reTrimSpaces=/^\s+|\s+$/g; + var reInsertCommas=/\b\s+\b|\b\s+(?=\.)/g; + var tpHighlightBorderColor="\@APtpHighlightBorderColor"; + var hightLightColor=% + tpHighlightBorderColor.replace(reTrimSpaces,"").% +replace(reInsertCommas,","); + var aHighlightColor = ("RGB,"+hightLightColor).split(","); + this.getField("Total"+whichPlayer).strokeColor=% +aHighlightColor; + var ckBx = this.getField("ckboxPlayer"+whichPlayer); + if ( ckBx != null ) % +this.getField("ckboxPlayer"+whichPlayer).checkThisBox(0,true); + this.dirty=false; +} +function qbrespond(ans,row,col) +{ + if (_processLink) { + \ifjjnopeeking\else this.getField(""+row+col).hidden=true;\fi + if ( eval("typeof pushCell"+row+col) == "undefined") { + app.alert("\jjIllegalAccessMsg"); + return null; + } + if ( twoplayerGame ) + var Total = this.getField("Total"+whichPlayer); + else + var Total = this.getField("Total"); + var p = numQuestions*(col-1)+row-1; + if (QAed.charAt(p)==0) + { + QAed = QAed.substring(0,p)+1+% + QAed.substring(p+1,totalQuestions); + if (ans==1) + { + this.getField(""+row+col+'R').hidden=false; + Total.value += \scaleFactor*row*100; + app.alert(aCM[nCM],3); + if (++nCM > 6) nCM=0; + } + else + { + this.getField(""+row+col+'W').hidden=false; + var f = this.getField(""+row+col) + Total.value -= \scaleFactor*row*100; + app.alert(aEM[nEM],3); + if (++nEM > 6) nEM=0; + } +% \end{macrocode} +% 11/13/08. After we process this question, we hide the layer containing +% the question, and reset \texttt{pushCell+row+col} to \texttt{undefined} so the layer +% will not be made visible again by the open page action. +% \begin{macrocode} + if ( typeof toggleSetThisLayer == "function" ) { + toggleSetThisLayer("q"+row+col,false); + eval("pushCell"+row+col+"=undefined"); + } + if ( twoplayerGame ) { + this.getField("Total"+whichPlayer).strokeColor=["G",0] + var ckBx = this.getField("ckboxPlayer"+whichPlayer); + if (ckBx != null ) % +this.getField("ckboxPlayer"+whichPlayer).checkThisBox(0,false); + whichPlayer = ( whichPlayer+1) \% 2; + this.getField("Total"+whichPlayer).strokeColor=% +aHighlightColor; + ckBx = this.getField("ckboxPlayer"+whichPlayer); + if (ckBx != null ) % +this.getField("ckboxPlayer"+whichPlayer).checkThisBox(0,true); + + } +% \end{macrocode} +% The end of the game. We see if the GraphPoobah has been reached, if a two person +% game we indicate who has won. +% \begin{macrocode} + if ( ++NumQAed>=totalQuestions ) { + if (Total.value>=Goal) + this.getField("GrandPoohbah").hidden=false; + if ( twoplayerGame ) { + var player0 = this.getField("Total0"); + var player1 = this.getField("Total1"); + var player0Score = Number(player0.value); + var player1Score = Number(player1.value); + if ( player0Score > player1Score ) { + if ( player0Score <= 0 ) { + player0.strokeColor = ["RGB", 1, 0, 0]; + player1.strokeColor = ["RGB", 1, 0, 0]; + var timer=app.setTimeOut( + 'app.alert("\jjbothlosers")',250); + } else { + player0.strokeColor = ["RGB", 0, .6, 0]; + player1.strokeColor = ["G",0]; + var timer=app.setTimeOut( + 'app.alert("\jjplayeriWinner")',250); + } + } + else if ( player1Score > player0Score ) { + if ( player1Score <= 0 ) { + player0.strokeColor = ["RGB", 1, 0, 0]; + player1.strokeColor = ["RGB", 1, 0, 0]; + var timer=app.setTimeOut( + 'app.alert("\jjbothlosers")',250); + } else { + player1.strokeColor = ["RGB", 0, .6, 0]; + player0.strokeColor = ["G",0]; + var timer=app.setTimeOut( + 'app.alert("\jjplayeriiWinner")',250); + } + } + else { + if ( player1Score <= 0 ) { + player0.strokeColor = ["RGB", 1, 0, 0]; + player1.strokeColor = ["RGB", 1, 0, 0]; + var timer=app.setTimeOut( + 'app.alert("\jjbothlosers")',250); + } else { + player0.strokeColor = ["RGB", 0, 0, 1]; + player1.strokeColor = ["RGB", 0, 0, 1]; + var timer=app.setTimeOut( + 'app.alert("\jjgameTied")',250); + } + } + } + } + } + else + app.alert("\jjIllegalAnswerTwiceMsg"); + } + this.dirty=false; +} +var tsfield = this.getField("timestamp"); +if ( tsfield != null ) + tsfield.value = util.printd("\jjTimeStampFormat", new Date()); +this.dirty=false; +function makeNameReadOnly() +{ + var f = this.getField("jjContestantName"); + if ( (f != null) && !f.readonly ) f.readonly=true; + this.dirty=false; +} +\end{newsegment} +\begin{newsegment}{JJG: Global Variables} +var numQuestions = \the\numQuestions; +var numCategories = \the\numCategories; +var Goal = \Goal; +var totalQuestions = numQuestions * numCategories; +var QAed = ""; +for (var i=0; i< totalQuestions; i++) QAed +="0"; +var nEM = 0; +var nCM = 0; +var NumQAed = 0; +this.dirty=false; +\end{newsegment} +\begin{JJLangEnglish} +\begin{newsegment}{JJG: Arrays for Jeopardy for English} +var aCM = new Array +( + "That's Right! Way to go, Kiddo!", + "Wonderfully Done! Congrats!", + "Very Good! Keep up the good work!", + "Good, good, good, good!", + "Gee, you're smart! Try a harder one!", + "You're pretty sharp! Continuez, s'il vous pla\356t!", + "You're the tops! But wait...try another." +) +var aEM = new Array +( + "That's wrong! Sorry. Try Again.", + "Error again. Don't guess, I'm watching!", + "Please! Please! Work it out first!", + "An error has insinuated itself into your calculations.\n" + +"Recalibrate your thinking!", + "Bah! Humbug! You're haunted by Errors!", + "Try again. This time with order and method.", + "Wrong again! Use your little gray cells!" +) +this.dirty=false; +\end{newsegment} +\end{JJLangEnglish} +\begin{JJLangGerman} +\begin{newsegment}{JJG: Arrays for Jeopardy for German} +var aCM = new Array +( + "Richtig! So ist's recht!", + "Gut gemacht! Gratuliere!", + "Sehr gut! Weiter so!", + "Gut, gut, gut, gut!", + "Du bist sehr clever! Jetzt versuch mal eine Schwierigere!", + "Jawoll! Continuez, s'il vous pla\356t!", + "Spitze! Auf geht's, zu einer weiteren Aufgabe!" +) +var aEM = new Array +( + "Leider falsch!", + "Schon wieder falsch! Nicht raten!", + "Bitte denk erst nach bevor Du auf die Antwort klickst!", + "Ein Fehler hat sich eingeschlichen. Erst denken, dann ...!", + "Ohje! So ein Quatsch!", + "Versuch's nochmal. Es ist noch nicht aller Tage Abend.", + "Schon wieder falsch! Nutz Deine kleine grauen Zellen!" +) +this.dirty=false; +\end{newsegment} +\end{JJLangGerman} +\begin{JJForCredit} +\begin{newsegment}{JJG: JS to support forcredit} +var noNameError, fname; +function forCreditClosePage() +{ + fname = this.getField("jjContestantName"); + if ( fname != null ) { + var JJjsCode = "if ( fname.value.replace(/\s*/g, '') == '' ) {" + + " if ( typeof closingJJ == 'undefined' ) {" + + " app.alert({cMsg: '\jjEnterNamePlease', % +cTitle: 'AcroTeX eDucation Bundle'});" + + " this.pageNum = 0;" + + " } } else { fname.readonly = true; }"; + noNameError = app.setTimeOut(JJjsCode, 15); + } + this.dirty=false; +} +\end{newsegment} +\end{JJForCredit} +\end{insDLJS*} +% \end{macrocode} +% \begin{macrocode} +\AtEndOfClass{\thisPageAction{\JS{this.dirty=false;}}{}} +% +%<*jjgpro> +\def\noPrintLayer#1{% + \literalps@out{/Print [/Print] [(xb.#1)] AddASEvent}% + \literalps@out{(xb.#1) << +/Print<< /PrintState/OFF >> >> SetOCGUsage}% +} +\def\bJJGInsertLayer{\xBld{q\the\rownum\the\colnum}} +\def\eJJGInsertLayer{\eBld\noPrintLayer{q\the\rownum\the\colnum}} +\def\jjAdditionalJSActions{/Next <<\JS{% + if ( typeof pushCell\the\rownum\the\colnum\space!= "undefined") + toggleSetThisLayer("q\the\rownum\the\colnum",true);}>>} +\begin{execJS}{lockocgs} +var o = this.getOCGs(); +for (var i = 0; i < o.length; i++) + o[i].locked = true; +\end{execJS} +% +%<*jjsecurity> +\begin{willClose} +var closingJJ = true; +\end{willClose} +\begin{addJSToPageClose} +forCreditClosePage(); +\end{addJSToPageClose} +% +%<*package> +% +% \end{macrocode} +% \Finale +\endinput diff --git a/texmf-dist/source/latex/jj-game/jj_game.ins b/texmf-dist/source/latex/jj-game/jj_game.ins new file mode 100644 index 00000000..ea3b11bd --- /dev/null +++ b/texmf-dist/source/latex/jj-game/jj_game.ins @@ -0,0 +1,63 @@ +%% +%% 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-2000 D. P. Story +%% +%% This file is part of the `JJ_Game Class'. +%% ------------------------------------------- +%% +%% 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{2000/01/22} +\def\batchfile{jj_game.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 +%\askonceonly +%\usedir{tex/latex/hyperref} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\preamble +\endpreamble + +\generate{% + \file{jj_game.cls}{\from{jj_game.dtx}{package}} + \file{jjgpro.def}{\from{jj_game.dtx}{copyright,jjgpro}} + \file{jjcredit.def}{\from{jj_game.dtx}{copyright,jjsecurity}} + \file{jj_game.drv}{\from{jj_game.dtx}{driver}} +} + +\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 -- cgit v1.2.3