diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/webquiz |
Initial commit
Diffstat (limited to 'macros/latex/contrib/webquiz')
134 files changed, 9505 insertions, 0 deletions
diff --git a/macros/latex/contrib/webquiz/README b/macros/latex/contrib/webquiz/README new file mode 120000 index 0000000000..92cacd2853 --- /dev/null +++ b/macros/latex/contrib/webquiz/README @@ -0,0 +1 @@ +README.rst
\ No newline at end of file diff --git a/macros/latex/contrib/webquiz/README.rst b/macros/latex/contrib/webquiz/README.rst new file mode 100644 index 0000000000..dd8efda77e --- /dev/null +++ b/macros/latex/contrib/webquiz/README.rst @@ -0,0 +1,168 @@ +==================================================== +WebQuiz: a LaTeX_ package for writing online quizzes +==================================================== + +WebQuiz_ makes it possible to use LaTeX_ to write interactive online quizzes. +The quizzes are first written in LaTeX_ and then converted into HTML using +WebQuiz_, which is written in python. The conversion from LaTeX_ to HTML is +done behind the scenes using TeX4ht_. The idea is that you should be able to +produce nice online quizzes using WebQuiz_ and basic knowledge of LaTeX_. + +WebQuiz_ is designed to be used from the command-line. For example, if +`quiz1.tex` is a LaTeX file for a quiz then: + +:`latex quiz1`: + produces a "readable" DVI file for the quiz +:`pdflatex quiz1`: + produces a "readable" PDF file for the quiz +:`webquiz quiz1`: + creates the web page `quiz1.html` + +If you prefer to use LaTeX_ from a GUI for LaTeX_ then it should be possible to +configure it to use WebQuiz_ directly. As an example, the manual provides some +details about how to do this for TeXShop. + +Usage +----- + +usage: webquiz [-h] [-q] [-d] [-s] [--latex | -l | -x] [-r RCFILE] + [-i | -e | --settings [SETTINGS]] + [quiz_file [quiz_file ...]] + +A LaTeX package for writing online quizzes + +positional arguments: + quiz_file latex quiz files + +optional arguments: + -h, --help show this help message and exit + -q, --quiet Suppress tex4ht messages (also -qq etc) + -d, --draft Use make4ht draft mode + -s, --shell-escape Shell escape for tex4ht/make4ht + --latex Use latex to compile document with make4ht (default) + -l, --lua Use lualatex to compile the quiz + -x, --xelatex Use xelatex to compile the quiz + -r RCFILE, --rcfile RCFILE + Specify location of the webquiz rc-file + -i, --initialise, --initialize + Install web components of webquiz + -e, --edit-settings Edit default settings for webquiz + --settings <SETTINGS> + List default settings for webquiz + +Installation +------------ +To use WebQuiz_ you need to have a standard LaTeX_ distribution installed, such as TeXLive_, that includes TeX4ht_. In addition, you need to have Python3_ installed. As WebQuiz_ uses scalable vector graphics (SVG) you should check that all of the dependencies of dvisvgm_ are installed on your system, especially if you plan on using graphics or images. + +Once the TeX components of WebQuiz_ package have been installed you can install the web components of WebQuiz_ using the following command, which needs to be run from the command line: + +> webquiz --initialise + +If you want to install the web components of WebQuiz_ into a system directory then you need to run this command from an administrators account, so using `sudo` on a unix-like system. For more details about the installation and configuration of WebQuiz_ please see Section 3.2 of the WebQuiz_ manual. + +Please see the manual for more details about initialising and using WebQuiz_. + +Installation from the ctan zipfile +---------------------------------- +On both unix-like systems (including macosx), and windows systems (using +either TeXLive or MiKTeX), you can install WebQuiz by downloading the +WebQuiz zip file from: + + http://mirrors.ctan.org/macros/latex/contrib/webquiz.zip + +To install the package, unzip this file and change directory to the +webquiz/scripts subdirectory run: + +> webquiz --tex-install + +(or webquiz.bat --text-install on windows). This commands unpacks the webquiz +files into their standard locations in the TeX install tree to it should be +run from an administrators account, or using sudo on a unix-like system. +Roughly what this command does is the following: + +- It creates a symbolic link, or equivalent, to the main WebQuiz executable, + which is the file webquiz.py in the scripts directory +- Copies the latex directory to somewhere in the TeX search path and then + runs `mktexlsr` so that LaTeX and WebQuiz can find these files. +- Copies the python code into the TeX scripts subdirectory +- Copies the WebQuiz doc subdirectory into the TeX doc/latex subdirectory. + +If you are using MiKTeX you may need to open the MiKTeX console, go to +the Tasks menu and then rebuild the TeX filename database. + +Once the files above are in place initialise WebQuiz by following the +installation instructions above. + +Mainly for development purposes, there is another undocumented +command-line option for removing these files from TEXMFMAIN: + +> sudo webquiz/scripts/webquiz --tex-uninstall + +System requirements +------------------- + +In order to work WebQuiz needs the following programs to be installed on your +system: + +* An up-to-date LaTeX_ distribution, such as that provided by TeXLive_. In + particular, you need to have TeX4ht_ and make4ht_ installed. + Unfortunately, since TeXLive 2018 was released there have been a significat + bunber of updates to a number of packahges that WebQuiz_ uses, including + updates to TeX4ht_, make4ht_, tikz_ and pstricks_. For this reason, *it is + strongly recommended that you all packages from ctan_ before using WebQuiz_*. + +* python3_ As of writing python 3.7.2 is available. + +* Javascript_ + +* If you plan to use pstricks_ with WebQuiz_, or if you want to + compile the online manual for WebQuiz, then you need to ensure that + ghostscript_ and dvisvgm_ are installed and properly configured on your + system. See the WebQuiz_ manual and the dvisvgm_ documentation for more + details + +* A web server. To view online quizzes you of course need a web server. As + described in the **Installation** section you will also need to copy of the + WebQuiz_ components onto your web server using the command: + + > webquiz --initialise + +Authors +------- +The LaTeX component of WebQuiz_ was written by Andrew Mathas and the python, +css and javascript code was written by Andrew Mathas (and Don Taylor), based on +an initial protype of Don Taylor's from 2001. Since 2004 the program has been +maintained and developed by Andrew Mathas. Although the program has changed +substantially since 2004 Don's idea of using TeX4ht_, and some of his code, is +still very much in use. + +Copyright (C) 2004-2019 + +License +------- +GNU General Public License, Version 3, 29 June 2007 + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU\_General Public License +(GPL_) as published by +the Free Software Foundation, either version 3 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +Public License for more details. + +.. _GPL: https://www.gnu.org/licenses/gpl-3.0.en.html +.. _LaTeX: https://www.latex-project.org/ +.. _Python3: https://www.python.org +.. _TeX4ht: http://www.tug.org/tex4ht/ +.. _TeXLive: https://www.tug.org/texlive/ +.. _WebQuiz: https://github.com/AndrewAtLarge/WebQuiz/ +.. _ctan: https://ctan.org/ +.. _dvisvgm: https://ctan.org/pkg/dvisvgm +.. _ghostscript: https://www.ghostscript.com +.. _javascript: https://www.javascript.com +.. _make4ht: https://ctan.org/pkg/make4ht +.. _pstricks: https://ctan.org/pkg/pstricks +.. _tikz: https://ctan.org/pkg/tikz diff --git a/macros/latex/contrib/webquiz/doc/README-doc b/macros/latex/contrib/webquiz/doc/README-doc new file mode 100644 index 0000000000..4c27dd387e --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/README-doc @@ -0,0 +1,24 @@ +The WebQuiz doc directory contains the follow files: + - webquiz.tex The LaTeX source for the WebQuiz manual + - webquiz.pdf A PDF version of the WebQuiz manual + - webquiz-online-manual.pdf A PDF version of the online manual + - webquiz.1 A unix manual page (converted from the ctan README file) + +The following files are included by the WebQuiz manual: + - webquiz.languages List of languages of the themes supported by WebQuiz. + - webquiz.settings List of settings supported by WebQuiz. + - webquiz.themes List of themes supported by WebQuiz. + - webquiz.usage The command-line options supported by WebQuiz. + - examples/ This directory contains the images that are + included by the WebQuiz manual. Once WebQuiz + has been initialised, the source files for + these images can be found in the WebQuiz web + directory + +The www subdirectory contains the files that are copied onto the local web +server when WebQuiz is initialised, In particular, www itself contains a doc +subdirectory that contains the source for the online manual: + - webquiz-online-manual.tex The LaTeX source for online WebQuiz manual + This file can be compiled with webquiz. It + uses pstricks and so must be compiled latex, + not pdflatex, to produce a PDF version diff --git a/macros/latex/contrib/webquiz/doc/examples/README-examples b/macros/latex/contrib/webquiz/doc/examples/README-examples new file mode 100644 index 0000000000..01e2455e27 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/README-examples @@ -0,0 +1,2 @@ +The TeX and png files in this directory are used to generate images in the +WebQuiz manual. Each TeX file can be compiled using (pdf)latex and webquiz. diff --git a/macros/latex/contrib/webquiz/doc/examples/answer-complex.png b/macros/latex/contrib/webquiz/doc/examples/answer-complex.png Binary files differnew file mode 100644 index 0000000000..841c81085f --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/answer-complex.png diff --git a/macros/latex/contrib/webquiz/doc/examples/answer-complex.tex b/macros/latex/contrib/webquiz/doc/examples/answer-complex.tex new file mode 100644 index 0000000000..603e666c07 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/answer-complex.tex @@ -0,0 +1,12 @@ +\documentclass[onepage]{webquiz} +\title{An answer with comparison=complex} +\begin{document} + \begin{question} % a quiz question + If $a=3-i$ and $b=2+i$ then what is $ab$? + \answer[complex]{7+i} (Correct answer $7+i$) + \end{question} + \begin{question} % a quiz question + If $a=3-i$ and $b=2+i$ then what is $ab$? + \answer[complex]{7+i} (Correct answer $7+i$) + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/answer-integer.png b/macros/latex/contrib/webquiz/doc/examples/answer-integer.png Binary files differnew file mode 100644 index 0000000000..dc6113b957 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/answer-integer.png diff --git a/macros/latex/contrib/webquiz/doc/examples/answer-integer.tex b/macros/latex/contrib/webquiz/doc/examples/answer-integer.tex new file mode 100644 index 0000000000..76b922be15 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/answer-integer.tex @@ -0,0 +1,10 @@ +\documentclass[hidesidemenu]{webquiz} +\title{An answer with comparison=integer} +\begin{document} + \begin{question} % a quiz question + How long is a piece of string? + \answer[integer]{18} mm (Correct answer $18$) + \whenRight Yes, $18$mm pieces of string are $18$mm long! + \whenWrong Incorrect! Is your ruler working? + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/answer-lowercase.png b/macros/latex/contrib/webquiz/doc/examples/answer-lowercase.png Binary files differnew file mode 100644 index 0000000000..a31d7049f3 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/answer-lowercase.png diff --git a/macros/latex/contrib/webquiz/doc/examples/answer-lowercase.tex b/macros/latex/contrib/webquiz/doc/examples/answer-lowercase.tex new file mode 100644 index 0000000000..c0c8665794 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/answer-lowercase.tex @@ -0,0 +1,16 @@ +\documentclass[onepage]{webquiz} +\title{An answer with comparison=lowercase} +\begin{document} + \begin{question} % a quiz question + How long is a piece of string? + \answer[lowercase]{Long} (Correct answer ``Long'') + \whenRight Correct! Obviously your ruler is working! + \whenWrong Incorrect! Is your ruler working? + \end{question} + \begin{question} % a quiz question + How long is a piece of string? + \answer[lowercase]{lonG} (Correct answer ``Long'') + \whenRight Correct! Obviously your ruler is working! + \whenWrong Incorrect! Is your ruler working? + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/answer-number.png b/macros/latex/contrib/webquiz/doc/examples/answer-number.png Binary files differnew file mode 100644 index 0000000000..14c3a9bed8 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/answer-number.png diff --git a/macros/latex/contrib/webquiz/doc/examples/answer-number.tex b/macros/latex/contrib/webquiz/doc/examples/answer-number.tex new file mode 100644 index 0000000000..1584b448a7 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/answer-number.tex @@ -0,0 +1,16 @@ +\documentclass[onepage]{webquiz} +\title{An answer with comparison=number} +\begin{document} + \begin{question} % a quiz question + What is $\frac12+\frac14$? + \answer[number]{3/4} (Correct answer $3/4$) + \whenRight Correct! + \whenWrong Incorrect! Is your ruler working? + \end{question} + \begin{question} % a quiz question + What is $\frac12+\frac14$? + \answer[number]{3/4} (Correct answer $3/4$) + \whenRight Correct! + \whenWrong Incorrect! Is your ruler working? + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/answer-star.png b/macros/latex/contrib/webquiz/doc/examples/answer-star.png Binary files differnew file mode 100644 index 0000000000..0852827408 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/answer-star.png diff --git a/macros/latex/contrib/webquiz/doc/examples/answer-star.tex b/macros/latex/contrib/webquiz/doc/examples/answer-star.tex new file mode 100644 index 0000000000..bb708cd203 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/answer-star.tex @@ -0,0 +1,16 @@ +\documentclass[onepage]{webquiz} +\title{An answer$*$ (and comparison=string)} +\begin{document} + \begin{question} % a quiz question + What is the capital of Australia? + \answer*{Canberra} (Correct answer ``Canberra'') + \whenRight Yes, Sydney is the capital of NSW. + \whenWrong Remember to correctly capitalise your answer! + \end{question} + \begin{question} % a quiz question + What is the capital of Australia? + \answer{Canberra} (Correct answer ``Canberra'') + \whenRight Yes, Sydney is the capital of NSW. + \whenWrong Remember to correctly capitalise your answer! + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/answer-string.png b/macros/latex/contrib/webquiz/doc/examples/answer-string.png Binary files differnew file mode 100644 index 0000000000..affdf18f6f --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/answer-string.png diff --git a/macros/latex/contrib/webquiz/doc/examples/answer-string.tex b/macros/latex/contrib/webquiz/doc/examples/answer-string.tex new file mode 100644 index 0000000000..d8884058a5 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/answer-string.tex @@ -0,0 +1,11 @@ +\documentclass[hidesidemenu]{webquiz} +\title{An answer with comparison=string} +\begin{document} + \begin{question} % a quiz question + What is the capital of Australia? + \answer[string]{Canberra} (Correct answer ``Canberra'') + \whenRight Yes, Sydney is the capital of NSW and Melbourne is the + capital of Victoria + \whenWrong Remember to correctly capitalise your answer! + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/breadcrumbs.png b/macros/latex/contrib/webquiz/doc/examples/breadcrumbs.png Binary files differnew file mode 100644 index 0000000000..2c2a8175ea --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/breadcrumbs.png diff --git a/macros/latex/contrib/webquiz/doc/examples/breadcrumbs.tex b/macros/latex/contrib/webquiz/doc/examples/breadcrumbs.tex new file mode 100644 index 0000000000..2de97a94e5 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/breadcrumbs.tex @@ -0,0 +1,5 @@ +\documentclass[hidesidemenu]{webquiz} +\BreadCrumbs{ Mathematics / | Math101 /u/math101 | quizindex | title } +\title{Quiz 1: Loafing around} +\begin{document} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/choice-multiple.png b/macros/latex/contrib/webquiz/doc/examples/choice-multiple.png Binary files differnew file mode 100644 index 0000000000..127f5d956c --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/choice-multiple.png diff --git a/macros/latex/contrib/webquiz/doc/examples/choice-multiple.tex b/macros/latex/contrib/webquiz/doc/examples/choice-multiple.tex new file mode 100644 index 0000000000..d52e78f981 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/choice-multiple.tex @@ -0,0 +1,20 @@ +\documentclass[theme=vibrant]{webquiz} +\title{A multiple choice example with zero or more correct answers} +\renewcommand\thechoice{\roman{choice})} +\begin{document} + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in three columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ + and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $1$ \feedback One is not a prime number because it + is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ + and $97$ + \end{choice} + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/choice-single.png b/macros/latex/contrib/webquiz/doc/examples/choice-single.png Binary files differnew file mode 100644 index 0000000000..eda5fd9634 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/choice-single.png diff --git a/macros/latex/contrib/webquiz/doc/examples/choice-single.tex b/macros/latex/contrib/webquiz/doc/examples/choice-single.tex new file mode 100644 index 0000000000..76537144f0 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/choice-single.tex @@ -0,0 +1,13 @@ +\documentclass{webquiz} +\title{A multiple choice question with a unique answer} +\begin{document} + \begin{question} % a quiz question + What is the cube root of $64$? + \begin{choice}[columns=4]% unique answer rendered in four columns + \incorrect 1 \feedback No, $1^3=1$ + \incorrect 2 \feedback No, $2^3=8$ + \incorrect 3 \feedback No, $3^3=27$ + \correct 4 \feedback Yes, $4^3=64$ + \end{choice} + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/ctanLion.jpg b/macros/latex/contrib/webquiz/doc/examples/ctanLion.jpg Binary files differnew file mode 100644 index 0000000000..9eac32a030 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/ctanLion.jpg diff --git a/macros/latex/contrib/webquiz/doc/examples/ctanLion.png b/macros/latex/contrib/webquiz/doc/examples/ctanLion.png Binary files differnew file mode 100644 index 0000000000..0d71107014 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/ctanLion.png diff --git a/macros/latex/contrib/webquiz/doc/examples/ctanLion.tex b/macros/latex/contrib/webquiz/doc/examples/ctanLion.tex new file mode 100644 index 0000000000..1382487ccb --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/ctanLion.tex @@ -0,0 +1,16 @@ +\documentclass{webquiz} +\usepackage[dvipdfmx]{graphicx} +\DeclareGraphicsExtensions{.jpg} +\title{I am not Lion to you} +\begin{document} + \begin{question} + Do you recognise this Lion? + \begin{center} + \includegraphics[height=30mm]{ctanLion.jpg} + \end{center} + \begin{choice} + \correct Yes! \feedback This is the \TeX{} lion! + \incorrect No! \feedback You are legally required to admire this lion! + \end{choice} + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/discussion-Qref.png b/macros/latex/contrib/webquiz/doc/examples/discussion-Qref.png Binary files differnew file mode 100644 index 0000000000..eafbab53de --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/discussion-Qref.png diff --git a/macros/latex/contrib/webquiz/doc/examples/discussion-Qref.tex b/macros/latex/contrib/webquiz/doc/examples/discussion-Qref.tex new file mode 100644 index 0000000000..5a54154332 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/discussion-Qref.tex @@ -0,0 +1,11 @@ +\documentclass[hidesidemenu]{webquiz} +\title{A Qref example} +\begin{document} + \begin{discussion}[First bit]\label{d:one} + Some interesting discussion related to question \Qref{1} or \Qref*{1} + or \Qref[Start Quiz]{1} or \Qref*[Start Quiz]{1} + \end{discussion} + \begin{question}\label{q:one} + An interesting question relating to discussion \dref{d:one}\answer{1} + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/discussion-ref.png b/macros/latex/contrib/webquiz/doc/examples/discussion-ref.png Binary files differnew file mode 100644 index 0000000000..a37f952648 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/discussion-ref.png diff --git a/macros/latex/contrib/webquiz/doc/examples/discussion-ref.tex b/macros/latex/contrib/webquiz/doc/examples/discussion-ref.tex new file mode 100644 index 0000000000..b51c903704 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/discussion-ref.tex @@ -0,0 +1,12 @@ +\documentclass[onepage]{webquiz} +\title{A dref and qref example} +\begin{document} + \begin{discussion}[First bit][First discussion item]\label{d:one} + Some cross-references to question 1: \qref{q:one}, \qref*{q:one}, + \qref[some text]{q:one}, and \qref*[some text]{q:one}. + \end{discussion} + \begin{question}\label{q:one} + Cross-references to discussion: \answer{1} \dref{d:one}, \dref*{d:one}, + \dref[some text]{d:one} and \dref*[some text]{d:one}. + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/discussion.png b/macros/latex/contrib/webquiz/doc/examples/discussion.png Binary files differnew file mode 100644 index 0000000000..1b327072a3 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/discussion.png diff --git a/macros/latex/contrib/webquiz/doc/examples/discussion.tex b/macros/latex/contrib/webquiz/doc/examples/discussion.tex new file mode 100644 index 0000000000..80154d10ec --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/discussion.tex @@ -0,0 +1,11 @@ +\documentclass[theme=muted]{webquiz} +\usepackage{lipsum}% for some random text +\title{A discussion environment example} +\begin{document} + \begin{discussion}[First bit] + \lipsum[1] + \end{discussion} + \begin{discussion}[Two][Second bit] + \lipsum[2] + \end{discussion} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/display-as-image.png b/macros/latex/contrib/webquiz/doc/examples/display-as-image.png Binary files differnew file mode 100644 index 0000000000..ce76cb1119 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/display-as-image.png diff --git a/macros/latex/contrib/webquiz/doc/examples/display-as-image.tex b/macros/latex/contrib/webquiz/doc/examples/display-as-image.tex new file mode 100644 index 0000000000..e82fe2e9d6 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/display-as-image.tex @@ -0,0 +1,16 @@ +\documentclass{webquiz} +\usepackage[version=4]{mhchem} +\Department{Chemistry} +\UnitCode{Chem101}\UnitURL{/chem101} +\title{Display as image example} +\begin{document} + \DisplayAsImage[style="vertical-align: middle;"]{ce} + \begin{question} + What is \ce{(NH4)2S}? + \begin{choice}[columns=1] + \correct Ammonium sulfide + \incorrect Ammonium hydrosulfide + \feedback This is \ce{(NH4)HS} + \end{choice} + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/french.png b/macros/latex/contrib/webquiz/doc/examples/french.png Binary files differnew file mode 100644 index 0000000000..42038b3693 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/french.png diff --git a/macros/latex/contrib/webquiz/doc/examples/french.tex b/macros/latex/contrib/webquiz/doc/examples/french.tex new file mode 100644 index 0000000000..928a4db126 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/french.tex @@ -0,0 +1,19 @@ +\documentclass[language=french]{webquiz} +\usepackage[french]{babel} +\usepackage[T1]{fontenc} +\title{Quiz Français} +\begin{document} + \begin{question} + Sous forme d’inéquation, $x\in[1,2]$ s’écrit aussi + \begin{choice}[columns=2] + \correct $1\le x\le 2$ + \incorrect $1\ge x\ge 2$ + \feedback L’ordre croissant est-il respecté? + \incorrect $1<x<2$ + \feedback L’intervalle est-il ouvert ou fermé? + \incorrect $1<x\le 2$ + \feedback Les bornes sont-elles incluses ou exclues? + \end{choice} + \end{question} +\end{document} + diff --git a/macros/latex/contrib/webquiz/doc/examples/index-cz.png b/macros/latex/contrib/webquiz/doc/examples/index-cz.png Binary files differnew file mode 100644 index 0000000000..e9d6a49ee0 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/index-cz.png diff --git a/macros/latex/contrib/webquiz/doc/examples/index-cz.tex b/macros/latex/contrib/webquiz/doc/examples/index-cz.tex new file mode 100644 index 0000000000..0fe0684785 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/index-cz.tex @@ -0,0 +1,15 @@ +\documentclass[hidesidemenu,language=czech]{webquiz} +\usepackage[czech]{babel} +\usepackage[T1]{fontenc} +\Department{Matematika}\DepartmentURL{/} +\BreadCrumbs{ department | Mat101 /mat101 | breadcrumb } +\BreadCrumb{ Index kvízů } +\title{Elementární počet} +\begin{document} + \begin{quizindex} + \quiz{Čísla a množiny} + \quiz{Polární forma a kořeny složitých čísel} + \quiz{Polar exponenciální forma a funkce} + \quiz*{Optimalizace funkcí dvou proměnných} + \end{quizindex} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/index-en.png b/macros/latex/contrib/webquiz/doc/examples/index-en.png Binary files differnew file mode 100644 index 0000000000..5d474581e0 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/index-en.png diff --git a/macros/latex/contrib/webquiz/doc/examples/index-en.tex b/macros/latex/contrib/webquiz/doc/examples/index-en.tex new file mode 100644 index 0000000000..317f24f8bb --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/index-en.tex @@ -0,0 +1,11 @@ +\documentclass[hidesidemenu]{webquiz} +\BreadCrumbs{ Mathematics / | Math101 /math101 | Index of quizzes } +\title{Elementary calculus} +\begin{document} + \begin{quizindex} + \quiz{Numbers and sets} + \quiz{Polar form and roots of complex numbers} + \quiz{Polar exponential form and functions} + \quiz*{Optimizing functions of two variables} + \end{quizindex} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/montypython.png b/macros/latex/contrib/webquiz/doc/examples/montypython.png Binary files differnew file mode 100644 index 0000000000..e924e43d8c --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/montypython.png diff --git a/macros/latex/contrib/webquiz/doc/examples/montypython.tex b/macros/latex/contrib/webquiz/doc/examples/montypython.tex new file mode 100644 index 0000000000..738424f879 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/montypython.tex @@ -0,0 +1,12 @@ +\documentclass[hidesidemenu]{webquiz} +\BreadCrumbs{ Monty Python http://www.montypython.com/ + | Our work http://www.montypython.com/ourwork + | The Meaning of life http://www.montypython.com/film_Monty\%20Python's\%20The\%20Meaning\%20of\%20Life\%20(1983)/17 +} +\title{I didn't even eat the mousse...} +\begin{document} + \begin{question} + What is the meaning of life? + \answer{42} + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/nounits.png b/macros/latex/contrib/webquiz/doc/examples/nounits.png Binary files differnew file mode 100644 index 0000000000..a504a247df --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/nounits.png diff --git a/macros/latex/contrib/webquiz/doc/examples/nounits.tex b/macros/latex/contrib/webquiz/doc/examples/nounits.tex new file mode 100644 index 0000000000..593c6c75d7 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/nounits.tex @@ -0,0 +1,4 @@ +\documentclass[hidesidemenu]{webquiz} +\BreadCrumb{Wholemeal bread} +\BreadCrumbs{unitcode|quizindex|breadcrumb} +\begin{document}\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/onepage.png b/macros/latex/contrib/webquiz/doc/examples/onepage.png Binary files differnew file mode 100644 index 0000000000..880a1990ae --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/onepage.png diff --git a/macros/latex/contrib/webquiz/doc/examples/onepage.tex b/macros/latex/contrib/webquiz/doc/examples/onepage.tex new file mode 100644 index 0000000000..6c47025a88 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/onepage.tex @@ -0,0 +1,15 @@ +\documentclass[onepage]{webquiz} +\title{A one page quiz} +\begin{document} + \begin{discussion}[One short][The full heading for discussion one] + This is discussion $1$ (one). It is very interesting. + \end{discussion} + \begin{discussion}[Two short][The full heading for discussion two] + This is discussion $2$ (two). It is very interesting. + \end{discussion} + \begin{question} Is this question $1$ (one)? \answer{1}\end{question} + \begin{question} Is a good question? + \begin{choice}\correct Yes \incorrect no\end{choice} + \end{question} + \begin{question} Is this question $3$ (three)? \answer{3}\end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/pst2pdf.png b/macros/latex/contrib/webquiz/doc/examples/pst2pdf.png Binary files differnew file mode 100644 index 0000000000..b47fd70325 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/pst2pdf.png diff --git a/macros/latex/contrib/webquiz/doc/examples/pst2pdf.tex b/macros/latex/contrib/webquiz/doc/examples/pst2pdf.tex new file mode 100644 index 0000000000..a6755167b6 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/pst2pdf.tex @@ -0,0 +1,22 @@ +\documentclass[pst2pdf]{webquiz} +\usepackage{pst-all,pst-3dplot} +\title{A pst2pdf example} +\begin{document} + \begin{question} % a quiz question + Which of the equations below could describe the following surface? + + \begin{pspicture*}(-4,-4)(4,4) + \psplotThreeD[linecolor=blue, plotstyle=curve, drawStyle=yLines, + yPlotpoints=30, xPlotpoints=30, linewidth=1pt](-4,1)(-4,1){ + x dup mul y dup mul add 1.01 exp} + \pstThreeDCoor[linewidth=1pt, xMin=-4,xMax=4,yMin=-4,yMax=4,zMin=-2,zMax=6] + \end{pspicture*} + + \begin{choice} + \incorrect \( z=\log(x^2+y^2) \) + \correct \( z=e^{x^2+y^2} \) + \incorrect \( z=1-e^{x^2+y^2} \) + \incorrect \( z=\dfrac1{x^2+y^2}\) + \end{choice} + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/pstricks-ex.png b/macros/latex/contrib/webquiz/doc/examples/pstricks-ex.png Binary files differnew file mode 100644 index 0000000000..1fe9bc1979 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/pstricks-ex.png diff --git a/macros/latex/contrib/webquiz/doc/examples/pstricks-ex.tex b/macros/latex/contrib/webquiz/doc/examples/pstricks-ex.tex new file mode 100644 index 0000000000..ff6b961d45 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/pstricks-ex.tex @@ -0,0 +1,27 @@ +\documentclass[svgnames]{webquiz} +\usepackage{pst-all} +\newcommand\C{\mathbb{C}} +\title{A pstricks example} +\begin{document} + \begin{question} + The shaded region in the graph + \begin{center} + \begin{pspicture}[unit=0.6cm](-3,-1.5)(3,4) + \pscircle[linewidth=1pt,linestyle=dashed, + fillcolor=SkyBlue,fillstyle=solid](1,1){2} + \psaxes[linecolor=red,linewidth=1pt,labels=none] + {->}(0,0)(-1.5,-1.5)(3.5,3.5) + \rput(3.75,0){$x$} \rput(0,3.85){$iy$} + \rput(3,-0.4){3} \rput(-0.4,3){3$i$} + \psdots(1,1) + \end{pspicture} + \end{center} + is equal to which of the following sets of complex numbers? + \begin{choice}[columns=2] + \incorrect $\{z \in \C : (z-1)^{2}+(z-(i+1))^{2}<2\}$ + \incorrect $\{z \in \C : z+(i+1)<2\}$ + \correct $\{z \in \C : |z-(i+1)|<2\}$ + \incorrect None of the above. + \end{choice} + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/quiz-page.png b/macros/latex/contrib/webquiz/doc/examples/quiz-page.png Binary files differnew file mode 100644 index 0000000000..82cb0dc973 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/quiz-page.png diff --git a/macros/latex/contrib/webquiz/doc/examples/quiz-page.tex b/macros/latex/contrib/webquiz/doc/examples/quiz-page.tex new file mode 100644 index 0000000000..9bc0740db1 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/quiz-page.tex @@ -0,0 +1,250 @@ +\documentclass[]{webquiz} +\BreadCrumbs{quizindex | title} +\DeclareMathOperator{\cis}{cis} +\newcommand{\R}{\mathbb R} +\newcommand{\C}{\mathbb C} +\usepackage{pst-all} + +\title{Quiz 1: Numbers and sets} + +\begin{document} + + \begin{question} + Which of the following are correct ways of writing the set + \[ A=\{x \in \mathbb{R} \mid -3 < x \leq -1 \text{ or } x\geq 0\} ?\] + \begin{choice}[columns=2] + \incorrect $(-3,\infty)$ + \feedback The interval $(-3,\infty)$ includes the real numbers + between $-1$ and $0$, which do not belong to $A$. + + \incorrect $[-3,\infty)$ + \feedback The interval $[-3,\infty)$ includes $-3$, and + the real numbers between $-1$ and $0$, which do not belong to $A$. + + \incorrect $[-3,-1]\cap[0,\infty)$ + \feedback The interval $[-3,-1]\cap[0,\infty)$ is the empty set + $\emptyset$. As $A$ is not empty (for example, $A$ includes + $-1$), this option cannot be correct. + + \incorrect $(-3,-1)\cup[0,\infty)$ + \feedback The interval $-1$ is not in $(-3,-1)\cup[0,\infty)$, + but $-1$ is in $A$. + + \correct $(-3,-1]\cup[0,\infty)$ + + \end{choice} + \end{question} + +%%%% 2 +\begin{question} +What is another way of writing the set +\[B= \{x \in {\mathbb R}\ |\ |x-3|<2 \}\ \rm{?}\] +\begin{choice}[columns=2] +\incorrect $(2,3]$ +\feedback For example, $4$ belongs to $B$ but is not in $(2,3]$. + +\incorrect $[2,4]$ +\feedback For example, $1.5$ belongs to $B$ but is not in $[2,4]$. + +\correct $(1,5)$ + +\feedback $B$ is the set of all points whose distance from 3 on the +number line is less than 2. \\ +The solution to $|x-3|<2$ is $1<x<5$. + +\incorrect $[1,5]$ +\feedback Neither $1$ nor $5$ belong to $B$, but both $1$ and $5$ belong to $[1,5]$. + +\incorrect $[2,3)$ +\feedback For example, $4$ belongs to $B$ but is not in $[2,3)$. + +\end{choice} +\end{question} + + +%%%%%%%%%% 3 +\begin{question} +If $A=\{7,8,9,10\}$ and $B=\{5,6,7,8\}$ then $(A\backslash +B)\cup(B\backslash A)$ is +\begin{choice}[columns=2] +\incorrect $\{5,6,7,8,9,10\}$ + +\correct $\{5,6,9,10\}$ + +\feedback $A\backslash B=\{9,10\}$ and $B\backslash A=\{5,6\}$ so +$(A\backslash B)\cup(B\backslash A)=\{5,6,9,10\}$. + +\incorrect $\emptyset$, the empty set. + +\incorrect $\{7,8\}$ + +\incorrect None of the above. + +\end{choice} +\end{question} + +%%%%%%%%%%%%%% 4 +\begin{question} +The set \(\{0,1,\pm\sqrt{-1},\pi,12\}\) is a subset of +\begin{choice}[columns=2] +\incorrect $\mathbb N$ +\feedback The number \(\pi\) is not a natural number. + +\incorrect $\mathbb Z$ +\feedback The number \(\pi\) is not an integer. + +\incorrect $\mathbb Q$ +\feedback The number \(\pi\) is not a rational number. + +\incorrect $\mathbb R$ +\feedback \(\sqrt{-1}\) is not real. + +\correct $\mathbb C$ +\feedback Since \(\pm\sqrt{-1}\) denotes the two imaginary numbers $i$ and $-i$, the given set cannot be +in any of the sets $\mathbb{N,Z,Q}\ \rm{or}\ \mathbb{R}$. \\ +Hence the +right answer must be ${\mathbb C}$ which contains all imaginary +numbers. + +\end{choice} +\end{question} + +%%%%%%%%%% 5 +\begin{question} +Which of the following alternatives is the best feedback to `Solve +$x^{2}-3x+4=0$ over $\mathbb{C}$'. +\begin{choice}[columns=2] +\incorrect There are no real solutions. +\feedback As the question asks us to solve the equation over $\mathbb C$ (that is, to find all solutions belonging to the set of complex numbers), this is not the best feedback. + +\incorrect $x=1,4$ + +\incorrect \(x=\dfrac{3\pm\sqrt{7}}{2}\) + +\correct \(x=\dfrac{3\pm i\sqrt{7}}{2}\) + +\feedback Using the quadratic formula, +\(x =\dfrac{3\pm\sqrt{9-16}}{2} = \dfrac{3\pm\sqrt{-7}}{2}\). + + +\incorrect None of the above is correct. +\end{choice} +\end{question} + +%%%%%%% 6 +\begin{question} +If $z=9+3i$ and $w=2-i$ then $z+w$ equals +\begin{choice}[columns=2] +\incorrect $9-i$ + +\correct $11+2i$ +\feedback $z+w=(9+3i)+(2-i)=(9+2)+(3-1)i=11+2i$. + +\incorrect $6+3i$ + +\incorrect $8$ + +\incorrect None of the above + +\end{choice} +\end{question} + +%%%%%%% 7 + +\begin{question} +If $w=2-i$ then $\overline{w}$ equals +\begin{choice}[columns=2] +\incorrect $2-i$ + +\incorrect $2$ + +\correct $2+i$ + +\feedback +$\overline{w}=\overline{2-i}=2+i$. + +\incorrect $-2+i$ + +\incorrect None of the above +\end{choice} +\end{question} + +%%%%%%%%% 8 +\begin{question} +If $p=9+3i$ and $q=2-i$ then $p\overline{q}$ equals +\begin{choice}[columns=2] + +\correct $15+15i$ + +\feedback +$p\overline{q}=(9+3i)\overline{(2-i)}$ \\ +$=(9+3i)(2+i)= (18-3)+(6+9)i$\\ +$=15+15i$. + +\incorrect $21+15i$ + +\incorrect $18+3i$ + +\incorrect $1-i$ + +\incorrect None of the above + +\end{choice} +\end{question} + + +%%%%%%%%% 9 +\begin{question} +If $z=9+3i$ and $w=2-i$ then $\dfrac{z}{w}$ equals +\begin{choice}[columns=2] +\incorrect $15+15i$ + +\incorrect $6+3i$ + +\incorrect $12+15i$ + +\incorrect $3-3i$ + +\correct None of the above + +\feedback +\(\dfrac{z}{w}=\dfrac{9+3i}{2-i} + =\dfrac{9+3i}{2-i}\times \dfrac{2+i}{2+i} + =\dfrac{15+15i}{5}=3+3i\). +\end{choice} +\end{question} + +%%%%%%%%%% 10 +\begin{question} +The shaded region in the graph +\begin{center}\begin{pspicture}(-3,-1.5)(3,4) +\pscircle[linewidth=2pt,linestyle=dashed,fillcolor=blue,fillstyle=solid](1,1){2} +\psaxes[linecolor=red,linewidth=1pt,labels=none]{->}(0,0)(-1.5,-1.5)(3.5,3.5) +\rput(3.75,0){$x$} +\rput(0,3.85){$iy$} +\rput(3,-0.4){3} +\rput(-0.4,3){3$i$} +\psdots(1,1) +\end{pspicture} +\end{center} +corresponds to which set of complex numbers? +\begin{choice}[columns=2] +\correct\(\{z \in \C : |z-(i+1)|<2\}\) + + +\incorrect \(\{z \in \C : |z|-|1+i|<2\}\) +\feedback This set corresponds to the interior of a circle, centre the origin, radius $2+\sqrt 2$. + + +\incorrect \(\{z \in \C : \text{Re}(z+(i+1))<2 \}\) +\feedback This set corresponds to the open half plane containing all complex numbers $z=x+iy$ with $x<1$. + +\incorrect \(\{z \in \C : |z-2|<|i+1-2|\}\) +\feedback This set corresponds to the interior of a circle, centre $2$, radius $\sqrt 2$. + +\incorrect None of the above. + +\end{choice} +\end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/quizindex-dropdown.png b/macros/latex/contrib/webquiz/doc/examples/quizindex-dropdown.png Binary files differnew file mode 100644 index 0000000000..2207f3a54b --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/quizindex-dropdown.png diff --git a/macros/latex/contrib/webquiz/doc/examples/random.png b/macros/latex/contrib/webquiz/doc/examples/random.png Binary files differnew file mode 100644 index 0000000000..592091f5a7 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/random.png diff --git a/macros/latex/contrib/webquiz/doc/examples/random.tex b/macros/latex/contrib/webquiz/doc/examples/random.tex new file mode 100644 index 0000000000..6818f2e6df --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/random.tex @@ -0,0 +1,8 @@ +\documentclass[randomorder, showsidemenu]{webquiz} +\title{Four randomly ordered questions} +\begin{document} + \begin{question}What is the question number of question one? \answer{1}\end{question} + \begin{question}What is the question number of question two? \answer{2}\end{question} + \begin{question}What is the question number of question three?\answer{3}\end{question} + \begin{question}What is the question number of question four? \answer{4}\end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/simple-html.png b/macros/latex/contrib/webquiz/doc/examples/simple-html.png Binary files differnew file mode 100644 index 0000000000..f4c03dd055 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/simple-html.png diff --git a/macros/latex/contrib/webquiz/doc/examples/simple-pdf.png b/macros/latex/contrib/webquiz/doc/examples/simple-pdf.png Binary files differnew file mode 100644 index 0000000000..1d1a6090d7 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/simple-pdf.png diff --git a/macros/latex/contrib/webquiz/doc/examples/simple.tex b/macros/latex/contrib/webquiz/doc/examples/simple.tex new file mode 100644 index 0000000000..7fe1e12084 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/simple.tex @@ -0,0 +1,22 @@ +\documentclass{webquiz} +\title{An easy example} +\begin{document} + \begin{question} % a quiz question + Alice is twice as old as Betty. + Betty is one year older than Claire. + If Alice is $4$ how old is Claire? + \begin{choice}[columns=2] % multiple choice question + \correct $1$ % first choice - correct answer + \feedback If Claire is $1$ then Betty is $2$ and Alice is~$4$! + + \incorrect $2$ % second choice - incorrect + \feedback If Claire is $2$ then Betty is $3$ and Alice is~$6$. + + \incorrect $3$ % third choice - incorrect + \feedback If Claire is $3$ then Betty is $4$ and Alice is~$8$. + + \incorrect $4$ % fourth choice - incorrect + \feedback If Claire is $4$ then Betty is $5$ and Alice is~$10$. + \end{choice} + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-blue.png b/macros/latex/contrib/webquiz/doc/examples/theme-blue.png Binary files differnew file mode 100644 index 0000000000..cb36293d76 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-blue.png diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-blue.tex b/macros/latex/contrib/webquiz/doc/examples/theme-blue.tex new file mode 100644 index 0000000000..7bff470187 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-blue.tex @@ -0,0 +1,90 @@ +\documentclass[theme=blue]{webquiz} +\BreadCrumbs{WebQuiz Themes | quizindex| breadcrumb}\BreadCrumb{blue} +\title{..................................the blue theme} +\begin{document} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-darkblue.png b/macros/latex/contrib/webquiz/doc/examples/theme-darkblue.png Binary files differnew file mode 100644 index 0000000000..57001cf437 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-darkblue.png diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-darkblue.tex b/macros/latex/contrib/webquiz/doc/examples/theme-darkblue.tex new file mode 100644 index 0000000000..108982912e --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-darkblue.tex @@ -0,0 +1,90 @@ +\documentclass[theme=darkblue]{webquiz} +\BreadCrumbs{WebQuiz Themes | quizindex| breadcrumb}\BreadCrumb{darkblue} +\title{..................................the darkblue theme} +\begin{document} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-darkred.png b/macros/latex/contrib/webquiz/doc/examples/theme-darkred.png Binary files differnew file mode 100644 index 0000000000..d47c50c1b3 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-darkred.png diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-darkred.tex b/macros/latex/contrib/webquiz/doc/examples/theme-darkred.tex new file mode 100644 index 0000000000..c0414b9d04 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-darkred.tex @@ -0,0 +1,90 @@ +\documentclass[theme=darkred]{webquiz} +\BreadCrumbs{WebQuiz Themes | quizindex| breadcrumb}\BreadCrumb{darkred} +\title{..................................the darkred theme} +\begin{document} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-default.png b/macros/latex/contrib/webquiz/doc/examples/theme-default.png Binary files differnew file mode 100644 index 0000000000..10ad1a00c3 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-default.png diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-default.tex b/macros/latex/contrib/webquiz/doc/examples/theme-default.tex new file mode 100644 index 0000000000..5aede1d90e --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-default.tex @@ -0,0 +1,90 @@ +\documentclass[theme=default]{webquiz} +\BreadCrumbs{WebQuiz Themes | quizindex| breadcrumb}\BreadCrumb{default} +\title{..................................the default theme} +\begin{document} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-earthy.png b/macros/latex/contrib/webquiz/doc/examples/theme-earthy.png Binary files differnew file mode 100644 index 0000000000..f8e65c2b75 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-earthy.png diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-earthy.tex b/macros/latex/contrib/webquiz/doc/examples/theme-earthy.tex new file mode 100644 index 0000000000..73d7247c55 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-earthy.tex @@ -0,0 +1,90 @@ +\documentclass[theme=earthy]{webquiz} +\BreadCrumbs{WebQuiz Themes | quizindex| breadcrumb}\BreadCrumb{earthy} +\title{..................................the earthy theme} +\begin{document} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-fresh.png b/macros/latex/contrib/webquiz/doc/examples/theme-fresh.png Binary files differnew file mode 100644 index 0000000000..b3690d8549 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-fresh.png diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-fresh.tex b/macros/latex/contrib/webquiz/doc/examples/theme-fresh.tex new file mode 100644 index 0000000000..28d16ce212 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-fresh.tex @@ -0,0 +1,90 @@ +\documentclass[theme=fresh]{webquiz} +\BreadCrumbs{WebQuiz Themes | quizindex| breadcrumb}\BreadCrumb{fresh} +\title{..................................the fresh theme} +\begin{document} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-light.png b/macros/latex/contrib/webquiz/doc/examples/theme-light.png Binary files differnew file mode 100644 index 0000000000..3282223e06 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-light.png diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-light.tex b/macros/latex/contrib/webquiz/doc/examples/theme-light.tex new file mode 100644 index 0000000000..11ae043f5f --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-light.tex @@ -0,0 +1,90 @@ +\documentclass[theme=light]{webquiz} +\BreadCrumbs{WebQuiz Themes | quizindex| breadcrumb}\BreadCrumb{light} +\title{..................................the light theme} +\begin{document} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-lively.png b/macros/latex/contrib/webquiz/doc/examples/theme-lively.png Binary files differnew file mode 100644 index 0000000000..c750615fe8 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-lively.png diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-lively.tex b/macros/latex/contrib/webquiz/doc/examples/theme-lively.tex new file mode 100644 index 0000000000..e947e7febf --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-lively.tex @@ -0,0 +1,90 @@ +\documentclass[theme=lively]{webquiz} +\BreadCrumbs{WebQuiz Themes | quizindex| breadcrumb}\BreadCrumb{lively} +\title{..................................the lively theme} +\begin{document} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-muted.png b/macros/latex/contrib/webquiz/doc/examples/theme-muted.png Binary files differnew file mode 100644 index 0000000000..9151228073 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-muted.png diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-muted.tex b/macros/latex/contrib/webquiz/doc/examples/theme-muted.tex new file mode 100644 index 0000000000..993c1a8917 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-muted.tex @@ -0,0 +1,90 @@ +\documentclass[theme=muted]{webquiz} +\BreadCrumbs{WebQuiz Themes | quizindex| breadcrumb}\BreadCrumb{muted} +\title{..................................the muted theme} +\begin{document} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-sleek.png b/macros/latex/contrib/webquiz/doc/examples/theme-sleek.png Binary files differnew file mode 100644 index 0000000000..c2c3f1c153 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-sleek.png diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-sleek.tex b/macros/latex/contrib/webquiz/doc/examples/theme-sleek.tex new file mode 100644 index 0000000000..0bb181d349 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-sleek.tex @@ -0,0 +1,90 @@ +\documentclass[theme=sleek]{webquiz} +\BreadCrumbs{WebQuiz Themes | quizindex| breadcrumb}\BreadCrumb{sleek} +\title{..................................the sleek theme} +\begin{document} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-spring.png b/macros/latex/contrib/webquiz/doc/examples/theme-spring.png Binary files differnew file mode 100644 index 0000000000..8efc7a9924 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-spring.png diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-spring.tex b/macros/latex/contrib/webquiz/doc/examples/theme-spring.tex new file mode 100644 index 0000000000..c6e84491df --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-spring.tex @@ -0,0 +1,90 @@ +\documentclass[theme=spring]{webquiz} +\BreadCrumbs{WebQuiz Themes | quizindex| breadcrumb}\BreadCrumb{spring} +\title{..................................the spring theme} +\begin{document} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-vibrant.png b/macros/latex/contrib/webquiz/doc/examples/theme-vibrant.png Binary files differnew file mode 100644 index 0000000000..fa1cdb3367 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-vibrant.png diff --git a/macros/latex/contrib/webquiz/doc/examples/theme-vibrant.tex b/macros/latex/contrib/webquiz/doc/examples/theme-vibrant.tex new file mode 100644 index 0000000000..62909e8430 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/theme-vibrant.tex @@ -0,0 +1,90 @@ +\documentclass[theme=vibrant]{webquiz} +\BreadCrumbs{WebQuiz Themes | quizindex| breadcrumb}\BreadCrumb{vibrant} +\title{..................................the vibrant theme} +\begin{document} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + + \begin{question} % a quiz question + Which of the following integers are prime? + % multiple (0 or more) correct answers rendered in two columns + \begin{choice}[multiple, columns=3] + \correct $17$ \feedback Yes, the only divisors of $17$ are $1$ and $17$ + \incorrect $12$ \feedback No, $12 = 3\times 4$ + \incorrect $27$ \feedback No, $27=3^3$ + \incorrect $91$ \feedback No, $91 = 3\times 17$ + \incorrect $0$ \feedback Prime numbers are non-zero + \incorrect $1$ \feedback One is not a prime number because it is invertible + \correct $97$ \feedback Yes, the only divisors of $97$ are $1$ and $97$ + \end{choice} + \end{question} + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/examples/tikz-ex.png b/macros/latex/contrib/webquiz/doc/examples/tikz-ex.png Binary files differnew file mode 100644 index 0000000000..5b51c8b24a --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/tikz-ex.png diff --git a/macros/latex/contrib/webquiz/doc/examples/tikz-ex.tex b/macros/latex/contrib/webquiz/doc/examples/tikz-ex.tex new file mode 100644 index 0000000000..6fe3dc692f --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/examples/tikz-ex.tex @@ -0,0 +1,19 @@ +\documentclass[tikz]{webquiz} +\usepackage{tikz} +\title{A tikz example} +\begin{document} + \begin{question} % a quiz question + What number is represented by the dot on the following number line? + \begin{center} + \begin{tikzpicture} + \foreach \x in {-3,...,3} { \draw(\x,0.25) --(\x,0)node[below]{$\x$}; } + \foreach \x in {-2.5,...,2.5} { \draw(\x,0.18) --(\x,0); } + \draw[thick,<->](-3.5,0)--(3.5,0); + \filldraw[blue!50!white](1.5,0) circle (1mm); + \end{tikzpicture} + \end{center} + \answer[number]{1.5} % inserts an answer box and specifies the answer as 1.5 + \whenRight Correct! + \whenWrong Incorrect! + \end{question} +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/webquiz-online-manual.pdf b/macros/latex/contrib/webquiz/doc/webquiz-online-manual.pdf Binary files differnew file mode 100644 index 0000000000..64dbf04186 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/webquiz-online-manual.pdf diff --git a/macros/latex/contrib/webquiz/doc/webquiz-online-manual.tex b/macros/latex/contrib/webquiz/doc/webquiz-online-manual.tex new file mode 120000 index 0000000000..9c095e5c9c --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/webquiz-online-manual.tex @@ -0,0 +1 @@ +www/doc/webquiz-online-manual.tex
\ No newline at end of file diff --git a/macros/latex/contrib/webquiz/doc/webquiz.1 b/macros/latex/contrib/webquiz/doc/webquiz.1 new file mode 100644 index 0000000000..4bf1587e60 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/webquiz.1 @@ -0,0 +1,216 @@ +.\" Man page generated from reStructuredText. +. +.TH WEBQUIZ: A LATEX PACKAGE FOR WRITING ONLINE QUIZZES "" "" "" +.SH NAME +WebQuiz: a LaTeX package for writing online quizzes \- +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +\fI\%WebQuiz\fP makes it possible to use \fI\%LaTeX\fP to write interactive online quizzes. +The quizzes are first written in \fI\%LaTeX\fP and then converted into HTML using +\fI\%WebQuiz\fP, which is written in python. The conversion from \fI\%LaTeX\fP to HTML is +done behind the scenes using \fI\%TeX4ht\fP\&. The idea is that you should be able to +produce nice online quizzes using \fI\%WebQuiz\fP and basic knowledge of \fI\%LaTeX\fP\&. +.sp +\fI\%WebQuiz\fP is designed to be used from the command\-line. For example, if +\fIquiz1.tex\fP is a LaTeX file for a quiz then: +.INDENT 0.0 +.TP +.B \fIlatex quiz1\fP +produces a "readable" DVI file for the quiz +.TP +.B \fIpdflatex quiz1\fP +produces a "readable" PDF file for the quiz +.TP +.B \fIwebquiz quiz1\fP +creates the web page \fIquiz1.html\fP +.UNINDENT +.sp +If you prefer to use \fI\%LaTeX\fP from a GUI for \fI\%LaTeX\fP then it should be possible to +configure it to use \fI\%WebQuiz\fP directly. As an example, the manual provides some +details about how to do this for TeXShop. +.SH USAGE +.INDENT 0.0 +.TP +.B usage: webquiz [\-h] [\-q] [\-d] [\-s] [\-\-latex | \-l | \-x] [\-r RCFILE] +[\-i | \-e | \-\-settings [SETTINGS]] +[quiz_file [quiz_file ...]] +.UNINDENT +.sp +A LaTeX package for writing online quizzes +.INDENT 0.0 +.TP +.B positional arguments: +quiz_file latex quiz files +.TP +.B optional arguments: +.INDENT 7.0 +.TP +.B \-h\fP,\fB \-\-help +show this help message and exit +.TP +.B \-q\fP,\fB \-\-quiet +Suppress tex4ht messages (also \-qq etc) +.TP +.B \-d\fP,\fB \-\-draft +Use make4ht draft mode +.TP +.B \-s\fP,\fB \-\-shell\-escape +Shell escape for tex4ht/make4ht +.TP +.B \-\-latex +Use latex to compile document with make4ht (default) +.TP +.B \-l\fP,\fB \-\-lua +Use lualatex to compile the quiz +.TP +.B \-x\fP,\fB \-\-xelatex +Use xelatex to compile the quiz +.TP +.BI \-r \ RCFILE\fP,\fB \ \-\-rcfile \ RCFILE +Specify location of the webquiz rc\-file +.TP +.B \-i\fP,\fB \-\-initialise\fP,\fB \-\-initialize +Install web components of webquiz +.TP +.B \-e\fP,\fB \-\-edit\-settings +Edit default settings for webquiz +.TP +.BI \-\-settings \ <SETTINGS> +List default settings for webquiz +.UNINDENT +.UNINDENT +.SH INSTALLATION +.sp +To use \fI\%WebQuiz\fP you need to have a standard \fI\%LaTeX\fP distribution installed, such as \fI\%TeXLive\fP, that includes \fI\%TeX4ht\fP\&. In addition, you need to have \fI\%Python3\fP installed. As \fI\%WebQuiz\fP uses scalable vector graphics (SVG) you should check that all of the dependencies of \fI\%dvisvgm\fP are installed on your system, especially if you plan on using graphics or images. +.sp +Once the TeX components of \fI\%WebQuiz\fP package have been installed you can install the web components of \fI\%WebQuiz\fP using the following command, which needs to be run from the command line: +.sp +> webquiz \-\-initialise +.sp +If you want to install the web components of \fI\%WebQuiz\fP into a system directory then you need to run this command from an administrators account, so using \fIsudo\fP on a unix\-like system. For more details about the installation and configuration of \fI\%WebQuiz\fP please see Section 3.2 of the \fI\%WebQuiz\fP manual. +.sp +Please see the manual for more details about initialising and using \fI\%WebQuiz\fP\&. +.SH INSTALLATION FROM THE CTAN ZIPFILE +.sp +On both unix\-like systems (including macosx), and windows systems (using +either TeXLive or MiKTeX), you can install WebQuiz by downloading the +WebQuiz zip file from: +.INDENT 0.0 +.INDENT 3.5 +\fI\%http://mirrors.ctan.org/macros/latex/contrib/webquiz.zip\fP +.UNINDENT +.UNINDENT +.sp +To install the package, unzip this file and change directory to the +webquiz/scripts subdirectory run: +.sp +> webquiz \-\-tex\-install +.sp +(or webquiz.bat \-\-text\-install on windows). This commands unpacks the webquiz +files into their standard locations in the TeX install tree to it should be +run from an administrators account, or using sudo on a unix\-like system. +Roughly what this command does is the following: +.INDENT 0.0 +.IP \(bu 2 +It creates a symbolic link, or equivalent, to the main WebQuiz executable, +which is the file webquiz.py in the scripts directory +.IP \(bu 2 +Copies the latex directory to somewhere in the TeX search path and then +runs \fImktexlsr\fP so that LaTeX and WebQuiz can find these files. +.IP \(bu 2 +Copies the python code into the TeX scripts subdirectory +.IP \(bu 2 +Copies the WebQuiz doc subdirectory into the TeX doc/latex subdirectory. +.UNINDENT +.sp +If you are using MiKTeX you may need to open the MiKTeX console, go to +the Tasks menu and then rebuild the TeX filename database. +.sp +Once the files above are in place initialise WebQuiz by following the +installation instructions above. +.sp +Mainly for development purposes, there is another undocumented +command\-line option for removing these files from TEXMFMAIN: +.sp +> sudo webquiz/scripts/webquiz \-\-tex\-uninstall +.SH SYSTEM REQUIREMENTS +.sp +In order to work WebQuiz needs the following programs to be installed on your +system: +.INDENT 0.0 +.IP \(bu 2 +An up\-to\-date \fI\%LaTeX\fP distribution, such as that provided by \fI\%TeXLive\fP\&. In +particular, you need to have \fI\%TeX4ht\fP and \fI\%make4ht\fP installed. +Unfortunately, since TeXLive 2018 was released there have been a significat +bunber of updates to a number of packahges that \fI\%WebQuiz\fP uses, including +updates to \fI\%TeX4ht\fP, \fI\%make4ht\fP, \fI\%tikz\fP and \fI\%pstricks\fP\&. For this reason, \fIit is +strongly recommended that you all packages from ctan_ before using WebQuiz_\fP\&. +.IP \(bu 2 +\fI\%python3\fP As of writing python 3.7.2 is available. +.IP \(bu 2 +\fI\%Javascript\fP +.IP \(bu 2 +If you plan to use \fI\%pstricks\fP with \fI\%WebQuiz\fP, or if you want to +compile the online manual for WebQuiz, then you need to ensure that +\fI\%ghostscript\fP and \fI\%dvisvgm\fP are installed and properly configured on your +system. See the \fI\%WebQuiz\fP manual and the \fI\%dvisvgm\fP documentation for more +details +.IP \(bu 2 +A web server. To view online quizzes you of course need a web server. As +described in the \fBInstallation\fP section you will also need to copy of the +\fI\%WebQuiz\fP components onto your web server using the command: +.sp +> webquiz \-\-initialise +.UNINDENT +.SH AUTHORS +.sp +The LaTeX component of \fI\%WebQuiz\fP was written by Andrew Mathas and the python, +css and javascript code was written by Andrew Mathas (and Don Taylor), based on +an initial protype of Don Taylor\(aqs from 2001. Since 2004 the program has been +maintained and developed by Andrew Mathas. Although the program has changed +substantially since 2004 Don\(aqs idea of using \fI\%TeX4ht\fP, and some of his code, is +still very much in use. +.sp +Copyright (C) 2004\-2019 +.SH LICENSE +.sp +GNU General Public License, Version 3, 29 June 2007 +.sp +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU_General Public License +(\fI\%GPL\fP) as published by +the Free Software Foundation, either version 3 of the License, or (at +your option) any later version. +.sp +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +Public License for more details. +.\" Generated by docutils manpage writer. +. diff --git a/macros/latex/contrib/webquiz/doc/webquiz.languages b/macros/latex/contrib/webquiz/doc/webquiz.languages new file mode 100644 index 0000000000..ebfe250533 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/webquiz.languages @@ -0,0 +1,3 @@ +% List of languages currently supported by WebQuiz +% Generated using 'makedoc --languages' on 2019-04-01 +\newcommand\WebQuizLanguages{Czech, English, French, German, Greek, Italian, Japanese, Mandarin, Russian, Spanish,, Swedish} diff --git a/macros/latex/contrib/webquiz/doc/webquiz.pdf b/macros/latex/contrib/webquiz/doc/webquiz.pdf Binary files differnew file mode 100644 index 0000000000..358637b1b0 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/webquiz.pdf diff --git a/macros/latex/contrib/webquiz/doc/webquiz.settings b/macros/latex/contrib/webquiz/doc/webquiz.settings new file mode 100644 index 0000000000..47dee55754 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/webquiz.settings @@ -0,0 +1,21 @@ +--------------------------------------------------------------------------- +WebQuiz rc-file: /usr/local/texlive/texmf-local/tex/latex/webquiz/webquizrc +--------------------------------------------------------------------------- +breadcrumbs = +department = +department-url = / +engine = latex +hide-side-menu = false +institution = +institution-url = / +language = english +one-page = false +random-order = false +theme = default +version = 5.2 +webquiz-url = /WebQuiz +webquiz-www = /Library/WebServer/Documents/WebQuiz +make4ht = +mathjax = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js +webquiz-layout = webquiz_layout +--------------------------------------------------------------------------- diff --git a/macros/latex/contrib/webquiz/doc/webquiz.tex b/macros/latex/contrib/webquiz/doc/webquiz.tex new file mode 100644 index 0000000000..808c7f032a --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/webquiz.tex @@ -0,0 +1,2339 @@ +%----------------------------------------------------------------------------- +% Copyright (C) 2004-2019 Andrew Mathas, University of Sydney +% +% Distributed under the terms of the GNU General Public License (GPL) +% http://www.gnu.org/licenses/ +% +% This file is part of the WebQuiz system. +% +% <Andrew.Mathas@sydney.edu.au> +%----------------------------------------------------------------------------- + +\synctex=1 + +\PassOptionsToClass{tikz,svgnames}{xcolor} +\documentclass[svgnames]{article} +\usepackage[a4paper,margin=30mm]{geometry} +\parindent=4mm +\parskip=1mm +\hfuzz 5pt +\synctex=1 + +% load webquiz-ini and webquiz-doc code -- doc needs ini so ini is first +\input{webquiz-ini.code} +\input{webquiz-doc.code} + +% Can't use same definition in webquiz-online-manual because of conflict +% with code in webquiz.cfg to make color work with listings +\newcommand\WebQuiz{\textcolor{Sienna}{WebQuiz}\xspace} + +\usepackage{textcomp} +\usepackage{pdfpages} +\usepackage{manfnt} +\usepackage{booktabs} +\usepackage{bbding} +\usepackage{pifont} +\usepackage{pgffor} + +\usepackage{etoolbox}% used below to patch l@section to remove extraneous spacing +\usepackage{appendix} +\def\sectionautorefname{Chapter} +\def\subsectionautorefname{Section} +\def\subsubsectionautorefname{\S\kern-0.8ex} +\def\appendixautorefname{Appendix} + +\usepackage{imakeidx} +\indexsetup{level=\section*,toclevel=section,noclearpage} +\makeindex[intoc,columns=3] + +\newenvironment{heading}[1][] +{\noindent\trivlist\item[\hskip\labelsep\textbf{#1}]} + {\endtrivlist} + +\newenvironment{dangerous}{\trivlist\item[\hskip\labelsep\textcolor{red}{\textdbend}]}{\endtrivlist} + +\setcounter{secnumdepth}{3} +\setcounter{tocdepth}{3} +\renewcommand\thesubsubsection{\thesubsection\alph{subsubsection}} +\newcommand\lowerCaseIndex[1]{% + \lowercase{\def\temp{#1}}% + \expandafter\index\expandafter{\temp@#1}% +} +% usage: \CrossIndex[*]{main entry}[*]{subentry} with *'s for macros +\NewDocumentCommand\CrossIndex{ smsm }{% + \IfBooleanTF{#1}{% + \lowercase{\def\tempa{#2}}% + \xdef\tempa{\tempa@\noexpand\textbackslash#2}% + }{\def\tempa{#2}}% + \IfBooleanTF{#3}{% + \lowercase{\def\tempb{#4}}% + \xdef\tempb{\tempb@\noexpand\textbackslash#4}% + }{\def\tempb{#4}}% + \expandafter\index\expandafter{\tempa!\tempb}% + \expandafter\index\expandafter{\tempb}% +} +\newcommand\macroIndex[1]{% + \lowercase{\def\temp{#1}}% + \expandafter\index\expandafter{\temp@\textbackslash#1}% +} +\newcommand\gobbleone[1]{}% https://tex.stackexchange.com/questions/318472 +\newcommand{\See}[2]{\unskip\emph{see } #1} +\newcommand\SeeIndex[2]{\index{#1!zzzz@\protect\gobbleone|See{#2}}} + +\newif\ifCtan\Ctantrue % condition compilation for ctan distribution + +\renewcommand*\contentsname{\relax} + +% hyperref links to ctan +\newcommand\TeXLive{\href{https://www.tug.org/texlive/}{\TeX Live}\xspace} +\newcommand\Ctan{\ctan[]{ctan}\xspace} +\newcommand\ddash{\texttt{\textemdash\textemdash}} +\NewDocumentCommand\webquizrc{s}{\index{webquizrc}% +\BashCode|webquizrc| file\IfBooleanF{#1}{ (\autoref{SS:rcfile})}\xspace% +} +\newcommand\MiKTeX{\href{https://miktex.org/}{MiK\TeX}\xspace} +\NewDocumentCommand\OnlineManual{s}{% + \href{http://www.maths.usyd.edu.au/u/mathas/WebQuiz/webquiz-online-manual.html}{Online manual}% + \IfBooleanF{#1}{ (\hyperref[S:online]{Appendix~B})}\xspace% +} + +\indexprologue{% + \noindent\textit{This is an index only for the main \WebQuiz manual. + It does not index the \OnlineManual.}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\input{webquiz.themes} % defines a comma separated list of themes \WebQuizThemes +\newcommand\ListWebQuizThemes{% + \begin{quote} + \def\sep{} + \foreach \theme in \WebQuizThemes {% + \ifx\theme\empty\gdef\sep{ and }% + \else\sep\index{theme!\theme}\theme\gdef\sep{, }% + \fi + } + \end{quote} +} +\newcommand\ShowcaseThemes{% + \foreach \theme in \WebQuizThemes { + \ifx\theme\empty\relax% + \else% + \ScreenShot[0.75]{Example of the \textbf{\theme} theme}{theme-\theme}% + \index{theme!\theme}% + \fi + } +} + +\input{webquiz.languages} % defines a comma separated list of themes \WebQuizLanguages +\newcommand\ListWebQuizLanguages{% + \begin{quote} + \def\sep{} + \foreach \lang in \WebQuizLanguages {% + \ifx\lang\empty\gdef\sep{ and }% + \else\sep\index{language!\lang}\lang\gdef\sep{, }% + \fi + } + \end{quote} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% WebQuiz title box for front page +\usepackage{tikz} +\usetikzlibrary{shadows.blur} + +\definecolor{stone}{HTML}{E9E0D8} +\tikzset{shadowed/.style={blur shadow={shadow blur steps=5}, + top color=stone, + bottom color=PapayaWhip, + draw=SaddleBrown, + shade, + font=\normalfont\Huge\bfseries\scshape, + rounded corners=8pt, + }, + boxes/.style={draw=Sienna, + fill=Cornsilk, + font=\sffamily\small, + inner sep=5pt, + rectangle, + rounded corners=8pt, + text=Brown, + } +} + +\def\WebQuizTitle{ + \begin{tikzpicture}[remember picture,overlay] + \node[yshift=-3cm] at (current page.north west) + {\begin{tikzpicture}[remember picture, overlay] + \draw[shadowed](30mm,0) rectangle node[Brown]{\WebQuiz} (\paperwidth-30mm,16mm); + \node[Sienna,font=\normalfont\small\itshape] at (\paperwidth/2,2mm) + {\small \webquiz{description}}; + \node[anchor=west,boxes] at (4cm,0cm) {\webquiz{name}}; + \node[anchor=east,boxes] at (\paperwidth-4cm,0) {Version \webquiz{version}}; + \end{tikzpicture} + }; + \end{tikzpicture} +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% headers and footers +\makeatletter +\def\ps@webquiz{ + \ps@empty + \def\@oddfoot{\tiny\WebQuiz\space -- version \webquiz{version}\hfill% + \textsc{\ifodd\thepage The \WebQuiz manual\else \webquizheader\fi}\hfill\thepage} +} +% hijack section and subsectionmark for our headers +\def\webquizheader{\WebQuiz} +\def\sectionmark#1{\def\webquizheader{#1}} +\def\subsectionmark#1{\def\webquizheader{#1}} +\pagestyle{webquiz} +\patchcmd\l@section{1.0em}{0.5em}{}{} +\makeatother + +\begin{document} + \hypersetup{pdftitle={WebQuiz manual}} + + \WebQuizTitle + + \begin{quote} + \WebQuiz is a \LaTeX{} package for writing online quizzes. It allows + the quiz author to concentrate on the content of quizzes, written + in standard \LaTeX, unencumbered by the technicalities of \HTML and + \Javascript. Online quizzes written using \WebQuiz can contain any + material that can be written using \LaTeX, including text, + mathematics, graphics and diagrams. + \ScreenShot[0.68]{An example \WebQuiz web page}{quiz-page} + \begin{center} + \hfil + \begin{minipage}{0.75\textwidth} + \tableofcontents + \end{minipage} + \end{center} + \end{quote} + + \newpage + + \section{Introduction} + Online quizzes provide a good way to reinforce learning, especially + because they can give ``interactive'' feedback to the + students\footnote{Throughout this manual, ``student'' means any + person taking the online quiz.\index{student}} based on the answers that they + give. Unfortunately, in addition to writing the actual quiz content there + are significant technical hurdles that need to be overcome when + writing an online quiz -- and there are additional complications if + the quiz involves mathematics or diagrams. + + \WebQuiz makes it possible to write online quizzes using \LaTeX, + which is the typesetting language used by mathematicians who use + \LaTeX\ to write their research papers, books and teaching + materials. In principle, a \WebQuiz quiz can contain anything that + can be typeset using \LaTeX. In practise, the \LaTeX\ is converted + to \HTML using \TeXfht (and + \ctan{make4ht}), so the + quizzes can contain any \LaTeX commands that are understood by \TeX + 4ht, which is almost everything. In particular, it is possible to + use graphics constructed using \ctan{pstricks} and + \ctan{tikz}; see \autoref{SS:graphics}. + + \WebQuiz supports the following three types of questions: + \begin{itemize} + \item Multiple choice questions with a unique correct answer + \item Multiple choice questions zero or more correct answers + \item Questions with an answer that is supplied by the student. + \end{itemize} + Each time a student answers a question it is possible to give them + feedback, reinforcing their learning when they answer correctly and + giving them further hints when they are wrong. This allows the + quiz author to give targeted feedback to the student based on their + answer. + + The online quizzes constructed using \WebQuiz can, in principle, + contain anything that can be typeset by \LaTeX. In particular, they + do not need to contain mathematics. In fact, the quizzes do not even + have to contain ``questions'' as it is possible for a \WebQuiz + ``quiz'' to contain only \LatexCode|discussion| environments that can + be used to revise material, or to introduce new material, for the + students; see \autoref{SS:discussion}. + + This introduction outlines how to use \WebQuiz, however, the + impatient reader may want to skip ahead directly to the + \autoref{S:documentclass}, where the \LaTeX\ commands used by + \WebQuiz are described. + + The easiest way to explain how \WebQuiz works is by example. The + following \LaTeX\ file defines a quiz with a single multiple choice + question that has four possible answers, each of which has a + customised feedback. Giving feedback to the students in each + question is optional but the capability of being able to give + students feedback on their answer is one of the main pedagogical + advantages of online quizzes. + + \InputLatexCode{simple} + + Since this is a \LaTeX\ file it can be processed using + \BashCode|pdflatex|, or \BashCode|latex|, to produce a readable and + printable version of the quiz, which can be useful when + proofreading. With the example above, the PDF version of the quiz looks + like this: + \ScreenShot[0.5]{Sample \BashCode|PDF| output}{simple-pdf} + Of course, the real reason for using \WebQuiz is to create a + web page for the quiz, which you do by processing the quiz using + the \BashCode|webquiz| command )instead of, say + \BashCode|pdflatex|). If you do this and open the resulting + web page in your favourite browser, after selecting answer~(a), you + will see a web page like this: + \ScreenShot{Sample web page}{simple-html} + The actual page that you see may be slightly different to + this because the appearance of the web page depends partly on your + choice of browser. + + By default, the online version of the quiz displays one question at + a time, with the question buttons serving the dual purpose of + navigation between questions and displaying how successful the + student was in answering the question. The decorations on the + question buttons indicate whether the question has been attempted + and, if so, whether it was answered correctly or incorrectly on the + first or subsequent attempts. One of the main points of \WebQuiz is + that (optional) targeted feedback can be given to the student taking + the quiz based on their answer. + + \subsection{What \WebQuiz does and does not do} + + \WebQuiz is a tool that makes it possible to write ``interactive'' + online quizzes using \LaTeX{}. To use \WebQuiz you only need + basic working knowledge of \LaTeX{}. In particular, no familiarity + of the underlying \CSS, \HTML or \Javascript is required. + + \WebQuiz can be used to ask students a series of ``quiz'' + questions. In addition, your online quiz web pages can contain + course material using the \WebQuiz \LatexCode|discussion| + environment; see \autoref{SS:discussion}. You can write \WebQuiz + quizzes that only contain questions, and no + \LatexCode|discussion|, quizzes that contain questions and + \LatexCode|discussion|, and (pseudo) quizzes that contains only + \LatexCode{discussion} and no quiz questions. + + By default, the online quizzes display one question (or + \LatexCode|discussion| environment) at a time. It is also possible + to display all of the quiz questions on a single web page + (\autoref{SS:classOptions}). One of the key features of \WebQuiz is + that you can give feedback to the students based on their answers. + In this way you can give hints to the students to correct their + mistakes and you can reinforce the students' understanding when they + are correct. Each question in a quiz, and each quiz itself, can be + attempted as many times as the student wants. \WebQuiz does not + limit the number of times that questions can be attempted. + + As described in \autoref{SS:Questions}, \WebQuiz supports the following question types: + \begin{itemize} + \item Multiple choice questions with a unique correct answer + \item Multiple choice questions zero or more correct answers + \item Questions that require students to type in an answer. There + are several different ``comparison'' methods available for + comparing the students answer where + for example, the entered answers can be a ``string'' or a ``number''. + \end{itemize} + + Questions can appear in either the same order that they appear in + the \LaTeX{} file for the quiz or in a random order that changes + each time the quiz page is loaded. For multiple choice questions the + order in which the choices appear is always the order that they + appear in the \LaTeX{} file for the quiz, even if the questions + appear in random order. + + \WebQuiz supports several different languages and it + provides a number of different colour schemes (see + \autoref{SS:commandline} and \hyperref[SS:themes]{Appendix A}). + + \WebQuiz quizzes are not timed and they do not have time-limits. + + Quizzes made using \WebQuiz are intended to be used as a + revision resource rather than as an assessment tool. In particular, + \WebQuiz does not provide a mechanism for recording the marks + obtained by the students taking the quiz + (\autoref{SS:classOptions}). Technically, it probably would not be + very hard to record marks but this introduces a significant amount + of extra overhead in terms of student authentication and interfacing + with a database. In addition, if \WebQuiz were used as an assessment + tool then there would be additional ``security issues'' to ensure + that the quiz content is secure. Currently, even though the + solutions to the quiz questions do not appear in the \HTML source + code for the quiz pages it is possible to access the answers if you + know what you are doing. + + The questions in a \WebQuiz quiz are static. In particular, + \WebQuiz quiz questions do not accept variables. + + The \WebQuiz program was designed to be run from the command-line. + To process the file \BashCode|quiz.tex| using \WebQuiz you would + type + \begin{bashcode} + > webquiz quiz or > webquiz quiz.tex + \end{bashcode} + \index{$>$ command-line prompt}\index{command-line prompt!$>$} + (Throughout this manual, \BashCode|>| is used for the command-line + prompt.) + + It is possible to use \WebQuiz from inside editors like + \TeX Shop, but exactly how this is done will depend on the program + that you use. In the case of \TeX Shop you need to define a + new \textit{engine} following, for example the instructions at + \href{https://tex.stackexchange.com/questions/376649} + {tex.stackexchange.com/questions/376649}. + \index{TeXShop@\TeX Shop} + + \subsection{Credits} + \WebQuiz{} was written and developed in the + \href{http://www.maths.usyd.edu.au/}{School of Mathematics and + Statistics} at the \href{http://www.usyd.edu.au/}{University of + Sydney}. The system is built on \LaTeX{} with the conversion from + \LaTeX{} to \HTML being done by Eitan Gurari's + \TeXfht and \ctan{make4ht}. + + To write quizzes using \WebQuiz it is only necessary to know + \LaTeX, however, the underlying \WebQuiz system actually has three + components: + \begin{itemize} + \item A \href{https://www.latex-project.org/}{\LaTeX} document class + file, \BashCode|webquiz.cls|, and a \TeXfht + configuration file, \BashCode|webquiz.cfg|, that enables the + quiz files to be processed by \LaTeX{} and \TeXfht, respectively. + \item A \python program, + \BashCode|webquiz|, that translates the + \LaTeX{} into \XML, using \TeXfht, and then into \HTML. + \item \CSS, \HTML and \Javascript code controls and style the + quiz web pages. + \end{itemize} + + The \LaTeX{} component of \WebQuiz{} was written by Andrew Mathas and + the \python, \CSS and \Javascript code was written by Andrew Mathas + based on an initial prototype that was written by Don Taylor in 2001-2. + Since 2004 the program has been maintained and developed by Andrew + Mathas. Although the program has changed substantially since 2004, + Don's idea of using \TeXfht, and some of his code, is still + in use. Prior to releasing \WebQuiz on \Ctan, the program was known + as \texttt{MathQuiz}. + + Hendrik Suess contributed code to improve session history + and suggested the \LatexCode|\qref| command. + + Thanks are due to Bob Howlett for general help with \CSS and to + Michal Hoftich for invaluable technical advice on \TeXfht. Thanks + are due to + Thomas Cailleteau + Michael Palmer and + Hendrik Suess + for helpful feedback on the package. + + \section{The \WebQuiz document class --- \hologo{LaTeX}{} commands} + \label{S:documentclass} + + This chapter describes the commands and environments provided by the + \WebQuiz document class. This assumes that you have already installed + and configured \WebQuiz. If you have not yet initialised \WebQuiz + then please follow the instructions in \autoref{S:configuration}. + + All of the code examples given in this and other sections can be + found in the \BashCode|examples| subdirectory of the \WebQuiz web + directory.\footnote{After you have initialised \WebQuiz, you can find the + \WebQuiz example directory from the command-line using: + \texttt{webquiz --settings webquiz-www}.} + Additional examples can be found in the \OnlineManual*, + which is included, in \BashCode|PDF| form, as + \hyperref[S:online]{Appendix B}. + + Zoomed out, the structure of a typical \WebQuiz quiz file is a \LaTeX{} file of the form: + \begin{latexcode} + \documentclass{webquiz} + \title{A quiz}% optional, but potentially informative, title + \begin{document} + + \begin{question}% text for first question + \end{question} + + \begin{question}% text for second question + \end{question} + + \begin{question}% text for third question + \end{question} + + ... + + \end{document} + \end{latexcode} + You should write your quizzes using the editor that you normally use + to write \LaTeX{} documents. As you write your quiz, say + \BashCode|quiz.tex|, you should use \BashCode|pdflatex| + (or \BashCode|latex|), in the usual way: + \begin{bashcode} + > pdflatex quiz + \end{bashcode} + This is the easiest way to check that your quiz compiles and to + proofread the output, just as if you were writing a normal \LaTeX{} + document. When you are satisfied with the content of the quiz, then + you can convert the quiz to an online quiz using the command + \begin{bashcode} + > webquiz quiz or > webquiz -d quiz # -d = draft mode = faster! + \end{bashcode} + The quiz file, \BashCode|quiz.tex|, should be in a directory on your + web server because \WebQuiz creates a number of different files and + directories when it converts the file into an online quiz and all + of these files are needed to display the quiz on the web. + + The reasons for using this workflow are: + \begin{itemize} + \item \textit{Every file that you give to \WebQuiz must be a valid + \LaTeX{} file!} + + \item The \BashCode|dvi| or \BashCode|PDF| file produced by \LaTeX{} + shows all of the information in the quiz + \textit{in an easy-to-read format}. That is, the \BashCode|PDF| file + displays the questions, the answers and the feedback that you are + giving to the students. In contrast, by design, the online version + of the quiz hides most of this information and shows it to the + student only when they need to see it. + + \item Typesetting the quiz file with \LaTeX{} is \textit{much + faster} than processing it with \WebQuiz. In fact, \WebQuiz uses + \BashCode|htlatex| to process the quiz file at least + \textit{three times} in order to produce an \XML file and it is only + then that the \WebQuiz program kicks in to rewrite this data as an + \HTML file. (If you use \textit{draft mode} then + \BashCode|htlatex| processes the quiz file only once.) + + \item If \LaTeX{} produces errors then \WebQuiz will produce more + errors. Further, \textit{\LaTeX{} error messages are much easier to + read and understand than those produced by \TeXfht and \WebQuiz}. + \end{itemize} + This said, \WebQuiz does check for more errors in the quiz than + \LaTeX{} is (easily) able to do. + + The \BashCode|PDF| version of a quiz does not contain information about + the unit, department or institution, which can be used in the + breadcrumbs. + + The next sections describe the commands and environments provided by + \WebQuiz for typesetting quizzes as well as the document-class options + for the package. If you plan to use \ctan{pstricks} or + \ctan[pgf]{tikz} then you should read \autoref{SS:graphics}, which + describes how to use graphics in a \WebQuiz quiz. + \autoref{SS:config} describes a work-around for using (some?) \LaTeX{} + features that have not been configured for use with \TeXfht. + + \subsection{Question environments}\label{SS:Questions} + + The \WebQuiz document class defines the following four environments: + \begin{quote} + \begin{description} + \item[question] Each quiz question needs to be inside + \LatexCode|question| environment + \item[choice] Typesets multiple choice questions, with + one or more correct answers + \item[discussion] Includes (optional) discussion, or revision, + material at the start of the quiz web page + \item[quizindex] Writes an index file for the quizzes in + a ``unit of study'' and generates drop-drop menus in each quiz for + the unit + \end{description} + \end{quote} + This section describes these environments and gives examples + of their use. + + \subsubsection{Question environments and the \textcolor{blue}{\textbackslash answer} macro} + \index{environment!question} + \index{question environment} + + Each quiz question must be placed inside a \LatexCode|question| + environment. Typically, a quiz has several questions, each wrapped in + its own \LatexCode|question| environment. For brevity, most of the + examples in this chapter have only one question. See the + \OnlineManual, in the \WebQuiz web directory for a more complete quiz + file. + + This manual describes the \WebQuiz commands, often by example. The + following code-block generates a quiz with one question for which the + student has to enter the answer. This answer is then compared with the + correct answer as a string, which it must match exactly. + \InputLatexCode{answer-string} + \macroIndex{answer}\CrossIndex{question environment}*{answer} + \CrossIndex*{answer}*{whenRight} + \CrossIndex*{answer}*{whenWrong} + \index{feedback!whenRight} + \index{feedback!whenWrong} + The \textit{optional} macros \LatexCode|\whenRight| and + \LatexCode|\whenWrong| are used to give the student additional + feedback, when they are right, or further hints etc for approaching + the question, when they are wrong. This feedback is displayed on the + quiz page only when the student checks their answer. + + The web page created by the code above, when an incorrect answer of + ``canberra'', instead of ``Canberra'' is given, looks something like + the following: + \ScreenShot{A question with an answer}{answer-string} + This example shows one way of using the \LatexCode|\answer| macro, which + asks for the student to type in an answer to the question. The general syntax of + this macro is: + \begin{latexcode} + \answer[comparison type]{correct answer} + \end{latexcode} + where the optional \textit{comparison type} is one of: + \begin{latexcode} + complex integer lowercase number string + \end{latexcode} + with \LatexCode|string| being the default. In addition, there is a + $*$-variant of the answer macro that does not print the word + ``Answer'' (or equivalent in other languages) before the input box. + The syntax for the \LatexCode|\answer*| command is identical to that + for the \LatexCode|\answer| except, of course, that there is a~$*$: + \begin{latexcode} + \answer*[comparison type]{correct answer} + \end{latexcode} + As \LatexCode|string| is the default answer comparison method, if we + instead use \LatexCode|\answer*{Canberra}| in the last example then + the quiz page generated by \WebQuiz looks like: + \ScreenShot{A question with answer$*$}{answer-star} + Notice that the word \LatexCode|Answer| no longer appears in front of + the answer box. Of course, if you use the unstarred version of the + \LatexCode|\answer|-macro together with the document class option + \LatexCode|language=xxx| to change the default language + (\autoref{SS:classOptions}), then the appropriate translation of + \LatexCode|Answer| will appear on the web page. + + We now give a description of the other comparison types for the + \LatexCode|\answer| and \LatexCode|\answer*| macros together with + code examples and screenshots. + + \CrossIndex*{answer}{complex} + \begin{heading}[complex comparison] The answers are compared as complex + numbers: the answer is marked as correct if it has the same real and + imaginary parts. + \InputLatexCode{answer-complex} + \ScreenShot{A question with a complex answer}{answer-complex} + \end{heading} + Observe that the correct answer is given in the quiz file as $7+i$ + and that \WebQuiz accepts $i+7$ as the correct answer. + + \begin{heading}[integer comparison] The answers are compared as + integers. If the correct answer was $18$ and a student entered + $36/2$ then their answer would be marked wrong. + \CrossIndex*{answer}{integer} + \InputLatexCode{answer-integer} + \ScreenShot{A question with a integer answer}{answer-integer} + \end{heading} + + \begin{heading}[lowercase comparison] The quiz answer and the + students' answer are both converted to lower case and then compared as + strings. + \CrossIndex*{answer}{lowercase} + \InputLatexCode{answer-lowercase} + \ScreenShot{A question with a lowercase string answer}{answer-lowercase} + \end{heading} + + \begin{heading}[number comparison] The quiz answer and the students' + answer are compared as numbers. \CrossIndex*{answer}{number} + \InputLatexCode{answer-number} + \ScreenShot{A question with a numeric answer}{answer-number} + Notice that the answer is given in the \LaTeX{} file as $3/4$ and + that the equivalent fraction, $0.75$, is accepted as the correct + answer. + \end{heading} + + \begin{heading}[string comparison] + This is the default, so \LatexCode|\answer{word}| and + \LatexCode|\answer[string]{word}| are equivalent. The student's + answer is marked correct if and only if it agrees exactly with + the quiz answer. + \CrossIndex*{answer}{string} + \end{heading} + + \subsubsection{Multiple choice questions}\label{SS:choice} + \index{environment!choice} + \index{question environment!choice} + \SeeIndex{multiple choice}{choice environment} + + The multiple choice options for a quiz question need to be placed inside + a \LatexCode|choice| environment -- and every \LatexCode|choice| + environment needs to be inside a \LatexCode|question| environment. + + The \LatexCode|choice| environment accepts two optional arguments, + can appear in any order: + \begin{itemize} + \item\CrossIndex{choice environment}{single} + \CrossIndex{choice environment}{multiple} + The word \LatexCode|single| (default, and can be omitted) or + \LatexCode|multiple|, which indicates whether the quiz has a + \textit{single} correct answer or whether 0 or more of the answers are + correct, respectively. + \item \index{choice environment!columns} + The number of \textit{columns} in which to typeset the choices. This + is specified as \LatexCode|columns=n|, where $n$ is a non-negative integer. + By default, the choices appear in $n=1$ columns + (\DefaultValue{columns=1}).\\ + \textit{Use \LatexCode|columns=n| with care when $n>1$ as multiple + columns do not always display well on mobile devices.} + \end{itemize} + The key difference between these two types of \LatexCode|choice| + questions is that a \LatexCode|single|-choice environment uses radio + boxes, so it is only possible to select \textit{one correct answer}. + In a \LatexCode|multiple|-choice environment checkboxes are used, so + that is possible to select \textit{zero or more correct answers}. + + A \LatexCode|choice| environment modelled on the standard + \LaTeX{} list environments (\textit{enumerate}, \textit{itemize}, + \textit{description}, ...), except that instead of using the + \LatexCode|\item| command to separate the items the + \LatexCode|choice| environment uses \LatexCode|\correct| + \CrossIndex{choice environment}*{correct} \LatexCode|\incorrect| + \CrossIndex{choice environment}*{incorrect}, which indicate correct + and incorrect answers respectively. In addition, after each + \LatexCode|\correct| or \LatexCode|\incorrect| you can, optionally, use + \LatexCode|\feedback| \CrossIndex{choice environment}*{feedback} to give + feedback to the student taking the quiz. Like + \LatexCode|\whenRight| and \LatexCode|\whenWrong| this feedback is + displayed only when the student checks their answer. + \index{feedback} + \CrossIndex{feedback}*{whenRight} + \CrossIndex{feedback}*{whenWrong} + + Here is an example of a \LatexCode|single|-choice question with a unique + answer: + \InputLatexCode{choice-single} + Note that \LatexCode|single| is the default, so this could also be written as + \begin{latexcode} + \begin{choice}[columns=3, single] + ... + \end{choice} + \end{latexcode} + It is not necessary to put the \LatexCode|\feedback| lines on the same + line as the \LatexCode|\incorrect| and \LatexCode|\incorrect|; this is + done only to make the example more compact. This results in the + following web page: + \ScreenShot{Single answer multiple choice question}{choice-single} + + Here is an example of a multiple choice question that has + two correct answers: + \InputLatexCode{choice-multiple} + Notice that this example uses the document-class option + \LatexCode{theme=vibrant}, which changes the \WebQuiz colour theme; + see \autoref{SS:classOptions}. + \ScreenShot{Multi-answer multiple choice question}{choice-multiple} + + When the optional argument \LatexCode|multiple| to the + \LatexCode|choice| environment is used, as above, then the question is + marked correct if and only if \textit{all} of the correct choices, and + none of the incorrect choices, are selected. If the student's + selections are not completely correct then are given feedback that is + randomly selected from amongst their wrong choices (that is, the + feedback is randomly selected from the set of \LatexCode|\correct| + choices that were not selected and the \LatexCode|\incorrect| choices + that were selected). + + Finally, observe that the multiple choice items in the screenshot + above are labelled by roman numerals. The items in a + \LatexCode{choice} environment are labelled by a standard \LaTeX{} + counter, that is also called \LatexCode|choice|. Redefining the + \LaTeX{} macro \LatexCode|\thechoice| changes how the corresponding + question choices are labelled in the online quiz. For example, to + label the items in a \LatexCode|choice| environment by A), B), C) + $\dots$ add the line: + \begin{latexcode} + \renewcommand\thechoice{\Alph{choice})} + \end{latexcode} + to the preamble of the \LaTeX{} file for your quiz. + \CrossIndex{choice environment}*{thechoice}\macroIndex{thechoice} + + \subsubsection{Discussion environments}\label{SS:discussion} + \index{environment!discussion} + + In addition to asking questions, it is possible to display revision, + or discussion, material on the quiz web page using the + \LatexCode|discussion| environment. All discussion material is + displayed on the quiz page \textit{before} the questions in the quiz + and the (short) titles for the discussion items appear before the quiz + questions in the menu on the left-hand side of the page --- it is + not possible to interleave discussion items and questions in the side + menu. + + Each quiz can have zero or more discussion environments. These + environments can, in principle, contain arbitrary \LaTeX{} code. The + syntax for the \LatexCode|discussion| environment is: + \begin{latexcode} + \begin{dicussion}[short heading][heading] + ... + \end{dicussion} + \end{latexcode} + The \textit{short heading} is used in the side-menu. Both the + \textit{heading} and \textit{short-heading} are optional, both + defaulting to \LatexCode|Discussion|. If only one heading is given + then this sets both the \textit{short heading} and \textit{heading} + for the discussion item. For example, running the following \LaTeX\ + file, which uses \LatexCode|theme=muted|, through \WebQuiz + \InputLatexCode{discussion} + produces the quiz page: + \ScreenShot{Web page: discussion environment}{discussion} + As with the questions, only one \LatexCode|discussion| environment is + displayed on the quiz web page at a time (unless the document-class + option \LatexCode|onepage| is used). It is possible to have quizzes + that contain only \LatexCode|discussion| environments, with no + questions, and quizzes that contain only \LatexCode|question| + environments, with no discussion. + + If you have a mixture of \LatexCode|discussion| and + \LatexCode|question| environments then it is useful to be able to add + thinks between them. \LaTeX{} provides the \LatexCode|\label| and + \LatexCode|\ref| commands for cross-referencing, so \WebQuiz builds + on this idea and provides the three commands \LatexCode|\dref|, + \LatexCode|\qref| and \LatexCode|\Qref| to reference + \LatexCode|discussion| and \LatexCode|question| environments. The + syntax for these commands is as follows: + \begin{latexcode} + \dref[optional text]{LaTeX label} % inserts discussion button + \dref*[optional text]{LaTeX label} % inserts discussion link + \qref[optional text]{LaTeX label} % inserts question button by label + \qref*[optional text]{LaTeX label} % inserts question link by label + \Qref[optional text]{question number} % inserts question button by number + \Qref*[optional text]{question number} % inserts question link by number + \end{latexcode} + \CrossIndex{cross-reference}*{dref} + \CrossIndex{cross-reference}*{qref} + \CrossIndex{cross-reference}*{Qref} + \CrossIndex{cross-reference}*{label} + In each case the text in the link or button defaults to either the + short-title, for discussion environments, or the question number for + questions. The ``optional text'' is used instead whenever it is + supplied. These commands can be used anywhere in a quiz, including + \LatexCode|discussion|, \LatexCode|question| and \LatexCode|choice| + environments and inside feedback text for the students written using + \LatexCode|\feedback|, \LatexCode|\whenRight| and \LatexCode|\whenWrong|. + + The macros \LatexCode|\dref| and \LatexCode|\qref| use a standard + \LaTeX{} \textit{label}, defined using the \LatexCode|\label| command, + to insert a button or a link. In contrast, \LatexCode|\Qref| uses the actual + \textit{question number}, so it is not necessary to define a + \LatexCode|\label| for a question when using \LatexCode|\Qref|. + + Even though the macros \LatexCode|\qref| and \LatexCode|\Qref| are + quite similar they serve different functions when the + \LatexCode|randomorder| document class option is used (see + \autoref{SS:classOptions}). In this case we do not know ahead of time + the question numbers that will be used in the quiz. So if + \LatexCode|q:one| is the label for the first question in the \LaTeX{} + file then \LatexCode|\qref{q:one}| will insert a button to this + question \textit{but} this will almost certainly not be Question~$1$. + On the other hand, we can create a ``Start quiz'' button, for example, + that will open Question~1 on any quiz, using + \LatexCode|\Qref[Start quiz]{1}|. + + Here is an example that shows how \LatexCode|\Qref| works: + \InputLatexCode{discussion-Qref}\macroIndex{Qref} + which produces the online quiz: + \ScreenShot{Crossing-referencing using question numbers}{discussion-Qref} + Similarly, here is an example showing how \LatexCode|\dref| and \LatexCode|qref| + are used: + \InputLatexCode{discussion-ref}\macroIndex{dref}\macroIndex{qref} + This code produces the online quiz: + \ScreenShot{Crossing-referencing using labels}{discussion-ref} + + \begin{dangerous} + When using the \LatexCode|randomorder| document class option + (\autoref{SS:classOptions}), ``optional text'' should always be + given when using \LatexCode|\qref|. This is because the question + number that is displayed by default will always be the question + number \textit{in the \LaTeX{} file} rather than the question number + in the online quiz. + \end{dangerous} + + \subsubsection{Index pages for quizzes}\label{SS:index} + \index{quizindex environment} + \index{environment!quizindex} + + Most quizzes occur in sets that cover related material, such as for + a particular unit of study. The \LatexCode|quizindex| environment + creates an index web page for related sets of quizzes. The \LaTeX{} + files for all of these quizzes must be in the same directory, or + folder, on the web server. The index web page is a \WebQuiz file of + the form: + \InputLatexCode{index-en} + which generates a web page that looks like: + \ScreenShot[0.7]{Example index page}{index-en} + As the next section describes, index files are also used to + automatically add a drop-down menu that contains the quiz-index to + the breadcrumbs on all of the quiz web pages. This drop-down menu + provides an easy way to navigate between all of the quizzes for a + particular unit of study. + + As the example above shows, the entries in the \LatexCode|quizindex| are + given using the \LatexCode|\quiz| or the \LatexCode|\quiz*| command. + \CrossIndex{quizindex environment}*{quiz} + The syntax for these commands is + \begin{latexcode} + \quiz[URL for quiz]{Title for quiz} + \quiz*[URL for quiz]{Title for quiz} + \end{latexcode} + The \LatexCode|\quiz| macro automatically inserts the quiz numbers + into the index listing. The \LatexCode|\quiz*| command is identical + \textit{except} that it does not add \BashCode|Quiz 1.|, + \BashCode|Quiz 2| etc to the index listing. By default, the URLs for + the quizzes in the index are assumed to be of the form + \BashCode|quiz1.html|, \BashCode|quiz2.html|, \BashCode|quiz3.html|, + .... These URLs can be changed using the optional argument of the + \LatexCode|\quiz| and \LatexCode|\quiz*| commands. For example, + \begin{latexcode} + \quiz[realquiz.html]{This is the real quiz} + \end{latexcode} + would create an item in a quiz index that links to the web page + \BashCode|realquiz.html|. + + Index pages in other languages are produced in exactly the same way. For example, + \InputLatexCode{index-cz} + produces the web page: + \ScreenShot[0.7]{A Czech index}{index-cz} + The next section describes the \LatexCode|\BreadCrumb| and + \LatexCode|\BreadCrumbs| commands. + + At most one file in each directory should contain a + \LatexCode|quizindex| environment. This is because \WebQuiz creates + the file \Javascript file \BashCode|quizindex.js| whenever it + compiles a \LatexCode|quizindex| environment. This file contains + \Javascript commands for displaying the quiz index. + + \subsubsection{Breadcrumbs}\label{SS:breadcrumbs}\index{breadcrumbs} + \WebQuiz provides a straightforward way to place navigation breadcrumbs + at the top of the quiz web page. By default the + breadcrumbs are disabled. If you have a \LatexCode|\BreadCrumbs| command + like: + \begin{latexcode} + \BreadCrumbs{Mathematics /|Math1001 /u/Math1001|quizindex|title} + \end{latexcode} + in your \LaTeX{} file then \WebQuiz will add a corresponding strip + of breadcrumbs, or navigation links, to the top of your quiz page: + \ScreenShot{Example breadcrumbs}{breadcrumbs} + The drop-down menu is normally hidden, appearing only after the + $\equiv$ ``button'' on the web page is clicked. + + Usually, most of the breadcrumbs are navigation links to other web pages. In + the example above: + \begin{itemize} + \item The first ``crumb' inside the + \LatexCode|\BreadCrumbs| command is \BashCode|Mathematics /|. This inserts the text + \BashCode|Mathematics| together with a (relative) URL to + \BashCode|/|, the root directory for the web + server, which is often the correct URL for the department (or the + institution) + \item The \BashCode|Math101 /u/math101| inserts the text + \BashCode|Math101| as the second breadcrumb with URL + \BashCode|/u/math101|. + \item The \BashCode|quizindex| inserts the text \BashCode|Quizzes| + together with the symbol $\equiv$, which opens a drop-down menu + that contains the list of quizzes in the quiz index for the unit. + This is described in more detail below. + \item Finally the \LatexCode|title| in the breadcrumbs inserts, as + text, the part of the title \textit{before the first colon} in the title, + where the title is given by \LatexCode|\title{...}|. + \end{itemize} + The breadcrumbs for the quiz web page can be either be configured + quiz-by-quiz, using the \LatexCode|\BreadCrumbs| macro + \macroIndex{BreadCrumbs}, as above, or by setting default + \LatexCode|breadcrumbs| in the \webquizrc using the command-line + option + \begin{bashcode} + > webquiz --edit-settings + \end{bashcode} + as described in \autoref{SS:commandline}. Breadcrumbs are disabled by default. + + The breadcrumbs inside the \LatexCode|\BreadCrumbs{...}| command are given as + a ``|-separated list''. For example, quite reasonable breadcrumbs are given by: + \begin{latexcode} + \BreadCrumbs{ department | unitcode | quizindex | title } + \end{latexcode} + To make this the default set of breadcrumbs use + \BashCode{webquiz --edit-settings} to set breadcrumbs + in the \webquizrc to: + \begin{latexcode} + department | unitcode | quizindex | title + \end{latexcode} + More generally, the breadcrumbs can be specified as: + \begin{latexcode} + \BreadCrumbs{ crumb1 | crumb2 | crumb3 | crumb4 | ... } + \end{latexcode} + In principle, there can be arbitrarily many crumbs in your + breadcrumbs but, in practice, five is more than enough. + The crumbs inside a \LatexCode|\BreadCrumbs| command have the + following meanings: + + \begin{description} + \item[breadcrumb] The breadcrumb for the current quiz, which is + set using the \LatexCode|\BreadCrumb| macro. This breadcrumb is + purely descriptive, with no hyperlink being added: only the text given by + \LatexCode|\BreadCrumb| appears. + \CrossIndex*{BreadCrumbs}{breadcrumb}\macroIndex{BreadCrumb} + + \item[department] This expands to a link to your department, where + the department text is set using the macro \LatexCode|\Department| and its URL is set by + \LatexCode|\DepartmentURL|. + \macroIndex{Department}\macroIndex{DepartmentURL} + \CrossIndex*{BreadCrumbs}{department} + + \item[institution] This expands to a link to your institution, where + the institution text is set using \LatexCode|\Institution| and its URL is set by + \LatexCode|\InstitutionURL|. The institution also appears in the + side-menu above the \WebQuiz copyright notice. + \macroIndex{Institution}\macroIndex{InstitutionURL} + \CrossIndex*{BreadCrumbs}{institution} + + \item[quizindex] This expands to \BashCode|Quizzes|, which is a + link to the index page for your unit, as defined by + \LatexCode|\QuizzesURL|, which is described below. In addition, + if the directory contains a BashCode|quizindex.js| file, which is + created by the \LatexCode|quizindex| environment (see + \autoref{SS:index}), then the symbol {\large$\equiv$} will appear, + giving access to a drop-down menu to the index page, looking + something like this: + \ScreenShot{Drop-down menu giving index of quizzes}{quizindex-dropdown} + \macroIndex{QuizzesURL} + \CrossIndex*{BreadCrumbs}{quizindex} Such drop-down menus are + automatically added to quiz web pages that have a + \LatexCode|quizindex| breadcrumb| as soon as + an quiz page that contained a \WebQuiz \LatexCode|quizindex| environment has + been compiled in the current directory. + \CrossIndex{breadcrumbs}{quizindex} + + For those interested in how this is done, whenever \WebQuiz + compiles a \LatexCode|quizindex| environment it creates a + \Javascript file \BashCode|quizindex.js|. Every quiz file includes + this \Javascript file, if it exists, and this allows it to display + a drop-down menu for the quiz index. + + \item[Title] This expands to the full title of the quiz page, + without a hyperlink, as given by the \LatexCode|\title|. + \CrossIndex*{BreadCrumb*}{Title} + + \item[title] This expands to the part of title of the quiz page, + without a hyperlink, that occurs \textit{before} the first colon + in the title of the quiz. For example, if the title is given as + \begin{latexcode} + \title{Quiz 1: The wonders of life} + \end{latexcode} + then ``Quiz 1'' will be added to the list of breadcrumbs. If the + title does not contain a colon then the full title is printed. + \CrossIndex*{BreadCrumbs}{title} + + \item[unitcode] This expands to a link to the unit code, where the + unit code text is set using \LatexCode|\UnitCode|, and its URL is + set by + \LatexCode|\UnitURL| + \macroIndex{UnitCode}\macroIndex{UnitURL} + \CrossIndex*{BreadCrumbs}{unitcode} + + \item[unitname] This expands to a link to the unit name, where the + unit name text is set using \LatexCode|\UnitName|, and its URL is + set by + \LatexCode|\UnitURL| + \macroIndex{UnitName}\macroIndex{UnitURL} + \CrossIndex*{BreadCrumbs}{unitname} + + \end{description} + + \noindent + In addition, each \textit{crumb} in a breadcrumb, except for the + ``magic crumbs'' listed above, is allowed to be arbitrary text --- + although, non-ascii characters may cause problems. In this case, the + last ``word'' in the crumb is treated as a URL if it either beings + with a forward slash, \BashCode|/|, or if it begins with + \BashCode|http|. For example, the code: + \InputLatexCode{montypython} + \noindent + results in the following breadcrumbs: + \ScreenShot{Guaranteed to offend some one}{montypython} + Notice that it is necessary to correctly escape spaces etc in + URLs that are specified this way. Similarly, all of the characters + in the breadcrumbs should be ascii characters as unicode is likely to + cause encoding issues (compare with the Czech index given in + \autoref{SS:index}). + + If any part of a ``magic'' breadcrumb has not been defined then it + is printed with a question mark on the web page. For example, the + quiz file + \InputLatexCode{nounits} + does not define the unit code, so it results in the ``questionable'' first breadcrumb: + \ScreenShot{Breadcrumbs with no unit code}{nounits} + + Here is the list of \WebQuiz macros that we be used to set the + values of the ``magic'' breadcrumbs inside a + \LatexCode|\BreadCrumbs|. Note that default values for many of these + ``crumbs'' can be given in the \webquizrc. + + \newcommand\Item[1]{\item[\textbackslash#1]\CrossIndex{breadcrumbs}*{#1}} + \begin{description} + \Item{BreadCrumb}\macroIndex{BreadCrumb} + The \LatexCode|\BreadCrumb| command sets the \LatexCode|breadcrumb| + variable in the \LatexCode|\BreadCrumbs|. The primary use for this + is when you have default breadcrumbs in the \webquizrc like + \begin{bashcode} + breadcrumbs = department | unitcode | breadcrumb + \end{bashcode} + Using \LatexCode|\BreadCrumb| allows you to set the last crumb to + some meaningful text that describes the quiz. + + \Item{Department}\macroIndex{Department} + The \LatexCode|\Department| command sets the name of the + \LatexCode|department|. As described earlier in this section, by + default, the \LatexCode|department| is the first item in the + breadcrumbs that appear at the top of the web page. + + The default department can be set in the \webquizrc using + \BashCode|webquiz --edit-settings|. + + Default value: \BashCode{''} \qquad(i.e. the empty string) + + \Item{DepartmentURL}\macroIndex{DepartmentURL} + The \LatexCode|\DepartmentURL| command sets URL for the department. As + described earlier in this section, by default the department URL is + the link in the first breadcrumb on each web page. + + The default department URL can be set in the \webquizrc using + \BashCode|webquiz --edit-settings|. + + Default value: \DefaultValue{/} + + \Item{Institution}\macroIndex{Institution} + The \LatexCode|\Institution| command sets the institution, or university. + The \LatexCode|institution| appears below the question buttons in the + left-hand navigation menu that appears on every quiz web page + (provided that the screen size is not too small). As described + earlier in this section, the institution can be used in the web + page breadcrumbs. + + The default institution can be set in the \webquizrc using + \BashCode|webquiz --edit-settings|. + + Default value: \BashCode{''} \qquad(i.e. the empty string) + + + \Item{InstitutionURL}\macroIndex{InstitutionURL} + The \LatexCode|\InstitutionURL| command sets the institution URL. This is + used as the link for the \LatexCode|institution| in the left-hand + navigation menu that appears on every quiz page. As described + earlier in this section, the institution URL can be used in the + web page breadcrumbs. + + The default institution URL can be set in the \webquizrc using + \BashCode|webquiz --edit-settings|. + + Default value: \DefaultValue{/} + + \Item{QuizzesURL}\macroIndex{QuizzesURL} + The \LatexCode|\QuizzesURL| command sets the URL for the suite of quizzes + attached to this unit of study. As described earlier in this + section, this can be used in the breadcrumb at the top of the quiz + web page. + + Default value: \DefaultValue{UnitURL/Quizzes}, where \DefaultValue{UnitURL} is set + using \LatexCode|\UnitURL| + + \Item{UnitCode}\macroIndex{UnitCode} + The \LatexCode|\UnitCode| command sets the unit of study code for the + unit that the quiz is part of. + + \Item{UnitName}\macroIndex{UnitName} + The \LatexCode|\UnitName| command sets the name of the unit of study for + the unit that the quiz is attached to. + + \Item{UnitURL}\macroIndex{UnitURL} + The \LatexCode|\UnitURL| command sets the URL for the unit of study code + for the unit that the quiz is attached to. + + \end{description} + + \noindent + It makes sense to set defaults for \LatexCode|\BreadCrumbs| + \LatexCode|\Department|, \LatexCode|\DepartmentURL|, + \LatexCode|\Institution| and \LatexCode|\InstitutionURL| in the + \webquizrc. After doing this, a typical \WebQuiz file might look like this: + + \begin{latexcode} + \documentclass{webquiz} + \UnitName{Fundamental stuff} + \UnitCode{Stuff101} + \UnitURL{/courses/stuff101} + + \title{Stuffing: the art of taxidermy} + + \begin{document} + \begin{question} + first question... + \end{question} + \begin{question} + second question... + \end{question} + \end{document} + \end{latexcode} + + If you have many quizzes for many different units then a better approach is to create + a \LaTeX{} ``package'', say \BashCode|ourunits.sty|, to set these variables: + \begin{latexcode} + % ourunits.sty - set unit names, codes and URLs + \DeclareOption{stuff101}{ + \UnitName{Fundamental stuff} + \UnitCode{Stuff101} + \UnitURL{/courses/stuff101} + } + \DeclareOption{stuff102}{ + \UnitName{Fundamental stuff too} + \UnitCode{Stuff102} + \UnitURL{/courses/stuff102} + } + \ProcessOptions + \endinput + \end{latexcode} + Then you can replace the opening lines of the quiz file with + \LatexCode|\usepackage[stuff101]{ourunits}|. Of course, you could also + set the default \LatexCode|\Department|, \LatexCode|\DepartmentURL|, + \LatexCode|\Institution| and \LatexCode|\InstitutionURL| in such a + style file as well. + + \subsection{\WebQuiz document class options}\label{SS:classOptions} + + The \WebQuiz document class supports the following options: + \begin{latexcode} + fixedorder, hidesidemenu, language, onepage, pst2pdf, + separatepages, showsidemenu, theme, tikz + \end{latexcode} + This section describes all of these document-class options except for + \ctan{tikz} and \ctan{pst2pdf}, which are discussed in + \autoref{SS:graphics}. Many of the document-class options below occur + in pairs and defaults for many of these can be set in the \webquizrc + file. The settings given in the \LaTeX{} file + for a quiz will always override the default settings in the \webquizrc*. + + \begin{description} + + \item[fixedorder, randomorder] + \CrossIndex{document class options}{fixedorder} + \CrossIndex{document class options}{randomorder} + By default, the questions in the quiz are displayed in a + \DefaultValue{fixedorder} for all students who take the quiz. + This order is the order that the question appear in the \LaTeX{} + file for the quiz. That is, the first question in the online quiz + is the first question appearing in the \LaTeX file, the second + question in the quiz is the second question in the \LaTeX{} file, + and so on. With the \LatexCode|randomorder| option the questions + in the quiz are displayed in a random order that changes each time + that the quiz is run. With this option, the online quiz questions + are generally in a different order for every student. For example, + the code: + \InputLatexCode{random} + produces the quiz with randomly arranged quiz questions, such as: + \ScreenShot{Randomly ordered questions}{random} + (So the first question in the \LaTeX{} file is being displayed as + the fourth online quiz question. The next time the page is + loaded, such as for the next student, the question order will + change again.) When using the \LatexCode|randomorder| + document-class option only the questions appear in random order. + If the quiz contains multiple choice questions then the choices + are \textit{not} randomly permuted. That is, the choices always + appear in the order that they are written in the \LaTeX{} file. + + \item[hidesidemenu, sidemenu] + \CrossIndex{document class options}{hidesidemenu} + \CrossIndex{document class options}{showsidemenu} + If the \LatexCode|hidesidemenu| option is set then the side menu + on the left-hand side of the quiz web page will not be displayed + when the quiz first loads. By default, the side menu appears + unless the screen size is too small, such as on a mobile phone. + Many examples of the \LatexCode|hidesidemenu| and + \LatexCode|showsidemenu| class options can be found above. + + The display of the side menu can is also toggled by clicking on + the {\textcolor{red}{\small\XSolidBold}} and + {\textcolor{red}{\large\ding{118}}} symbols. The side-menu + automatically disappears for devices with narrow screens, such as + mobile phones. + + \item[language=<lang>] \CrossIndex{document class options}{language} + Set the language used by the \textit{web pages} constructed by \WebQuiz. + The following languages are currently supported by \WebQuiz: + \ListWebQuizLanguages + The languages files are used to print the various buttons and text + that is generated on the web pages constructed by \WebQuiz. The + \LatexCode|language| option does not affect the DVI or + \BashCode|PDF| versions of the quiz and it does not load language + packages like \ctan{babel} or \ctan{polyglossia}. + + The \LatexCode|language| keyword can be in upper or lower case, with + the result that either (but not both!) of the following two lines set the + quiz language to German: + \begin{latexcode} + \documentclass[language=German]{webquiz} + \documentclass[language=german]{webquiz} + \end{latexcode} + + Typical usage of the \LatexCode|language| option is the following: + \lstinputlisting[style=latexcode,extendedchars=false]{examples/french} + This produces a web page like this: + \ScreenShot{A web page with \textsf{language=french}}{french} + As a general rule, \LaTeX{} and \TeXfht do not cope well with + unicode characters, so if your quiz contains (a lot of) unicode + characters then we recommend using \hologo{LuaLaTeX} or \hologo{XeLaTeX}, which + corresponds to the \WebQuiz command-line options + \BashCode|webquiz -x| or \BashCode|webquiz -l|, respectively. The + default \TeX{} engine can be set in the \webquizrc. + \index{unicode}\index{lualatex}\index{xelatex} + + The language files were created largely using google translate so + they may well need fine-tuning\footnote{The word ``Copyright'' in + the left-hand side-margin is not translated but perhaps it should + be.}. You can use \BashCode|kpsewhich| to look at the language + files, which all have names of the form \BashCode|webquiz-xxx.lang|, + where \BashCode|xxx| is the name of the language in lower case. For example, + the \textit{English} language file, which is the default, can be + found using the command: + \begin{bashcode} + > kpsewhich webquiz-english.lang + \end{bashcode} + The file \BashCode|webquiz-english.lang| contains the following: + \InputBashCode{webquiz-english.lang} + In these files, the material to the left of the equals signs are + effectively variables, and so they should never be changed, or + deleted, whereas anything to the right of the equals signs is the + text that will appear on the \WebQuiz web pages. \textit{The pairs + of braces, }\LatexCode|{}|, \textit{in the language files must be present + because in the online quizzes they expand to expressions like} + \LatexCode|(a)|, \LatexCode|(b)|\dots + + To add \WebQuiz support for a new language, say language + \LatexCode|xxx|, copy any \WebQuiz language file to a new file + \BashCode|webquiz-xxx.lang| and then translate all of the words to + the right of the equals signs.\footnote{\WebQuiz assumes that all + language names are in lower case so \texttt{xxx}, and not + \texttt{XXX}, should be used.} \WebQuiz will be able to find the new + language file as long as it appears in the \LaTeX{} search + path\footnote{To help \LaTeX/\WebQuiz fined your language file you + may need to run a program like \texttt{mktexlsr} using an + administrators account}. Once the new language file + \BashCode|webquiz-xxx.lang| is in the \LaTeX{} search path it can be + used by \WebQuiz using \LatexCode|language=xxx| as a document-class + option: + \begin{latexcode} + \documentclass[language=xxx]{webquiz} + \begin{document} + ...quiz code here... + \end{document} + \end{latexcode} + Please submit any new language files, or corrections to existing + language files, as a \textit{new issue} at: + \href{https://\webquiz{repository}}{\webquiz{repository}}. + + \item[onepage, separatepages] + \CrossIndex{document class options}{onepage} + \CrossIndex{document class options}{separatepages} + By default, only one question, or one discussion environment, is displayed + by the quiz at any time. As \LatexCode|separatepages| is the default, every + example so far is of this form. With the document-class option + \LatexCode|onepage| all questions, and discussion environments, are + displayed at the same time on a single web page. So, for example, the code: + \InputLatexCode{onepage} + produces the quiz page: + \ScreenShot{A one page quiz}{onepage} + + \item[theme]\CrossIndex{document class options}{theme} + + \WebQuiz\ has a small number of different themes for setting the + colours on the quiz web pages. The theme can be set as an option to + the document class or in the \webquizrc. Most, but not all, of the examples + so far have used the \LatexCode|default| theme. + \WebQuiz currently supports the following themes: + \ListWebQuizThemes + Example screenshots of all \WebQuiz themes can be found in + \hyperref[SS:themes]{Appendix A}. + + \end{description} + + + \subsection{Including graphics and using pstricks and tikz}\label{SS:graphics} + It is also possible to include complicated diagrams in \WebQuiz + quizzes using packages like \ctan{tikz} and \ctan{pstricks}. + \textit{As there have been several recent updates to these packages it + is advisable to install the latest version of both of these packages, + as well as the packages \ctan{make4ht}, \ctan{pgf} and \TeXfht.} In + fact, it is recommended that you update all installed \TeX{} packages. + + By far the easiest way to include images when using \WebQuiz is by + adding the following lines to your document preamble: + \begin{latexcode} + \usepackage[dvipdfmx]{graphicx} + \DeclareGraphicsExtensions{.png} + \end{latexcode} + to your document preamble. You need to use + \LatexCode|\DeclareGraphicsExtensions| to tell \WebQuiz the different + types of images you are using, so the code above works for + \LatexCode{png} images. More generally, you can use a comma separated + list of extensions, such as: + \begin{latexcode} + \DeclareGraphicsExtensions{.png, .jpg, .gif} + \end{latexcode} + The option \LatexCode|dvipdfmx| + to \LatexCode|graphicx| is only necessary if you want to be able to + rescale images. For example, the code: + \InputLatexCode{ctanLion} + produces the quiz page: + \ScreenShot{Including a lion}{ctanLion} + Note that \WebQuiz assumes that all images are \BashCode|SVG| images by + default so it is necessary to give the full filename in any + \LatexCode|\includegraphics| command. + + Using \ctan{pstricks} is often just as easy, such as the following + code that works out of the box: + \InputLatexCode{pstricks-ex} + to produce the web page: + \ScreenShot{Pstricks example}{pstricks-ex} + + Even though \ctan{tikz} and \ctan{pstricks} can be used in \WebQuiz + quizzes, both of these packages sometimes have problems. \WebQuiz tries + to solve some these problems for you if you use the + \LatexCode|pst2pdf| or \LatexCode|tikz| document-class options, which + we now describe. + + \begin{description} + \item[pst2pdf] \index{pstricks}\CrossIndex{document class options}{pst2pdf} + + For the most part, \ctan{pstricks} drawings display correctly. + When they do fail they can sometimes be salvaged using + \ctan{pst2pdf}. Applying \ctan{pst2pdf} to a \WebQuiz quiz is not + completely straightforward, so \WebQuiz provides the + document-class option \ctan{pst2pdf} to automatically apply + \ctan{pst2pdf} as part of the quiz web page build process. If your + \ctan{pstricks} drawings do not display correctly it is worthwhile + to see if \ctan{pst2pdf} fixes the problems. + + For example, the following quiz compiles only with the + \ctan{pst2pdf} document-class option: + \InputLatexCode{pst2pdf} + to produce the quiz: + \ScreenShot{Example requiring the pst2pdf document class option}{pst2pdf} + The position of the image adjusts with the screen size and it + does, in fact, display well on a mobile device. \WebQuiz is not + able to display this image without the \LatexCode|pst2pdf| + document-class option. + + \begin{dangerous} + Unfortunately, \ctan{pst2pdf} can fail silently without giving any + warnings. If you plan to use the \LatexCode|pst2pdf| + document-class option then you should first check to make that the + \ctan{pst2pdf} package and executable is properly installed. + According to the \ctan{pst2pdf} manual: + \begin{quote} + \ctan{pst2pdf} needs \Ghostscript (>=9.14), perl (>=5.18), pdf2svg, pdftoppm + and pdftops (from poppler-utils or xpdf-utils) to process a file + using \ctan{pst2pdf}. + \end{quote} + If using \ctan{pst2pdf} does not produce an image then, rather + than \ctan{pst2pdf} not working, the problem might be that you + have not installed all of the programs that \ctan{pst2pdf} relies + upon, so look in your log files for error messages and check that + all of the programs listed above are correctly installed, with the + specified version numbers. See also \autoref{SS:pstricks}. + \end{dangerous} + + \item[tikz]\CrossIndex{document class options}{tikz} + Giving this class option both loads the \ctan[pgf]{tikz} package + and it fixes several issues with PGF that prevent it from working + with \TeXfht. It is important that you use the \WebQuiz + \LatexCode|tikz| document-class option, and not + \LatexCode|\usepackage{tikz}|, because \WebQuiz loads slightly + different configuration files for \ctan[pgf]{tikz} that are + optimised for use with \TeXfht. \textit{Please note that for + \ctan[pfd]{tikz} you need to use \TeXLive \textsf{2018} with all + packages updated.} Thanks are due to Michal Hoftich for the + enormous amount of effort that he has put into making \TeXfht and + \ctan[pgf]{tikz} more compatible. As an example, the quiz file + \InputLatexCode{tikz-ex} + produces the online quiz: + \ScreenShot{Tikz example}{tikz-ex} + \end{description} + + Most people use either \ctan{pstricks} or \ctan{tikz}. A quiz that + tries to use both \ctan{pstricks} and \ctan{tikz} will probably not + compile. + + \subsection{Configuring commands and environments for \TeXfht}\label{SS:config}\macroIndex{DisplayAsImage} + + The underlying engine used by \WebQuiz is \TeXfht so, because + \TeXfht is not able process all \LaTeX{} code, there is \LaTeX{} + code that \WebQuiz is not able to cope with. This said, \TeXfht is + able to display \textit{most} \LaTeX{} code and \WebQuiz has been + used to write literally thousands of quiz questions so it is likely + that you will be able to typeset what you want in your online + quizzes. In particular, as discussed in \autoref{SS:graphics}, it + is possible to use \ctan[pgf]{tikz} and \ctan{pstricks} in \WebQuiz + quizzes. + + \WebQuiz uses \TeXfht{} to convert the quiz content from \LaTeX{} to + \HTML. If \TeXfht{} has not been configured to for some of the + commands or environments that you are using then they may not + display correctly in your online quizzes. The ``correct'' way to + fix such problems is to write appropriate \TeXfht{} configuration + commands, however, this can be tricky to do --- especially if you + are not familiar with the inner workings of \TeX{} and \TeXfht. + + As a workaround, \WebQuiz provides the command + \LatexCode|\DisplayAsImage| that, in effect, tells \TeXfht to treat + your command as an image when it creates the web page. This is an + easy work-around that often produces good results -- and it is much + easier than writing your own \TeXfht configuration commands. + + For example, the \ctan{mhchem} package is a powerful package that + defines a macro \LatexCode{\ce} for writing chemical symbols but, + unfortunately, the \LatexCode{\ce} macro has not (yet) been + configured to work with \TeXfht, which means that this command does + not work very well when used in \WebQuiz quizzes. + + For example, the following code: + \InputLatexCode{display-as-image} + shows that if you add the line + \LatexCode|\DisplayAsImage{ce}| to your quiz after + \LatexCode|\begin{document}| then it is + possible to use \LatexCode|\ce| in your quizzes: + \ScreenShot{Using DisplayAsImage}{display-as-image} + As the example code shows, \LatexCode|\DisplayAsImage| accepts an optional + argument that can be used to fine-tune the placement of the image on + the quiz web page using \CSS. For those interested in the technical details, the + definition of \LatexCode|\DisplayAsImage| is: + \begin{latexcode} + \RequirePackage{etoolbox} + \renewcommand\DisplayAsImage[2][]{% + \csletcs{real:#2}{#2}% + \NewConfigure{#2}{2} + \csdef{#2}##1{\Picture+[#1]{}\csuse{real:#2}{##1}\EndPicture} + \Configure{#2}{\Picture+[#1]{}}{\EndPicture} + } + \end{latexcode} + + \section{System requirements, installation and configuration} + \label{S:configuration} + \index{system requirements} + \CrossIndex{system requirements}{tex4ht} + \CrossIndex{system requirements}{make4ht} + \CrossIndex{system requirements}{python} + + \WebQuiz takes a \LaTeX\ file and translates it into a functional + web page. To use \WebQuiz the quiz author only needs to know how to + use \LaTeX\ \textit{and} to have all of the programs used by \WebQuiz + installed. Fortunately, most of the system requirements will already + be installed on a system with an up-to-date installation of + \TeXLive, however, some tweaking may still be necessary. + + Behind the scenes, \WebQuiz uses \TeXfht, \python, \Javascript and + several other tools to construct and operate the online quizzes. + The \WebQuiz program has three main components: + \begin{itemize} + \item \LaTeX\ files (a class file and \TeXfht configuration files) + \item A Python3 program that uses \TeXfht to convert \LaTeX\ + files into web pages + \item Web files (\Javascript, \CSS and online documentation) + %\item Documentation + \end{itemize} + Of course, to use the online quizzes created by \WebQuiz you + need a web server. To use \WebQuiz all of these files need to + be in appropriate places. Fortunately, \Ctan takes care of + most of this but the web-related files still need to be put onto + your web server. + + \WebQuiz has been tested extensively on Linux and Mac operating + systems. Several people have used \WebQuiz on windows computers, + but I have not tested the program on a windows computer myself. + + \subsection{System requirements}\index{system requirements} + + In order to work \WebQuiz needs the following programs to be + installed on your system: + \begin{itemize}[nosep] + \item An up-to-date \LaTeX{} distribution, such as that provided + by \TeXLive. In particular, you need to have \TeXfht{} and + \ctan{make4ht} installed. + + Unfortunately, the version of \ctan{make4ht} that was released + with \TeXLive{} 2018 had some bugs and there have been many + recent changes to \ctan{make4ht} and \ctan{pstricks}, + so it is strongly recommended that you update all packages + from \Ctan before you try and use \WebQuiz. + + \item \python[Python 3]. As of writing python 3.7.2 is available. + \item \Javascript + \item If your quizzes use \ctan{pstricks}, or if you want to + compile the \OnlineManual, then you need to ensure that + \Ghostscript and \ctan{dvisvgm} are installed and properly + configured; see \autoref{SS:pstricks} for more details. + \item A web server. As detailed in \autoref{SS:Initialise}, you + will need to install the web components of \WebQuiz. + \end{itemize} + + \subsection{Installing + \WebQuiz}\label{SS:Install}\index{install}\index{miktex@Mik\TeX}\index{texlive@\TeXLive} + \WebQuiz will be included as a package in \TeXLive 2019 and, once a + packaging issue is sorted out, it will be included in \MiKTeX. If + \WebQuiz is available as a package from either of these distributions + then it can be installed in the usual way. + + Alternatively, it is possible to download the + \href{http://mirrors.ctan.org/macros/latex/contrib/webquiz.zip}{WebQuiz zipfile} from \Ctan. + To install \WebQuiz from the zipfile you should: + \begin{enumerate}[nosep] + \item Download the + \href{http://mirrors.ctan.org/macros/latex/contrib/webquiz.zip}{WebQuiz zipfile} from \Ctan. + \item Unzip the file + \item Change directory of the \BashCode|webquiz/scripts| subdirectory from the zipfile + \item From an administrators account, or using \BashCode|sudo| on a + unix-like system, run he command: + \begin{bashcode} + > webquiz --tex-install + \end{bashcode} + On windows, use: + \begin{bashcode} + > webquiz.bat --tex-install + \end{bashcode} + \end{enumerate} + This will install the different components of \WebQuiz to their + ``standard'' locations in he \TeX\ search tree. If you are using + \MiKTeX you may need to open the \MiKTeX console, go to the Tasks menu + and then rebuild the TeX filename database. + + Once the \WebQuiz package is installed you should initialise thew + package, following the steps given in \autoref{SS:Initialise}. + + \subsection{Initialising \WebQuiz}\label{SS:Initialise} + \CrossIndex{command-line option}{initialise} + \index{initialisation} + + \WebQuiz is a tool for creating online quizzes and in order for + it to work efficiently various files + (\href{https://en.wikipedia.org/wiki/JavaScript}{javascript} and + \href{https://www.w3schools.com/css/css_intro.asp}{cascading style + sheets}) need to put onto your web server. \WebQuiz has an + \textit{initialisation} routine for installing the web components + of the program. In fact, until \WebQuiz has been initialised it + will ask you if you to run the initialisation routine every time + you use \WebQuiz. You can reinitialise \WebQuiz at any time using + the command-line option: + \begin{bashcode} + > webquiz --initialise + \end{bashcode} + \WebQuiz will actually work without being initialised, however, any + quiz web pages that are created before initialisation will be + emblazoned with a message reminding you to initialise \WebQuiz. + + The location of the files on the web server depends both on the + operating system that is running on your computer and how your web + server has been configured. It is essential that the \WebQuiz files + are installed in a directory that is accessible from the web. It + does not matter if they are put into a user web directory or into a + system web directory. If in doubt please consult your system + administrator. + + Common locations for the \textit{web root} of the server are: + \begin{center} + \begin{tabular}{ll} + \toprule + Operating system & Root of web server \\\midrule + Mac OSX & \BashCode|/Library/WebServer/Documents|\\ + Linux & \BashCode|/var/www/html|\\ + Windows & \BashCode|C:\inetpub\wwwroot|\\ + \bottomrule + \end{tabular} + \end{center} + \WebQuiz needs to copy several files into a subdirectory of this + \textit{web root}. When you run + \begin{bashcode} + > webquiz --initialise + \end{bashcode} + you will be prompted for the following: + \begin{itemize} + \item The location of the \WebQuiz web directory, which needs to + be a directory that is visible to your web server + \item The relative URL for this directory, which tells your web + browser where to find these files + \end{itemize} + For example, on my system the web root for our web server is + \BashCode|/usr/local/httpd/| and the \WebQuiz web files are in + the directory \BashCode|/usr/local/httpd/UoS/WebQuiz|. So, I set: + \begin{quote} + \begin{tabular}{lll} \WebQuiz web + directory &=& \BashCode|/usr/local/httpd/UoS/WebQuiz|\\ + \WebQuiz relative URL &=& \BashCode|/UoS/WebQuiz| + \end{tabular} + \end{quote} + Once the initialisation step is complete, \WebQuiz is ready to use + although you, possibly from an administrators account or using + \BashCode|sudo|, may also want to run: + \begin{bashcode} + > webquiz --edit-settings + \end{bashcode} + This will talk you the process of setting system defaults for the quizzes that, + for example, specify the name and URL for your department and + institution as well as the default language and theme used for the + quizzes. If in doubt about any of the option press return to accept + the default. See \autoref{SS:rcfile} for more details. + + You can test your \WebQuiz installation by compiling the example + files from the \WebQuiz manual. You can find these files in the + directory \BashCode|web_root/doc/examples|, where the + \BashCode|web_root| is the directory where you just installed + the \WebQuiz web files. If \Ghostscript and \ctan{dvisvgm} are + installed and properly configured (see \autoref{SS:graphics}) then you + should also be able to compile the \OnlineManual using \WebQuiz. + + \begin{dangerous} + \textit{To install the \WebQuiz files for general use on + your system, or to save system wide settings, you need to run + the initialisation command }\BashCode|webquiz --initialise| + \textit{using an administrator account or using \BashCode|sudo| on a + UNIX or Mac OSX system.} + + If you have already saved a \textit{user} \webquizrc file then to + change the \textit{system} \webquizrc* you will use need to + use the \BashCode|--rcfile| command-line option: + \begin{latexcode} + > webquiz --rcfile /path/to/system/rc-file --initialise + \end{latexcode}\index{rcfile} + \end{dangerous} + + \begin{heading}[Remark] + To remove all \WebQuiz files from your web server use: + \begin{bashcode} + > webquiz --uninstall + \end{bashcode} + \end{heading} + + \subsection{Graphics and \texorpdfstring{\ctan{dvisvgm}}{dvisvgm}} + \label{SS:pstricks} + + \index{pstricks} + \noindent + \WebQuiz, via \TeXfht, uses \ctan{dvisvgm} to convert certain images to + \href{https://en.wikipedia.org/wiki/Scalable_Vector_Graphics}{Scalable + Vector Graphics} (SVG). This is done using his is done + using \ctan{dvisvgm}. At first sight this is OK because \ctan{dvisvgm} is + included in \TeXLive and \MiKTeX, however, \ctan{dvisvgm} uses + \Ghostscript and this needs to be correctly configured and, as + outlined in \href{http://dvisvgm.bplaced.net/FAQ}{FAQ}, \ctan{dvisvgm} + needs to know where to find the \Ghostscript libraries. For example, + to get \ctan{dvisvgm} to work on my system I needed to add the line + \begin{bashcode} + export LIBGS=/usr/local/lib/libgs.dylib + \end{bashcode} + to my \BashCode|.bashrc| file. To see whether you need to do something + similar on your system you need to look at the output from the following + two commands: + + \begin{bashcode} + > dvisvgm -h + > dvisvgm -l + \end{bashcode} + + \noindent There are three possibilities: + + \begin{itemize} + \item the \BashCode|-h| output does not contain \BashCode|-libgs| + and the \BashCode|-l| output contains \BashCode|ps|: + ghostscript was linked at build time, so everything should work + \item + the \BashCode|-h| output contains \BashCode|-libgs| and the + \BashCode|-l| output does not contain \BashCode|ps|: + gpostscript support is enabled but ghostscript is not linked. You + need to locate the ghostscript library + \BashCode|libgs.so| or \BashCode|libgs.dylib| on your system and set + the \BashCode|LIBGS| environment variable, or equivalent, + accordingly + \item the \BashCode|-h| output does not contain \BashCode|-libgs| + and the \BashCode|-l| output does not contain \BashCode|ps|: + \ctan{dvisvgm} was not built with postscript support. In this + case, \WebQuiz will not be able to process \ctan{svg} images. You + need to reinstall \ctan{dvisvgm} with ghostscript support. + \end{itemize} + + \section{The \WebQuiz program} \index{usage} + + The \WebQuiz program was designed to be run from the command-line. + To produce an online quiz from a \WebQuiz \LaTeX{} file \BashCode|quiz.tex| + type: + \begin{bashcode} + > webquiz quiz or > webquiz quiz.tex + \end{bashcode} + One feature of \WebQuiz is that you can process more than one + quiz file at a time. For example, if you have quiz files + \BashCode|quiz1.tex|, ..., \BashCode|quiz9.tex| in the current directory + then, on a UNIX system, you can rebuild the web pages for all of + these quizzes using the single command: + \begin{bashcode} + > webquiz quiz[1-9].tex + \end{bashcode} + This is useful if some generic aspect of all of the quizzes has + changed, such as the theme, the language, thebreadcrumbs or a + department URL. In fact, one would probably use + \begin{bashcode} + > webquiz -dqq quiz*.tex + \end{bashcode} + because the \BashCode|webquiz --qq| command-line option suppresses + almost all of the output produced by \LaTeX\ and \TeXfht and + \BashCode|-d|, which is \textit{draft mode}, is faster and it is + probably sufficient if the quizzes were compiled recently. The + next section discusses the \WebQuiz command-line options. + + \subsection{Command-line options}\label{SS:commandline} + \index{command-line option} + Typing \BashCode|webquiz -h|, or \BashCode|webquiz --help| on + the command-line gives the following summary of the \WebQuiz + command-line options: + \InputBashCode{webquiz.usage} + The command-line options are listed on separate lines above to + improve readability. In practice, the different options need to be + one the same line, although they can appear in any order. + + We describe the different options, grouping them according to + functionality. + + \begin{description} + \item[-h, --help] \CrossIndex{command-line option}{help} + list the command-line options and exit + \CrossIndex{command-line option}{help} + + \item[-q, -qq, \ddash quiet] \CrossIndex{command-line option}{quiet mode} + Suppress \LaTeX{} and \TeXfht error messages: \BashCode|-q| is + quiet and \BashCode|-qq| is very quiet. If you use + \BashCode|webquiz -qq texfile.tex| then almost no output will + be printed by \WebQuiz when it is processing your quiz file. Be + warned, however, that both of these options can make it harder + to find and fix errors, so using the \BashCode|-q| and + \BashCode|-qq| options is recommended if your file is known + to compile. + \CrossIndex{command-line option}{quiet} + + \end{description} + + \subsubsection*{\TeX{} options} + + \begin{description} + + \item[-d, \ddash draft] draft mode. The \LaTeX file is processed + only once by \BashCode|htlatex|, which gives a much faster + compilation time but cross references etc may not be completely + up to date. This is equivalent to using: + \BashCode|make4ht --mode draft| + \CrossIndex{command-line option}{draft mode} + + \item[-s,\ddash shell-escape] Shell escape for \LaTeX/ht\LaTeX/make4ht + \CrossIndex{command-line option}{shell-escape} + + \item[\ddash latex] Use \LaTeX{} to compile the quiz (the default) + \CrossIndex{command-line option}{lua} + + \item[-l,\ddash lua] Use lua\LaTeX{} to compile the quiz + \CrossIndex{command-line option}{lua} + + \item[-x, \ddash xelatex] Use xe\LaTeX{} to compile the quiz + \CrossIndex{command-line option}{xelatex} + \index{xelatex} + + \end{description} + + \subsubsection*{Settings and configuration} + + \begin{description} + + \item[-r {[RCFILE]}, \ddash rcfile {[RCFILE]}] + \CrossIndex{command-line option}{rcfile} Specify the + location of the \webquizrc file to use. This setting is only + necessary if you want to override the default \webquizrc*. + + \item[-i, \ddash initialise] \CrossIndex{command-line + option}{initialisation} Initialise files and settings for + webquiz. See \autoref{SS:Initialise} for more details. + + \item[\ddash edit-settings] \CrossIndex{command-line + option}{edit-settings} Edit the webquiz settings in the + \WebQuiz rc-file. See \autoref{SS:rcfile} for more details. + + \textit{If you do not have permission to write to the system + rc-file, which is in the \WebQuiz scripts directory, then you + will be given the option of saving the \WebQuiz settings to an + rc-file in your home directory or another file of your choice. + If you want to save the settings to a particular rc-file use + the \BashCode|--rcfile| option. If you want to change the + system \webquizrc then use a administrator account or, + on a unix-like system,} use \BashCode|sudo webquiz --edit-settings|. + + \item[\ddash settings {[SETTING]}] \CrossIndex{command-line option}{settings} + \SeeIndex{rcfile}{webquizrc} + \SeeIndex{default settings}{webquizrc} + List system settings for webquiz stored in \webquizrc, the + (\textit{run-time configuration file}). Optionally, a single + \BashCode|SETTING| can be given in which case the value of + only that setting is returned. If \BashCode|SETTING| is + omitted then the list of current settings are printed. Use + \BashCode|SETTING=verbose| for a more verbose listing of the + settings and \BashCode|SETTING=help| for a summary of the + settings. + + The rc-file can be edited by hand, however, it is + recommended that you instead use + \begin{bashcode} + webquiz --edit-settings + \end{bashcode} + Typical settings returned by this command look like: + \InputBashCode{webquiz.settings} + See \autoref{SS:rcfile} for more details. + + \end{description} + + \subsubsection*{Advanced command-line options} + + \begin{dangerous} + \textit{Change these settings with care: an incorrect value for + these settings can stop \WebQuiz from working.} + \end{dangerous} + + \begin{description} + \item[\ddash make4ht MAKE4HT-OPTIONS] + \CrossIndex{command-line option}{make4ht} + Options to be passed to \ctan{make4ht} when converting the + \LaTeX{} to \XML. This option is equivalent to setting + the \BashCode|make4ht| in the \webquizrc; see + \autoref{SS:rcfile}. At least under UNIX, multiple arguments + should be enclosed in quotes. For example, to give + \ctan{make4ht} a custom mk4 file (note that + \BashCode|myquiz.mk4| is included, if it exists), you would use + \begin{bashcode} + > webquiz --make4ht "-e file.mk4" myquiz.tex + \end{bashcode} + The \BashCode|make4ht| command-line option will be required + only in rare instances. + \index{lualatex}\index{xelatex} + + \item[\ddash uninstall] Remove all \WebQuiz files from your + web server directory. This command only removes files that + \WebQuiz may have installed on your web server. It does + \textit{not} remove \WebQuiz from your \LaTeX{} distribution. + + \item[\ddash webquiz-layout WEBQUIZ-LAYOUT] + \CrossIndex{command-line option}{layout} + Name of (local) \python code that controls the layout of quiz web page. This + option is equivalent to setting the \LatexCode|webquiz-layout| + in the \webquizrc. See \autoref{SS:layout} for + more details. + + \end{description} + + \subsubsection*{Other options} + + The following command-line options are mainly useful mainly for + code developers. + + \begin{description} + \item[\ddash version] Prints the \WebQuiz version number and + exit (currently \webquiz{version}) + + \item[\ddash tex-install] Use this command-line option if + you are installing the \LaTeX{} components of + \WebQuiz from the \Ctan zip-filei (see \autoref{SS:Install}). It will install the different + \LaTeX{} components of \WebQuiz into \BashCode|TEXMFMAIN|. If + you installed \WebQuiz as part of a \TeX{} distribution, such as + \TeXLive, then you do not need to use this option. + + \item[\ddash tex-uninstall] Use this command-line option to + remove the \LaTeX{} components of \WebQuiz from your system. + Only use this option if you installed \WebQuiz using the \Ctan + zip-file. + + \item[\ddash debugging] Displays extra debugging information + when compiling and prevents \WebQuiz from deleting the many + intermediary files that are created when building the quiz web + pages. + \end{description} + + \subsection{\WebQuiz settings and the webquizrc file} + \label{SS:rcfile}\index{default settings}\index{webquizrc} + + \WebQuiz stores the following default sets in \webquizrc*, a + \textit{run-time configuration file}: + \begin{description}[nosep, labelwidth=18ex] + \item[breadcrumbs] breadcrumbs at the top of quiz page (\autoref{SS:breadcrumbs}) + \item[department] name of department (\autoref{SS:breadcrumbs}) + \item[department-url] url for department (\autoref{SS:breadcrumbs}) + \item[engine] default tex engine used to compile web pages (\autoref{SS:classOptions}) + \item[hide-side-menu] do not display the side menu at start of quiz + (\autoref{SS:classOptions}) + \item[institution] institution or university (\autoref{SS:breadcrumbs}) + \item[institution-url] url for institution or university (\autoref{SS:breadcrumbs}) + \item[language] default language used on web pages (\autoref{SS:classOptions}) + \item[one-page] display questions on one page (\autoref{SS:classOptions}) + \item[random-order] randomly order the quiz questions (\autoref{SS:classOptions}) + \item[theme] default colour theme used on web pages (\autoref{SS:classOptions}) + \item[version] webquiz version number for webquizrc settings + (\autoref{SS:rcfile}) + \item[webquiz-url] relative url for webquiz web directory (\autoref{SS:Initialise}) + \item[webquiz-www] full path to webquiz web directory (\autoref{SS:Initialise}) + \item[make4ht] build file for make4ht (\autoref{SS:Initialise}) + \item[mathjax] url for mathjax (\autoref{SS:Initialise}) + \item[webquiz-layout] name of \python module that formats the quizzes + (\autoref{SS:layout}) + \end{description} + The last three options are \textit{advanced options} that you should + change with care. + + The default values of all of these settings can be overridden in the + \LaTeX{} file for the quiz, or with the command-line options. The + default values can be changed at any time using + \begin{bashcode} + webquiz --edit-settings + \end{bashcode} + When changing the settings \WebQuiz tries to explain what it is + doing at each step. If you are unsure what a particular setting does + then \textit{press return} to accept the default value --- the + default value is printed inside square brackets as + \BashCode|[default]|. In particular, when you first start using + \WebQuiz it is recommended that you accept the default values + for all of the advanced options because it is very unlikely that you + will need to change these initially. + + The first line of output from \BashCode|webquiz --settings| gives + the location of the rc-file being used. The system rc-file, + \webquizrc*, is saved in the \BashCode|tex/latex/webquiz| subdirectory + of the \BashCode|TEXMFLOCAL| directory. A typically location for + this file is + \begin{bashcode} + /usr/local/texlive/texmf-local/tex/latex/webquiz/webquizrc + \end{bashcode} + By default, the \WebQuiz settings are saved here so that you do not + need to reinitialise \WebQuiz whenever you update your \TeX{} + distribution. If you do not have permission to write to this + directory then you will be asked if you would like to save the + rc-file somewhere else. The location of the user rc-file is: + \begin{itemize} + \item \BashCode|~/.dotfiles/config/webquizrc| + if the directory \BashCode|~/.dotfiles/config| exists, + \item \BashCode|~/.config/webquizrc| + if the directory \BashCode|~/.config| exists, + \item \BashCode|~/.webquizrc| otherwise. + \end{itemize} + Each time \WebQuiz is run it reads the system and user rc-files, if + they exist. When using \BashCode|webquiz --edit-settings| you will + be promoted for a different installation location if you do not have + permission to write to the specified rc-file. To use a particular + \webquizrc* use the \BashCode|--rcfile| command-line option: + \begin{bashcode} + > webquiz --rcfile <full path to rc-file> ... + \end{bashcode} + If you save the settings to a non-standard location then you will + need to use the command-line option \BashCode|webquiz --rcfile RCFILE| to access + these settings. + + \noindent To describe the \WebQuiz defaults settings we consider them by category. + + \subsubsection*{Institution settings} + \begin{description} + + \item[department] + Sets the default department name. This can be overridden in + the \LaTeX{} file using \LatexCode|\Department| in + \autoref{SS:breadcrumbs} + \CrossIndex{webquizrc}*{Department} + + \item[department-url] + Sets the URL for the department. This can be overridden in + the \LaTeX{} file using \LatexCode|\DepartmentURL| in + \autoref{SS:breadcrumbs} + \CrossIndex{webquizrc}*{DepartmentURL} + + \item[institution] + Sets the default institution name. This can be overridden in the + \LaTeX{} file using \LatexCode|\Institution| in + \autoref{SS:breadcrumbs} + \CrossIndex{webquizrc}*{Institution} + + \item[institution-url] + Sets the URL for the institution.This can be overridden in + the \LaTeX{} file using \LatexCode|\InstitutionURL| in + \autoref{SS:breadcrumbs} + \CrossIndex{webquizrc}*{InstitutionURL`} + + \end{description} + + \subsubsection*{Formatting options} + + \begin{description} + + \item[breadcrumbs]\index{breadcrumbs} + Sets the default breadcrumbs at the top of quiz page. The + default breadcrumbs can be overwritten in the quiz file using + the \LatexCode{\BreadCrumbs} command. See + \autoref{SS:breadcrumbs} for more details. + \CrossIndex{webquizrc}*{BreadCrumbs} + + \item[engine] Sets the default \TeX{} engine to be used when + compiling the quiz. By default, \BashCode|latex| is used, with + the two other possibilities being \BashCode|lua| and + \BashCode|xelatex|, for \Hologo{LuaLaTeX} and \hologo{XeLaTeX} + respectively. Behind the scenes, the two choices + correspond to invoking \ctan{make4ht} with the + \BashCode|--lua| and \BashCode|--xelatex| options, + respectively. The \BashCode|engine| setting in the + \webquizrc* can be overridden by the webquizrc + \BashCode|--latex|, \BashCode|--lua| and \BashCode|--xelatex|. + \CrossIndex{webquizrc}{engine} + \CrossIndex{webquizrc}{latex} + \CrossIndex{webquizrc}{lualatex} + \CrossIndex{webquizrc}{xelatex} + + \item[language]\index{language} + Sets the default language for the \WebQuiz web pages. This can + be overridden in the quiz file by using the document class + \LatexCode|language| option: \LatexCode|language=xxx| + See \autoref{SS:classOptions}. + \CrossIndex{webquizrc}{language} + + \item[theme]\index{theme} + Sets the default colour theme for the \WebQuiz web pages. This can + be overridden in the quiz file by using the document class + \LatexCode|theme| option: \LatexCode|theme=xxx|. + See \autoref{SS:classOptions}. + \CrossIndex{webquizrc}{theme} + + \end{description} + + \subsubsection*{Advanced options} + + \begin{description} + + \item[make4ht]\index{make4ht} + Options for \ctan{make4ht}. Rather than using \TeXfht + directly, \WebQuiz uses \ctan{make4ht} to convert the + \LaTeX\ file to \XML. Use this option to + customise how \ctan{make4ht} is called. See the + \ctan[make4ht]{make4ht manual} for more information. + \CrossIndex{webquizrc}{make4ht} + + \item[mathjax] \WebQuiz web pages use \href{https://www.mathjax.org/}{mathjax} to + render the mathematics on the quiz web pages. By default this + is done by loading \BashCode|mathjax| from + \begin{bashcode} + https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js + \end{bashcode} + Fetching \BashCode|mathjax| from an external site can + cause a delay when the quiz web pages are loaded. This setting + in the rc-file allows you to change where \BashCode|mathjax| is + loaded from. For example, if you install \BashCode|mathjax| on + your web server then you would replace this will the + corresponding relative URL. + \CrossIndex{webquizrc}{mathjax} + + \item[webquiz-layout] + Sets the \python file that writes the \HTML file for the quiz. + Most people will not need this option. The next subsection + describes how to do this in more detail. + \CrossIndex{webquizrc}{layout} + + \end{description} + + \subsubsection*{Configuration settings} + Use \BashCode|webquiz --initialise| to change these settings. + + \begin{description} + + \item[webquiz-url] This is the relative URL for \WebQuiz web directory + \CrossIndex{webquizrc}{webquiz-url} + + \item[webquiz-www] This is the full path to the \WebQuiz web + directory. The \OnlineManual and other example code can be found + in the \BashCode|docs| subdirectory. If you use \BashCode|bash|, + then the command + \begin{bashcode} + > cd $(webquiz --settings webquiz-www)/docs + \end{bashcode}%$ + will take you to the \WebQuiz online \BashCode|docs/| directory. + \CrossIndex{webquizrc}{webquiz-www} + + \end{description} + + \subsection{Changing the layout of the \WebQuiz web pages} + \label{SS:layout}\index{layout} + + \begin{dangerous} + \textit{This is an advanced \WebQuiz feature that most people will + not need. To change the layout of the quiz web pages created by + \WebQuiz requires working knowledge of \HTML and \python.} + \end{dangerous} + + The construction of the online quizzes is controlled by the \python + file \PythonCode|webquiz_standard.py|. If you want to change the + structure of the web pages for the quizzes then the easiest way to + do this is to make a copy of \PythonCode|webquiz_standard.py|, say + \PythonCode|webquiz_myformat.py|, and then edit this file directly. + This will require working knowledge of \python and \HTML. To give + you an idea of what needs to be done, the \python file + \PythonCode|webquiz_standard| contains a single function + \PythonCode|write_web_page| that returns the \HTML for the page as a + string using the following: + \begin{htmlcode} + quiz_page = r'''<!DOCTYPE HTML> + <html lang="en"> + <head> + <title> {title} </title> + {htmlpreamble} + </head> + <body> + {no_script}{breadcrumbs} + <div class="quiz-page"> + {side_menu} + <div class="quiz-questions"> + {quiz_header} + {quiz_questions} + </div> + </div> + {webquiz_init} + </body> + </html> + ''' + \end{htmlcode} + By changing this output you can change the layout of the quizzes + produced by \WebQuiz. For example, by adding code to the + \HTMLCode|<head>...</head>| section of \HTMLCode|quiz_page| it is + easy to include new \CSS code and by modifying + \HTMLCode|<body>....</body>| you can change the layout of the page. + More sophisticated versions of \PythonCode|webquiz_standard.py|, + where you change the underlying \python code, are possible. At the + University of Sydney we have a custom version of + \PythonCode|webquiz_standard.py| that calls our content management + system and, in this way, embeds the quiz web page inside a web page + that used the official ``branding'' required by our university. + + When experimenting with a new layout can run + \WebQuiz using the command: + \begin{bashcode} + > webquiz --webquiz-layout webquiz_myformat quizfile.tex + \end{bashcode} + Once the new layout is finalised you can make it the default + layout by setting \BashCode|webquiz-layout| equal to \BashCode|webquiz_my_format| + in the \webquizrc using \BashCode|webquiz --edit-settings|. + \index{edit-settings}\index{webquiz-layout} + + If you do make modifications to any of these files then, by the + \WebQuiz Licensing agreement, you are required to create a new + version of this file that has a \textit{different name}. Doing this + will also make it easier for you to integrate your changes with any + future releases of \WebQuiz. + + \subsection{Bugs, issues and feature requests}\index{bug reports} + Please report any bugs, issues or feature requests using the + \textit{issue} tracker at + \begin{quote} + \href{https://\webquiz{repository}}{\webquiz{repository}}. + \end{quote} + When reporting a bug please provide a \textit{minimal working example} + that clearly demonstrates your problem. This should be a compilable + \LaTeX file that looks something like the following: + \begin{latexcode} + \documentclass{webquiz} + \begin{document} + ** insert problematic code here ** + \end{document} + \end{latexcode} + Bug reports that do not have a minimal working example can be + hard to reproduce in which case it is not possible to fix them. + Before submitting a bug export please first compile your quiz using + (pdf)latex to check to see if your problem is an issue with \LaTeX + or with \WebQuiz. If you can, please also test to see if your code + compiles using \TeXfht directly. + +\appendix +\section*{Appendices} + \addcontentsline{toc}{section}{Appendices} +\renewcommand\thesection{} +\renewcommand\thesubsection{\Alph{subsection}} + + \subsection{Catalogue of web page themes}\index{theme}\label{SS:themes} + \WebQuiz{} comes with different themes for changing the colour scheme + of the online quizzes, which can be set using the \LatexCode|theme| + document-class option or in the \webquizrc; see + \autoref{SS:classOptions} for more details. Themes are easy to + construct in principle although finding colours that work well together + can be tricky in practice so, as a result, there are some themes that + I would not personally recommend! + + New themes, and modifications to existing themes, can be submitted as + an \textit{issue} at: + \begin{quote} + \href{https://\webquiz{repository}/issues}{\webquiz{repository}/issues}. + \end{quote} + Where possible these will be incorporated into a future release of the + package, although there is a potential technical issue here in that + the underlying \CSS files are written using + \href{http://sass-lang.com/}{sass}. + + \ShowcaseThemes + +\subsection{The online \WebQuiz manual}\label{S:online} + + \WebQuiz has an \OnlineManual* that is a \LaTeX file written with the + \LatexCode|webquiz| document class. The conversion of the manual from + \LaTeX{} to \HTML is done by \WebQuiz. The \BashCode|PDF| version of + this manual is included here as an easy reference. The source file + for the \OnlineManual* is included in the documentation of \WebQuiz to + allow you to create a local version of the \OnlineManual*. Look for the + file \BashCode|webquiz-online-manual.tex| in the + \BashCode|webquiz-www/docs| directory; see~\autoref{SS:rcfile}. + + The online manual can either be compiled as a PDF file (see below), + or using \WebQuiz to produce an online version of the manual. + The \OnlineManual* was written for ``internal use'' when \WebQuiz was + first written in 2004. \WebQuiz has evolved quite a lot since then. + There is some overlap between the \OnlineManual* and previous sections, + however, the \OnlineManual* only describes how to typeset questions and + it does not cover some of the more recent features of \WebQuiz, such + as the document class options, or how to use the program. If there + are any discrepancies between the \OnlineManual* and the earlier + sections of this manual then the \OnlineManual* should be discounted. + + The \OnlineManual* has diagrams that are drawn using \ctan{pstricks} + and, as a result, to create a \BashCode|PDF| version of the \OnlineManual* + use \BashCode|latex webquiz-online-manual| to create a + \BashCode|dvi| file. The \BashCode|dvi| file can be converted to + \BashCode|PDF| using \BashCode|dvipdf|. The online manual needs to be + compiled using \BashCode|latex| rather than \BashCode|pdflatex|, + which will generate errors. + + \includepdf[pages=-,pagecommand={\pagestyle{webquiz}}]{webquiz-online-manual} + + +\subsection{Licence} + +Version 3, Copyright (C) 2007, + +\href{https://www.gnu.org/licenses/gpl-3.0.en.html} + {GNU General Public License, Version 3, 29 June 2007} + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License (GPL) as published by the Free +Software Foundation, either version 3 of the License, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + + +\vfil +\begin{tabular}{@{}ll} +Authors & \webquiz{authors}\\ +Description & \webquiz{description}\\ +Maintainer & \webquiz{name}\\ +System requirements & \webquiz{requirements}\\ +Licence & \webquiz{licence}\\ +Release date & \webquiz{release date}\\ +Repository & \href{https://\webquiz{repository}}{\webquiz{repository}} +\end{tabular} +\eject + +\printindex + +\end{document} diff --git a/macros/latex/contrib/webquiz/doc/webquiz.themes b/macros/latex/contrib/webquiz/doc/webquiz.themes new file mode 100644 index 0000000000..ef4329b8f9 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/webquiz.themes @@ -0,0 +1,2 @@ +% List of themes supported by WebQuiz -- generated 2019-04-01 +\newcommand\WebQuizThemes{blue, darkblue, darkred, default, earthy, fresh, light, lively, muted, sleek, spring,, vibrant} diff --git a/macros/latex/contrib/webquiz/doc/webquiz.usage b/macros/latex/contrib/webquiz/doc/webquiz.usage new file mode 100644 index 0000000000..76c28a4a6b --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/webquiz.usage @@ -0,0 +1,24 @@ +usage: webquiz [-h] [-q] [-d] [-s] [--latex | -l | -x] [-r RCFILE] + [-i | -e | --settings [SETTINGS]] + [quiz_file [quiz_file ...]] + +A LaTeX package for writing online quizzes + +positional arguments: + quiz_file latex quiz files + +optional arguments: + -h, --help show this help message and exit + -q, --quiet Suppress tex4ht messages (also -qq etc) + -d, --draft Use make4ht draft mode + -s, --shell-escape Shell escape for tex4ht/make4ht + --latex Use latex to compile document with make4ht (default) + -l, --lua Use lualatex to compile the quiz + -x, --xelatex Use xelatex to compile the quiz + -r RCFILE, --rcfile RCFILE + Specify location of the webquiz rc-file + -i, --initialise, --initialize + Install web components of webquiz + -e, --edit-settings Edit default settings for webquiz + --settings [SETTINGS] + List default settings for webquiz diff --git a/macros/latex/contrib/webquiz/doc/www/css/webquiz-blue.css b/macros/latex/contrib/webquiz/doc/www/css/webquiz-blue.css new file mode 100644 index 0000000000..36db8d3f05 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/css/webquiz-blue.css @@ -0,0 +1 @@ +body{color:#036;background-color:#e6f0ff}body a{color:#0c106a}body a:hover{color:#2830e7}body a:visited{color:#02020e}div.quiz-page{position:absolute;top:36px;left:5%;min-width:60%;width:88%}div.button,span.button{background-color:#ccebff;border-radius:5px;color:#004d99;border:solid #002db3 2px;font-size:12px;font-weight:normal;text-align:center}span.button{padding:1px 4px 1px 4px}span.button-selected{color:#39f}span:hover.button-selected{color:#1a1aff}div.button:hover,span.button:hover{border:solid #1a1aff 2px !important;color:#1a1aff;text-decoration:underline}div.blank,span.blank{content:"";color:#000;background:#afe4fd}div.side-menu{float:left;font-size:10px;font-weight:normal;margin:0;overflow:hidden;width:100px;display:block;clear:left}div.side-menu>div{color:#339;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;margin-bottom:.8ex}div.side-menu ul{list-style:none;padding-left:0;padding-bottom:10px}div.side-menu ul li{color:#004d99;font-size:14px;text-align:left;word-wrap:break-word}div.side-menu ul li.button-selected{color:#39f}div.side-menu ul li:hover.button-selected{color:#1a1aff}div.side-menu ul li:hover{text-decoration:underline}div.side-menu div.buttons{width:100%;height:100%;margin-bottom:6px;display:table}div.side-menu div.buttons div.button{display:table-cell;float:left;line-height:30px;margin-left:5px;margin-top:5px;position:relative;width:30px}div.side-menu div.buttons div.button span{color:#004d99;text-decoration:none}div.side-menu div.buttons div.button:after{bottom:-35%;content:attr(content);height:100%;position:absolute;width:100%;right:-35%;clear:right}div.side-menu div.buttons div.button-selected{border:solid #39f 2px;color:#39f}div.side-menu div.buttons div.cross{content:"u2718";color:red;background:linear-gradient(to bottom right, #00befe, #ccebff)}div.side-menu div.buttons div.star{content:"u272D";color:#ff0;background:linear-gradient(to bottom right, #3399ff, #004d99)}div.side-menu div.buttons div.tick{content:"u2714";color:silver;background:linear-gradient(to bottom right, #ccebff, #1a1aff)}div.side-menu table.marking-key{margin-left:2px;clear:left}div.side-menu table.marking-key tbody tr td{width:2ex;padding-right:2px !important}div.side-menu table.marking-key tbody tr td.cross{font-size:medium;color:red}div.side-menu table.marking-key tbody tr td.star{font-size:small;color:#ff0}div.side-menu table.marking-key tbody tr td.tick{font-size:medium;color:silver}div.side-menu div.school{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#5c85d6;text-align:center;padding:10px 0 0 0}div.side-menu div.school A,div.side-menu div.school A:link,div.side-menu div.school A:visited{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#5c85d6;text-align:center;padding:10px 0 0 0}div.side-menu div.copyright{font-family:arial,verdana,helvetica;font-size:xx-small;font-weight:normal;text-align:center;color:#2952a3}div.side-menu div.copyright A,div.side-menu div.copyright A:link,div.side-menu div.copyright A:visited{text-decoration:none;color:#36c;font-weight:bold}div.side-menu div.copyright A span.webquizlogo,div.side-menu div.copyright A:link span.webquizlogo,div.side-menu div.copyright A:visited span.webquizlogo{font-variant:small-caps;font-weight:bold}div.question-label,span.question-label{color:#1a1aff;font-variant:small-caps;font-weight:normal;font-size:smaller;margin-bottom:10px;text-align:left}span#question-label{display:none}div.quiz-questions{display:grid}div.quiz-questions div.quiz-header{padding-right:1%;width:80%}div.quiz-questions div.quiz-header div.quiz-title{color:#339;font-size:large;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-bottom:.8ex;min-width:50%}div.quiz-questions div.quiz-header span.arrows{color:#1a1aff;float:right;right:5%;font-size:12px;margin-right:20px}div.quiz-questions div.quiz-header span.arrows A{text-decoration:none !important}div.quiz-questions div.quiz-header span.arrows A{color:#1a1aff;font-size:12px}div.quiz-questions div.quiz-header span.arrows A:hover{color:#0000b3;text-decoration:underline}div.quiz-questions div.quiz-index{color:#339;font-family:Arial,Helvetica,sans-serif;text-decoration:none;text-align:left}div.quiz-questions div.quiz-index ul{list-style:none !important}div.quiz-questions div.quiz-index ul li:before{content:"➣";color:#339;padding-left:0;padding-right:1ex;margin-left:-1em}div.quiz-questions div.quiz-index ul li{list-style-image:none !important;overflow:visible}div.quiz-questions div.quiz-index ul li:hover{color:#1a1aff}div.quiz-questions div.question{position:relative;margin:0 0 5px 0;display:none;padding-bottom:1em}div.quiz-questions div.question form{padding:10px 0 0 0}div.quiz-questions div.question form table tr{vertical-align:top}div.quiz-questions div.question form table tr td{vertical-align:top}div.quiz-questions div.question div.question-choices{padding-left:10px;padding-right:15px;text-align:left}div.quiz-questions div.question table.question-choices td{padding-right:0;vertical-align:baseline}div.quiz-questions div.question table.question-choices td:nth-child(3n+1){padding-right:6px}div.quiz-questions div.question td.brown{color:#3d3db8}div.quiz-questions div.question div.feedback{background-color:#ccebff;border:solid #009bff 2px;border-radius:5px;display:none;padding:0 1ex 0 1ex;transition:height .66s ease-out}div.quiz-questions div.question div.feedback div{text-align:left;color:#483d8b}div.quiz-questions div.question div.feedback ol{counter-reset:list;list-style-type:none;margin:0;padding:0 !important}div.quiz-questions div.question div.feedback ol li:before{color:#3d3db8;content:counter(list, lower-latin) ") ";counter-increment:list;padding:0 0 0 0}div.quiz-questions div.question div.feedback ol li{text-align:left;color:#483d8b;padding-right:2em}div.quiz-questions div.question div.feedback ol li em{color:#36c}input.input-button{color:#000;background-color:#ccebff;border:solid #002db3 2px;border-radius:5px;margin-right:40px;padding:0 4px 0 4px}div.warning{background-color:lime;border:2px solid #339;color:#fff;padding:2mm;top:20%;left:20%;position:absolute;z-index:999}div.breadcrumbs{float:left;clear:both;display:block}nav{margin:0 auto;padding:4px 0 4px 0;height:20px;z-index:99;position:absolute;left:5%;top:10px;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:9px;font-weight:bold;min-width:600px}nav div.navleft{float:left}nav div.navright{float:right}nav div ul{margin:0;padding:0;list-style-type:none;position:absolute}nav div ul li{text-align:center;margin:0;-webkit-transition:all .2s;padding:2px 4px 2px 18px;background-color:#339;position:relative;float:left}nav div ul li a{text-decoration:none;display:contents;-webkit-transition:all .5s}nav div ul li span{color:#e6f0ff}nav div ul li ul{display:none;padding-left:4px;margin:0;-webkit-transition:all 1s;border:solid #002db3 2px;border-radius:5px;background-color:#ccebff}nav div ul li ul li{width:100%;text-align:left;-webkit-transition:height .5s;padding:1px 0 0 4px}nav div ul li ul li a{color:#85a3e0 !important}nav div ul li ul li::after{content:none}nav div ul li ul li:first-child{padding-top:2px}nav div ul li ul li:nth-child(n){background:#ccebff;padding-left:0}nav div ul li ul li:nth-child(n):after{border-left-color:#ccebff;border:7px solid}nav div ul li ul li:hover{background:#002db3;color:red}nav div ul span{color:#e6f0ff}nav div ul li:hover{background-color:#ccebff}nav div ul li a{color:green}nav div ul li a:hover{color:#ff0}nav div ul>li::after{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #339;position:absolute;top:50%;margin-top:-7px;left:100%;z-index:99}nav div ul>li::before{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #e6f0ff;position:absolute;top:50%;margin-top:-7px;margin-left:2px;left:100%;z-index:98}nav div ul>li:nth-child(1){padding-left:4px}nav div ul>li:nth-child(1){background:#36c;color:#e6f0ff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(1) a{color:#e6f0ff}nav div ul>li:nth-child(1) ul li a{color:#e6f0ff}nav div ul>li:nth-child(1):after{border-left-color:#36c}nav div ul>li:nth-child(2){background:#5c85d6;color:#e6f0ff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(2) a{color:#e6f0ff}nav div ul>li:nth-child(2) ul li a{color:#e6f0ff}nav div ul>li:nth-child(2):after{border-left-color:#5c85d6}nav div ul>li:nth-child(3){background:#85a3e0;color:#e6f0ff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(3) a{color:#e6f0ff}nav div ul>li:nth-child(3) ul li a{color:#e6f0ff}nav div ul>li:nth-child(3):after{border-left-color:#85a3e0}nav div ul>li:nth-child(4){background:#adc2eb;color:#e6f0ff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(4) a{color:#e6f0ff}nav div ul>li:nth-child(4) ul li a{color:#e6f0ff}nav div ul>li:nth-child(4):after{border-left-color:#adc2eb}nav div ul>li:nth-child(5){background:#d6e0f5;color:#e6f0ff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(5) a{color:#e6f0ff}nav div ul>li:nth-child(5) ul li a{color:#e6f0ff}nav div ul>li:nth-child(5):after{border-left-color:#d6e0f5}nav div ul>li:nth-child(6){background:#fff;color:#e6f0ff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(6) a{color:#e6f0ff}nav div ul>li:nth-child(6) ul li a{color:#e6f0ff}nav div ul>li:nth-child(6):after{border-left-color:#fff}nav div ul>li:nth-child(7){background:#fff;color:#e6f0ff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(7) a{color:#e6f0ff}nav div ul>li:nth-child(7) ul li a{color:#e6f0ff}nav div ul>li:nth-child(7):after{border-left-color:#fff}div#menu-icon{display:inline-block;color:#339;float:left;text-decoration:none;margin-right:1px;font-family:Verdana,Arial,Helvetica,sans-serif !important;font-weight:bold !important;font-size:14px !important}div#menu-icon:hover{background-color:#ccebff}span#quizzes-menu-icon{color:#e6f0ff;font-size:8px}span#sidelabelopen{display:block}span#sidelabelclosed{display:none}@media(max-width: 600px){div.side-menu{display:none}#sidelabelopen span{display:none}#sidelabelclosed span{display:block}div.breadcrumbs{display:none}div.quiz-page{top:6px}}@media(min-width: 601px){div.side-menu{display:block}#sidelabelopen span{display:block}#sidelabelclosed span{display:none}div.breadcrumbs{display:block}div.quiz-page{top:36px}}/*# sourceMappingURL=webquiz-blue.css.map */ diff --git a/macros/latex/contrib/webquiz/doc/www/css/webquiz-darkblue.css b/macros/latex/contrib/webquiz/doc/www/css/webquiz-darkblue.css new file mode 100644 index 0000000000..37b4791471 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/css/webquiz-darkblue.css @@ -0,0 +1 @@ +body{color:#f5f5f5;background-color:#0f203d}body a{color:blue}body a:hover{color:#99f}body a:visited{color:#009}div.quiz-page{position:absolute;top:36px;left:5%;min-width:60%;width:88%}div.button,span.button{background-color:#aaa;border-radius:5px;color:#fff;border:solid blue 2px;font-size:12px;font-weight:normal;text-align:center}span.button{padding:1px 4px 1px 4px}span.button-selected{color:#483d8b}span:hover.button-selected{color:skyblue}div.button:hover,span.button:hover{border:solid skyblue 2px !important;color:skyblue;text-decoration:underline}div.blank,span.blank{content:"";color:#2c2d72;background:#aaa}div.side-menu{float:left;font-size:10px;font-weight:normal;margin:0;overflow:hidden;width:100px;display:block;clear:left}div.side-menu>div{color:#156fc6;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;margin-bottom:.8ex}div.side-menu ul{list-style:none;padding-left:0;padding-bottom:10px}div.side-menu ul li{color:#fff;font-size:14px;text-align:left;word-wrap:break-word}div.side-menu ul li.button-selected{color:#483d8b}div.side-menu ul li:hover.button-selected{color:skyblue}div.side-menu ul li:hover{text-decoration:underline}div.side-menu div.buttons{width:100%;height:100%;margin-bottom:6px;display:table}div.side-menu div.buttons div.button{display:table-cell;float:left;line-height:30px;margin-left:5px;margin-top:5px;position:relative;width:30px}div.side-menu div.buttons div.button span{color:#fff;text-decoration:none}div.side-menu div.buttons div.button:after{bottom:-35%;content:attr(content);height:100%;position:absolute;width:100%;right:-35%;clear:right}div.side-menu div.buttons div.button-selected{border:solid #483d8b 2px;color:#483d8b}div.side-menu div.buttons div.cross{content:"u2718";color:red;background:linear-gradient(to bottom right, #f8f8f8, #250bc5)}div.side-menu div.buttons div.star{content:"u272D";color:#ff0;background:linear-gradient(to bottom right, #1609e0, #07f3f2)}div.side-menu div.buttons div.tick{content:"u2714";color:#fff;background:linear-gradient(to bottom right, aqua, #1b02ec)}div.side-menu table.marking-key{margin-left:2px;clear:left}div.side-menu table.marking-key tbody tr td{width:2ex;padding-right:2px !important}div.side-menu table.marking-key tbody tr td.cross{font-size:medium;color:red}div.side-menu table.marking-key tbody tr td.star{font-size:small;color:#ff0}div.side-menu table.marking-key tbody tr td.tick{font-size:medium;color:#fff}div.side-menu div.school{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#c9c9ff;text-align:center;padding:10px 0 0 0}div.side-menu div.school A,div.side-menu div.school A:link,div.side-menu div.school A:visited{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#c9c9ff;text-align:center;padding:10px 0 0 0}div.side-menu div.copyright{font-family:arial,verdana,helvetica;font-size:xx-small;font-weight:normal;text-align:center;color:#6363ff}div.side-menu div.copyright A,div.side-menu div.copyright A:link,div.side-menu div.copyright A:visited{text-decoration:none;color:#9696ff;font-weight:bold}div.side-menu div.copyright A span.webquizlogo,div.side-menu div.copyright A:link span.webquizlogo,div.side-menu div.copyright A:visited span.webquizlogo{font-variant:small-caps;font-weight:bold}div.question-label,span.question-label{color:#4169e1;font-variant:small-caps;font-weight:normal;font-size:smaller;margin-bottom:10px;text-align:left}span#question-label{display:none}div.quiz-questions{display:grid}div.quiz-questions div.quiz-header{padding-right:1%;width:80%}div.quiz-questions div.quiz-header div.quiz-title{color:#156fc6;font-size:large;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-bottom:.8ex;min-width:50%}div.quiz-questions div.quiz-header span.arrows{color:#4169e1;float:right;right:5%;font-size:12px;margin-right:20px}div.quiz-questions div.quiz-header span.arrows A{text-decoration:none !important}div.quiz-questions div.quiz-header span.arrows A{color:#4169e1;font-size:12px}div.quiz-questions div.quiz-header span.arrows A:hover{color:#1a3ca2;text-decoration:underline}div.quiz-questions div.quiz-index{color:#156fc6;font-family:Arial,Helvetica,sans-serif;text-decoration:none;text-align:left}div.quiz-questions div.quiz-index ul{list-style:none !important}div.quiz-questions div.quiz-index ul li:before{content:"➣";color:#156fc6;padding-left:0;padding-right:1ex;margin-left:-1em}div.quiz-questions div.quiz-index ul li{list-style-image:none !important;overflow:visible}div.quiz-questions div.quiz-index ul li:hover{color:#4169e1}div.quiz-questions div.question{position:relative;margin:0 0 5px 0;display:none;padding-bottom:1em}div.quiz-questions div.question form{padding:10px 0 0 0}div.quiz-questions div.question form table tr{vertical-align:top}div.quiz-questions div.question form table tr td{vertical-align:top}div.quiz-questions div.question div.question-choices{padding-left:10px;padding-right:15px;text-align:left}div.quiz-questions div.question table.question-choices td{padding-right:0;vertical-align:baseline}div.quiz-questions div.question table.question-choices td:nth-child(3n+1){padding-right:6px}div.quiz-questions div.question td.brown{color:#54a2ed}div.quiz-questions div.question div.feedback{background-color:#1f1f88;border:solid #000 2px;border-radius:5px;display:none;padding:0 1ex 0 1ex;transition:height .66s ease-out}div.quiz-questions div.question div.feedback div{text-align:left;color:#aabafa}div.quiz-questions div.question div.feedback ol{counter-reset:list;list-style-type:none;margin:0;padding:0 !important}div.quiz-questions div.question div.feedback ol li:before{color:#54a2ed;content:counter(list, lower-latin) ") ";counter-increment:list;padding:0 0 0 0}div.quiz-questions div.question div.feedback ol li{text-align:left;color:#aabafa;padding-right:2em}div.quiz-questions div.question div.feedback ol li em{color:#ff0}input.input-button{color:#2c2d72;background-color:#aaa;border:solid blue 2px;border-radius:5px;margin-right:40px;padding:0 4px 0 4px}div.warning{background-color:red;border:2px solid #156fc6;color:#fff;padding:2mm;top:20%;left:20%;position:absolute;z-index:999}div.breadcrumbs{float:left;clear:both;display:block}nav{margin:0 auto;padding:4px 0 4px 0;height:20px;z-index:99;position:absolute;left:5%;top:10px;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:9px;font-weight:bold;min-width:600px}nav div.navleft{float:left}nav div.navright{float:right}nav div ul{margin:0;padding:0;list-style-type:none;position:absolute}nav div ul li{text-align:center;margin:0;-webkit-transition:all .2s;padding:2px 4px 2px 18px;background-color:#156fc6;position:relative;float:left}nav div ul li a{text-decoration:none;display:contents;-webkit-transition:all .5s}nav div ul li span{color:#f5f5f5}nav div ul li ul{display:none;padding-left:4px;margin:0;-webkit-transition:all 1s;border:solid blue 2px;border-radius:5px;background-color:#aaa}nav div ul li ul li{width:100%;text-align:left;-webkit-transition:height .5s;padding:1px 0 0 4px}nav div ul li ul li a{color:#fff !important}nav div ul li ul li::after{content:none}nav div ul li ul li:first-child{padding-top:2px}nav div ul li ul li:nth-child(n){background:#aaa;padding-left:0}nav div ul li ul li:nth-child(n):after{border-left-color:#aaa;border:7px solid}nav div ul li ul li:hover{background:blue;color:red}nav div ul span{color:#f5f5f5}nav div ul li:hover{background-color:#aaa}nav div ul li a{color:green}nav div ul li a:hover{color:#ff0}nav div ul>li::after{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #156fc6;position:absolute;top:50%;margin-top:-7px;left:100%;z-index:99}nav div ul>li::before{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #0f203d;position:absolute;top:50%;margin-top:-7px;margin-left:2px;left:100%;z-index:98}nav div ul>li:nth-child(1){padding-left:4px}nav div ul>li:nth-child(1){background:#06469b;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(1) a{color:#f5f5f5}nav div ul>li:nth-child(1) ul li a{color:#f5f5f5}nav div ul>li:nth-child(1):after{border-left-color:#06469b}nav div ul>li:nth-child(2){background:#085ccc;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(2) a{color:#f5f5f5}nav div ul>li:nth-child(2) ul li a{color:#f5f5f5}nav div ul>li:nth-child(2):after{border-left-color:#085ccc}nav div ul>li:nth-child(3){background:#1173f6;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(3) a{color:#f5f5f5}nav div ul>li:nth-child(3) ul li a{color:#f5f5f5}nav div ul>li:nth-child(3):after{border-left-color:#1173f6}nav div ul>li:nth-child(4){background:#4290f8;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(4) a{color:#f5f5f5}nav div ul>li:nth-child(4) ul li a{color:#f5f5f5}nav div ul>li:nth-child(4):after{border-left-color:#4290f8}nav div ul>li:nth-child(5){background:#73adfa;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(5) a{color:#f5f5f5}nav div ul>li:nth-child(5) ul li a{color:#f5f5f5}nav div ul>li:nth-child(5):after{border-left-color:#73adfa}nav div ul>li:nth-child(6){background:#a5cafb;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(6) a{color:#f5f5f5}nav div ul>li:nth-child(6) ul li a{color:#f5f5f5}nav div ul>li:nth-child(6):after{border-left-color:#a5cafb}nav div ul>li:nth-child(7){background:#d6e7fd;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(7) a{color:#f5f5f5}nav div ul>li:nth-child(7) ul li a{color:#f5f5f5}nav div ul>li:nth-child(7):after{border-left-color:#d6e7fd}div#menu-icon{display:inline-block;color:#156fc6;float:left;text-decoration:none;margin-right:1px;font-family:Verdana,Arial,Helvetica,sans-serif !important;font-weight:bold !important;font-size:14px !important}div#menu-icon:hover{background-color:#aaa}span#quizzes-menu-icon{color:#f5f5f5;font-size:8px}span#sidelabelopen{display:block}span#sidelabelclosed{display:none}@media(max-width: 600px){div.side-menu{display:none}#sidelabelopen span{display:none}#sidelabelclosed span{display:block}div.breadcrumbs{display:none}div.quiz-page{top:6px}}@media(min-width: 601px){div.side-menu{display:block}#sidelabelopen span{display:block}#sidelabelclosed span{display:none}div.breadcrumbs{display:block}div.quiz-page{top:36px}}/*# sourceMappingURL=webquiz-darkblue.css.map */ diff --git a/macros/latex/contrib/webquiz/doc/www/css/webquiz-darkred.css b/macros/latex/contrib/webquiz/doc/www/css/webquiz-darkred.css new file mode 100644 index 0000000000..9d6fadd62f --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/css/webquiz-darkred.css @@ -0,0 +1 @@ +body{color:#fff;background-color:#2d2d2d}body a{color:#ff8c00}body a:hover{color:#ffd199}body a:visited{color:#995400}div.quiz-page{position:absolute;top:36px;left:5%;min-width:60%;width:88%}div.button,span.button{background-color:#900;border-radius:5px;color:#fff;border:solid #f03 2px;font-size:12px;font-weight:normal;text-align:center}span.button{padding:1px 4px 1px 4px}span.button-selected{color:#ff007f}span:hover.button-selected{color:#f2bac2}div.button:hover,span.button:hover{border:solid #f2bac2 2px !important;color:#f2bac2;text-decoration:underline}div.blank,span.blank{content:"";color:#fee7ec;background:#900}div.side-menu{float:left;font-size:10px;font-weight:normal;margin:0;overflow:hidden;width:100px;display:block;clear:left}div.side-menu>div{color:#e31230;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;margin-bottom:.8ex}div.side-menu ul{list-style:none;padding-left:0;padding-bottom:10px}div.side-menu ul li{color:#fff;font-size:14px;text-align:left;word-wrap:break-word}div.side-menu ul li.button-selected{color:#ff007f}div.side-menu ul li:hover.button-selected{color:#f2bac2}div.side-menu ul li:hover{text-decoration:underline}div.side-menu div.buttons{width:100%;height:100%;margin-bottom:6px;display:table}div.side-menu div.buttons div.button{display:table-cell;float:left;line-height:30px;margin-left:5px;margin-top:5px;position:relative;width:30px}div.side-menu div.buttons div.button span{color:#fff;text-decoration:none}div.side-menu div.buttons div.button:after{bottom:-35%;content:attr(content);height:100%;position:absolute;width:100%;right:-35%;clear:right}div.side-menu div.buttons div.button-selected{border:solid #ff007f 2px;color:#ff007f}div.side-menu div.buttons div.cross{content:"u2718";color:red;background:linear-gradient(to bottom right, #e60000, #f2bac2)}div.side-menu div.buttons div.star{content:"u272D";color:#fff;background:linear-gradient(to bottom right, red, purple)}div.side-menu div.buttons div.tick{content:"u2714";color:#ff8;background:linear-gradient(to bottom right, #f3687c, #e31230)}div.side-menu table.marking-key{margin-left:2px;clear:left}div.side-menu table.marking-key tbody tr td{width:2ex;padding-right:2px !important}div.side-menu table.marking-key tbody tr td.cross{font-size:medium;color:red}div.side-menu table.marking-key tbody tr td.star{font-size:small;color:#fff}div.side-menu table.marking-key tbody tr td.tick{font-size:medium;color:#ff8}div.side-menu div.school{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#cc0029;text-align:center;padding:10px 0 0 0}div.side-menu div.school A,div.side-menu div.school A:link,div.side-menu div.school A:visited{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#cc0029;text-align:center;padding:10px 0 0 0}div.side-menu div.copyright{font-family:arial,verdana,helvetica;font-size:xx-small;font-weight:normal;text-align:center;color:#cc0029}div.side-menu div.copyright A,div.side-menu div.copyright A:link,div.side-menu div.copyright A:visited{text-decoration:none;color:#f03;font-weight:bold}div.side-menu div.copyright A span.webquizlogo,div.side-menu div.copyright A:link span.webquizlogo,div.side-menu div.copyright A:visited span.webquizlogo{font-variant:small-caps;font-weight:bold}div.question-label,span.question-label{color:#ef3953;font-variant:small-caps;font-weight:normal;font-size:smaller;margin-bottom:10px;text-align:left}span#question-label{display:none}div.quiz-questions{display:grid}div.quiz-questions div.quiz-header{padding-right:1%;width:80%}div.quiz-questions div.quiz-header div.quiz-title{color:#e31230;font-size:large;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-bottom:.8ex;min-width:50%}div.quiz-questions div.quiz-header span.arrows{color:#ef3953;float:right;right:5%;font-size:12px;margin-right:20px}div.quiz-questions div.quiz-header span.arrows A{text-decoration:none !important}div.quiz-questions div.quiz-header span.arrows A{color:#ef3953;font-size:12px}div.quiz-questions div.quiz-header span.arrows A:hover{color:#b40e26;text-decoration:underline}div.quiz-questions div.quiz-index{color:#e31230;font-family:Arial,Helvetica,sans-serif;text-decoration:none;text-align:left}div.quiz-questions div.quiz-index ul{list-style:none !important}div.quiz-questions div.quiz-index ul li:before{content:"➣";color:#e31230;padding-left:0;padding-right:1ex;margin-left:-1em}div.quiz-questions div.quiz-index ul li{list-style-image:none !important;overflow:visible}div.quiz-questions div.quiz-index ul li:hover{color:#ef3953}div.quiz-questions div.question{position:relative;margin:0 0 5px 0;display:none;padding-bottom:1em}div.quiz-questions div.question form{padding:10px 0 0 0}div.quiz-questions div.question form table tr{vertical-align:top}div.quiz-questions div.question form table tr td{vertical-align:top}div.quiz-questions div.question div.question-choices{padding-left:10px;padding-right:15px;text-align:left}div.quiz-questions div.question table.question-choices td{padding-right:0;vertical-align:baseline}div.quiz-questions div.question table.question-choices td:nth-child(3n+1){padding-right:6px}div.quiz-questions div.question td.brown{color:#f3687c}div.quiz-questions div.question div.feedback{background-color:#99182c;border:solid #000 2px;border-radius:5px;display:none;padding:0 1ex 0 1ex;transition:height .66s ease-out}div.quiz-questions div.question div.feedback div{text-align:left;color:#f2bac2}div.quiz-questions div.question div.feedback ol{counter-reset:list;list-style-type:none;margin:0;padding:0 !important}div.quiz-questions div.question div.feedback ol li:before{color:#f3687c;content:counter(list, lower-latin) ") ";counter-increment:list;padding:0 0 0 0}div.quiz-questions div.question div.feedback ol li{text-align:left;color:#f2bac2;padding-right:2em}div.quiz-questions div.question div.feedback ol li em{color:#e31230}input.input-button{color:#fee7ec;background-color:#900;border:solid #f03 2px;border-radius:5px;margin-right:40px;padding:0 4px 0 4px}div.warning{background-color:red;border:2px solid #e31230;color:#fff;padding:2mm;top:20%;left:20%;position:absolute;z-index:999}div.breadcrumbs{float:left;clear:both;display:block}nav{margin:0 auto;padding:4px 0 4px 0;height:20px;z-index:99;position:absolute;left:5%;top:10px;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:9px;font-weight:bold;min-width:600px}nav div.navleft{float:left}nav div.navright{float:right}nav div ul{margin:0;padding:0;list-style-type:none;position:absolute}nav div ul li{text-align:center;margin:0;-webkit-transition:all .2s;padding:2px 4px 2px 18px;background-color:#e31230;position:relative;float:left}nav div ul li a{text-decoration:none;display:contents;-webkit-transition:all .5s}nav div ul li span{color:#ffe6e6}nav div ul li ul{display:none;padding-left:4px;margin:0;-webkit-transition:all 1s;border:solid #f03 2px;border-radius:5px;background-color:#900}nav div ul li ul li{width:100%;text-align:left;-webkit-transition:height .5s;padding:1px 0 0 4px}nav div ul li ul li a{color:#ffe5e7 !important}nav div ul li ul li::after{content:none}nav div ul li ul li:first-child{padding-top:2px}nav div ul li ul li:nth-child(n){background:#900;padding-left:0}nav div ul li ul li:nth-child(n):after{border-left-color:#900;border:7px solid}nav div ul li ul li:hover{background:#f03;color:red}nav div ul span{color:#ffe6e6}nav div ul li:hover{background-color:#900}nav div ul li a{color:green}nav div ul li a:hover{color:#ff0}nav div ul>li::after{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #e31230;position:absolute;top:50%;margin-top:-7px;left:100%;z-index:99}nav div ul>li::before{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #2d2d2d;position:absolute;top:50%;margin-top:-7px;margin-left:2px;left:100%;z-index:98}nav div ul>li:nth-child(1){padding-left:4px}nav div ul>li:nth-child(1){background:#900;color:#ffe6e6;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(1) a{color:#ffe6e6}nav div ul>li:nth-child(1) ul li a{color:#ffe6e6}nav div ul>li:nth-child(1):after{border-left-color:#900}nav div ul>li:nth-child(2){background:#b30000;color:#ffe6e6;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(2) a{color:#ffe6e6}nav div ul>li:nth-child(2) ul li a{color:#ffe6e6}nav div ul>li:nth-child(2):after{border-left-color:#b30000}nav div ul>li:nth-child(3){background:#c00;color:#ffe6e6;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(3) a{color:#ffe6e6}nav div ul>li:nth-child(3) ul li a{color:#ffe6e6}nav div ul>li:nth-child(3):after{border-left-color:#c00}nav div ul>li:nth-child(4){background:#e60000;color:#ffe6e6;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(4) a{color:#ffe6e6}nav div ul>li:nth-child(4) ul li a{color:#ffe6e6}nav div ul>li:nth-child(4):after{border-left-color:#e60000}nav div ul>li:nth-child(5){background:red;color:#ffe6e6;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(5) a{color:#ffe6e6}nav div ul>li:nth-child(5) ul li a{color:#ffe6e6}nav div ul>li:nth-child(5):after{border-left-color:red}nav div ul>li:nth-child(6){background:#ff1a1a;color:#ffe6e6;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(6) a{color:#ffe6e6}nav div ul>li:nth-child(6) ul li a{color:#ffe6e6}nav div ul>li:nth-child(6):after{border-left-color:#ff1a1a}nav div ul>li:nth-child(7){background:#f33;color:#ffe6e6;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(7) a{color:#ffe6e6}nav div ul>li:nth-child(7) ul li a{color:#ffe6e6}nav div ul>li:nth-child(7):after{border-left-color:#f33}div#menu-icon{display:inline-block;color:#e31230;float:left;text-decoration:none;margin-right:1px;font-family:Verdana,Arial,Helvetica,sans-serif !important;font-weight:bold !important;font-size:14px !important}div#menu-icon:hover{background-color:#900}span#quizzes-menu-icon{color:#ffe6e6;font-size:8px}span#sidelabelopen{display:block}span#sidelabelclosed{display:none}@media(max-width: 600px){div.side-menu{display:none}#sidelabelopen span{display:none}#sidelabelclosed span{display:block}div.breadcrumbs{display:none}div.quiz-page{top:6px}}@media(min-width: 601px){div.side-menu{display:block}#sidelabelopen span{display:block}#sidelabelclosed span{display:none}div.breadcrumbs{display:block}div.quiz-page{top:36px}}/*# sourceMappingURL=webquiz-darkred.css.map */ diff --git a/macros/latex/contrib/webquiz/doc/www/css/webquiz-default.css b/macros/latex/contrib/webquiz/doc/www/css/webquiz-default.css new file mode 100644 index 0000000000..b1341bd621 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/css/webquiz-default.css @@ -0,0 +1 @@ +body{color:#000;background-color:#fff}body a{color:#900}body a:hover{color:#f33}body a:visited{color:#300}div.quiz-page{position:absolute;top:36px;left:5%;min-width:60%;width:88%}div.button,span.button{background-color:#fff8dc;border-radius:5px;color:#000;border:solid #f2bb66 2px;font-size:12px;font-weight:normal;text-align:center}span.button{padding:1px 4px 1px 4px}span.button-selected{color:#db0b3e}span:hover.button-selected{color:#5b2c6f}div.button:hover,span.button:hover{border:solid #5b2c6f 2px !important;color:#5b2c6f;text-decoration:underline}div.blank,span.blank{content:"";color:#000;background:#fff8dc}div.side-menu{float:left;font-size:10px;font-weight:normal;margin:0;overflow:hidden;width:100px;display:block;clear:left}div.side-menu>div{color:#ce1126;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;margin-bottom:.8ex}div.side-menu ul{list-style:none;padding-left:0;padding-bottom:10px}div.side-menu ul li{color:#000;font-size:14px;text-align:left;word-wrap:break-word}div.side-menu ul li.button-selected{color:#db0b3e}div.side-menu ul li:hover.button-selected{color:#5b2c6f}div.side-menu ul li:hover{text-decoration:underline}div.side-menu div.buttons{width:100%;height:100%;margin-bottom:6px;display:table}div.side-menu div.buttons div.button{display:table-cell;float:left;line-height:30px;margin-left:5px;margin-top:5px;position:relative;width:30px}div.side-menu div.buttons div.button span{color:#000;text-decoration:none}div.side-menu div.buttons div.button:after{bottom:-35%;content:attr(content);height:100%;position:absolute;width:100%;right:-35%;clear:right}div.side-menu div.buttons div.button-selected{border:solid #db0b3e 2px;color:#db0b3e}div.side-menu div.buttons div.cross{content:"u2718";color:red;background:linear-gradient(to bottom right, white, slateblue)}div.side-menu div.buttons div.star{content:"u272D";color:#ff0;background:linear-gradient(to bottom right, yellow, green)}div.side-menu div.buttons div.tick{content:"u2714";color:green;background:linear-gradient(to bottom right, red, yellow)}div.side-menu table.marking-key{margin-left:2px;clear:left}div.side-menu table.marking-key tbody tr td{width:2ex;padding-right:2px !important}div.side-menu table.marking-key tbody tr td.cross{font-size:medium;color:red}div.side-menu table.marking-key tbody tr td.star{font-size:small;color:#ff0}div.side-menu table.marking-key tbody tr td.tick{font-size:medium;color:green}div.side-menu div.school{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#cc6700;text-align:center;padding:10px 0 0 0}div.side-menu div.school A,div.side-menu div.school A:link,div.side-menu div.school A:visited{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#cc6700;text-align:center;padding:10px 0 0 0}div.side-menu div.copyright{font-family:arial,verdana,helvetica;font-size:xx-small;font-weight:normal;text-align:center;color:#630}div.side-menu div.copyright A,div.side-menu div.copyright A:link,div.side-menu div.copyright A:visited{text-decoration:none;color:#994d00;font-weight:bold}div.side-menu div.copyright A span.webquizlogo,div.side-menu div.copyright A:link span.webquizlogo,div.side-menu div.copyright A:visited span.webquizlogo{font-variant:small-caps;font-weight:bold}div.question-label,span.question-label{color:#ed253b;font-variant:small-caps;font-weight:normal;font-size:smaller;margin-bottom:10px;text-align:left}span#question-label{display:none}div.quiz-questions{display:grid}div.quiz-questions div.quiz-header{padding-right:1%;width:80%}div.quiz-questions div.quiz-header div.quiz-title{color:#ce1126;font-size:large;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-bottom:.8ex;min-width:50%}div.quiz-questions div.quiz-header span.arrows{color:#ed253b;float:right;right:5%;font-size:12px;margin-right:20px}div.quiz-questions div.quiz-header span.arrows A{text-decoration:none !important}div.quiz-questions div.quiz-header span.arrows A{color:#ed253b;font-size:12px}div.quiz-questions div.quiz-header span.arrows A:hover{color:#9f0d1d;text-decoration:underline}div.quiz-questions div.quiz-index{color:#ce1126;font-family:Arial,Helvetica,sans-serif;text-decoration:none;text-align:left}div.quiz-questions div.quiz-index ul{list-style:none !important}div.quiz-questions div.quiz-index ul li:before{content:"➣";color:#ce1126;padding-left:0;padding-right:1ex;margin-left:-1em}div.quiz-questions div.quiz-index ul li{list-style-image:none !important;overflow:visible}div.quiz-questions div.quiz-index ul li:hover{color:#ed253b}div.quiz-questions div.question{position:relative;margin:0 0 5px 0;display:none;padding-bottom:1em}div.quiz-questions div.question form{padding:10px 0 0 0}div.quiz-questions div.question form table tr{vertical-align:top}div.quiz-questions div.question form table tr td{vertical-align:top}div.quiz-questions div.question div.question-choices{padding-left:10px;padding-right:15px;text-align:left}div.quiz-questions div.question table.question-choices td{padding-right:0;vertical-align:baseline}div.quiz-questions div.question table.question-choices td:nth-child(3n+1){padding-right:6px}div.quiz-questions div.question td.brown{color:#f15466}div.quiz-questions div.question div.feedback{background-color:#e9e0d8;border:solid #c9a798 2px;border-radius:5px;display:none;padding:0 1ex 0 1ex;transition:height .66s ease-out}div.quiz-questions div.question div.feedback div{text-align:left;color:#ce1126}div.quiz-questions div.question div.feedback ol{counter-reset:list;list-style-type:none;margin:0;padding:0 !important}div.quiz-questions div.question div.feedback ol li:before{color:#f15466;content:counter(list, lower-latin) ") ";counter-increment:list;padding:0 0 0 0}div.quiz-questions div.question div.feedback ol li{text-align:left;color:#ce1126;padding-right:2em}div.quiz-questions div.question div.feedback ol li em{color:#ff1a1a}input.input-button{color:#000;background-color:#fff8dc;border:solid #f2bb66 2px;border-radius:5px;margin-right:40px;padding:0 4px 0 4px}div.warning{background-color:#ec7063;border:2px solid #ce1126;color:#fc0;padding:2mm;top:20%;left:20%;position:absolute;z-index:999}div.breadcrumbs{float:left;clear:both;display:block}nav{margin:0 auto;padding:4px 0 4px 0;height:20px;z-index:99;position:absolute;left:5%;top:10px;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:9px;font-weight:bold;min-width:600px}nav div.navleft{float:left}nav div.navright{float:right}nav div ul{margin:0;padding:0;list-style-type:none;position:absolute}nav div ul li{text-align:center;margin:0;-webkit-transition:all .2s;padding:2px 4px 2px 18px;background-color:#ce1126;position:relative;float:left}nav div ul li a{text-decoration:none;display:contents;-webkit-transition:all .5s}nav div ul li span{color:#fff}nav div ul li ul{display:none;padding-left:4px;margin:0;-webkit-transition:all 1s;border:solid #f2bb66 2px;border-radius:5px;background-color:#fff8dc}nav div ul li ul li{width:100%;text-align:left;-webkit-transition:height .5s;padding:1px 0 0 4px}nav div ul li ul li a{color:#994d00 !important}nav div ul li ul li::after{content:none}nav div ul li ul li:first-child{padding-top:2px}nav div ul li ul li:nth-child(n){background:#fff8dc;padding-left:0}nav div ul li ul li:nth-child(n):after{border-left-color:#fff8dc;border:7px solid}nav div ul li ul li:hover{background:#f2bb66;color:red}nav div ul span{color:#fff}nav div ul li:hover{background-color:#fff8dc}nav div ul li a{color:green}nav div ul li a:hover{color:#ff0}nav div ul>li::after{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #ce1126;position:absolute;top:50%;margin-top:-7px;left:100%;z-index:99}nav div ul>li::before{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #fff;position:absolute;top:50%;margin-top:-7px;margin-left:2px;left:100%;z-index:98}nav div ul>li:nth-child(1){padding-left:4px}nav div ul>li:nth-child(1){background:#994d00;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(1) a{color:#fff}nav div ul>li:nth-child(1) ul li a{color:#fff}nav div ul>li:nth-child(1):after{border-left-color:#994d00}nav div ul>li:nth-child(2){background:#b35a00;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(2) a{color:#fff}nav div ul>li:nth-child(2) ul li a{color:#fff}nav div ul>li:nth-child(2):after{border-left-color:#b35a00}nav div ul>li:nth-child(3){background:#cc6700;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(3) a{color:#fff}nav div ul>li:nth-child(3) ul li a{color:#fff}nav div ul>li:nth-child(3):after{border-left-color:#cc6700}nav div ul>li:nth-child(4){background:#e67400;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(4) a{color:#fff}nav div ul>li:nth-child(4) ul li a{color:#fff}nav div ul>li:nth-child(4):after{border-left-color:#e67400}nav div ul>li:nth-child(5){background:#ff8000;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(5) a{color:#fff}nav div ul>li:nth-child(5) ul li a{color:#fff}nav div ul>li:nth-child(5):after{border-left-color:#ff8000}nav div ul>li:nth-child(6){background:#ff8d1a;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(6) a{color:#fff}nav div ul>li:nth-child(6) ul li a{color:#fff}nav div ul>li:nth-child(6):after{border-left-color:#ff8d1a}nav div ul>li:nth-child(7){background:#ff9a33;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(7) a{color:#fff}nav div ul>li:nth-child(7) ul li a{color:#fff}nav div ul>li:nth-child(7):after{border-left-color:#ff9a33}div#menu-icon{display:inline-block;color:#ce1126;float:left;text-decoration:none;margin-right:1px;font-family:Verdana,Arial,Helvetica,sans-serif !important;font-weight:bold !important;font-size:14px !important}div#menu-icon:hover{background-color:#fff8dc}span#quizzes-menu-icon{color:#fff;font-size:8px}span#sidelabelopen{display:block}span#sidelabelclosed{display:none}@media(max-width: 600px){div.side-menu{display:none}#sidelabelopen span{display:none}#sidelabelclosed span{display:block}div.breadcrumbs{display:none}div.quiz-page{top:6px}}@media(min-width: 601px){div.side-menu{display:block}#sidelabelopen span{display:block}#sidelabelclosed span{display:none}div.breadcrumbs{display:block}div.quiz-page{top:36px}}/*# sourceMappingURL=webquiz-default.css.map */ diff --git a/macros/latex/contrib/webquiz/doc/www/css/webquiz-earthy.css b/macros/latex/contrib/webquiz/doc/www/css/webquiz-earthy.css new file mode 100644 index 0000000000..0e28843eeb --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/css/webquiz-earthy.css @@ -0,0 +1 @@ +body{color:#5d001e;background-color:#e3e2df}body a{color:blue}body a:hover{color:#99f}body a:visited{color:#009}div.quiz-page{position:absolute;top:36px;left:5%;min-width:60%;width:88%}div.button,span.button{background-color:#fae5d3;border-radius:5px;color:#90002e;border:solid #e5791c 2px;font-size:12px;font-weight:normal;text-align:center}span.button{padding:1px 4px 1px 4px}span.button-selected{color:#c0392b}span:hover.button-selected{color:#943126}div.button:hover,span.button:hover{border:solid #943126 2px !important;color:#943126;text-decoration:underline}div.blank,span.blank{content:"";color:#000;background:#fef9e7}div.side-menu{float:left;font-size:10px;font-weight:normal;margin:0;overflow:hidden;width:100px;display:block;clear:left}div.side-menu>div{color:#873600;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;margin-bottom:.8ex}div.side-menu ul{list-style:none;padding-left:0;padding-bottom:10px}div.side-menu ul li{color:#90002e;font-size:14px;text-align:left;word-wrap:break-word}div.side-menu ul li.button-selected{color:#c0392b}div.side-menu ul li:hover.button-selected{color:#943126}div.side-menu ul li:hover{text-decoration:underline}div.side-menu div.buttons{width:100%;height:100%;margin-bottom:6px;display:table}div.side-menu div.buttons div.button{display:table-cell;float:left;line-height:30px;margin-left:5px;margin-top:5px;position:relative;width:30px}div.side-menu div.buttons div.button span{color:#90002e;text-decoration:none}div.side-menu div.buttons div.button:after{bottom:-35%;content:attr(content);height:100%;position:absolute;width:100%;right:-35%;clear:right}div.side-menu div.buttons div.button-selected{border:solid #c0392b 2px;color:#c0392b}div.side-menu div.buttons div.cross{content:"u2718";color:red;background:linear-gradient(to bottom right, #784212, #fae5d3)}div.side-menu div.buttons div.star{content:"u272D";color:#ff0;background:linear-gradient(to bottom right, #e5791c, #90002e)}div.side-menu div.buttons div.tick{content:"u2714";color:#271096;background:linear-gradient(to bottom right, #e5791c, #fef7e7)}div.side-menu table.marking-key{margin-left:2px;clear:left}div.side-menu table.marking-key tbody tr td{width:2ex;padding-right:2px !important}div.side-menu table.marking-key tbody tr td.cross{font-size:medium;color:red}div.side-menu table.marking-key tbody tr td.star{font-size:small;color:#ff0}div.side-menu table.marking-key tbody tr td.tick{font-size:medium;color:#271096}div.side-menu div.school{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#a14000;text-align:center;padding:10px 0 0 0}div.side-menu div.school A,div.side-menu div.school A:link,div.side-menu div.school A:visited{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#a14000;text-align:center;padding:10px 0 0 0}div.side-menu div.copyright{font-family:arial,verdana,helvetica;font-size:xx-small;font-weight:normal;text-align:center;color:#3b1800}div.side-menu div.copyright A,div.side-menu div.copyright A:link,div.side-menu div.copyright A:visited{text-decoration:none;color:#6e2c00;font-weight:bold}div.side-menu div.copyright A span.webquizlogo,div.side-menu div.copyright A:link span.webquizlogo,div.side-menu div.copyright A:visited span.webquizlogo{font-variant:small-caps;font-weight:bold}div.question-label,span.question-label{color:#900c3f;font-variant:small-caps;font-weight:normal;font-size:smaller;margin-bottom:10px;text-align:left}span#question-label{display:none}div.quiz-questions{display:grid}div.quiz-questions div.quiz-header{padding-right:1%;width:80%}div.quiz-questions div.quiz-header div.quiz-title{color:#873600;font-size:large;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-bottom:.8ex;min-width:50%}div.quiz-questions div.quiz-header span.arrows{color:#900c3f;float:right;right:5%;font-size:12px;margin-right:20px}div.quiz-questions div.quiz-header span.arrows A{text-decoration:none !important}div.quiz-questions div.quiz-header span.arrows A{color:#900c3f;font-size:12px}div.quiz-questions div.quiz-header span.arrows A:hover{color:#320416;text-decoration:underline}div.quiz-questions div.quiz-index{color:#873600;font-family:Arial,Helvetica,sans-serif;text-decoration:none;text-align:left}div.quiz-questions div.quiz-index ul{list-style:none !important}div.quiz-questions div.quiz-index ul li:before{content:"➣";color:#873600;padding-left:0;padding-right:1ex;margin-left:-1em}div.quiz-questions div.quiz-index ul li{list-style-image:none !important;overflow:visible}div.quiz-questions div.quiz-index ul li:hover{color:#900c3f}div.quiz-questions div.question{position:relative;margin:0 0 5px 0;display:none;padding-bottom:1em}div.quiz-questions div.question form{padding:10px 0 0 0}div.quiz-questions div.question form table tr{vertical-align:top}div.quiz-questions div.question form table tr td{vertical-align:top}div.quiz-questions div.question div.question-choices{padding-left:10px;padding-right:15px;text-align:left}div.quiz-questions div.question table.question-choices td{padding-right:0;vertical-align:baseline}div.quiz-questions div.question table.question-choices td:nth-child(3n+1){padding-right:6px}div.quiz-questions div.question td.brown{color:#b04600}div.quiz-questions div.question div.feedback{background-color:#fae5d3;border:solid #e5791c 2px;border-radius:5px;display:none;padding:0 1ex 0 1ex;transition:height .66s ease-out}div.quiz-questions div.question div.feedback div{text-align:left;color:#784212}div.quiz-questions div.question div.feedback ol{counter-reset:list;list-style-type:none;margin:0;padding:0 !important}div.quiz-questions div.question div.feedback ol li:before{color:#b04600;content:counter(list, lower-latin) ") ";counter-increment:list;padding:0 0 0 0}div.quiz-questions div.question div.feedback ol li{text-align:left;color:#784212;padding-right:2em}div.quiz-questions div.question div.feedback ol li em{color:#ba4a00}input.input-button{color:#000;background-color:#fae5d3;border:solid #e5791c 2px;border-radius:5px;margin-right:40px;padding:0 4px 0 4px}div.warning{background-color:lime;border:2px solid #873600;color:#fff;padding:2mm;top:20%;left:20%;position:absolute;z-index:999}div.breadcrumbs{float:left;clear:both;display:block}nav{margin:0 auto;padding:4px 0 4px 0;height:20px;z-index:99;position:absolute;left:5%;top:10px;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:9px;font-weight:bold;min-width:600px}nav div.navleft{float:left}nav div.navright{float:right}nav div ul{margin:0;padding:0;list-style-type:none;position:absolute}nav div ul li{text-align:center;margin:0;-webkit-transition:all .2s;padding:2px 4px 2px 18px;background-color:#873600;position:relative;float:left}nav div ul li a{text-decoration:none;display:contents;-webkit-transition:all .5s}nav div ul li span{color:#fef5e7}nav div ul li ul{display:none;padding-left:4px;margin:0;-webkit-transition:all 1s;border:solid #e5791c 2px;border-radius:5px;background-color:#fae5d3}nav div ul li ul li{width:100%;text-align:left;-webkit-transition:height .5s;padding:1px 0 0 4px}nav div ul li ul li a{color:#873600 !important}nav div ul li ul li::after{content:none}nav div ul li ul li:first-child{padding-top:2px}nav div ul li ul li:nth-child(n){background:#fae5d3;padding-left:0}nav div ul li ul li:nth-child(n):after{border-left-color:#fae5d3;border:7px solid}nav div ul li ul li:hover{background:#e5791c;color:red}nav div ul span{color:#fef5e7}nav div ul li:hover{background-color:#fae5d3}nav div ul li a{color:green}nav div ul li a:hover{color:#ff0}nav div ul>li::after{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #873600;position:absolute;top:50%;margin-top:-7px;left:100%;z-index:99}nav div ul>li::before{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #e3e2df;position:absolute;top:50%;margin-top:-7px;margin-left:2px;left:100%;z-index:98}nav div ul>li:nth-child(1){padding-left:4px}nav div ul>li:nth-child(1){background:#6e2c00;color:#fef5e7;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(1) a{color:#fef5e7}nav div ul>li:nth-child(1) ul li a{color:#fef5e7}nav div ul>li:nth-child(1):after{border-left-color:#6e2c00}nav div ul>li:nth-child(2){background:#883600;color:#fef5e7;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(2) a{color:#fef5e7}nav div ul>li:nth-child(2) ul li a{color:#fef5e7}nav div ul>li:nth-child(2):after{border-left-color:#883600}nav div ul>li:nth-child(3){background:#a14000;color:#fef5e7;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(3) a{color:#fef5e7}nav div ul>li:nth-child(3) ul li a{color:#fef5e7}nav div ul>li:nth-child(3):after{border-left-color:#a14000}nav div ul>li:nth-child(4){background:#bb4b00;color:#fef5e7;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(4) a{color:#fef5e7}nav div ul>li:nth-child(4) ul li a{color:#fef5e7}nav div ul>li:nth-child(4):after{border-left-color:#bb4b00}nav div ul>li:nth-child(5){background:#d45500;color:#fef5e7;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(5) a{color:#fef5e7}nav div ul>li:nth-child(5) ul li a{color:#fef5e7}nav div ul>li:nth-child(5):after{border-left-color:#d45500}nav div ul>li:nth-child(6){background:#ee5f00;color:#fef5e7;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(6) a{color:#fef5e7}nav div ul>li:nth-child(6) ul li a{color:#fef5e7}nav div ul>li:nth-child(6):after{border-left-color:#ee5f00}nav div ul>li:nth-child(7){background:#ff6b08;color:#fef5e7;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(7) a{color:#fef5e7}nav div ul>li:nth-child(7) ul li a{color:#fef5e7}nav div ul>li:nth-child(7):after{border-left-color:#ff6b08}div#menu-icon{display:inline-block;color:#873600;float:left;text-decoration:none;margin-right:1px;font-family:Verdana,Arial,Helvetica,sans-serif !important;font-weight:bold !important;font-size:14px !important}div#menu-icon:hover{background-color:#fae5d3}span#quizzes-menu-icon{color:#fef5e7;font-size:8px}span#sidelabelopen{display:block}span#sidelabelclosed{display:none}@media(max-width: 600px){div.side-menu{display:none}#sidelabelopen span{display:none}#sidelabelclosed span{display:block}div.breadcrumbs{display:none}div.quiz-page{top:6px}}@media(min-width: 601px){div.side-menu{display:block}#sidelabelopen span{display:block}#sidelabelclosed span{display:none}div.breadcrumbs{display:block}div.quiz-page{top:36px}}/*# sourceMappingURL=webquiz-earthy.css.map */ diff --git a/macros/latex/contrib/webquiz/doc/www/css/webquiz-fresh.css b/macros/latex/contrib/webquiz/doc/www/css/webquiz-fresh.css new file mode 100644 index 0000000000..1d1c64e6e6 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/css/webquiz-fresh.css @@ -0,0 +1 @@ +body{color:#000;background-color:#e1f5f4}body a{color:#4169e1}body a:hover{color:#c5d1f6}body a:visited{color:#1a3ca2}div.quiz-page{position:absolute;top:36px;left:5%;min-width:60%;width:88%}div.button,span.button{background-color:#d1f6ff;border-radius:5px;color:#1a1a1a;border:solid #05ceff 2px;font-size:12px;font-weight:normal;text-align:center}span.button{padding:1px 4px 1px 4px}span.button-selected{color:#1a0ee4}span:hover.button-selected{color:#6b63f5}div.button:hover,span.button:hover{border:solid #6b63f5 2px !important;color:#6b63f5;text-decoration:underline}div.blank,span.blank{content:"";color:#191970;background:#dcfffe}div.side-menu{float:left;font-size:10px;font-weight:normal;margin:0;overflow:hidden;width:100px;display:block;clear:left}div.side-menu>div{color:#05386b;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;margin-bottom:.8ex}div.side-menu ul{list-style:none;padding-left:0;padding-bottom:10px}div.side-menu ul li{color:#1a1a1a;font-size:14px;text-align:left;word-wrap:break-word}div.side-menu ul li.button-selected{color:#1a0ee4}div.side-menu ul li:hover.button-selected{color:#6b63f5}div.side-menu ul li:hover{text-decoration:underline}div.side-menu div.buttons{width:100%;height:100%;margin-bottom:6px;display:table}div.side-menu div.buttons div.button{display:table-cell;float:left;line-height:30px;margin-left:5px;margin-top:5px;position:relative;width:30px}div.side-menu div.buttons div.button span{color:#1a1a1a;text-decoration:none}div.side-menu div.buttons div.button:after{bottom:-35%;content:attr(content);height:100%;position:absolute;width:100%;right:-35%;clear:right}div.side-menu div.buttons div.button-selected{border:solid #1a0ee4 2px;color:#1a0ee4}div.side-menu div.buttons div.cross{content:"u2718";color:red;background:linear-gradient(to bottom right, #1e90ff, #d1f6ff)}div.side-menu div.buttons div.star{content:"u272D";color:#fff;background:linear-gradient(to bottom right, #8484f0, cyan)}div.side-menu div.buttons div.tick{content:"u2714";color:#ff8;background:linear-gradient(to bottom right, #1a0ee4, #d1f6ff)}div.side-menu table.marking-key{margin-left:2px;clear:left}div.side-menu table.marking-key tbody tr td{width:2ex;padding-right:2px !important}div.side-menu table.marking-key tbody tr td.cross{font-size:medium;color:red}div.side-menu table.marking-key tbody tr td.star{font-size:small;color:#fff}div.side-menu table.marking-key tbody tr td.tick{font-size:medium;color:#ff8}div.side-menu div.school{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#0828d9;text-align:center;padding:10px 0 0 0}div.side-menu div.school A,div.side-menu div.school A:link,div.side-menu div.school A:visited{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#0828d9;text-align:center;padding:10px 0 0 0}div.side-menu div.copyright{font-family:arial,verdana,helvetica;font-size:xx-small;font-weight:normal;text-align:center;color:#041677}div.side-menu div.copyright A,div.side-menu div.copyright A:link,div.side-menu div.copyright A:visited{text-decoration:none;color:#061fa8;font-weight:bold}div.side-menu div.copyright A span.webquizlogo,div.side-menu div.copyright A:link span.webquizlogo,div.side-menu div.copyright A:visited span.webquizlogo{font-variant:small-caps;font-weight:bold}div.question-label,span.question-label{color:#0a6bcc;font-variant:small-caps;font-weight:normal;font-size:smaller;margin-bottom:10px;text-align:left}span#question-label{display:none}div.quiz-questions{display:grid}div.quiz-questions div.quiz-header{padding-right:1%;width:80%}div.quiz-questions div.quiz-header div.quiz-title{color:#05386b;font-size:large;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-bottom:.8ex;min-width:50%}div.quiz-questions div.quiz-header span.arrows{color:#0a6bcc;float:right;right:5%;font-size:12px;margin-right:20px}div.quiz-questions div.quiz-header span.arrows A{text-decoration:none !important}div.quiz-questions div.quiz-header span.arrows A{color:#0a6bcc;font-size:12px}div.quiz-questions div.quiz-header span.arrows A:hover{color:#05386b;text-decoration:underline}div.quiz-questions div.quiz-index{color:#05386b;font-family:Arial,Helvetica,sans-serif;text-decoration:none;text-align:left}div.quiz-questions div.quiz-index ul{list-style:none !important}div.quiz-questions div.quiz-index ul li:before{content:"➣";color:#05386b;padding-left:0;padding-right:1ex;margin-left:-1em}div.quiz-questions div.quiz-index ul li{list-style-image:none !important;overflow:visible}div.quiz-questions div.quiz-index ul li:hover{color:#0a6bcc}div.quiz-questions div.question{position:relative;margin:0 0 5px 0;display:none;padding-bottom:1em}div.quiz-questions div.question form{padding:10px 0 0 0}div.quiz-questions div.question form table tr{vertical-align:top}div.quiz-questions div.question form table tr td{vertical-align:top}div.quiz-questions div.question div.question-choices{padding-left:10px;padding-right:15px;text-align:left}div.quiz-questions div.question table.question-choices td{padding-right:0;vertical-align:baseline}div.quiz-questions div.question table.question-choices td:nth-child(3n+1){padding-right:6px}div.quiz-questions div.question td.brown{color:#074c92}div.quiz-questions div.question div.feedback{background-color:#d1f6ff;border:solid #05ceff 2px;border-radius:5px;display:none;padding:0 1ex 0 1ex;transition:height .66s ease-out}div.quiz-questions div.question div.feedback div{text-align:left;color:#01a}div.quiz-questions div.question div.feedback ol{counter-reset:list;list-style-type:none;margin:0;padding:0 !important}div.quiz-questions div.question div.feedback ol li:before{color:#074c92;content:counter(list, lower-latin) ") ";counter-increment:list;padding:0 0 0 0}div.quiz-questions div.question div.feedback ol li{text-align:left;color:#01a;padding-right:2em}div.quiz-questions div.question div.feedback ol li em{color:#6bb6ff}input.input-button{color:#191970;background-color:#d1f6ff;border:solid #05ceff 2px;border-radius:5px;margin-right:40px;padding:0 4px 0 4px}div.warning{background-color:lime;border:2px solid #05386b;color:#fff;padding:2mm;top:20%;left:20%;position:absolute;z-index:999}div.breadcrumbs{float:left;clear:both;display:block}nav{margin:0 auto;padding:4px 0 4px 0;height:20px;z-index:99;position:absolute;left:5%;top:10px;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:9px;font-weight:bold;min-width:600px}nav div.navleft{float:left}nav div.navright{float:right}nav div ul{margin:0;padding:0;list-style-type:none;position:absolute}nav div ul li{text-align:center;margin:0;-webkit-transition:all .2s;padding:2px 4px 2px 18px;background-color:#05386b;position:relative;float:left}nav div ul li a{text-decoration:none;display:contents;-webkit-transition:all .5s}nav div ul li span{color:#fff}nav div ul li ul{display:none;padding-left:4px;margin:0;-webkit-transition:all 1s;border:solid #05ceff 2px;border-radius:5px;background-color:#d1f6ff}nav div ul li ul li{width:100%;text-align:left;-webkit-transition:height .5s;padding:1px 0 0 4px}nav div ul li ul li a{color:#4682b4 !important}nav div ul li ul li::after{content:none}nav div ul li ul li:first-child{padding-top:2px}nav div ul li ul li:nth-child(n){background:#d1f6ff;padding-left:0}nav div ul li ul li:nth-child(n):after{border-left-color:#d1f6ff;border:7px solid}nav div ul li ul li:hover{background:#05ceff;color:red}nav div ul span{color:#fff}nav div ul li:hover{background-color:#d1f6ff}nav div ul li a{color:green}nav div ul li a:hover{color:#ff0}nav div ul>li::after{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #05386b;position:absolute;top:50%;margin-top:-7px;left:100%;z-index:99}nav div ul>li::before{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #e1f5f4;position:absolute;top:50%;margin-top:-7px;margin-left:2px;left:100%;z-index:98}nav div ul>li:nth-child(1){padding-left:4px}nav div ul>li:nth-child(1){background:#1e90ff;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(1) a{color:#fff}nav div ul>li:nth-child(1) ul li a{color:#fff}nav div ul>li:nth-child(1):after{border-left-color:#1e90ff}nav div ul>li:nth-child(2){background:#389dff;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(2) a{color:#fff}nav div ul>li:nth-child(2) ul li a{color:#fff}nav div ul>li:nth-child(2):after{border-left-color:#389dff}nav div ul>li:nth-child(3){background:#51a9ff;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(3) a{color:#fff}nav div ul>li:nth-child(3) ul li a{color:#fff}nav div ul>li:nth-child(3):after{border-left-color:#51a9ff}nav div ul>li:nth-child(4){background:#6bb6ff;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(4) a{color:#fff}nav div ul>li:nth-child(4) ul li a{color:#fff}nav div ul>li:nth-child(4):after{border-left-color:#6bb6ff}nav div ul>li:nth-child(5){background:#84c2ff;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(5) a{color:#fff}nav div ul>li:nth-child(5) ul li a{color:#fff}nav div ul>li:nth-child(5):after{border-left-color:#84c2ff}nav div ul>li:nth-child(6){background:#9ecfff;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(6) a{color:#fff}nav div ul>li:nth-child(6) ul li a{color:#fff}nav div ul>li:nth-child(6):after{border-left-color:#9ecfff}nav div ul>li:nth-child(7){background:#b7dbff;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(7) a{color:#fff}nav div ul>li:nth-child(7) ul li a{color:#fff}nav div ul>li:nth-child(7):after{border-left-color:#b7dbff}div#menu-icon{display:inline-block;color:#05386b;float:left;text-decoration:none;margin-right:1px;font-family:Verdana,Arial,Helvetica,sans-serif !important;font-weight:bold !important;font-size:14px !important}div#menu-icon:hover{background-color:#d1f6ff}span#quizzes-menu-icon{color:#fff;font-size:8px}span#sidelabelopen{display:block}span#sidelabelclosed{display:none}@media(max-width: 600px){div.side-menu{display:none}#sidelabelopen span{display:none}#sidelabelclosed span{display:block}div.breadcrumbs{display:none}div.quiz-page{top:6px}}@media(min-width: 601px){div.side-menu{display:block}#sidelabelopen span{display:block}#sidelabelclosed span{display:none}div.breadcrumbs{display:block}div.quiz-page{top:36px}}/*# sourceMappingURL=webquiz-fresh.css.map */ diff --git a/macros/latex/contrib/webquiz/doc/www/css/webquiz-light.css b/macros/latex/contrib/webquiz/doc/www/css/webquiz-light.css new file mode 100644 index 0000000000..3ae3a1bc9b --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/css/webquiz-light.css @@ -0,0 +1 @@ +body{color:#d77c04;background-color:#eae7dc}body a{color:blue}body a:hover{color:#99f}body a:visited{color:#009}div.quiz-page{position:absolute;top:36px;left:5%;min-width:60%;width:88%}div.button,span.button{background-color:#d8c3a5;border-radius:5px;color:#734202;border:solid #c08206 2px;font-size:12px;font-weight:normal;text-align:center}span.button{padding:1px 4px 1px 4px}span.button-selected{color:#634b11e6}span:hover.button-selected{color:rgba(143,108,24,.9019607843)}div.button:hover,span.button:hover{border:solid rgba(143,108,24,.9019607843) 2px !important;color:rgba(143,108,24,.9019607843);text-decoration:underline}div.blank,span.blank{content:"";color:#775004;background:#fff8dc}div.side-menu{float:left;font-size:10px;font-weight:normal;margin:0;overflow:hidden;width:100px;display:block;clear:left}div.side-menu>div{color:#6b1309;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;margin-bottom:.8ex}div.side-menu ul{list-style:none;padding-left:0;padding-bottom:10px}div.side-menu ul li{color:#734202;font-size:14px;text-align:left;word-wrap:break-word}div.side-menu ul li.button-selected{color:#634b11e6}div.side-menu ul li:hover.button-selected{color:rgba(143,108,24,.9019607843)}div.side-menu ul li:hover{text-decoration:underline}div.side-menu div.buttons{width:100%;height:100%;margin-bottom:6px;display:table}div.side-menu div.buttons div.button{display:table-cell;float:left;line-height:30px;margin-left:5px;margin-top:5px;position:relative;width:30px}div.side-menu div.buttons div.button span{color:#734202;text-decoration:none}div.side-menu div.buttons div.button:after{bottom:-35%;content:attr(content);height:100%;position:absolute;width:100%;right:-35%;clear:right}div.side-menu div.buttons div.button-selected{border:solid #634b11e6 2px;color:#634b11e6}div.side-menu div.buttons div.cross{content:"u2718";color:red;background:linear-gradient(to bottom right, #e7aa00, white)}div.side-menu div.buttons div.star{content:"u272D";color:#ff0;background:linear-gradient(to bottom right, #cf730c, #594466)}div.side-menu div.buttons div.tick{content:"u2714";color:green;background:linear-gradient(to bottom right, #7e3523, #ede20d)}div.side-menu table.marking-key{margin-left:2px;clear:left}div.side-menu table.marking-key tbody tr td{width:2ex;padding-right:2px !important}div.side-menu table.marking-key tbody tr td.cross{font-size:medium;color:red}div.side-menu table.marking-key tbody tr td.star{font-size:small;color:#ff0}div.side-menu table.marking-key tbody tr td.tick{font-size:medium;color:green}div.side-menu div.school{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#a96d12;text-align:center;padding:10px 0 0 0}div.side-menu div.school A,div.side-menu div.school A:link,div.side-menu div.school A:visited{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#a96d12;text-align:center;padding:10px 0 0 0}div.side-menu div.copyright{font-family:arial,verdana,helvetica;font-size:xx-small;font-weight:normal;text-align:center;color:#4d3108}div.side-menu div.copyright A,div.side-menu div.copyright A:link,div.side-menu div.copyright A:visited{text-decoration:none;color:#7b4f0d;font-weight:bold}div.side-menu div.copyright A span.webquizlogo,div.side-menu div.copyright A:link span.webquizlogo,div.side-menu div.copyright A:visited span.webquizlogo{font-variant:small-caps;font-weight:bold}div.question-label,span.question-label{color:#7a4109;font-variant:small-caps;font-weight:normal;font-size:smaller;margin-bottom:10px;text-align:left}span#question-label{display:none}div.quiz-questions{display:grid}div.quiz-questions div.quiz-header{padding-right:1%;width:80%}div.quiz-questions div.quiz-header div.quiz-title{color:#6b1309;font-size:large;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-bottom:.8ex;min-width:50%}div.quiz-questions div.quiz-header span.arrows{color:#7a4109;float:right;right:5%;font-size:12px;margin-right:20px}div.quiz-questions div.quiz-header span.arrows A{text-decoration:none !important}div.quiz-questions div.quiz-header span.arrows A{color:#7a4109;font-size:12px}div.quiz-questions div.quiz-header span.arrows A:hover{color:#1b0e02;text-decoration:underline}div.quiz-questions div.quiz-index{color:#6b1309;font-family:Arial,Helvetica,sans-serif;text-decoration:none;text-align:left}div.quiz-questions div.quiz-index ul{list-style:none !important}div.quiz-questions div.quiz-index ul li:before{content:"➣";color:#6b1309;padding-left:0;padding-right:1ex;margin-left:-1em}div.quiz-questions div.quiz-index ul li{list-style-image:none !important;overflow:visible}div.quiz-questions div.quiz-index ul li:hover{color:#7a4109}div.quiz-questions div.question{position:relative;margin:0 0 5px 0;display:none;padding-bottom:1em}div.quiz-questions div.question form{padding:10px 0 0 0}div.quiz-questions div.question form table tr{vertical-align:top}div.quiz-questions div.question form table tr td{vertical-align:top}div.quiz-questions div.question div.question-choices{padding-left:10px;padding-right:15px;text-align:left}div.quiz-questions div.question table.question-choices td{padding-right:0;vertical-align:baseline}div.quiz-questions div.question table.question-choices td:nth-child(3n+1){padding-right:6px}div.quiz-questions div.question td.brown{color:brown}div.quiz-questions div.question div.feedback{background-color:#d8c3a5;border:solid #7b5f36 2px;border-radius:5px;display:none;padding:0 1ex 0 1ex;transition:height .66s ease-out}div.quiz-questions div.question div.feedback div{text-align:left;color:#231f1b}div.quiz-questions div.question div.feedback ol{counter-reset:list;list-style-type:none;margin:0;padding:0 !important}div.quiz-questions div.question div.feedback ol li:before{color:brown;content:counter(list, lower-latin) ") ";counter-increment:list;padding:0 0 0 0}div.quiz-questions div.question div.feedback ol li{text-align:left;color:#231f1b;padding-right:2em}div.quiz-questions div.question div.feedback ol li em{color:#6e5728}input.input-button{color:#775004;background-color:#d8c3a5;border:solid #c08206 2px;border-radius:5px;margin-right:40px;padding:0 4px 0 4px}div.warning{background-color:red;border:2px solid #6b1309;color:#fff;padding:2mm;top:20%;left:20%;position:absolute;z-index:999}div.breadcrumbs{float:left;clear:both;display:block}nav{margin:0 auto;padding:4px 0 4px 0;height:20px;z-index:99;position:absolute;left:5%;top:10px;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:9px;font-weight:bold;min-width:600px}nav div.navleft{float:left}nav div.navright{float:right}nav div ul{margin:0;padding:0;list-style-type:none;position:absolute}nav div ul li{text-align:center;margin:0;-webkit-transition:all .2s;padding:2px 4px 2px 18px;background-color:#6b1309;position:relative;float:left}nav div ul li a{text-decoration:none;display:contents;-webkit-transition:all .5s}nav div ul li span{color:#fff}nav div ul li ul{display:none;padding-left:4px;margin:0;-webkit-transition:all 1s;border:solid #c08206 2px;border-radius:5px;background-color:#d8c3a5}nav div ul li ul li{width:100%;text-align:left;-webkit-transition:height .5s;padding:1px 0 0 4px}nav div ul li ul li a{color:#7b5f36 !important}nav div ul li ul li::after{content:none}nav div ul li ul li:first-child{padding-top:2px}nav div ul li ul li:nth-child(n){background:#d8c3a5;padding-left:0}nav div ul li ul li:nth-child(n):after{border-left-color:#d8c3a5;border:7px solid}nav div ul li ul li:hover{background:#c08206;color:red}nav div ul span{color:#fff}nav div ul li:hover{background-color:#d8c3a5}nav div ul li a{color:green}nav div ul li a:hover{color:#ff0}nav div ul>li::after{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #6b1309;position:absolute;top:50%;margin-top:-7px;left:100%;z-index:99}nav div ul>li::before{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #eae7dc;position:absolute;top:50%;margin-top:-7px;margin-left:2px;left:100%;z-index:98}nav div ul>li:nth-child(1){padding-left:4px}nav div ul>li:nth-child(1){background:#7b4f0d;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(1) a{color:#fff}nav div ul>li:nth-child(1) ul li a{color:#fff}nav div ul>li:nth-child(1):after{border-left-color:#7b4f0d}nav div ul>li:nth-child(2){background:#925e0f;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(2) a{color:#fff}nav div ul>li:nth-child(2) ul li a{color:#fff}nav div ul>li:nth-child(2):after{border-left-color:#925e0f}nav div ul>li:nth-child(3){background:#a96d12;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(3) a{color:#fff}nav div ul>li:nth-child(3) ul li a{color:#fff}nav div ul>li:nth-child(3):after{border-left-color:#a96d12}nav div ul>li:nth-child(4){background:#c07b14;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(4) a{color:#fff}nav div ul>li:nth-child(4) ul li a{color:#fff}nav div ul>li:nth-child(4):after{border-left-color:#c07b14}nav div ul>li:nth-child(5){background:#d78a17;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(5) a{color:#fff}nav div ul>li:nth-child(5) ul li a{color:#fff}nav div ul>li:nth-child(5):after{border-left-color:#d78a17}nav div ul>li:nth-child(6){background:#e79820;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(6) a{color:#fff}nav div ul>li:nth-child(6) ul li a{color:#fff}nav div ul>li:nth-child(6):after{border-left-color:#e79820}nav div ul>li:nth-child(7){background:#eaa237;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(7) a{color:#fff}nav div ul>li:nth-child(7) ul li a{color:#fff}nav div ul>li:nth-child(7):after{border-left-color:#eaa237}div#menu-icon{display:inline-block;color:#6b1309;float:left;text-decoration:none;margin-right:1px;font-family:Verdana,Arial,Helvetica,sans-serif !important;font-weight:bold !important;font-size:14px !important}div#menu-icon:hover{background-color:#d8c3a5}span#quizzes-menu-icon{color:#fff;font-size:8px}span#sidelabelopen{display:block}span#sidelabelclosed{display:none}@media(max-width: 600px){div.side-menu{display:none}#sidelabelopen span{display:none}#sidelabelclosed span{display:block}div.breadcrumbs{display:none}div.quiz-page{top:6px}}@media(min-width: 601px){div.side-menu{display:block}#sidelabelopen span{display:block}#sidelabelclosed span{display:none}div.breadcrumbs{display:block}div.quiz-page{top:36px}}/*# sourceMappingURL=webquiz-light.css.map */ diff --git a/macros/latex/contrib/webquiz/doc/www/css/webquiz-lively.css b/macros/latex/contrib/webquiz/doc/www/css/webquiz-lively.css new file mode 100644 index 0000000000..cd2a4f2a99 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/css/webquiz-lively.css @@ -0,0 +1 @@ +body{color:#ca3435;background-color:#fbe7b2}body a{color:#299617}body a:hover{color:#73e75f}body a:visited{color:#113e09}div.quiz-page{position:absolute;top:36px;left:5%;min-width:60%;width:88%}div.button,span.button{background-color:#febaad;border-radius:5px;color:#a8d0e6;border:solid #da2647 2px;font-size:12px;font-weight:normal;text-align:center}span.button{padding:1px 4px 1px 4px}span.button-selected{color:#ad4379}span:hover.button-selected{color:#d086ac}div.button:hover,span.button:hover{border:solid #d086ac 2px !important;color:#d086ac;text-decoration:underline}div.blank,span.blank{content:"";color:#ff3855;background:#fdd7e4}div.side-menu{float:left;font-size:10px;font-weight:normal;margin:0;overflow:hidden;width:100px;display:block;clear:left}div.side-menu>div{color:#fd0e35;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;margin-bottom:.8ex}div.side-menu ul{list-style:none;padding-left:0;padding-bottom:10px}div.side-menu ul li{color:#a8d0e6;font-size:14px;text-align:left;word-wrap:break-word}div.side-menu ul li.button-selected{color:#ad4379}div.side-menu ul li:hover.button-selected{color:#d086ac}div.side-menu ul li:hover{text-decoration:underline}div.side-menu div.buttons{width:100%;height:100%;margin-bottom:6px;display:table}div.side-menu div.buttons div.button{display:table-cell;float:left;line-height:30px;margin-left:5px;margin-top:5px;position:relative;width:30px}div.side-menu div.buttons div.button span{color:#a8d0e6;text-decoration:none}div.side-menu div.buttons div.button:after{bottom:-35%;content:attr(content);height:100%;position:absolute;width:100%;right:-35%;clear:right}div.side-menu div.buttons div.button-selected{border:solid #ad4379 2px;color:#ad4379}div.side-menu div.buttons div.cross{content:"u2718";color:red;background:linear-gradient(to bottom right, #da2647, #febaad)}div.side-menu div.buttons div.star{content:"u272D";color:#ff0;background:linear-gradient(to bottom right, #cc0000, #ff00cc)}div.side-menu div.buttons div.tick{content:"u2714";color:#fff;background:linear-gradient(to bottom right, #ffaeac, #cc0000)}div.side-menu table.marking-key{margin-left:2px;clear:left}div.side-menu table.marking-key tbody tr td{width:2ex;padding-right:2px !important}div.side-menu table.marking-key tbody tr td.cross{font-size:medium;color:red}div.side-menu table.marking-key tbody tr td.star{font-size:small;color:#ff0}div.side-menu table.marking-key tbody tr td.tick{font-size:medium;color:#fff}div.side-menu div.school{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#f10628;text-align:center;padding:10px 0 0 0}div.side-menu div.school A,div.side-menu div.school A:link,div.side-menu div.school A:visited{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#f10628;text-align:center;padding:10px 0 0 0}div.side-menu div.copyright{font-family:arial,verdana,helvetica;font-size:xx-small;font-weight:normal;text-align:center;color:#8d0418}div.side-menu div.copyright A,div.side-menu div.copyright A:link,div.side-menu div.copyright A:visited{text-decoration:none;color:#bf0520;font-weight:bold}div.side-menu div.copyright A span.webquizlogo,div.side-menu div.copyright A:link span.webquizlogo,div.side-menu div.copyright A:visited span.webquizlogo{font-variant:small-caps;font-weight:bold}div.question-label,span.question-label{color:#f0c;font-variant:small-caps;font-weight:normal;font-size:smaller;margin-bottom:10px;text-align:left}span#question-label{display:none}div.quiz-questions{display:grid}div.quiz-questions div.quiz-header{padding-right:1%;width:80%}div.quiz-questions div.quiz-header div.quiz-title{color:#fd0e35;font-size:large;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-bottom:.8ex;min-width:50%}div.quiz-questions div.quiz-header span.arrows{color:#f0c;float:right;right:5%;font-size:12px;margin-right:20px}div.quiz-questions div.quiz-header span.arrows A{text-decoration:none !important}div.quiz-questions div.quiz-header span.arrows A{color:#f0c;font-size:12px}div.quiz-questions div.quiz-header span.arrows A:hover{color:#99007a;text-decoration:underline}div.quiz-questions div.quiz-index{color:#fd0e35;font-family:Arial,Helvetica,sans-serif;text-decoration:none;text-align:left}div.quiz-questions div.quiz-index ul{list-style:none !important}div.quiz-questions div.quiz-index ul li:before{content:"➣";color:#fd0e35;padding-left:0;padding-right:1ex;margin-left:-1em}div.quiz-questions div.quiz-index ul li{list-style-image:none !important;overflow:visible}div.quiz-questions div.quiz-index ul li:hover{color:#f0c}div.quiz-questions div.question{position:relative;margin:0 0 5px 0;display:none;padding-bottom:1em}div.quiz-questions div.question form{padding:10px 0 0 0}div.quiz-questions div.question form table tr{vertical-align:top}div.quiz-questions div.question form table tr td{vertical-align:top}div.quiz-questions div.question div.question-choices{padding-left:10px;padding-right:15px;text-align:left}div.quiz-questions div.question table.question-choices td{padding-right:0;vertical-align:baseline}div.quiz-questions div.question table.question-choices td:nth-child(3n+1){padding-right:6px}div.quiz-questions div.question td.brown{color:#fd3657}div.quiz-questions div.question div.feedback{background-color:#febaad;border:solid #dc2603 2px;border-radius:5px;display:none;padding:0 1ex 0 1ex;transition:height .66s ease-out}div.quiz-questions div.question div.feedback div{text-align:left;color:#ffe4df}div.quiz-questions div.question div.feedback ol{counter-reset:list;list-style-type:none;margin:0;padding:0 !important}div.quiz-questions div.question div.feedback ol li:before{color:#fd3657;content:counter(list, lower-latin) ") ";counter-increment:list;padding:0 0 0 0}div.quiz-questions div.question div.feedback ol li{text-align:left;color:#ffe4df;padding-right:2em}div.quiz-questions div.question div.feedback ol li em{color:#f76c6c}input.input-button{color:#ff3855;background-color:#febaad;border:solid #da2647 2px;border-radius:5px;margin-right:40px;padding:0 4px 0 4px}div.warning{background-color:#c289b0;border:2px solid #fd0e35;color:#fff;padding:2mm;top:20%;left:20%;position:absolute;z-index:999}div.breadcrumbs{float:left;clear:both;display:block}nav{margin:0 auto;padding:4px 0 4px 0;height:20px;z-index:99;position:absolute;left:5%;top:10px;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:9px;font-weight:bold;min-width:600px}nav div.navleft{float:left}nav div.navright{float:right}nav div ul{margin:0;padding:0;list-style-type:none;position:absolute}nav div ul li{text-align:center;margin:0;-webkit-transition:all .2s;padding:2px 4px 2px 18px;background-color:#fd0e35;position:relative;float:left}nav div ul li a{text-decoration:none;display:contents;-webkit-transition:all .5s}nav div ul li span{color:#ff0}nav div ul li ul{display:none;padding-left:4px;margin:0;-webkit-transition:all 1s;border:solid #da2647 2px;border-radius:5px;background-color:#febaad}nav div ul li ul li{width:100%;text-align:left;-webkit-transition:height .5s;padding:1px 0 0 4px}nav div ul li ul li a{color:#ff6 !important}nav div ul li ul li::after{content:none}nav div ul li ul li:first-child{padding-top:2px}nav div ul li ul li:nth-child(n){background:#febaad;padding-left:0}nav div ul li ul li:nth-child(n):after{border-left-color:#febaad;border:7px solid}nav div ul li ul li:hover{background:#da2647;color:red}nav div ul span{color:#ff0}nav div ul li:hover{background-color:#febaad}nav div ul li a{color:green}nav div ul li a:hover{color:#ff0}nav div ul>li::after{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #fd0e35;position:absolute;top:50%;margin-top:-7px;left:100%;z-index:99}nav div ul>li::before{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #fbe7b2;position:absolute;top:50%;margin-top:-7px;margin-left:2px;left:100%;z-index:98}nav div ul>li:nth-child(1){padding-left:4px}nav div ul>li:nth-child(1){background:#ff3855;color:#ff0;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(1) a{color:#ff0}nav div ul>li:nth-child(1) ul li a{color:#ff0}nav div ul>li:nth-child(1):after{border-left-color:#ff3855}nav div ul>li:nth-child(2){background:#ff526b;color:#ff0;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(2) a{color:#ff0}nav div ul>li:nth-child(2) ul li a{color:#ff0}nav div ul>li:nth-child(2):after{border-left-color:#ff526b}nav div ul>li:nth-child(3){background:#ff6b81;color:#ff0;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(3) a{color:#ff0}nav div ul>li:nth-child(3) ul li a{color:#ff0}nav div ul>li:nth-child(3):after{border-left-color:#ff6b81}nav div ul>li:nth-child(4){background:#ff8596;color:#ff0;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(4) a{color:#ff0}nav div ul>li:nth-child(4) ul li a{color:#ff0}nav div ul>li:nth-child(4):after{border-left-color:#ff8596}nav div ul>li:nth-child(5){background:#ff9eac;color:#ff0;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(5) a{color:#ff0}nav div ul>li:nth-child(5) ul li a{color:#ff0}nav div ul>li:nth-child(5):after{border-left-color:#ff9eac}nav div ul>li:nth-child(6){background:#ffb8c2;color:#ff0;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(6) a{color:#ff0}nav div ul>li:nth-child(6) ul li a{color:#ff0}nav div ul>li:nth-child(6):after{border-left-color:#ffb8c2}nav div ul>li:nth-child(7){background:#ffd1d8;color:#ff0;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(7) a{color:#ff0}nav div ul>li:nth-child(7) ul li a{color:#ff0}nav div ul>li:nth-child(7):after{border-left-color:#ffd1d8}div#menu-icon{display:inline-block;color:#fd0e35;float:left;text-decoration:none;margin-right:1px;font-family:Verdana,Arial,Helvetica,sans-serif !important;font-weight:bold !important;font-size:14px !important}div#menu-icon:hover{background-color:#febaad}span#quizzes-menu-icon{color:#ff0;font-size:8px}span#sidelabelopen{display:block}span#sidelabelclosed{display:none}@media(max-width: 600px){div.side-menu{display:none}#sidelabelopen span{display:none}#sidelabelclosed span{display:block}div.breadcrumbs{display:none}div.quiz-page{top:6px}}@media(min-width: 601px){div.side-menu{display:block}#sidelabelopen span{display:block}#sidelabelclosed span{display:none}div.breadcrumbs{display:block}div.quiz-page{top:36px}}/*# sourceMappingURL=webquiz-lively.css.map */ diff --git a/macros/latex/contrib/webquiz/doc/www/css/webquiz-muted.css b/macros/latex/contrib/webquiz/doc/www/css/webquiz-muted.css new file mode 100644 index 0000000000..9e4d845614 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/css/webquiz-muted.css @@ -0,0 +1 @@ +body{color:#373737;background-color:#f4f4f4}body a{color:blue}body a:hover{color:#99f}body a:visited{color:#009}div.quiz-page{position:absolute;top:36px;left:5%;min-width:60%;width:88%}div.button,span.button{background-color:#dcd0c0;border-radius:5px;color:#655d41;border:solid #866c4a 2px;font-size:12px;font-weight:normal;text-align:center}span.button{padding:1px 4px 1px 4px}span.button-selected{color:#bd7209}span:hover.button-selected{color:#ba6513}div.button:hover,span.button:hover{border:solid #ba6513 2px !important;color:#ba6513;text-decoration:underline}div.blank,span.blank{content:"";color:#000;background:#fff8dc}div.side-menu{float:left;font-size:10px;font-weight:normal;margin:0;overflow:hidden;width:100px;display:block;clear:left}div.side-menu>div{color:#c0b283;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;margin-bottom:.8ex}div.side-menu ul{list-style:none;padding-left:0;padding-bottom:10px}div.side-menu ul li{color:#655d41;font-size:14px;text-align:left;word-wrap:break-word}div.side-menu ul li.button-selected{color:#bd7209}div.side-menu ul li:hover.button-selected{color:#ba6513}div.side-menu ul li:hover{text-decoration:underline}div.side-menu div.buttons{width:100%;height:100%;margin-bottom:6px;display:table}div.side-menu div.buttons div.button{display:table-cell;float:left;line-height:30px;margin-left:5px;margin-top:5px;position:relative;width:30px}div.side-menu div.buttons div.button span{color:#655d41;text-decoration:none}div.side-menu div.buttons div.button:after{bottom:-35%;content:attr(content);height:100%;position:absolute;width:100%;right:-35%;clear:right}div.side-menu div.buttons div.button-selected{border:solid #bd7209 2px;color:#bd7209}div.side-menu div.buttons div.cross{content:"u2718";color:red;background:linear-gradient(to bottom right, white, slateblue)}div.side-menu div.buttons div.star{content:"u272D";color:#ff0;background:linear-gradient(to bottom right, yellow, green)}div.side-menu div.buttons div.tick{content:"u2714";color:green;background:linear-gradient(to bottom right, red, yellow)}div.side-menu table.marking-key{margin-left:2px;clear:left}div.side-menu table.marking-key tbody tr td{width:2ex;padding-right:2px !important}div.side-menu table.marking-key tbody tr td.cross{font-size:medium;color:red}div.side-menu table.marking-key tbody tr td.star{font-size:small;color:#ff0}div.side-menu table.marking-key tbody tr td.tick{font-size:medium;color:green}div.side-menu div.school{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#4f4628;text-align:center;padding:10px 0 0 0}div.side-menu div.school A,div.side-menu div.school A:link,div.side-menu div.school A:visited{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#4f4628;text-align:center;padding:10px 0 0 0}div.side-menu div.copyright{font-family:arial,verdana,helvetica;font-size:xx-small;font-weight:normal;text-align:center;color:#0b0a06}div.side-menu div.copyright A,div.side-menu div.copyright A:link,div.side-menu div.copyright A:visited{text-decoration:none;color:#2d2817;font-weight:bold}div.side-menu div.copyright A span.webquizlogo,div.side-menu div.copyright A:link span.webquizlogo,div.side-menu div.copyright A:visited span.webquizlogo{font-variant:small-caps;font-weight:bold}div.question-label,span.question-label{color:#bd960f;font-variant:small-caps;font-weight:normal;font-size:smaller;margin-bottom:10px;text-align:left}span#question-label{display:none}div.quiz-questions{display:grid}div.quiz-questions div.quiz-header{padding-right:1%;width:80%}div.quiz-questions div.quiz-header div.quiz-title{color:#c0b283;font-size:large;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-bottom:.8ex;min-width:50%}div.quiz-questions div.quiz-header span.arrows{color:#bd960f;float:right;right:5%;font-size:12px;margin-right:20px}div.quiz-questions div.quiz-header span.arrows A{text-decoration:none !important}div.quiz-questions div.quiz-header span.arrows A{color:#bd960f;font-size:12px}div.quiz-questions div.quiz-header span.arrows A:hover{color:#5f4b08;text-decoration:underline}div.quiz-questions div.quiz-index{color:#c0b283;font-family:Arial,Helvetica,sans-serif;text-decoration:none;text-align:left}div.quiz-questions div.quiz-index ul{list-style:none !important}div.quiz-questions div.quiz-index ul li:before{content:"➣";color:#c0b283;padding-left:0;padding-right:1ex;margin-left:-1em}div.quiz-questions div.quiz-index ul li{list-style-image:none !important;overflow:visible}div.quiz-questions div.quiz-index ul li:hover{color:#bd960f}div.quiz-questions div.question{position:relative;margin:0 0 5px 0;display:none;padding-bottom:1em}div.quiz-questions div.question form{padding:10px 0 0 0}div.quiz-questions div.question form table tr{vertical-align:top}div.quiz-questions div.question form table tr td{vertical-align:top}div.quiz-questions div.question div.question-choices{padding-left:10px;padding-right:15px;text-align:left}div.quiz-questions div.question table.question-choices td{padding-right:0;vertical-align:baseline}div.quiz-questions div.question table.question-choices td:nth-child(3n+1){padding-right:6px}div.quiz-questions div.question td.brown{color:#cec39e}div.quiz-questions div.question div.feedback{background-color:#dcd0c0;border:solid #866c4a 2px;border-radius:5px;display:none;padding:0 1ex 0 1ex;transition:height .66s ease-out}div.quiz-questions div.question div.feedback div{text-align:left;color:#fff}div.quiz-questions div.question div.feedback ol{counter-reset:list;list-style-type:none;margin:0;padding:0 !important}div.quiz-questions div.question div.feedback ol li:before{color:#cec39e;content:counter(list, lower-latin) ") ";counter-increment:list;padding:0 0 0 0}div.quiz-questions div.question div.feedback ol li{text-align:left;color:#fff;padding-right:2em}div.quiz-questions div.question div.feedback ol li em{color:#261868}input.input-button{color:#000;background-color:#dcd0c0;border:solid #866c4a 2px;border-radius:5px;margin-right:40px;padding:0 4px 0 4px}div.warning{background-color:#e37222;border:2px solid #c0b283;color:#fff;padding:2mm;top:20%;left:20%;position:absolute;z-index:999}div.breadcrumbs{float:left;clear:both;display:block}nav{margin:0 auto;padding:4px 0 4px 0;height:20px;z-index:99;position:absolute;left:5%;top:10px;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:9px;font-weight:bold;min-width:600px}nav div.navleft{float:left}nav div.navright{float:right}nav div ul{margin:0;padding:0;list-style-type:none;position:absolute}nav div ul li{text-align:center;margin:0;-webkit-transition:all .2s;padding:2px 4px 2px 18px;background-color:#c0b283;position:relative;float:left}nav div ul li a{text-decoration:none;display:contents;-webkit-transition:all .5s}nav div ul li span{color:#a8a8a8}nav div ul li ul{display:none;padding-left:4px;margin:0;-webkit-transition:all 1s;border:solid #866c4a 2px;border-radius:5px;background-color:#dcd0c0}nav div ul li ul li{width:100%;text-align:left;-webkit-transition:height .5s;padding:1px 0 0 4px}nav div ul li ul li a{color:#804000 !important}nav div ul li ul li::after{content:none}nav div ul li ul li:first-child{padding-top:2px}nav div ul li ul li:nth-child(n){background:#dcd0c0;padding-left:0}nav div ul li ul li:nth-child(n):after{border-left-color:#dcd0c0;border:7px solid}nav div ul li ul li:hover{background:#866c4a;color:red}nav div ul span{color:#a8a8a8}nav div ul li:hover{background-color:#dcd0c0}nav div ul li a{color:green}nav div ul li a:hover{color:#ff0}nav div ul>li::after{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #c0b283;position:absolute;top:50%;margin-top:-7px;left:100%;z-index:99}nav div ul>li::before{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #f4f4f4;position:absolute;top:50%;margin-top:-7px;margin-left:2px;left:100%;z-index:98}nav div ul>li:nth-child(1){padding-left:4px}nav div ul>li:nth-child(1){background:#2d2817;color:#a8a8a8;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(1) a{color:#a8a8a8}nav div ul>li:nth-child(1) ul li a{color:#a8a8a8}nav div ul>li:nth-child(1):after{border-left-color:#2d2817}nav div ul>li:nth-child(2){background:#3e3720;color:#a8a8a8;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(2) a{color:#a8a8a8}nav div ul>li:nth-child(2) ul li a{color:#a8a8a8}nav div ul>li:nth-child(2):after{border-left-color:#3e3720}nav div ul>li:nth-child(3){background:#4f4628;color:#a8a8a8;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(3) a{color:#a8a8a8}nav div ul>li:nth-child(3) ul li a{color:#a8a8a8}nav div ul>li:nth-child(3):after{border-left-color:#4f4628}nav div ul>li:nth-child(4){background:#605531;color:#a8a8a8;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(4) a{color:#a8a8a8}nav div ul>li:nth-child(4) ul li a{color:#a8a8a8}nav div ul>li:nth-child(4):after{border-left-color:#605531}nav div ul>li:nth-child(5){background:#716439;color:#a8a8a8;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(5) a{color:#a8a8a8}nav div ul>li:nth-child(5) ul li a{color:#a8a8a8}nav div ul>li:nth-child(5):after{border-left-color:#716439}nav div ul>li:nth-child(6){background:#827342;color:#a8a8a8;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(6) a{color:#a8a8a8}nav div ul>li:nth-child(6) ul li a{color:#a8a8a8}nav div ul>li:nth-child(6):after{border-left-color:#827342}nav div ul>li:nth-child(7){background:#93824a;color:#a8a8a8;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(7) a{color:#a8a8a8}nav div ul>li:nth-child(7) ul li a{color:#a8a8a8}nav div ul>li:nth-child(7):after{border-left-color:#93824a}div#menu-icon{display:inline-block;color:#c0b283;float:left;text-decoration:none;margin-right:1px;font-family:Verdana,Arial,Helvetica,sans-serif !important;font-weight:bold !important;font-size:14px !important}div#menu-icon:hover{background-color:#dcd0c0}span#quizzes-menu-icon{color:#a8a8a8;font-size:8px}span#sidelabelopen{display:block}span#sidelabelclosed{display:none}@media(max-width: 600px){div.side-menu{display:none}#sidelabelopen span{display:none}#sidelabelclosed span{display:block}div.breadcrumbs{display:none}div.quiz-page{top:6px}}@media(min-width: 601px){div.side-menu{display:block}#sidelabelopen span{display:block}#sidelabelclosed span{display:none}div.breadcrumbs{display:block}div.quiz-page{top:36px}}/*# sourceMappingURL=webquiz-muted.css.map */ diff --git a/macros/latex/contrib/webquiz/doc/www/css/webquiz-sleek.css b/macros/latex/contrib/webquiz/doc/www/css/webquiz-sleek.css new file mode 100644 index 0000000000..16f9a248f7 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/css/webquiz-sleek.css @@ -0,0 +1 @@ +body{color:#000;background-color:#fff}body a{color:blue}body a:hover{color:#99f}body a:visited{color:#009}div.quiz-page{position:absolute;top:36px;left:5%;min-width:60%;width:88%}div.button,span.button{background-color:#e8e8e8;border-radius:5px;color:#1a1a1a;border:solid #4682b4 2px;font-size:12px;font-weight:normal;text-align:center}span.button{padding:1px 4px 1px 4px}span.button-selected{color:#0000cd}span:hover.button-selected{color:gray}div.button:hover,span.button:hover{border:solid gray 2px !important;color:gray;text-decoration:underline}div.blank,span.blank{content:"";color:#4169e1;background:#f2f2f2}div.side-menu{float:left;font-size:10px;font-weight:normal;margin:0;overflow:hidden;width:100px;display:block;clear:left}div.side-menu>div{color:navy;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;margin-bottom:.8ex}div.side-menu ul{list-style:none;padding-left:0;padding-bottom:10px}div.side-menu ul li{color:#1a1a1a;font-size:14px;text-align:left;word-wrap:break-word}div.side-menu ul li.button-selected{color:#0000cd}div.side-menu ul li:hover.button-selected{color:gray}div.side-menu ul li:hover{text-decoration:underline}div.side-menu div.buttons{width:100%;height:100%;margin-bottom:6px;display:table}div.side-menu div.buttons div.button{display:table-cell;float:left;line-height:30px;margin-left:5px;margin-top:5px;position:relative;width:30px}div.side-menu div.buttons div.button span{color:#1a1a1a;text-decoration:none}div.side-menu div.buttons div.button:after{bottom:-35%;content:attr(content);height:100%;position:absolute;width:100%;right:-35%;clear:right}div.side-menu div.buttons div.button-selected{border:solid #0000cd 2px;color:#0000cd}div.side-menu div.buttons div.cross{content:"u2718";color:red;background:linear-gradient(to bottom right, #b1b1ec, #ccc)}div.side-menu div.buttons div.star{content:"u272D";color:#ff0;background:linear-gradient(to bottom right, #000080, aqua)}div.side-menu div.buttons div.tick{content:"u2714";color:silver;background:linear-gradient(to bottom right, aqua, #000080)}div.side-menu table.marking-key{margin-left:2px;clear:left}div.side-menu table.marking-key tbody tr td{width:2ex;padding-right:2px !important}div.side-menu table.marking-key tbody tr td.cross{font-size:medium;color:red}div.side-menu table.marking-key tbody tr td.star{font-size:small;color:#ff0}div.side-menu table.marking-key tbody tr td.tick{font-size:medium;color:silver}div.side-menu div.school{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#bcbcbc;text-align:center;padding:10px 0 0 0}div.side-menu div.school A,div.side-menu div.school A:link,div.side-menu div.school A:visited{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#bcbcbc;text-align:center;padding:10px 0 0 0}div.side-menu div.copyright{font-family:arial,verdana,helvetica;font-size:xx-small;font-weight:normal;text-align:center;color:#898989}div.side-menu div.copyright A,div.side-menu div.copyright A:link,div.side-menu div.copyright A:visited{text-decoration:none;color:#a2a2a2;font-weight:bold}div.side-menu div.copyright A span.webquizlogo,div.side-menu div.copyright A:link span.webquizlogo,div.side-menu div.copyright A:visited span.webquizlogo{font-variant:small-caps;font-weight:bold}div.question-label,span.question-label{color:#0000e6;font-variant:small-caps;font-weight:normal;font-size:smaller;margin-bottom:10px;text-align:left}span#question-label{display:none}div.quiz-questions{display:grid}div.quiz-questions div.quiz-header{padding-right:1%;width:80%}div.quiz-questions div.quiz-header div.quiz-title{color:navy;font-size:large;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-bottom:.8ex;min-width:50%}div.quiz-questions div.quiz-header span.arrows{color:#0000e6;float:right;right:5%;font-size:12px;margin-right:20px}div.quiz-questions div.quiz-header span.arrows A{text-decoration:none !important}div.quiz-questions div.quiz-header span.arrows A{color:#0000e6;font-size:12px}div.quiz-questions div.quiz-header span.arrows A:hover{color:navy;text-decoration:underline}div.quiz-questions div.quiz-index{color:navy;font-family:Arial,Helvetica,sans-serif;text-decoration:none;text-align:left}div.quiz-questions div.quiz-index ul{list-style:none !important}div.quiz-questions div.quiz-index ul li:before{content:"➣";color:navy;padding-left:0;padding-right:1ex;margin-left:-1em}div.quiz-questions div.quiz-index ul li{list-style-image:none !important;overflow:visible}div.quiz-questions div.quiz-index ul li:hover{color:#0000e6}div.quiz-questions div.question{position:relative;margin:0 0 5px 0;display:none;padding-bottom:1em}div.quiz-questions div.question form{padding:10px 0 0 0}div.quiz-questions div.question form table tr{vertical-align:top}div.quiz-questions div.question form table tr td{vertical-align:top}div.quiz-questions div.question div.question-choices{padding-left:10px;padding-right:15px;text-align:left}div.quiz-questions div.question table.question-choices td{padding-right:0;vertical-align:baseline}div.quiz-questions div.question table.question-choices td:nth-child(3n+1){padding-right:6px}div.quiz-questions div.question td.brown{color:#0000a9}div.quiz-questions div.question div.feedback{background-color:#e8e8e8;border:solid #828282 2px;border-radius:5px;display:none;padding:0 1ex 0 1ex;transition:height .66s ease-out}div.quiz-questions div.question div.feedback div{text-align:left;color:#000}div.quiz-questions div.question div.feedback ol{counter-reset:list;list-style-type:none;margin:0;padding:0 !important}div.quiz-questions div.question div.feedback ol li:before{color:#0000a9;content:counter(list, lower-latin) ") ";counter-increment:list;padding:0 0 0 0}div.quiz-questions div.question div.feedback ol li{text-align:left;color:#000;padding-right:2em}div.quiz-questions div.question div.feedback ol li em{color:#0000e6}input.input-button{color:#4169e1;background-color:#e8e8e8;border:solid #4682b4 2px;border-radius:5px;margin-right:40px;padding:0 4px 0 4px}div.warning{background-color:red;border:2px solid navy;color:#fff;padding:2mm;top:20%;left:20%;position:absolute;z-index:999}div.breadcrumbs{float:left;clear:both;display:block}nav{margin:0 auto;padding:4px 0 4px 0;height:20px;z-index:99;position:absolute;left:5%;top:10px;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:9px;font-weight:bold;min-width:600px}nav div.navleft{float:left}nav div.navright{float:right}nav div ul{margin:0;padding:0;list-style-type:none;position:absolute}nav div ul li{text-align:center;margin:0;-webkit-transition:all .2s;padding:2px 4px 2px 18px;background-color:navy;position:relative;float:left}nav div ul li a{text-decoration:none;display:contents;-webkit-transition:all .5s}nav div ul li span{color:#fff}nav div ul li ul{display:none;padding-left:4px;margin:0;-webkit-transition:all 1s;border:solid #4682b4 2px;border-radius:5px;background-color:#e8e8e8}nav div ul li ul li{width:100%;text-align:left;-webkit-transition:height .5s;padding:1px 0 0 4px}nav div ul li ul li a{color:#00008b !important}nav div ul li ul li::after{content:none}nav div ul li ul li:first-child{padding-top:2px}nav div ul li ul li:nth-child(n){background:#e8e8e8;padding-left:0}nav div ul li ul li:nth-child(n):after{border-left-color:#e8e8e8;border:7px solid}nav div ul li ul li:hover{background:#4682b4;color:red}nav div ul span{color:#fff}nav div ul li:hover{background-color:#e8e8e8}nav div ul li a{color:green}nav div ul li a:hover{color:#ff0}nav div ul>li::after{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid navy;position:absolute;top:50%;margin-top:-7px;left:100%;z-index:99}nav div ul>li::before{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #fff;position:absolute;top:50%;margin-top:-7px;margin-left:2px;left:100%;z-index:98}nav div ul>li:nth-child(1){padding-left:4px}nav div ul>li:nth-child(1){background:#a2a2a2;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(1) a{color:#fff}nav div ul>li:nth-child(1) ul li a{color:#fff}nav div ul>li:nth-child(1):after{border-left-color:#a2a2a2}nav div ul>li:nth-child(2){background:#bcbcbc;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(2) a{color:#fff}nav div ul>li:nth-child(2) ul li a{color:#fff}nav div ul>li:nth-child(2):after{border-left-color:#bcbcbc}nav div ul>li:nth-child(3){background:#d5d5d5;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(3) a{color:#fff}nav div ul>li:nth-child(3) ul li a{color:#fff}nav div ul>li:nth-child(3):after{border-left-color:#d5d5d5}nav div ul>li:nth-child(4){background:#efefef;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(4) a{color:#fff}nav div ul>li:nth-child(4) ul li a{color:#fff}nav div ul>li:nth-child(4):after{border-left-color:#efefef}nav div ul>li:nth-child(5){background:#fff;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(5) a{color:#fff}nav div ul>li:nth-child(5) ul li a{color:#fff}nav div ul>li:nth-child(5):after{border-left-color:#fff}nav div ul>li:nth-child(6){background:#fff;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(6) a{color:#fff}nav div ul>li:nth-child(6) ul li a{color:#fff}nav div ul>li:nth-child(6):after{border-left-color:#fff}nav div ul>li:nth-child(7){background:#fff;color:#fff;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(7) a{color:#fff}nav div ul>li:nth-child(7) ul li a{color:#fff}nav div ul>li:nth-child(7):after{border-left-color:#fff}div#menu-icon{display:inline-block;color:navy;float:left;text-decoration:none;margin-right:1px;font-family:Verdana,Arial,Helvetica,sans-serif !important;font-weight:bold !important;font-size:14px !important}div#menu-icon:hover{background-color:#e8e8e8}span#quizzes-menu-icon{color:#fff;font-size:8px}span#sidelabelopen{display:block}span#sidelabelclosed{display:none}@media(max-width: 600px){div.side-menu{display:none}#sidelabelopen span{display:none}#sidelabelclosed span{display:block}div.breadcrumbs{display:none}div.quiz-page{top:6px}}@media(min-width: 601px){div.side-menu{display:block}#sidelabelopen span{display:block}#sidelabelclosed span{display:none}div.breadcrumbs{display:block}div.quiz-page{top:36px}}/*# sourceMappingURL=webquiz-sleek.css.map */ diff --git a/macros/latex/contrib/webquiz/doc/www/css/webquiz-spring.css b/macros/latex/contrib/webquiz/doc/www/css/webquiz-spring.css new file mode 100644 index 0000000000..5030398ff2 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/css/webquiz-spring.css @@ -0,0 +1 @@ +body{color:#e5ee00;background-color:#2faa54}body a{color:#095c0f}body a:hover{color:#17e726}body a:visited{color:#000}div.quiz-page{position:absolute;top:36px;left:5%;min-width:60%;width:88%}div.button,span.button{background-color:#18cc44;border-radius:5px;color:#f7ff22;border:solid #185522 2px;font-size:12px;font-weight:normal;text-align:center}span.button{padding:1px 4px 1px 4px}span.button-selected{color:#084316}span:hover.button-selected{color:#0d7126}div.button:hover,span.button:hover{border:solid #0d7126 2px !important;color:#0d7126;text-decoration:underline}div.blank,span.blank{content:"";color:#185522;background:#aef9b2}div.side-menu{float:left;font-size:10px;font-weight:normal;margin:0;overflow:hidden;width:100px;display:block;clear:left}div.side-menu>div{color:#ff0;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;margin-bottom:.8ex}div.side-menu ul{list-style:none;padding-left:0;padding-bottom:10px}div.side-menu ul li{color:#f7ff22;font-size:14px;text-align:left;word-wrap:break-word}div.side-menu ul li.button-selected{color:#084316}div.side-menu ul li:hover.button-selected{color:#0d7126}div.side-menu ul li:hover{text-decoration:underline}div.side-menu div.buttons{width:100%;height:100%;margin-bottom:6px;display:table}div.side-menu div.buttons div.button{display:table-cell;float:left;line-height:30px;margin-left:5px;margin-top:5px;position:relative;width:30px}div.side-menu div.buttons div.button span{color:#f7ff22;text-decoration:none}div.side-menu div.buttons div.button:after{bottom:-35%;content:attr(content);height:100%;position:absolute;width:100%;right:-35%;clear:right}div.side-menu div.buttons div.button-selected{border:solid #084316 2px;color:#084316}div.side-menu div.buttons div.cross{content:"u2718";color:red;background:linear-gradient(to bottom right, #AEF9B2, darkgreen)}div.side-menu div.buttons div.star{content:"u272D";color:#ff0;background:linear-gradient(to bottom right, #18cc44, #048022)}div.side-menu div.buttons div.tick{content:"u2714";color:#fff;background:linear-gradient(to bottom right, darkgreen, limegreen)}div.side-menu table.marking-key{margin-left:2px;clear:left}div.side-menu table.marking-key tbody tr td{width:2ex;padding-right:2px !important}div.side-menu table.marking-key tbody tr td.cross{font-size:medium;color:red}div.side-menu table.marking-key tbody tr td.star{font-size:small;color:#ff0}div.side-menu table.marking-key tbody tr td.tick{font-size:medium;color:#fff}div.side-menu div.school{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:f0ff5c;text-align:center;padding:10px 0 0 0}div.side-menu div.school A,div.side-menu div.school A:link,div.side-menu div.school A:visited{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:f0ff5c;text-align:center;padding:10px 0 0 0}div.side-menu div.copyright{font-family:arial,verdana,helvetica;font-size:xx-small;font-weight:normal;text-align:center;color:#e6e6e6}div.side-menu div.copyright A,div.side-menu div.copyright A:link,div.side-menu div.copyright A:visited{text-decoration:none;color:#fff;font-weight:bold}div.side-menu div.copyright A span.webquizlogo,div.side-menu div.copyright A:link span.webquizlogo,div.side-menu div.copyright A:visited span.webquizlogo{font-variant:small-caps;font-weight:bold}div.question-label,span.question-label{color:#80ff00;font-variant:small-caps;font-weight:normal;font-size:smaller;margin-bottom:10px;text-align:left}span#question-label{display:none}div.quiz-questions{display:grid}div.quiz-questions div.quiz-header{padding-right:1%;width:80%}div.quiz-questions div.quiz-header div.quiz-title{color:#ff0;font-size:large;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-bottom:.8ex;min-width:50%}div.quiz-questions div.quiz-header span.arrows{color:#80ff00;float:right;right:5%;font-size:12px;margin-right:20px}div.quiz-questions div.quiz-header span.arrows A{text-decoration:none !important}div.quiz-questions div.quiz-header span.arrows A{color:#80ff00;font-size:12px}div.quiz-questions div.quiz-header span.arrows A:hover{color:#4d9900;text-decoration:underline}div.quiz-questions div.quiz-index{color:#ff0;font-family:Arial,Helvetica,sans-serif;text-decoration:none;text-align:left}div.quiz-questions div.quiz-index ul{list-style:none !important}div.quiz-questions div.quiz-index ul li:before{content:"➣";color:#ff0;padding-left:0;padding-right:1ex;margin-left:-1em}div.quiz-questions div.quiz-index ul li{list-style-image:none !important;overflow:visible}div.quiz-questions div.quiz-index ul li:hover{color:#80ff00}div.quiz-questions div.question{position:relative;margin:0 0 5px 0;display:none;padding-bottom:1em}div.quiz-questions div.question form{padding:10px 0 0 0}div.quiz-questions div.question form table tr{vertical-align:top}div.quiz-questions div.question form table tr td{vertical-align:top}div.quiz-questions div.question div.question-choices{padding-left:10px;padding-right:15px;text-align:left}div.quiz-questions div.question table.question-choices td{padding-right:0;vertical-align:baseline}div.quiz-questions div.question table.question-choices td:nth-child(3n+1){padding-right:6px}div.quiz-questions div.question td.brown{color:#ffff29}div.quiz-questions div.question div.feedback{background-color:#29964a;border:solid #007a00 2px;border-radius:5px;display:none;padding:0 1ex 0 1ex;transition:height .66s ease-out}div.quiz-questions div.question div.feedback div{text-align:left;color:#1007b1}div.quiz-questions div.question div.feedback ol{counter-reset:list;list-style-type:none;margin:0;padding:0 !important}div.quiz-questions div.question div.feedback ol li:before{color:#ffff29;content:counter(list, lower-latin) ") ";counter-increment:list;padding:0 0 0 0}div.quiz-questions div.question div.feedback ol li{text-align:left;color:#1007b1;padding-right:2em}div.quiz-questions div.question div.feedback ol li em{color:#09dd34}input.input-button{color:#185522;background-color:#18cc44;border:solid #185522 2px;border-radius:5px;margin-right:40px;padding:0 4px 0 4px}div.warning{background-color:red;border:2px solid #ff0;color:#fff;padding:2mm;top:20%;left:20%;position:absolute;z-index:999}div.breadcrumbs{float:left;clear:both;display:block}nav{margin:0 auto;padding:4px 0 4px 0;height:20px;z-index:99;position:absolute;left:5%;top:10px;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:9px;font-weight:bold;min-width:600px}nav div.navleft{float:left}nav div.navright{float:right}nav div ul{margin:0;padding:0;list-style-type:none;position:absolute}nav div ul li{text-align:center;margin:0;-webkit-transition:all .2s;padding:2px 4px 2px 18px;background-color:#ff0;position:relative;float:left}nav div ul li a{text-decoration:none;display:contents;-webkit-transition:all .5s}nav div ul li span{color:#f5f5f5}nav div ul li ul{display:none;padding-left:4px;margin:0;-webkit-transition:all 1s;border:solid #185522 2px;border-radius:5px;background-color:#18cc44}nav div ul li ul li{width:100%;text-align:left;-webkit-transition:height .5s;padding:1px 0 0 4px}nav div ul li ul li a{color:#b9f7c8 !important}nav div ul li ul li::after{content:none}nav div ul li ul li:first-child{padding-top:2px}nav div ul li ul li:nth-child(n){background:#18cc44;padding-left:0}nav div ul li ul li:nth-child(n):after{border-left-color:#18cc44;border:7px solid}nav div ul li ul li:hover{background:#185522;color:red}nav div ul span{color:#f5f5f5}nav div ul li:hover{background-color:#18cc44}nav div ul li a{color:green}nav div ul li a:hover{color:#ff0}nav div ul>li::after{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #ff0;position:absolute;top:50%;margin-top:-7px;left:100%;z-index:99}nav div ul>li::before{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #2faa54;position:absolute;top:50%;margin-top:-7px;margin-left:2px;left:100%;z-index:98}nav div ul>li:nth-child(1){padding-left:4px}nav div ul>li:nth-child(1){background:#185522;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(1) a{color:#f5f5f5}nav div ul>li:nth-child(1) ul li a{color:#f5f5f5}nav div ul>li:nth-child(1):after{border-left-color:#185522}nav div ul>li:nth-child(2){background:#1e692a;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(2) a{color:#f5f5f5}nav div ul>li:nth-child(2) ul li a{color:#f5f5f5}nav div ul>li:nth-child(2):after{border-left-color:#1e692a}nav div ul>li:nth-child(3){background:#237d32;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(3) a{color:#f5f5f5}nav div ul>li:nth-child(3) ul li a{color:#f5f5f5}nav div ul>li:nth-child(3):after{border-left-color:#237d32}nav div ul>li:nth-child(4){background:#29913a;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(4) a{color:#f5f5f5}nav div ul>li:nth-child(4) ul li a{color:#f5f5f5}nav div ul>li:nth-child(4):after{border-left-color:#29913a}nav div ul>li:nth-child(5){background:#2ea542;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(5) a{color:#f5f5f5}nav div ul>li:nth-child(5) ul li a{color:#f5f5f5}nav div ul>li:nth-child(5):after{border-left-color:#2ea542}nav div ul>li:nth-child(6){background:#34b84a;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(6) a{color:#f5f5f5}nav div ul>li:nth-child(6) ul li a{color:#f5f5f5}nav div ul>li:nth-child(6):after{border-left-color:#34b84a}nav div ul>li:nth-child(7){background:#3ec854;color:#f5f5f5;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(7) a{color:#f5f5f5}nav div ul>li:nth-child(7) ul li a{color:#f5f5f5}nav div ul>li:nth-child(7):after{border-left-color:#3ec854}div#menu-icon{display:inline-block;color:#ff0;float:left;text-decoration:none;margin-right:1px;font-family:Verdana,Arial,Helvetica,sans-serif !important;font-weight:bold !important;font-size:14px !important}div#menu-icon:hover{background-color:#18cc44}span#quizzes-menu-icon{color:#f5f5f5;font-size:8px}span#sidelabelopen{display:block}span#sidelabelclosed{display:none}@media(max-width: 600px){div.side-menu{display:none}#sidelabelopen span{display:none}#sidelabelclosed span{display:block}div.breadcrumbs{display:none}div.quiz-page{top:6px}}@media(min-width: 601px){div.side-menu{display:block}#sidelabelopen span{display:block}#sidelabelclosed span{display:none}div.breadcrumbs{display:block}div.quiz-page{top:36px}}/*# sourceMappingURL=webquiz-spring.css.map */ diff --git a/macros/latex/contrib/webquiz/doc/www/css/webquiz-vibrant.css b/macros/latex/contrib/webquiz/doc/www/css/webquiz-vibrant.css new file mode 100644 index 0000000000..cb2979a644 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/css/webquiz-vibrant.css @@ -0,0 +1 @@ +body{color:#24304e;background-color:#f9f9dd}body a{color:green}body a:hover{color:#1aff1a}body a:visited{color:#001a00}div.quiz-page{position:absolute;top:36px;left:5%;min-width:60%;width:88%}div.button,span.button{background-color:#98fb98;border-radius:5px;color:#a8d0e6;border:solid #228b22 2px;font-size:12px;font-weight:normal;text-align:center}span.button{padding:1px 4px 1px 4px}span.button-selected{color:#03bd0e}span:hover.button-selected{color:#adff2f}div.button:hover,span.button:hover{border:solid #adff2f 2px !important;color:#adff2f;text-decoration:underline}div.blank,span.blank{content:"";color:#006400;background:#fff8dc}div.side-menu{float:left;font-size:10px;font-weight:normal;margin:0;overflow:hidden;width:100px;display:block;clear:left}div.side-menu>div{color:#228b22;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;margin-bottom:.8ex}div.side-menu ul{list-style:none;padding-left:0;padding-bottom:10px}div.side-menu ul li{color:#a8d0e6;font-size:14px;text-align:left;word-wrap:break-word}div.side-menu ul li.button-selected{color:#03bd0e}div.side-menu ul li:hover.button-selected{color:#adff2f}div.side-menu ul li:hover{text-decoration:underline}div.side-menu div.buttons{width:100%;height:100%;margin-bottom:6px;display:table}div.side-menu div.buttons div.button{display:table-cell;float:left;line-height:30px;margin-left:5px;margin-top:5px;position:relative;width:30px}div.side-menu div.buttons div.button span{color:#a8d0e6;text-decoration:none}div.side-menu div.buttons div.button:after{bottom:-35%;content:attr(content);height:100%;position:absolute;width:100%;right:-35%;clear:right}div.side-menu div.buttons div.button-selected{border:solid #03bd0e 2px;color:#03bd0e}div.side-menu div.buttons div.cross{content:"u2718";color:red;background:linear-gradient(to bottom right, #ffffbf, #007e00)}div.side-menu div.buttons div.star{content:"u272D";color:#ff0;background:linear-gradient(to bottom right, #0e6655, #00fd00)}div.side-menu div.buttons div.tick{content:"u2714";color:silver;background:linear-gradient(to bottom right, #0e6655, #00fd00)}div.side-menu table.marking-key{margin-left:2px;clear:left}div.side-menu table.marking-key tbody tr td{width:2ex;padding-right:2px !important}div.side-menu table.marking-key tbody tr td.cross{font-size:medium;color:red}div.side-menu table.marking-key tbody tr td.star{font-size:small;color:#ff0}div.side-menu table.marking-key tbody tr td.tick{font-size:medium;color:silver}div.side-menu div.school{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#11806a;text-align:center;padding:10px 0 0 0}div.side-menu div.school A,div.side-menu div.school A:link,div.side-menu div.school A:visited{font-family:arial,verdana,helvetica;font-weight:normal;font-size:xx-small;color:#11806a;text-align:center;padding:10px 0 0 0}div.side-menu div.copyright{font-family:arial,verdana,helvetica;font-size:xx-small;font-weight:normal;text-align:center;color:#052620}div.side-menu div.copyright A,div.side-menu div.copyright A:link,div.side-menu div.copyright A:visited{text-decoration:none;color:#0b5345;font-weight:bold}div.side-menu div.copyright A span.webquizlogo,div.side-menu div.copyright A:link span.webquizlogo,div.side-menu div.copyright A:visited span.webquizlogo{font-variant:small-caps;font-weight:bold}div.question-label,span.question-label{color:#0aa738;font-variant:small-caps;font-weight:normal;font-size:smaller;margin-bottom:10px;text-align:left}span#question-label{display:none}div.quiz-questions{display:grid}div.quiz-questions div.quiz-header{padding-right:1%;width:80%}div.quiz-questions div.quiz-header div.quiz-title{color:#228b22;font-size:large;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-bottom:.8ex;min-width:50%}div.quiz-questions div.quiz-header span.arrows{color:#0aa738;float:right;right:5%;font-size:12px;margin-right:20px}div.quiz-questions div.quiz-header span.arrows A{text-decoration:none !important}div.quiz-questions div.quiz-header span.arrows A{color:#0aa738;font-size:12px}div.quiz-questions div.quiz-header span.arrows A:hover{color:#044718;text-decoration:underline}div.quiz-questions div.quiz-index{color:#228b22;font-family:Arial,Helvetica,sans-serif;text-decoration:none;text-align:left}div.quiz-questions div.quiz-index ul{list-style:none !important}div.quiz-questions div.quiz-index ul li:before{content:"➣";color:#228b22;padding-left:0;padding-right:1ex;margin-left:-1em}div.quiz-questions div.quiz-index ul li{list-style-image:none !important;overflow:visible}div.quiz-questions div.quiz-index ul li:hover{color:#0aa738}div.quiz-questions div.question{position:relative;margin:0 0 5px 0;display:none;padding-bottom:1em}div.quiz-questions div.question form{padding:10px 0 0 0}div.quiz-questions div.question form table tr{vertical-align:top}div.quiz-questions div.question form table tr td{vertical-align:top}div.quiz-questions div.question div.question-choices{padding-left:10px;padding-right:15px;text-align:left}div.quiz-questions div.question table.question-choices td{padding-right:0;vertical-align:baseline}div.quiz-questions div.question table.question-choices td:nth-child(3n+1){padding-right:6px}div.quiz-questions div.question td.brown{color:#06c316}div.quiz-questions div.question div.feedback{background-color:#98fb98;border:solid #006400 2px;border-radius:5px;display:none;padding:0 1ex 0 1ex;transition:height .66s ease-out}div.quiz-questions div.question div.feedback div{text-align:left;color:#0e6655}div.quiz-questions div.question div.feedback ol{counter-reset:list;list-style-type:none;margin:0;padding:0 !important}div.quiz-questions div.question div.feedback ol li:before{color:#06c316;content:counter(list, lower-latin) ") ";counter-increment:list;padding:0 0 0 0}div.quiz-questions div.question div.feedback ol li{text-align:left;color:#0e6655;padding-right:2em}div.quiz-questions div.question div.feedback ol li em{color:#007e00}input.input-button{color:#006400;background-color:#98fb98;border:solid #228b22 2px;border-radius:5px;margin-right:40px;padding:0 4px 0 4px}div.warning{background-color:#e37222;border:2px solid #228b22;color:#fff;padding:2mm;top:20%;left:20%;position:absolute;z-index:999}div.breadcrumbs{float:left;clear:both;display:block}nav{margin:0 auto;padding:4px 0 4px 0;height:20px;z-index:99;position:absolute;left:5%;top:10px;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:9px;font-weight:bold;min-width:600px}nav div.navleft{float:left}nav div.navright{float:right}nav div ul{margin:0;padding:0;list-style-type:none;position:absolute}nav div ul li{text-align:center;margin:0;-webkit-transition:all .2s;padding:2px 4px 2px 18px;background-color:#228b22;position:relative;float:left}nav div ul li a{text-decoration:none;display:contents;-webkit-transition:all .5s}nav div ul li span{color:#e2e25b}nav div ul li ul{display:none;padding-left:4px;margin:0;-webkit-transition:all 1s;border:solid #228b22 2px;border-radius:5px;background-color:#98fb98}nav div ul li ul li{width:100%;text-align:left;-webkit-transition:height .5s;padding:1px 0 0 4px}nav div ul li ul li a{color:#38a32a !important}nav div ul li ul li::after{content:none}nav div ul li ul li:first-child{padding-top:2px}nav div ul li ul li:nth-child(n){background:#98fb98;padding-left:0}nav div ul li ul li:nth-child(n):after{border-left-color:#98fb98;border:7px solid}nav div ul li ul li:hover{background:#228b22;color:red}nav div ul span{color:#e2e25b}nav div ul li:hover{background-color:#98fb98}nav div ul li a{color:green}nav div ul li a:hover{color:#ff0}nav div ul>li::after{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #228b22;position:absolute;top:50%;margin-top:-7px;left:100%;z-index:99}nav div ul>li::before{content:"";display:block;width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:14px solid #f9f9dd;position:absolute;top:50%;margin-top:-7px;margin-left:2px;left:100%;z-index:98}nav div ul>li:nth-child(1){padding-left:4px}nav div ul>li:nth-child(1){background:#006400;color:#e2e25b;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(1) a{color:#e2e25b}nav div ul>li:nth-child(1) ul li a{color:#e2e25b}nav div ul>li:nth-child(1):after{border-left-color:#006400}nav div ul>li:nth-child(2){background:#007e00;color:#e2e25b;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(2) a{color:#e2e25b}nav div ul>li:nth-child(2) ul li a{color:#e2e25b}nav div ul>li:nth-child(2):after{border-left-color:#007e00}nav div ul>li:nth-child(3){background:#009700;color:#e2e25b;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(3) a{color:#e2e25b}nav div ul>li:nth-child(3) ul li a{color:#e2e25b}nav div ul>li:nth-child(3):after{border-left-color:#009700}nav div ul>li:nth-child(4){background:#00b100;color:#e2e25b;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(4) a{color:#e2e25b}nav div ul>li:nth-child(4) ul li a{color:#e2e25b}nav div ul>li:nth-child(4):after{border-left-color:#00b100}nav div ul>li:nth-child(5){background:#00ca00;color:#e2e25b;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(5) a{color:#e2e25b}nav div ul>li:nth-child(5) ul li a{color:#e2e25b}nav div ul>li:nth-child(5):after{border-left-color:#00ca00}nav div ul>li:nth-child(6){background:#00e400;color:#e2e25b;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(6) a{color:#e2e25b}nav div ul>li:nth-child(6) ul li a{color:#e2e25b}nav div ul>li:nth-child(6):after{border-left-color:#00e400}nav div ul>li:nth-child(7){background:#00fd00;color:#e2e25b;font-family:Arial,Verdana,sans-serif !important}nav div ul>li:nth-child(7) a{color:#e2e25b}nav div ul>li:nth-child(7) ul li a{color:#e2e25b}nav div ul>li:nth-child(7):after{border-left-color:#00fd00}div#menu-icon{display:inline-block;color:#228b22;float:left;text-decoration:none;margin-right:1px;font-family:Verdana,Arial,Helvetica,sans-serif !important;font-weight:bold !important;font-size:14px !important}div#menu-icon:hover{background-color:#98fb98}span#quizzes-menu-icon{color:#e2e25b;font-size:8px}span#sidelabelopen{display:block}span#sidelabelclosed{display:none}@media(max-width: 600px){div.side-menu{display:none}#sidelabelopen span{display:none}#sidelabelclosed span{display:block}div.breadcrumbs{display:none}div.quiz-page{top:6px}}@media(min-width: 601px){div.side-menu{display:block}#sidelabelopen span{display:block}#sidelabelclosed span{display:none}div.breadcrumbs{display:block}div.quiz-page{top:36px}}/*# sourceMappingURL=webquiz-vibrant.css.map */ diff --git a/macros/latex/contrib/webquiz/doc/www/doc/webquiz-online-manual.tex b/macros/latex/contrib/webquiz/doc/www/doc/webquiz-online-manual.tex new file mode 100644 index 0000000000..ab86e3a90c --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/doc/webquiz-online-manual.tex @@ -0,0 +1,624 @@ +%----------------------------------------------------------------------------- +% Copyright (C) 2004-2019 Andrew Mathas, University of Sydney +% +% Distributed under the terms of the GNU General Public License (GPL) +% http://www.gnu.org/licenses/ +% +% This file is part of the WebQuiz system. +% +% <Andrew.Mathas@sydney.edu.au> +%----------------------------------------------------------------------------- + +%% This file is part of the WebQuiz class distribution +\PassOptionsToClass{svgnames}{xcolor} +\documentclass[svgnames]{webquiz} + +% load webquiz-doc code -- the class file loads webquiz-ini.code.tex is first +\input{webquiz-doc.code} + +% using \textcolor or \color in \WebQuiz conflicts with the code to make +% listings respect color in webquiz.cfg +\newcommand\WebQuiz{WebQuiz\xspace} + +\usepackage{pst-plot} +\usepackage{hyperref} + +\usepackage{ifpdf} +\ifpdf + \PackageError{WebQuiz}{This file must be compiled using latex not pdflatex} +\fi +\newcommand{\C}{\mathbb C} +\newcommand*{\vect}[1]{\mathbf{#1}} + +\hypersetup{pdftitle={WebQuiz online manual}} + +\title{WebQuiz: Web Quizzes using LaTeX} +\begin{document} + +\begin{discussion}[Introduction] + \WebQuiz is a \LaTeX{} package for creating \textit{interactive} + web quizzes. The idea is that you write the quiz using \LaTeX{} and that + \WebQuiz creates the web page from this file. Anything that you can + write using \LaTeX{} will be converted to \HTML by \WebQuiz. This + includes, for example, mathematics and graphics written using + \ctan{pstricks}. \WebQuiz supports three different types of quiz + questions: + + \begin{enumerate} + \item Multiple choice questions with a \emph{unique} correct answer. + (See \qref{question1}) + \item Multiple choice questions with \emph{several} (or no) + correct answers. + (See \qref{question2}) + \item Questions that require the student to enter an answer, which + can then be compared with the correct answer in several different + ways. (See \qref{question3}) + \end{enumerate} +The use of \WebQuiz is described in the next section. Later +sections describe how each of the \WebQuiz environments are used. + +The \LatexCode|discussion| environment in \WebQuiz can also be used to +write Web Pages like this one (The pages you are reading here were +written using \WebQuiz.) +\end{discussion} +\begin{discussion}[Basic Usage] +Once you have a \WebQuiz file, you can run it through \LaTeX, in +the usual way, to produce a readable version of your quiz. When you +are happy with the quiz, use \WebQuiz to create the HTML +version. Note that the printable version of the quiz does \emph{not} +look like the web page; rather, it contains all of the information in +an easily readable layout. + + If, for example, your quiz file is called \emph{quiz1.tex} then you + can use the following commands: +\begin{latexcode} + > latex quiz1 % latex a quiz file + > pdflatex quiz1 % a PDF versio of the quiz + > xdvi quiz1 % view the quiz using xdvi + > dvips quiz1 % print the quiz + > webquiz quiz1 % converts the quiz to html +\end{latexcode} + Converting the quiz to html can take quite a long time, particularly + if a large number of images need to be created. + +\end{discussion} +\begin{discussion}[WebQuiz files] + + The basic structure of a \WebQuiz file is as follows: +\begin{latexcode} + \documentclass{webquiz} + + \title{Quiz 1: Complex numbers} + + \UnitCode{MATH1001} + \UnitName{Differential Calculus} + \UnitURL{/u/UG/JM/MATH1001/} + \QuizzesURL{/u/UG/JM/MATH1001/Quizzes/} + + \begin{document} + + \begin{discussion}[short heading][optional heading] + . . . % optional discussion + \end{discussion} + + \begin{question} % question 1 + . . . + \end{question} + + \begin{question} % question 2 + . . . + \end{question} + . + . + \end{document} +\end{latexcode} + In the preamble of the \LaTeX{} file you can specify the unit code, the + name of the unit of study, the location of the homepage for the + unit and the index file for the quizzes for this unit; this is + done using the commands + \LatexCode|\UnitCode|, + \LatexCode|\UnitName|, + \LatexCode|\UnitURL| and + \LatexCode|\QuizzesURL| respectively. If the + command \LatexCode|\QuizzesURL| is omitted then the URL for the quiz + index file is set to \LatexCode|\UnitURL/|Quizzes. + + The title of the quiz can be set in the preamble using the + \LatexCode|\title| command. Note that the \LatexCode|\title| + command \emph{must} appear before the \LatexCode|\begin{document}| command. + As in any \LaTeX{} document, the preamble can define macros and load + other \LaTeX{} packages the usual way . + + By using the \LatexCode|discussion| environment you can summarise the + material for the students or add introductory material for the quiz. + For example, \LatexCode|discussion| environments can be used to recall + that main concepts being covered by the quiz or to give references to + the lecture notes for the unit. The syntax for the + \LatexCode|discussion| environment is as follows: +\begin{latexcode} + \begin{discussion}[optional short heading][optional heading] + . . . + \end{discussion} +\end{latexcode} + Anything you like (text, mathematics, \ldots) can go inside + discussion environments. The \emph{optional heading}, which defaults + to Discussion'', is used both as + the section heading on the web page and as the heading in the + side-menu on left hand side of the page. If a \textit{short heading} + is also given then it is used in the side-menu. The quiz can contain + zero or more discussion items ( and zero or more quiz questions). + + Questions are set inside a \LatexCode|question| environment. The text is + followed by the answers. + + \WebQuiz supports three types of questions: + \begin{itemize} + \item Multiple choice questions with \emph{precisely one} correct + answer; + \item Multiple choice questions with \emph{zero or more } correct + answers; + \item Questions that require the students to enter an answer. Five + difference comparison methods are available. + \end{itemize} + With each of these types of questions you can (and should) provide + feedback to the students depending on whether their answer is + correct or incorrect. Below we describe how to produce these + different types of questions. +\end{discussion} +\begin{discussion}[Question 1] + The syntax for a multiple choice question having \emph{precisely + one} correct answer is as follows: +\begin{latexcode} + \begin{question} + . . .question text + \begin{choice} + \(in)correct . . . text for (in)correct option + \feedback . . . feedback on response + + \(in)correct . . . text for (in)correct option + \feedback . . . feedback on response + . + . + . + \end{choice} + \end{question} +\end{latexcode} + The different choices in a multiple choice question must be inside a + \LatexCode|choice| environment. This environment behaves like a + standard \LaTeX{} list environment except that instead of using + \LatexCode|\item| for list item you use: + \begin{itemize} + \item \LatexCode|\correct| for a correct choice + \item \LatexCode|\incorrect| for an incorrect choice + \item \LatexCode|\feedback| to give feedback to the student when + they select this choice + \end{itemize} + At most one \LatexCode|\feedback| response should be given for each + \LatexCode|\correct| and each \LatexCode|\incorrect| response. + The \LatexCode|\feedback| commands are optional; however, it is + recommended that you use them because targeted feedback to the + students based on their responses can be beneficial. + \par + For example, the code below, when run through \WebQuiz, produces \qref{question1} + in the online manual quiz. +\begin{latexcode} + \begin{question} + The shaded region in the graph + \begin{center} + \begin{pspicture}(-3,-1.5)(3,4) + \pscircle[linewidth=1pt,linestyle=dashed,% + fillcolor=SkyBlue,fillstyle=solid](1,1){2} + \psaxes[linecolor=red,linewidth=1pt,labels=none]% + {->}(0,0)(-1.5,-1.5)(3.5,3.5) + \rput(3.75,0){$x$} + \rput(0,3.85){$iy$} + \rput(3,-0.4){3} + \rput(-0.4,3){3$i$} + \psdots(1,1) + \end{pspicture} + \end{center} + is equal to which of the following sets of complex numbers? + \begin{choice} + \incorrect $\{z \in \C : (z-1)^{2}+(z-(i+1))^{2}<2\}$ + \feedback The equation of a circle in the complex plane with + centre $a+ib$ and radius $r$ is + \begin{displaymath} + \{z\in\C : |z-(a+ib)|<r \}. + \end{displaymath} + + \incorrect $\{z \in \C : z+(i+1)<2\}$ + \feedback You want the set of points whose \textit{distance} + from $1+i$ is less than $2$. + + \correct $\{z \in \C : |z-(i+1)|<2\}$ + \feedback The graph shows the set of complex numbers whose + distance from $1+i$ is less than $2$. + + \incorrect $\{z \in \C : |z-2|<|i+1-2|\}$ + \feedback As $|i+1-2|=\sqrt 2$, this is the set of complex + numbers whose distance from $2$ is less than + $\sqrt 2$. + + \incorrect None of the above. + \feedback The graph shows the set of complex numbers whose + distance from the centre of the circle is less than $2$. + \end{choice} + \end{question} +\end{latexcode} +\end{discussion} +\begin{discussion}[Question 2] + To allow multiple (or no) correct answer we add \LatexCode|multiple| as an + optional argument to the \LatexCode|choice| environment: +\begin{latexcode} + \begin{question} + . . .question text. . . + \begin{choice}[multiple] + \(in)correct . . . text for (in)correct option + \feedback . . . feedback on response + + \(in)correct . . . text for (in)correct option + \feedback . . . feedback on response + . + . + . + \end{choice} + \end{question} +\end{latexcode} + The only difference to the previous case is that zero or more + \LatexCode|\correct| commands can appear. + \par + For example, \qref{question2} below was typed into \WebQuiz + using the following commands: +\begin{latexcode} + \begin{question} + Which of the following numbers are prime? + \begin{choice}[multiple] + \incorrect 1 + \feedback By definition, a prime is a number greater than 1 + whose only factors are 1 and itself. + + \correct 19 + \feedback The only factors of 19 are 1 and itself. + + \incorrect 6 + \feedback 2 is a factor of 6 + + \correct 23 + \feedback The only factors of 23 are 1 and itself. + + \correct 191 + \feedback The only factors of 191 are 1 and itself. + \end{choice} + \end{question} +\end{latexcode} +\end{discussion} +\begin{discussion}[Question 3] + + By default, the \LatexCode|choice| environments puts the multiple + choice options into one column format. Sometimes the options look + better when listed in two or more columns, however, this should be + used sparingly as multiple columns do not always display well if the + quiz is viewed on a mobile device. By using the \LatexCode|columns| + key word in a \LatexCode|choice| environment you can specify the + number of columns in the HTML version of the quiz. + +\begin{latexcode} + \begin{question} + . . .question text. . . + \begin{choice}[multiple, columns=n] . . . n columns + \(in)correct . . . text for (in)correct option + \feedback . . . feedback on response + + \(in)correct . . . text for (in)correct option + \feedback . . . feedback on response + . + . + . + \end{choice} + \end{question} +\end{latexcode} + If the optional argument \LatexCode|[multiple]| is not present, then the + question admits precisely one correct answer. + \par + For example, \qref{question3} below was typed into \WebQuiz + using the following commands: +\begin{latexcode} + \begin{question} + What are suitable parametric equations for this plane curve? + \begin{center} + \psset{unit=.6cm} + \begin{pspicture}(-2.5,-0.5)(5,5.5) + \psaxes[linecolor=red,linewidth=1pt,labels=none]% + {->}(0,0)(-2.5,-1.5)(5,5) + \psellipse[linecolor=SkyBlue,linewidth=2pt](1,2)(3,2) + \end{pspicture} + \end{center} + + \begin{choice}[columns=1] + \incorrect $x=2\cos t + 1$, $y=3\sin t + 2$ + \feedback This is an ellipse with centre $(1,2)$ and with axes of + length $4$ in the $x$-direction and $6$ in the $y$-direction. + \begin{center} + \psset{unit=.6cm} + \begin{pspicture}(-2.5,-0.5)(5,5.5) + \psaxes[linecolor=red,linewidth=1pt,labels=none]% + {->}(0,0)(-2.5,-1.5)(5,5) + \parametricplot[linecolor=SkyBlue,linewidth=2pt]{0}{360}% + {t cos 2 mul 1 add t sin 3 mul 2 add} + \end{pspicture} + \end{center} + + \correct $x=3\cos t + 1$, $y=2\sin t + 2$ + \feedback The curve is an ellipse centre (1,2) with axes length 6 + in the $x$ direction and 4 in the $y$ direction. + + \incorrect $x=3\cos t - 1$, $y=2\sin t - 2$ + \feedback This is an ellipse with centre $(-1,-2)$ and with axes + of length $6$ in the $x$-direction and $4$ in the $y$-direction. + \begin{center} + \psset{unit=.6cm} + \begin{pspicture}(-5,-4)(1,2) + \psaxes[linecolor=red,linewidth=1pt,labels=none]% + {<-}(0,0)(-4.5,-5.5)(1,2) + \parametricplot[linecolor=SkyBlue,linewidth=2pt]{0}{360}% + {t cos 3 mul 1 sub t sin 2 mul 2 sub} + \end{pspicture} + \end{center} + + \incorrect $x=2\cos t - 1$, $y=3\sin t - 2$ + \feedback This is an ellipse with centre $(-1,-2)$ and with axes + of length $4$ in the $x$-direction and $6$ in the $y$-direction. + \begin{center} + \psset{unit=.6cm} + \begin{pspicture}(-4,-5)(1,2) + \psaxes[linecolor=red,linewidth=1pt,labels=none]% + {<-}(0,0)(-4.5,-5.5)(1,2) + \parametricplot[linecolor=SkyBlue,linewidth=2pt]{0}{360}% + { t cos 2 mul 1 sub t sin 3 mul 2 sub} + \end{pspicture} + \end{center} + \end{choice} + \end{question} +\end{latexcode} +\end{discussion} +\begin{discussion}[Question 4] + The final type of question that \WebQuiz supports is a question that + requires an answer, which can be a number or a string. The answer is + typeset using the \LatexCode|\answer| macro. The \LatexCode|\answer| + macro takes two arguments: an optional comparison method, which + defaults to \LatexCode|string|, and the correct answer for the + question: + \begin{latexcode} + \answer[comparison method]{correct answer} + \end{latexcode} + Feedback for correct and incorrect answers is given + using the macros \LatexCode|\whenRight| and \LatexCode|\whenWrong|, + respectively. The structure of questions with \LatexCode|\answer|'s is as follows: + \begin{latexcode} + \begin{question} + . . .question text. . . + \answer[*][complex|integer|lowercase|number|string]{actual answer} + \whenRight . . . feedback when right (optional) + \whenWrong . . . feedback when wrong (optional) + \end{question} + \end{latexcode} + See the \WebQuiz manual for details of the different + comparison types. For example, \qref{question4} below was typed into + \WebQuiz using the following commands: +\begin{latexcode} + \begin{question} + If the vectors $\vect{a}$ (of magnitude 8 units) and $\vect{b}$ + (of magnitude 3 units) are perpendicular, what is the value + of + \begin{displaymath} + |\vect{a} -2\vect{b}|~? + \end{displaymath} + (Hint: Draw a diagram!) + + \answer[number]{10} + \whenRight The vectors $\vect{a}$, \(-2\vect{b}\), and + $\vect{a} - 2\vect{b}$ form the sides of a right-angled + triangle, with sides of length $8$ and $6$ and + hypotenuse of length $|\vect{a} -2\vect{b}|$. Therefore + by Pythagoras' Theorem, + \(|\vect{a} -2\vect{b}|=\sqrt{8^2+6^2}=10\). + + \whenWrong Draw a diagram and then use Pythagoras' theorem. + \end{question} +\end{latexcode} +\end{discussion} +\begin{discussion}[Index Files] + \WebQuiz also provides a mechanism for creating a web page + containing an index of all quizzes for a given Unit of Study. + This is done with a \WebQuiz file that contains a \LatexCode|quizindex| + environment. The syntax for this environment is as follows: +\begin{latexcode} + \begin{quizindex} + \quiz[url1]{title for quiz 1} + \quiz[url2]{title for quiz 2} + . . . + \end{quizindex} +\end{latexcode} +If no \textit{URL} is given as an optional argument to +\LatexCode|\quiz| then + \WebQuiz sets the url(s) to \BashCode|quiz1.html|, \BashCode|quiz2.html| + and so on. +\end{discussion} + +\begin{discussion}[Credits] + \WebQuiz was written and developed in the + \href{http://www.maths.usyd.edu.au/}{School of Mathematics and + Statistics} at the \href{http://www.usyd.edu.au/}{University of + Sydney}. The system is built on \LaTeX{} with the conversion from + \LaTeX{} to HTML using Eitan Gurari's + \href{http://www.cis.ohio-state.edu/~gurari/TeX4ht/mn.html}{TeX4ht}, + and Michal Hoftich's + \href{https://github.com/michal-h21/make4ht}{make4ht}. + + To write quizzes using \WebQuiz it is only necessary to know + \LaTeX, however, the \WebQuiz system has three components: + \begin{itemize} + \item A \LaTeX{} document class file, \LatexCode{webquiz.cls}, and + a \TeXfht configuration file, \LatexCode{webquitexz.cfg}, that enable the + quiz files to be processed by \LaTeX{} and \TeXfht, respectively. + \item A python program, \BashCode{webquiz}, that translates the \XML + file that is produced by \TeXfht into \HTML. + \item Some \Javascript and \CSS that controls the quiz web page. + \end{itemize} + + The \LaTeX{} component of \WebQuiz was written by Andrew Mathas and + the python, \CSS and \Javascript code was written by Andrew Mathas (and + Don Taylor), based on an initial prototype of Don Taylor's from 2001. + Since 2004 the program has been maintained and developed by Andrew + Mathas. Although the program has changed substantially since 2004, + Don's idea of using \TeXfht, and some of his code, is still in use. + + Thanks are due to Bob Howlett for general help with CSS and, for + Version~5, to Michal Hoftich for technical advice. +\end{discussion} + +\begin{question} + \label{question1} + The shaded region in the graph + \begin{center} + \begin{pspicture}(-3,-1.5)(3,4) + \pscircle[linewidth=1pt,linestyle=dashed,fillcolor=SkyBlue,fillstyle=solid](1,1){2} + \psaxes[linecolor=red,linewidth=1pt,labels=none]% + {->}(0,0)(-1.5,-1.5)(3.5,3.5) + \rput(3.75,0){$x$} + \rput(0,3.85){$iy$} + \rput(3,-0.4){3} + \rput(-0.4,3){3$i$} + \psdots(1,1) + \end{pspicture} + \end{center} + is equal to which of the following sets of complex numbers? + \begin{choice} + \incorrect $\{z \in \C : (z-1)^{2}+(z-(i+1))^{2}<2\}$ + \feedback The equation of a circle in the complex plane with + centre $a+ib$ and radius $r$ is + \begin{displaymath} + \{z\in\C : |z-(a+ib)|<r \}. + \end{displaymath} + + \incorrect $\{z \in \C : z+(i+1)<2\}$ + \feedback You want the set of points whose \textit{distance} + from $1+i$ is less than $2$. + + \correct $\{z \in \C : |z-(i+1)|<2\}$ + \feedback The graph shows the set of complex numbers whose + distance from $1+i$ is less than $2$. + + \incorrect $\{z \in \C : |z-2|<|i+1-2|\}$ + \feedback As $|i+1-2|=\sqrt 2$, this is the set of complex + numbers whose distance from $2$ is less than + $\sqrt 2$. + + \incorrect None of the above. + \feedback The graph shows the set of complex numbers whose + distance from the centre of the circle is less than $2$. + \end{choice} +\end{question} + +\begin{question} + \label{question2} + Which of the following numbers are prime? + \begin{choice}[multiple] + \incorrect 1 + \feedback By definition, a prime is a number greater than 1 + whose only factors are 1 and itself. + + \correct 19 + \feedback The only factors of 19 are 1 and itself. + + \incorrect 6 + \feedback 2 is a factor of 6 + + \correct 23 + \feedback The only factors of 23 are 1 and itself. + + \correct 191 + \feedback The only factors of 191 are 1 and itself. + \end{choice} +\end{question} + +\begin{question} + \label{question3} + What are suitable parametric equations for this plane curve? + \begin{center} + \psset{unit=.6cm} + \begin{pspicture}(-2.5,-0.5)(5,5.5) + \psaxes[linecolor=red,linewidth=1pt,labels=none]% + {->}(0,0)(-2.5,-1.5)(5,5) + \psellipse[linecolor=SkyBlue,linewidth=2pt](1,2)(3,2) + \end{pspicture} + \end{center} + + \begin{choice}[columns=1] + \incorrect $x=2\cos t + 1$, $y=3\sin t + 2$ + \feedback This is an ellipse with centre $(1,2)$ and with axes of + length $4$ in the $x$-direction and $6$ in the $y$-direction. + \begin{center} + \psset{unit=.6cm} + \begin{pspicture}(-2.5,-0.5)(5,5.5) + \psaxes[linecolor=red,linewidth=1pt,labels=none]% + {->}(0,0)(-2.5,-1.5)(5,5) + \parametricplot[linecolor=SkyBlue,linewidth=2pt]{0}{360}% + {t cos 2 mul 1 add t sin 3 mul 2 add} + \end{pspicture} + \end{center} + + \correct $x=3\cos t + 1$, $y=2\sin t + 2$ + \feedback The curve is an ellipse centre (1,2) with axes length 6 + in the $x$ direction and 4 in the $y$ direction. + + \incorrect $x=3\cos t - 1$, $y=2\sin t - 2$ + \feedback This is an ellipse with centre $(-1,-2)$ and with axes + of length $6$ in the $x$-direction and $4$ in the $y$-direction. + \begin{center} + \psset{unit=.6cm} + \begin{pspicture}(-5,-4)(1,2) + \psaxes[linecolor=red,linewidth=1pt,labels=none]% + {<-}(0,0)(-4.5,-5.5)(1,2) + \parametricplot[linecolor=SkyBlue,linewidth=2pt]{0}{360}% + {t cos 3 mul 1 sub t sin 2 mul 2 sub} + \end{pspicture} + \end{center} + + \incorrect $x=2\cos t - 1$, $y=3\sin t - 2$ + \feedback This is an ellipse with centre $(-1,-2)$ and with axes + of length $4$ in the $x$-direction and $6$ in the $y$-direction. + \begin{center} + \psset{unit=.6cm} + \begin{pspicture}(-4,-5)(1,2) + \psaxes[linecolor=red,linewidth=1pt,labels=none]% + {<-}(0,0)(-4.5,-5.5)(1,2) + \parametricplot[linecolor=SkyBlue,linewidth=2pt]{0}{360}% + { t cos 2 mul 1 sub t sin 3 mul 2 sub} + \end{pspicture} + \end{center} + \end{choice} +\end{question} + +\begin{question} + \label{question4} + If the vectors $\vect{a}$ (of magnitude 8 units) and $\vect{b}$ + (of magnitude 3 units) are perpendicular, what is the value + of + \(|\vect{a} -2\vect{b}|\)~? + (Hint: Draw a diagram!) + + \answer[number]{10} units + \whenRight The vectors $\vect{a}$, \(-2\vect{b}\), and + $\vect{a} - 2\vect{b}$ form the sides of a right-angled + triangle, with sides of length $8$ and $6$ and + hypotenuse of length $|\vect{a} -2\vect{b}|$. Therefore + by Pythagoras' Theorem, + \(|\vect{a} -2\vect{b}|=\sqrt{8^2+6^2}=10\). + + \whenWrong Draw a diagram and then use Pythagoras' theorem. +\end{question} +\end{document} +\endinput + +%% End of file `webquiz-manual.tex'. diff --git a/macros/latex/contrib/webquiz/doc/www/js/webquiz.js b/macros/latex/contrib/webquiz/doc/www/js/webquiz.js new file mode 100644 index 0000000000..f919a1c672 --- /dev/null +++ b/macros/latex/contrib/webquiz/doc/www/js/webquiz.js @@ -0,0 +1 @@ +var currentB,currentQ,dTotal,quizindex_menu,qTotal,side_closed,side_menu,side_open,correct=[],buttonOrder=[],questionOrder=[],wrongAnswers=[],currentFeedback=null,QuizSpecifications=[],Discussion=[],onePage=!1,QuizTitles=[],blank={content:"",name:"blank"},cross={content:"✘",name:"cross"},star={content:"✭",name:"star"},tick={content:"✔",name:"tick"};function markAnswer(){"undefined"!=typeof Storage&&(sessionStorage.correct=JSON.stringify(correct),sessionStorage.wrongAnswers=JSON.stringify(wrongAnswers))}var quizindex_menu_not_created=!0;function create_quizindex_menu(){if(quizindex_menu_not_created){document.getElementById("quizzes-menu-icon").innerHTML=" ☰";var q,quiz_link,max=0,menu=document.createDocumentFragment();for(q=0;q<QuizTitles.length;q++)(quiz_link=document.createElement("li")).innerHTML='<a href="'+QuizTitles[q][1]+'">'+QuizTitles[q][0]+"</a>",menu.appendChild(quiz_link),max=Math.max(max,QuizTitles[q][0].length);quizindex_menu.style.width=Math.round(max)+"ex",quizindex_menu.appendChild(menu),quizindex_menu_not_created=!1}}function MenuEventListener(evnt){var menu_icon=document.getElementById("quzzes-menu-icon");quizindex_menu.contains(evnt.target)||("block"===quizindex_menu.style.display||menu_icon.contains(evnt.target))&&(evnt.stopPropagation(),toggle_quizindex_menu())}function toggle_quizindex_menu(){"block"===quizindex_menu.style.display?quizindex_menu.style.display="none":(quizindex_menu.style.display="block",window.addEventListener("click",MenuEventListener,!0))}function toggle_side_menu(){"block"===side_menu.style.display||""===side_menu.style.display?(side_menu.style.display="none",side_open.style.display="none",side_closed.style.display="block"):(side_menu.style.display="block",side_open.style.display="block",side_closed.style.display="none")}function showQuestion(newB,newQ){onePage||(newQ!=currentQ&&0!=currentQ&&(hideFeedback(),document.getElementById("question"+currentQ).style.display="none",currentB.classList.remove("button-selected")),document.getElementById("question"+newQ).style.display="table",document.getElementById("question-number").innerHTML=0<newQ?(document.getElementById("question-label").style.display="contents",String(newB)):(document.getElementById("question-label").style.display="none",Discussion[-newQ]),(currentB=document.getElementById("button"+newB)).classList.add("button-selected")),currentQ=newQ}function hideFeedback(){currentFeedback&&(currentFeedback.style.display="none")}function showFeedback(tag){hideFeedback(),(currentFeedback=document.getElementById(tag)).style.display="block"}function nextQuestion(increment){if(currentQ<0)gotoQuestion(1===increment?1:qTotal);else{for(var q,b=buttonOrder[currentQ];0===(b+=increment)?b=qTotal:qTotal<b&&(b=1),(q=questionOrder[b])!==currentQ&&correct[q];);b===currentB?alert("There are no more unanswered questions"):gotoQuestion(b)}}var buttons=["blank","cross","star","tick"];function updateQuestionMarker(bnum,qnum){if(0<qnum){var marker,button=document.getElementById("button"+bnum);marker=correct[qnum]?0===wrongAnswers[qnum]?star:tick:0<wrongAnswers[qnum]?cross:blank;for(var b=0;b<buttons.length;b++)button.classList.remove(buttons[b]);button.classList.add(marker.name),button.setAttribute("content",marker.content)}}function gotoQuestion(bnum){var qnum=0<bnum?questionOrder[bnum]:bnum;gotoQuestionHelper(qnum),history.pushState(qnum,null,null)}function gotoQuestionHelper(qnum){var bnum=0<qnum?buttonOrder[qnum]:qnum;updateQuestionMarker(bnum,qnum),showQuestion(bnum,qnum)}var compare={complex:function(ans,val){var a=math.complex(ans),b=math.complex(val);return a.re==b.re&&a.im==b.im},integer:function(ans,val){return parseInt(val)==parseInt(ans)},lowercase:function(ans,val){return val==String(ans).toLowerCase()},number:function(ans,val){return math.eval(val)==math.eval(ans)},string:function(ans,val){return val==String(ans)}};function checkAnswer(qnum){var i,question=QuizSpecifications[qnum],studentAnswer=document.forms["Q"+qnum+"Form"];if("input"==question.type){var answer=studentAnswer.elements[0].value;if(""==answer)return void alert("Please answer the question first!");try{correct[qnum]=compare[question.comparison](answer,question.value)}catch(err){correct[qnum]=False}correct[qnum]?showFeedback("q"+qnum+"true"):showFeedback("q"+qnum+"false")}else if("single"==question.type){var checkedAnswer=0;for(i=0;i<question.length;i++)if(studentAnswer.elements[i].checked){correct[qnum]=question[i],checkedAnswer=i+1;break}showFeedback("q"+qnum+"feedback"+checkedAnswer)}else{var badAnswers=[];for(i=0;i<question.length;i++)if(studentAnswer.elements[i].checked!==question[i]){badAnswers.push(i+1);break}0===badAnswers.length?(correct[qnum]=!0,showFeedback("q"+qnum+"feedback0")):(correct[qnum]=!1,showFeedback("q"+qnum+"feedback"+badAnswers[Math.floor(Math.random()*badAnswers.length)]))}correct[qnum]||(wrongAnswers[qnum]+=1),updateQuestionMarker(buttonOrder[qnum],qnum),markAnswer()}function shuffleQuestions(){var i,j,qi;for(i=questionOrder.length-1;0<i;i--)j=1+Math.floor(Math.random()*i),qi=questionOrder[i],questionOrder[i]=questionOrder[j],questionOrder[j]=qi;for(i=buttonOrder.length-1;0<i;i--)buttonOrder[questionOrder[i]]=i}function initSession(){for("undefined"!=typeof Storage&&(sessionStorage.correct&&(correct=JSON.parse(sessionStorage.correct)),sessionStorage.wrongAnswers&&(wrongAnswers=JSON.parse(sessionStorage.wrongAnswers))),i=0;i<qTotal+1;i++)updateQuestionMarker(buttonOrder[i],i);qnum=0<dTotal?-1:questionOrder[1],history.replaceState(qnum,null,null)}function WebQuizInit(questions,discussions,quizfile){window.addEventListener("popstate",function(e){gotoQuestionHelper(e.state)}),dTotal=discussions,0==(qTotal=questions)&&(document.getElementsByClassName("arrows")[0].style.display="none");var i;currentQ=currentB=0;for(i=0;i<qTotal+1;i++)wrongAnswers[i]=0,correct[i]=!1,questionOrder[i]=i,buttonOrder[i]=i;var script=document.createElement("script");script.src=quizfile+"/wq-"+quizfile+".js",script.type="text/javascript",document.head.appendChild(script),side_menu=document.getElementById("sidemenu"),side_open=document.getElementById("sidelabelopen"),side_closed=document.getElementById("sidelabelclosed"),quizindex_menu=document.getElementById("quizindex-menu"),0<QuizTitles.length&&quizindex_menu&&create_quizindex_menu()}
\ No newline at end of file diff --git a/macros/latex/contrib/webquiz/latex/pgfsys-dvisvgm4ht.def b/macros/latex/contrib/webquiz/latex/pgfsys-dvisvgm4ht.def new file mode 100644 index 0000000000..6bcb89dab0 --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/pgfsys-dvisvgm4ht.def @@ -0,0 +1,92 @@ +% Copyright 2006 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +% Modifications by Michal Hoftich +% https://github.com/michal-h21/dvisvgm4ht + +% Driver commands for tex4ht + +% +% Load common pdf commands: +% + %\input pgfsys-dvisvgm.def + \input pgfsys-dvips.def + +% +% tex4ht-specific stuff: +% + +\newcount\pgf@sys@svg@picnum + +% configure the output picture format to svg +\AtBeginDocument{ + \Configure{Picture}{.svg} +} + + +% Make the code inserted by tex4ht configurable + +\NewConfigure{tikzpicture}{2} +\Configure{tikzpicture}{% + % \ifvmode\IgnorePar\fi\EndP%\HtmlParOff + \Picture*{} +}{\EndPicture} + +\let\orig@pgfsys@begin\pgfsys@beginpicture +\let\orig@pgfsys@end\pgfsys@endpicture +\def\pgf@sys@postscript@header#1{{\special{! #1}}} +\def\pgfsys@beginpicture{% + \bgroup + \csname a:tikzpicture\endcsname + \pgf@sys@postscript@header{ + /pgfsc{}bind def% stroke color is empty by default + /pgffc{}bind def% fill color is empty by default + /pgfstr{stroke}bind def% + /pgffill{fill}bind def% + /pgfeofill{eofill}bind def% + /pgfe{a dup 0 rlineto exch 0 exch rlineto neg 0 rlineto closepath}bind def% rectangle + /pgfw{setlinewidth}bind def% setlinewidth + /pgfs{save pgfpd 72 Resolution div 72 VResolution div neg scale + magscale{1 DVImag div dup scale}if + pgfx neg pgfy neg translate pgffoa .setopacityalpha}bind def% save + /pgfr{pgfsd restore}bind def %restore + userdict begin% + /pgfo{pgfsd /pgfx currentpoint /pgfy exch def def @beginspecial}bind def %open + /pgfc{newpath @endspecial pgfpd}bind def %close + /pgfsd{globaldict /pgfdelta /delta where {pop delta} {0} ifelse put}bind def% save delta + /pgfpd{/delta globaldict /pgfdelta get def}bind def % put delta + /.setopacityalpha where {pop} {/.setopacityalpha{pop}def} ifelse % install .setopacityalpha + /.pgfsetfillopacityalpha{/pgffoa exch def + /pgffill{gsave pgffoa .setopacityalpha fill 1 .setopacityalpha newpath fill grestore newpath}bind def + /pgfeofill{gsave pgffoa .setopacityalpha eofill 1 .setopacityalpha newpath eofill grestore newpath}bind def}bind def + /.pgfsetstrokeopacityalpha{/pgfsoa exch def /pgfstr{gsave pgfsoa .setopacityalpha stroke grestore newpath}bind def}bind def + /pgffoa 1 def + /pgfsoa 1 def + end + }% + \orig@pgfsys@begin% +}% + + +\def\pgfsys@endpicture{% + % Save the bounding box + %\printdim% + \orig@pgfsys@end% + \csname b:tikzpicture\endcsname% + \egroup + \par% FIXME : was '\Par' but that seems to be undefined!? +}% + + +\endinput + + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/macros/latex/contrib/webquiz/latex/webquiz-czech.lang b/macros/latex/contrib/webquiz/latex/webquiz-czech.lang new file mode 100644 index 0000000000..a7d4a752b7 --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-czech.lang @@ -0,0 +1,20 @@ +answer = Odpovědět +check answer = Zkontrolujte odpově +choice = Volba {} je +correct = Správné! +false = falešná +incorrect = Nesprávné! +multiple incorrect = Například volba {} by měla být +next question = Další otázka +next question = Další nezodpovězená otázka +one mistake = Existuje alespoň jedna chyba. +previous question = Předchozí nezodpovězená otázka +question = Otázka +questions = Otázky +quiz = Kvíz +quizzes = Kvízy +side menu cross = nesprávná +side menu star = pravý první pokus +side menu tick = správné +true = pravda +try again = Zkuste to znovu diff --git a/macros/latex/contrib/webquiz/latex/webquiz-doc.code.tex b/macros/latex/contrib/webquiz/latex/webquiz-doc.code.tex new file mode 100644 index 0000000000..2a078b8bdb --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-doc.code.tex @@ -0,0 +1,195 @@ +%----------------------------------------------------------------------------- +% Copyright (C) 2004-2019 Andrew Mathas, University of Sydney +% +% Distributed under the terms of the GNU General Public License (GPL) +% http://www.gnu.org/licenses/ +% +% This file is part of the WebQuiz system. +% +% <Andrew.Mathas@sydney.edu.au> +%----------------------------------------------------------------------------- + +% common latex code in the documentation files +\RequirePackage{cmap} % fix search and cut-and-paste in Acrobat + +\RequirePackage[utf8]{inputenc} +\RequirePackage[T1]{fontenc} + +\RequirePackage{enumitem} +\setlist[itemize]{nosep} +\setlist[description]{ + font=\sffamily\bfseries\color{DodgerBlue}, + labelwidth=\textwidth +} + +\RequirePackage{graphicx} + +\RequirePackage{xspace} +\RequirePackage[svgnames]{xcolor} + +\usepackage{hologo} +\newcommand\TeXfht{\href{https://www.ctan.org/tex4ht}{\hologo{TeX4ht}}\xspace} + +\NewDocumentCommand\ctan{ O{pkg/#2} m}{\href{https://www.ctan.org/#1}{\texttt{#2}}\xspace} + +\newcommand\HTML{\href{https://www.w3schools.com/html/html_intro.asp}{HTML}\xspace} +\newcommand\CSS{\href{https://www.w3schools.com/css}{CSS}\xspace} +\newcommand\XML{\href{https://www.w3schools.com/xml/xml_whatis.asp}{XML}\xspace} +\newcommand\Javascript{\href{https://www.w3schools.com/Js/}{Javascript}\xspace} +\newcommand\python[1][python]{\href{https://www.python.org/}{#1}\xspace} +\newcommand\Ghostscript{\href{https://www.ghostscript.com/}{Ghostscript}\xspace} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% listings code for python and latex examples in webquiz documentation +\RequirePackage{listings} +\lstset{% + % Basic design + backgroundcolor=\color{LightYellow!50!White}, + basicstyle={\small\ttfamily}, + boxpos=c, % centered + % frame + framerule=2pt, + frame=l, + framerule=0.5mm, + rulesep=10mm, + rulecolor=\color{Peru}, + breaklines=true, + % colours for keywords etc + commentstyle=\color{DarkRed}, + keywordstyle=\color{MediumBlue}, + linewidth=14cm, + basewidth = {.5em,0.5em}, + numbers=none, + resetmargins=true, + tabsize=2, + xleftmargin=10mm, + classoffset=1, + % Code design + keywordstyle={[1]\color{Blue}\bfseries}, + keywordstyle={[2]\color{ForestGreen}}, + keywordstyle={[3]\color{LimeGreen}}, + keywordstyle={[4]\color{DarkBlue}}, + commentstyle=\color{BurlyWood}\ttfamily, + stringstyle=\color{Coral}, + tabsize=4, + showtabs=false, + showspaces=false, + showstringspaces=false, + inputencoding=utf8, + extendedchars=true, + literate={á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1 + {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1 + {à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1 + {À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1 + {ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1 + {Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1 + {â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1 + {Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1 + {œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1 + {ű}{{\H{u}}}1 {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1 + {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1 + {€}{{\euro}}1 {£}{{\pounds}}1 {«}{{\guillemotleft}}1 + {»}{{\guillemotright}}1{ñ}{{\~n}}1{Ñ}{{\~N}}1{¿}{{?`}}1 + {á}{{\'a}}1{í}{{\'i}}1{é}{{\'e}}1{ý}{{\'y}}1{ú}{{\'u}}1{ó}{{\'o}}1 + {ě}{{\v{e}}}1{š}{{\v{s}}}1{č}{{\v{c}}}1{ř}{{\v{r}}}1{ž}{{\v{z}}}1{ď}{{\v{d}}}1 + {ť}{{\v{t}}}1{ň}{{\v{n}}}1{ů}{{\r{u}}}1{Á}{{\'A}}1{Í}{{\'I}}1{É}{{\'E}}1 + {Ý}{{\'Y}}1{Ú}{{\'U}}1{Ó}{{\'O}}1{Ě}{{\v{E}}}1{Š}{{\v{S}}}1{Č}{{\v{C}}}1 + {Ř}{{\v{R}}}1{Ž}{{\v{Z}}}1{Ď}{{\v{D}}}1{Ť}{{\v{T}}}1{Ň}{{\v{N}}}1{Ů}{{\r{U}}}1 +} +\lstdefinestyle{latexcode}{ + language=[LaTeX]TeX, + texcsstyle=*\bfseries\color{DodgerBlue}, + classoffset=1, + morekeywords={UnitCode,UnitName,UnitURL,QuizzesURL,BreadCrumbs,BreadCrumb,Department,DepartmentURL, + includegraphics,DeclareGraphicsExtensions,DisplayAsImage,thechoice,quiz, + Institution,InstitutionURL,feedback,correct,incorrect,whenRight,whenWrong,answer, + dref, qref, Qref}, + classoffset=2, + morekeywords={quizindex, discussion, question, multiple, single, columns, choice}, + classoffset=3, + alsoletter=2, + morekeywords={theme, language, hide side menu, pst2pdf, tikz, fixed order, random order, + show side menu, one page, separate pages, english, french, integer, complex, + number, string, lowercase, pspicture}, + classoffset=4, + morekeywords={tikzset, foreach, draw, filldraw, Configure, NewConfigure, csdef, csletcs, csuse, + Picture, EndPicture, psplotThreeD, pstThreeDCoor, RequirePackage, DeclareGraphicsExtensions}, +} +\lstnewenvironment{latexcode}{\lstset{style=latexcode}}{} +\NewDocumentCommand\LatexCode{v}{\lstinline[style=latexcode]|#1|} +\NewDocumentCommand\InputLatexCode{ O{examples/} m}{\lstinputlisting[style=latexcode]{#1#2}} + +\lstdefinestyle{bashcode}{ + language=bash, + upquote=true, + classoffset=1, + morekeywords={webquiz, kpsewhich, latex, pdflatex, xelatex. lualatex}, + classoffset=2, + morekeywords={>} +} +\lstnewenvironment{bashcode}{\lstset{style=bashcode}}{} +\NewDocumentCommand\BashCode{v}{\lstinline[style=bashcode]|#1|} +\newcommand\InputBashCode[1]{\lstinputlisting[style=bashcode]{#1}} + +\lstdefinestyle{pythoncode}{ + language=HTML, + upquote=true, + classoffset=1, + morekeywords={quiz_page}, +} +\lstnewenvironment{pythoncode}{\lstset{style=pythoncode}}{} +\NewDocumentCommand\PythonCode{v}{\lstinline[style=pythoncode]|#1|} +\newcommand\InputPythoCode[1]{\lstinputlisting[style=pythoncode]{#1}} + +\lstdefinestyle{htmlcode}{ + language=HTML, + upquote=true, + morekeywords={no} + classoffset=1, + morekeywords={quiz_page, side_menu, quiz_questions, quiz_header, no_script, include, breadcrumbs,}, +} +\lstnewenvironment{htmlcode}{\lstset{style=htmlcode}}{} +\NewDocumentCommand\HTMLCode{v}{\lstinline[style=htmlcode]|#1|} + +\newcommand\DefaultValue[1]{\textcolor{ForestGreen}{\texttt{#1}}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\RequirePackage{tcolorbox} +\tcbuselibrary{skins} +\NewDocumentCommand\ScreenShot{ O{0.7} m O{examples/} m }{% + \begin{center} + \begin{tcolorbox}[width=#1\textwidth, title=#2, arc=3mm, + colframe=Peru, + boxrule=0.2mm, + colback=white, + halign=center, + enhanced, + attach boxed title to bottom right={yshift=3mm, xshift=-3mm}, + fonttitle=\footnotesize, + boxed title style={size=fbox, colback=white, arc=2mm}, + coltitle=Peru, + ] \includegraphics[width=\textwidth]{#3#4} + \end{tcolorbox} + \end{center}% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% hyperref settings + +\AtEndPreamble{ + \RequirePackage{hyperref} + \hypersetup{% + colorlinks=true, + linkcolor=SaddleBrown, + urlcolor=Brown, + pdfauthor = {\webquiz{authors} }, + pdfkeywords = {\webquiz{keywords} }, + pdfsubject = {\webquiz{description} }, + pdfinfo = {% + copyright = {\webquiz{copyright}}, + licence = {\webquiz{licence}}, + release date = {\webquiz{release date}}, + url = {\webquiz{url}}, + } + } +} +\endinput diff --git a/macros/latex/contrib/webquiz/latex/webquiz-english.lang b/macros/latex/contrib/webquiz/latex/webquiz-english.lang new file mode 100644 index 0000000000..00e6314713 --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-english.lang @@ -0,0 +1,20 @@ +answer = Answer +check answer = Check answer +choice = Choice {} is +correct = Correct! +false = false +incorrect = Incorrect. +multiple incorrect = For example, choice {} should be +next question = Next question +next question = Next unanswered question +one mistake = There is at least one mistake. +previous question = Previous unanswered question +question = Question +questions = Questions +quiz = Quiz +quizzes = Quizzes +side menu cross = wrong +side menu star = right first attempt +side menu tick = right +true = true +try again = Please try again diff --git a/macros/latex/contrib/webquiz/latex/webquiz-french.lang b/macros/latex/contrib/webquiz/latex/webquiz-french.lang new file mode 100644 index 0000000000..d2b0100f38 --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-french.lang @@ -0,0 +1,20 @@ +answer = Réponse +check answer = Vérifier la réponse +choice = Choix {} est +correct = Correct! +false = faux +incorrect = Incorrect. +multiple incorrect = Par exemple, le choix {} devrait être +next question = Question suivante +next question = Prochaine question sans réponse +one mistake = Il y a au moins une erreur. +previous question = Précédente question sans réponse +question = Question +questions = Questions +quiz = Quiz +quizzes = Quizzes +side menu cross = faux +side menu star = bon dès la première tentative +side menu tick = correct +true = vrai +try again = Essayez à nouveau diff --git a/macros/latex/contrib/webquiz/latex/webquiz-german.lang b/macros/latex/contrib/webquiz/latex/webquiz-german.lang new file mode 100644 index 0000000000..35f1a8d80b --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-german.lang @@ -0,0 +1,20 @@ +answer = Antworten +check answer = Antwort prüfen +choice = Wahl {} ist +correct = Richtig! +false = falsch +incorrect = Falsch. +multiple incorrect = Zum Beispiel sollte die Wahl {} sein +next question = Nächste Frage +next question = Nächste unbeantwortete Frage +one mistake = Es gibt mindestens einen Fehler. +previous question = Vorherige unbeantwortete Frage +question = Frage +questions = Fragen +quiz = Quiz +quizzes = Quizzes +side menu cross = falsch +side menu star = richtig erster Versuch +side menu tick = rechts +true = wahr +try again = Bitte versuchen Sie es erneut diff --git a/macros/latex/contrib/webquiz/latex/webquiz-greek.lang b/macros/latex/contrib/webquiz/latex/webquiz-greek.lang new file mode 100644 index 0000000000..12fa3cec87 --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-greek.lang @@ -0,0 +1,20 @@ +answer = Απάντηση +check answer = Ελενξε την απάντηση +choice = Επιλογή {} είναι +correct = Σωστός! +incorrect = Aνακριβής. +false = Λάθος +multiple incorrect = Για παράδειγμα, η επιλογή {} θα πρέπει να είναι +next question = Επόμενη ερώτηση +next question = επόμενη αναπάντητη ερώτηση +one mistake = Υπάρχει τουλάχιστον ένα λάθος. +previous question = προηγούμενη αναπάντητη ερώτηση +question = Ερώτηση +questions = Ερωτήσεις +quiz = Κουίζ +quizzes = Κουίζ +side menu cross = λανθασμένος +side menu star = σωστή πρώτη προσπάθεια +side menu tick = σωστά +true = ωστό +try again = ΠΑΡΑΚΑΛΩ προσπαθησε ξανα diff --git a/macros/latex/contrib/webquiz/latex/webquiz-ini.code.tex b/macros/latex/contrib/webquiz/latex/webquiz-ini.code.tex new file mode 100644 index 0000000000..3fa2d45469 --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-ini.code.tex @@ -0,0 +1,52 @@ +% ----------------------------------------------------------------------- +% webquiz-ini.sty | read the webquiz.ini file into pgfkeys +% ----------------------------------------------------------------------- +% +% Copyright (C) Andrew Mathas, University of Sydney +% +% Distributed under the terms of the GNU General Public License (GPL) +% http://www.gnu.org/licenses/ +% +% This file is part of the webquiz system. +% +% <Andrew.Mathas@sydney.edu.au> +% ---------------------------------------------------------------------- + +%% Read the webquiz.ini file into \pgfkeys for later use so that we +%% don't need to hard-code version information. We allow unknown keys so +%% that we can slurp in all of the information in the file into +%% \pgfkeys{/webquiz} +\RequirePackage{pgfkeys} +\pgfkeys{/webquiz/.is family, /webquiz, + % allow arbitrary unknown keys and set with \pgfkeyssetvalue + .unknown/.code={\pgfkeyssetvalue{\pgfkeyscurrentpath/\pgfkeyscurrentname}{#1}}, +} +\newcommand\webquiz[1]{\pgfkeysvalueof{/webquiz/#1}} + +% split input line into key-value pairs -- necessary as commas can appear in the value +\RequirePackage{xparse} +% \AddIniFileKeyValue{key=value} - take a single argument and split it on = +\NewDocumentCommand{\AddIniFileKeyValue}{ >{\SplitList{=}} m }{% + \AddIniFileValue #1% +} +% put a key-value pair into \pgfkeys{/webquiz} +% \AddIniFile{key}{value} - note that value may contain commas +\newcommand\AddIniFileValue[2]{\expandafter\pgfkeys\expandafter{/webquiz,#1={#2}}} + +% read the webquiz.ini file into \pgfkeys{/webquiz} +\newread\inifile% file handler +\def\apar{\par}% \ifx\par won't work but \ifx\apar will +\newcommand\AddEntry[1]{\expandafter\pgfkeys\expandafter{/webquiz, #1}} +\openin\inifile=webquiz.ini% open file for reading +\loop\unless\ifeof\inifile% loop until end of file + \read\inifile to \iniline% read line from file + \ifx\iniline\apar% test for, and ignore, \par + \else% + \ifx\iniline\empty\relax% skip over empty lines/comments + \else\expandafter\AddIniFileKeyValue\expandafter{\iniline} + \fi% + \fi% +\repeat% end of file reading loop +\closein\inifile% close input file + +\endinput diff --git a/macros/latex/contrib/webquiz/latex/webquiz-italian.lang b/macros/latex/contrib/webquiz/latex/webquiz-italian.lang new file mode 100644 index 0000000000..f2ffba0166 --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-italian.lang @@ -0,0 +1,20 @@ +answer = Risposta +check answer = Controlla la risposta +choice = La scelta {} è +correct = Corretta! +false = falso +incorrect = Non corretta. +multiple incorrect = Ad esempio, dovrebbe essere scelta {} +next question = la prossima domanda senza risposta +next question = Prossima domanda +one mistake = C'è almeno un errore. +previous question = precedente domanda senza risposta +question = Domanda +questions = Le domande +quiz = Quiz +quizzes = Quiz +side menu cross = sbagliato +side menu star = giusto primo tentativo +side menu tick = destra +true = vero +try again = Riprova diff --git a/macros/latex/contrib/webquiz/latex/webquiz-japanese.lang b/macros/latex/contrib/webquiz/latex/webquiz-japanese.lang new file mode 100644 index 0000000000..da05742dbd --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-japanese.lang @@ -0,0 +1,20 @@ +answer = 回答 +check answer = 回答を確認する +choice = 選択肢 {} は +correct = 正しい! +false = 偽 +incorrect = 間違っています。 +multiple incorrect = たとえば、選択肢 {} は +next question = 次の問題 +next question = 次の未回答の質問 +one mistake = 少なくとも1つの間違いがあります。 +previous question = 前の未回答の質問 +question = 質問 +questions = 質問 +quiz = クイズ +quizzes = クイズ +side menu cross = 違う +side menu star = 最初の正しい試み +side menu tick = 右 +true = 本当の +try again = もう一度お試しください diff --git a/macros/latex/contrib/webquiz/latex/webquiz-mandarin.lang b/macros/latex/contrib/webquiz/latex/webquiz-mandarin.lang new file mode 100644 index 0000000000..b00da9d8be --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-mandarin.lang @@ -0,0 +1,20 @@ +answer = 回答 +check answer = 检查答案 +choice = 选择 {} 是 +correct = 正确! +false = 假 +incorrect = 不正确。 +multiple incorrect = 例如,选择 {} 应该是 +next question = 下一个问题 +next question = 下一个未回答的问题 +one mistake = 至少有一个错误。 +previous question = 以前没有回答的问题 +question = 题 +questions = 问题 +quiz = 测验 +quizzes = 测验 +side menu cross = 错误 +side menu star = 正确的第一次尝试 +side menu tick = 对 +true = 真正 +try again = 请再试一次 diff --git a/macros/latex/contrib/webquiz/latex/webquiz-russian.lang b/macros/latex/contrib/webquiz/latex/webquiz-russian.lang new file mode 100644 index 0000000000..039cd0f66e --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-russian.lang @@ -0,0 +1,20 @@ +answer = Ответ +check answer = Проверить ответ +choice = Выбор {} является +correct = Верный! +false = ложный +incorrect = Неправильно. +multiple incorrect = Например, выбор {} должен быть +next question = Следующий вопрос +next question = следующий неотвеченный вопрос +one mistake = Есть хотя бы одна ошибка. +previous question = предыдущий неотвеченный вопрос +question = Вопрос +questions = Вопросов +quiz = викторина +quizzes = Викторины +side menu cross = неправильно +side menu star = правая первая попытка +side menu tick = правильно +true = правда +try again = Пожалуйста, попробуйте еще раз diff --git a/macros/latex/contrib/webquiz/latex/webquiz-spanish.lang b/macros/latex/contrib/webquiz/latex/webquiz-spanish.lang new file mode 100644 index 0000000000..88631aa813 --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-spanish.lang @@ -0,0 +1,20 @@ +answer = Responder +check answer = Checar respuesta +choice = La opción {} es +correct = Correcto +false = falso +incorrect = Incorrecto. +multiple incorrect = Por ejemplo, la opción {} debe ser +next question = Próxima pregunta +next question = siguiente pregunta sin respuesta +one mistake = Hay al menos un error. +previous question = pregunta sin respuesta anterior +question = Pregunta +questions = Preguntas +quiz = Examen +quizzes = Concursos +side menu cross = incorrecto +side menu star = primer intento correcto +side menu tick = derecho +true = cierto +try again = Por favor, inténtelo de nuevo diff --git a/macros/latex/contrib/webquiz/latex/webquiz-swedish.lang b/macros/latex/contrib/webquiz/latex/webquiz-swedish.lang new file mode 100644 index 0000000000..084f3cb3a3 --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz-swedish.lang @@ -0,0 +1,21 @@ +answer = Svar +check answer = Kolla svar +choice = Valet {} är +correct = Rätta! +false = falsk +incorrect = Felaktig. +multiple incorrect = Till exempel bör valet {} vara +next question = Nästa fråga +next question = nästa obesvarad fråga +one mistake = Det finns minst ett misstag. +previous question = tidigare obesvarad fråga +question = Fråga +questions = frågor +quiz = frågesport +quizzes = Frågesport +side menu cross = fel +side menu star = rätt första försök +side menu tick = höger +true = Sann +try again = Var god försök igen + diff --git a/macros/latex/contrib/webquiz/latex/webquiz.cfg b/macros/latex/contrib/webquiz/latex/webquiz.cfg new file mode 100644 index 0000000000..571fecd2fa --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz.cfg @@ -0,0 +1,342 @@ +% ----------------------------------------------------------------------- +% webquiz.cfg | webquiz TeX4ht configuration file +% ----------------------------------------------------------------------- +% +% Copyright (C) Andrew Mathas and Don Taylor, University of Sydney +% +% Distributed under the terms of the GNU General Public License (GPL) +% http://www.gnu.org/licenses/ +% +% This file is part of the WebQuiz system. +% +% <Andrew.Mathas@sydney.edu.au> +% ---------------------------------------------------------------------- + +\NeedsTeXFormat{LaTeX2e}[1996/12/01] +\ProvidesFile{webquiz.cfg}[\webquiz{release date} v\webquiz{version} WebQuiz tex4ht configuration] + +\makeatletter% quite surprisingly, this is needed! + +% shortcut for inserting newlines into xml ifle +\newcommand\HNewLine{\HCode{\Hnewline}} + +% Generate HTML5 + MathML code +\Preamble{xhtml,mathml,html5,NoFonts,charset="utf-8",ext=xml,svg} + +% Don't output xml version tag +\Configure{VERSION}{} + +% Output a WebQuiz doctype instead of the default for HTML5 +\Configure{DOCTYPE}{\HCode{<?xml version="1.0" encoding="UTF-8" ?>\Hnewline +<!DOCTYPE webquiz>}} + +\ifWQ@Debugging\def\WQ@debugging{true}\else\def\WQ@debugging{false}\fi + +% store the quiz specifications as attributes to <quiz> +\Configure{HTML}{% + \HNewLine% + \Tg<webquiz debugging="\WQ@debugging" + hide_side_menu="\WQ@ClassOption{hidesidemenu value}" + language="\WQ@ClassOption{language}" + one_page="\WQ@ClassOption{onepage value}" + pst2pdf="\WQ@ClassOption{pst2pdf value}" + random_order="\WQ@ClassOption{randomorder value}" + src="\jobname.tex" + theme="\WQ@ClassOption{theme}"> + \HNewLine% + \Tg<title>\@title\Tg</title>% + \HNewLine% + \Tg<breadcrumb breadcrumbs="\WQ@breadcrumbs">\WQ@breadcrumb\Tg</breadcrumb>% + \HNewLine% + \Tg<unit_name url="\uos@url" quizzes_url="\WQ@quizzesUrl">\uos@name\Tg</unit_name>% + \HNewLine% + \Tg<unit_code>\uos@code\Tg</unit_code>% + \HNewLine% + \Tg<department url="\WQ@departmentURL">\WQ@department\Tg</department>% + \HNewLine% + \Tg<institution url="\WQ@institutionURL">\WQ@institution\Tg</institution>% + \HNewLine% +}{\Tg</webquiz>} + +% reset all configurations +\Configure{HEAD}{}{} +\Configure{BODY}{}{} +\Configure{TITLE}{}{} +\Configure{TITLE+}{} +\Configure{thanks author date and}{}{}{}{}{}{}{}{} +\renewcommand{\maketitle}{} + +% convert pictures to svg +\Configure{Picture}{.svg} +%\Configure{Picture*}{.svg} + +%\Configure{textit}{\HCode{<span class="textit">}\NoFonts}{\EndNoFonts\HCode{</span>}} +%\Configure{textsf}{\HCode{<span class="textsf">}\NoFonts}{\EndNoFonts\HCode{</span>}} + +% The webquiz macros and environments need to write opening and closing tags to +% the xml file. Opening these tags is easy. To close them we use \WQ@closeXXX +% and \WQ@@closeXXX macros. Each time a tag is opened we \let the \WQ@closeTag +% macro to the corresponding \WQ@@close macro. The \WQ@@close macro closes the +% tag and then \let's the \WQ@closeTag macro to \relax. This allows us to use +% the \WQ@close macros at the start of the tag routines below, which results in +% fairly transparent and readable code. + +% make the @close tags \relax initially +\let\WQ@closeTag\relax % closes \correct, \incorrect, \feedback, \whenRight and \whenWrong +\let\WQ@closeText\relax % closes text + +% text tags - everything in wrapped inside <text>...</text> tags +\def\WQ@openText{\Tg<text>\HtmlParOff\HCode{<![CDATA[}\let\WQ@closeText\WQ@@closeText} +\def\WQ@@closeText{\HCode{]]>}\HtmlParOn\Tg</text>\HNewLine\global\let\WQ@closeText\relax} + +% ----------------------------------------------------------------------- +% discussion environment +% ----------------------------------------------------------------------- + +% discussion environments are number -1, -2, ... in the webquiz.js +\renewcommand\thediscussion{-\arabic{discussion}} + +% inside a discussion environment any label defines two labels, the second of +% which is a label to the short-title for the discussion item. Of there are many +% labels this is slightly in efficient but, because of tex4ht magic, it proved +% too painful to extract the discussion number from the label. +\let\WQ@reallabel=\label +\newcommand\WQ@discussionLabel[1]{% + \WQ@reallabel{#1}% + \bgroup\let\@currentlabel\WQ@shortDiscussionTitle% + \WQ@reallabel{discussion-title-#1}% + \egroup% +} + +% discussion environments +\RenewDocumentEnvironment{discussion}{O{Discussion}O{#1}}{% + \WQ@DiscussionStart% + \HNewLine% + \Tg<discussion>\HNewLine + \Tg<short_heading>#1\Tg</short_heading>\HNewLine + \Tg<heading>#2\Tg</heading>\HNewLine + \Tg<text>\HCode{<![CDATA[}% don't use \WQ@openText as we want paragraphs + \def\WQ@shortDiscussionTitle{#1}% + \let\label\WQ@discussionLabel% +}{\EndP\HCode{]]>}\Tg</text>\HNewLine\Tg</discussion>\HNewLine\WQ@DiscussionEnd} + +% --------------------------------------------------------------------------- +% Cross referencing question and discussion environments +% --------------------------------------------------------------------------- + +% tex4ht redefines the \ref internals so that r@<label> uses \rEfLiNK, +% so we temporarily redefine \rEfLiNK to access the question/discussion +% number +\def\WQ@rEfLiNK#1#2{#2} +% \WQ@Ref[optional *][optional text]{mandatory label} +\RenewDocumentCommand\WQ@ref{ m s o m }{% + \HNewLine% + \bgroup% + \let\rEfLiNK\WQ@rEfLiNK% + \IfBooleanTF{#2}{% link + \HCode{<a onClick="gotoQuestion(}\ref{#4}\HCode{);">}% + \IfNoValueTF{#3}{\ref{#1#4}}{#3}% + \HCode{</a>}% + }{% button + \HCode{<span class="button blank" onClick="gotoQuestion(}\ref{#4}% + \HCode{);">}% + \IfNoValueTF{#3}{\ref{#1#4}}{#3}% + \HCode{</span>}% + }% + \egroup% +} + +\renewcommand\dref{\WQ@ref{discussion-title-}} +\renewcommand\qref{\WQ@ref{}} +\RenewDocumentCommand\Qref{ s O{#3} m }{% + \HNewLine% + \IfBooleanTF{#1}{% link + \HCode{<a onClick="gotoQuestion(#3);">}#2\HCode{</a>}% + }{% button + \HCode{<span class="button blank" onClick="gotoQuestion(#3);">}#2\HCode{</span>}% + }% +} + +% ----------------------------------------------------------------------- +% question environments +% ----------------------------------------------------------------------- + +\renewenvironment{question}{% + \WQ@QuestionStart% + \IgnorePar\HCode{\Hnewline<question>}% open the question tag + \WQ@openText% start some text +}{\WQ@QuestionEnd\WQ@closeText\WQ@closeTag\Tg</question>\HNewLine} + +% ----------------------------------------------------------------------- +% choice environment, \correct and \incorrect choices and \feedback +% ----------------------------------------------------------------------- + +\RenewDocumentEnvironment{choice}{O{}}{% + \WQ@ChoiceStart{#1}% + \WQ@closeText% close any open text tags and then insert tex4ht code + \IgnorePar% + \Tg<choice type="\pgfkeysvalueof{/webquiz checker/mode}" + columns="\pgfkeysvalueof{/webquiz checker/columns value}">% + \let\WQ@closeTag\relax% +}{\WQ@ChoiceEnd\WQ@closeTag\Tg</choice>} + +% correct and incorrect items +\def\WQ@@closeItem{\WQ@closeText\Tg</item>\HNewLine\let\WQ@closeTag\relax} +\def\WQ@Item#1{% + \WQ@ItemStart% + \WQ@closeTag% + \Tg<item correct="#1" symbol="\thechoice">\WQ@openText% + \let\WQ@closeTag\WQ@@closeItem% +} +\def\correct{\WQ@Item{true}} +\def\incorrect{\WQ@Item{false}} + +% feedback +\def\WQ@@closeFeedback{\WQ@closeText\Tg</feedback>\HNewLine\let\WQ@closeTag\relax} +\def\feedback{% + \WQ@FeedbackStart% + \WQ@closeTag\Tg<feedback>\WQ@openText\let\WQ@closeTag\WQ@@closeFeedback% +} + +% ----------------------------------------------------------------------- +% The \answer macro and \whenRight, \whenWrong +% ----------------------------------------------------------------------- + +\RenewDocumentCommand\answer {sO{string}m}{% + \WQ@AnswerStart{#2}% + \WQ@closeText% + \IfBooleanTF{#1}{\def\WQ@prompt{false}}{\def\WQ@prompt{true}}% + \Tg<answer prompt="\WQ@prompt" comparison="#2">\HNewLine% + \WQ@openText#3\WQ@closeText% + \Tg</answer>% + \HNewLine% + \let\WQ@closeTag\relax% + \WQ@openText% +} + +% whenRight and whenWrong +\def\WQ@closeWhen{\Tg</when>\HNewLine\let\WQ@closeTag\relax} +\def\WQ@When#1{% + \WQ@WhenStart{#1}% + \WQ@closeText\WQ@closeTag% + \IgnorePar\Tg<when type="#1">\WQ@openText% + \let\WQ@closeTag\WQ@closeWhen% +} +\def\whenRight{\WQ@When{right}} +\def\whenWrong{\WQ@When{wrong}} + +% ----------------------------------------------------------------------- +% the quizindex environment and \quiz macro +% ----------------------------------------------------------------------- + +% quizindex environment and \quiz +\ConfigureEnv{quizindex}{\Tg<quizindex>\HNewLine}{\Tg</quizindex>\HNewLine}{}{} +\RenewDocumentCommand\quiz{som}{\refstepcounter{quiz}% + \WQ@QuizStart% + \IfBooleanTF{#1}{\def\WQ@prompt{false}}{\def\WQ@prompt{true}}% + \IfNoValueTF{#2}{\def\WQ@url{quiz\thequiz.html}}{\def\WQ@url{#2}}% + \Tg<index_item prompt="\WQ@prompt" url="\WQ@url">\WQ@openText #3 \WQ@closeText\Tg</index_item>\HNewLine% +} + +% ----------------------------------------------------------------------- +% making listing environment work with colour I +% - this code appears to break \color and \textcolor in the online manual +% ----------------------------------------------------------------------- + + +% from https://tex.stackexchange.com/questions/225554/syntax-highlighting-in-an-html-presentation +% extract current color as hexadecimal value +\makeatletter +\ifdefined\lst@version +\newcommand\tsf@getColor[1][.]{% + % colorname `.` holds current color + \extractcolorspec{.}{\tsf@color} + \expandafter\convertcolorspec\tsf@color{HTML}\tsf@color + %\tmpcolor + } + + % write css color for given css selector + \newcommand\CssColor[1]{%on-l + % save current color + \tsf@getColor% + \Css{#1{color:\#\tsf@color;}}% + } +\fi + +% Do not set indent and noindent classes on paragraphs +\Configure{HtmlPar} + {\EndP\Tg<p>} + {\EndP\Tg<p>} + {\HCode{</p>\Hnewline}} + {\HCode{</p>\Hnewline}} + +\renewcommand\DisplayAsImage[2][]{% + \csletcs{real:#2}{#2}% + \NewConfigure{#2}{2} + \csdef{#2}##1{\Picture+[#1]{}\csuse{real:#2}{##1}\EndPicture} + \Configure{#2}{\Picture+[#1]{}}{\EndPicture} +} + +\begin{document} + +% disable \title after \begin{document} +\def\title{\WQ@Error{\@backslashchar title can only be used in the preamble}\@ehc} + +% ----------------------------------------------------------------------- +% making listing environment work with colour II +% - this code appears to break \color and \textcolor in the online manual +% ----------------------------------------------------------------------- + +%% this code is for processing the listing environments in the online manual +\ifdefined\lst@version + % from https://www.mail-archive.com/tex4ht@tug.org/msg00116.html + \let\savecolor\color + \NewConfigure{color}[2]{\def\a@color{#1}\def\b@color{#2}} + \def\color@@tmp#1{\a@color#1\b@color\savecolor{#1}\aftergroup\endspan} + \let\color\color@@tmp + \def\endspan{\Tg</span>} + \Configure{color}{\HCode{<span style="color:}}{\HCode{">}} + + \ConfigureEnv{lstlisting} + {\let\color\savecolor + \ifvmode \IgnorePar\fi \EndP + \gHAdvance\listingN by 1 + \HCode{<!--l. \the\inputlineno-->}% + \gdef\start:LstLn{\HCode{<div class="lstlisting" id="listing-\listingN">}% + \gdef\start:LstLn{\leavevmode\special{t4ht@+\string&{35}x00A0{59}}x% + \HCode{<br/>}}} + \bgroup + \Configure{listings} + {{\everypar{}\leavevmode}} + {{\everypar{}\leavevmode}} + {\start:LstLn \HCode{<span class="label">}} + {\HCode{</span>}}% + } + {\egroup + \ifvmode \IgnorePar\fi \EndP \HCode{</div>}\par} + {}{} + + % for listings in webquiz-manual + % from https://tex.stackexchange.com/questions/225554/syntax-highlighting-in-an-html-presentation + \newcommand\LstCss[2]{% + \bgroup% + \csname lst@#2\endcsname% + \CssColor{#1}% + \egroup% + } + + \LstCss{div.lstlisting .ecbx-1000}{keywordstyle} + \LstCss{div.lstlisting .ecss-1000}{commentstyle} + \LstCss{div.lstlisting .ectt-1000}{basicstyle} +\fi + +\makeatother + +\EndPreamble + +% bug fix for \mathbf from http://tex.stackexchange.com/questions/362178 +%\Configure{mathbf}{\HCode{<mi mathvariant="bold">}\PauseMathClass}{\EndPauseMathClass\HCode{</mi>}} + +\endinput +%% +%% End of file `webquiz.cfg'. diff --git a/macros/latex/contrib/webquiz/latex/webquiz.cls b/macros/latex/contrib/webquiz/latex/webquiz.cls new file mode 100644 index 0000000000..29e6f22675 --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz.cls @@ -0,0 +1,391 @@ +% ----------------------------------------------------------------------- +% webquiz.cls | webquiz latex class file +% ----------------------------------------------------------------------- +% +% Copyright (C) Andrew Mathas, University of Sydney +% +% Distributed under the terms of the GNU General Public License (GPL) +% http://www.gnu.org/licenses/ +% +% This file is part of the WebQuiz system. +% +% <Andrew.Mathas@sydney.edu.au> +% ---------------------------------------------------------------------- + +\NeedsTeXFormat{LaTeX2e}[1996/12/01] + +% load webquiz-ini style +\input{webquiz-ini.code} + +% ---------------------------------------------------------------------- +\ProvidesClass{webquiz}[\webquiz{release date} Version \webquiz{version}] + +% initialise and then process document class options usng pgfopts +\RequirePackage{etoolbox} +\RequirePackage{pgfopts} +\def\unknown@options{}% unknown options are passed to article.cls +\def\WQ@HideSideMenu{DeFaUlT}% side menu visible by default +\newif\ifWQ@Tikz\WQ@Tikzfalse% true if tikz a document class option + +\newif\ifWQ@Debugging % for the debugging class option +% Process the documentclass options using pgfkeys and \ProcessPgfOptions +\pgfkeys{/WQ@ClassOptions/.is family, + /WQ@ClassOptions, + % turn debugging on + debugging/.code = {\WQ@Debuggingtrue}, + % pst2pdf + pst2pdf/.style = {pst2pdf value=true}, + pst2pdf value/.initial = false, + % languaage + language/.initial = DeFaUlT, + % one page + onepage/.style = {onepage value=true}, + separatepages/.style = {onepage value=false}, + onepage value/.initial = DeFaUlT, + % side menu + showsidemenu/.style = {hidesidemenu value=false}, + hidesidemenu/.style = {hidesidemenu value=true}, + hidesidemenu value/.initial= DeFaUlT, + % random order of quiz questions + randomorder/.style = {randomorder value=true}, + fixedorder/.style = {randomorder value=false}, + randomorder value/.initial = DeFaUlT, + % theme + theme/.initial = DeFaUlT, + % tikz + tikz/.code = {\global\WQ@Tikztrue}, + % unknown options => passed to article class + .unknown/.code={\edef\unknown@options{\unknown@options,\pgfkeyscurrentname}} +} +\newcommand\WQ@ClassOption[1]{\pgfkeysvalueof{/WQ@ClassOptions/#1}} + +% Use pgfkeys to check for valid options for the choice environment and the +% answer comparisons. As \ERROR is not defined an error message is +% generated by the unknown handlers below +\pgfkeys{/webquiz checker/.is family, /webquiz checker, + mode/.initial = single, + columns value/.initial = 1, + columns/.style = {columns value=#1}, + single/.style = {mode=single}, + multiple/.style = {mode=multiple}, + .unknown/.code = {\ERROR: invalid choice type: use single or multiple} + comparison/.is choice, + comparison/complex/.code = \relax, + comparison/integer/.code = \relax, + comparison/lowercase/.code = \relax, + comparison/number/.code = \relax, + comparison/string/.code = \relax, + comparison/.unknown/.code = {\ERROR: invalid input type: use integer, string or eval} +} + +% now process the options +\ProcessPgfOptions{/WQ@ClassOptions}% process options +\LoadClass[\unknown@options]{article}% load article class with options + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\RequirePackage{xparse} +\RequirePackage{pgffor} + +% load Michal Hoftich's new tikz driver for tex4ht +\ifWQ@Tikz + \ifdefined\HCode + \def\pgfsysdriver{pgfsys-dvisvgm4ht.def} + \fi +\fi + +\def\WQ@Error{\PackageError{webquiz}} +\def\WQ@Debugging#1{\ifWQ@Debugging\typeout{Debugging: #1}\fi} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\RequirePackage{amsfonts,amsmath} +\RequirePackage{bbding} +\setlength{\parindent}{0pt} +\setlength{\parskip}{10pt} + +% Macro to define a picture variant of \<command>. The latex version does +% nothing but the cfg version converts \<command> into an image + +\newcommand\DisplayAsImage[2][]{\relax} + +% Need to declare possible graphics extensions: see https://tex.stackexchange.com/questions/213461 +% This is just placeholder - the real definition is used in the cfg file +%\newcommand\DeclareGraphicsExtensions[1]{} + +% Macros for defining the university and department +\newcommand*{\DepartmentURL}[1]{\def\WQ@departmentURL{#1}} +\newcommand*{\Department}[1]{\def\WQ@department{#1}} + +% University/instution - university included for backwards compatibility +\newcommand*{\InstitutionURL}[1]{\def\WQ@institutionURL{#1}} +\newcommand*{\Institution}[1]{\def\WQ@institution{#1}} +\newcommand*{\UniversityURL}[1]{\def\WQ@institutionURL{#1}} +\newcommand*{\University}[1]{\def\WQ@institution{#1}} + +% Macros for defining the quiz web breadcrumbs using the unit code, name and +% URL. The names of these macros are chosen so as to be compatible with the +% in-house SMS package sms-uos.sty that specifies these for all units. +\newcommand*\UnitCode[1]{\def\uos@code{#1}} +\newcommand*\UnitName[1]{\def\uos@name{#1}} +\newcommand*\UnitURL[1]{\def\uos@url{#1}} +\newcommand*\QuizzesURL[1]{\def\WQ@quizzesUrl{#1}} +\newcommand*\BreadCrumb[1]{\def\WQ@breadcrumb{#1}} +\newcommand*\BreadCrumbs[1]{\def\WQ@breadcrumbs{#1}} + +% Default values - the university and department defaults can also be +% set in the webquizrc file. The main purpose of these defaults is +% to remind the user to set them. +\UnitCode{Unit code?} +\UnitName{Unit name?} +\UnitURL{} +\QuizzesURL{DeFaUlT} +\BreadCrumb{} +\BreadCrumbs{DeFaUlT} +\Department{DeFaUlT} +\DepartmentURL{DeFaUlT} +\University{DeFaUlT} +\UniversityURL{DeFaUlT} + +% Define page header and footer for the printable version of the quiz +% to show the unit code information. +\def\ps@quiz{\ps@empty + \def\@oddhead{\hbox to\textwidth{% + \uos@code\hss\textsc{\@title}\hss Page \thepage}}% + \let\@evenhead=\@oddhead +} +\def\ps@firstpage{\ps@empty} +\pagestyle{quiz} + + +\def\@title{} +\def\maketitle{\vspace*{10mm} + \begin{center} + {\large\textsc{\@title}}% + \end{center} +} +\AtBeginDocument{ + \maketitle% + \def\title{\WQ@Error{\noexpand\title can only be used in the preamble}\@ehc} + \thispagestyle{firstpage}% + \ifdefined\HCode\else + \textsc{WebQuiz} will process this quiz using \textbf{pst2pdf}. + \fi + \RequirePackage{tikz} +} + +% ----------------------------------------------------------------------- +% WebQuiz macros +% Define \WQ@XXXStart and \WQ@XXXEnd macros to avoid code duplication +% in webquiz.cfg. The following switches are used for syntax checking +% ----------------------------------------------------------------------- + +% These are all for error checking... +\newif\ifWQ@InFeedback +\newif\ifWQ@InAnswer +\newif\ifWQ@InChoice +\newif\ifWQ@InDiscussion +\newif\ifWQ@InItem +\newif\ifWQ@InQuestion +\newif\ifWQ@InQuizIndex +\newif\ifWQ@InWhenright +\newif\ifWQ@InWhenwrong + +% ----------------------------------------------------------------------- +% the quizindex environment and \quiz macro +% ----------------------------------------------------------------------- + +% the quiz counter keeps track of the question numbers in a quizindex environement +\newcounter{quiz} +\renewcommand\thequiz{\arabic{quiz}} +\def\WQ@QuizStart{% + \WQ@Debugging{Starting \noexpand\quiz...}% + \ifWQ@InQuizIndex\else\WQ@Error{\noexpand\quiz must appear inside a quizindex environment}\fi% + \refstepcounter{quiz}% increment the quiz counter for the URLs +} +\NewDocumentCommand\quiz{som}{% + \WQ@QuizStart% + \IfBooleanTF{#1}{\def\WQ@Quiz{}}{\def\WQ@Quiz{Quiz~\thequiz.\space}}% + \IfNoValueTF{#2}{\def\WQ@url{quiz\thequiz.html}}{\def\WQ@url{#2}}% + \leavevmode\medskip\newline% + \WQ@Quiz #3\newline% + \phantom{Quiz 10}\textit{URL}:\quad \WQ@url% +} + +\def\WQ@QuizIndexStart{% + \WQ@Debugging{Starting quizindex...}% + \ifWQ@InQuestion\WQ@Error{quizindex cannot appear in a question environment}\fi% + \ifWQ@InDiscussion\WQ@Error{quizindex environments cannot be inside a discussion environment}\fi + \ifWQ@InQuizIndex\WQ@Error{quizindex environments cannot be nested}\fi% + \global\WQ@InQuizIndextrue% here, and below, using \global is probably overkill... +} +\def\WQ@QuizIndexEnd{\global\WQ@InQuizIndexfalse\WQ@Debugging{Ending quizindex...}} +\newenvironment{quizindex}{\WQ@QuizIndexStart\bigskip}{\WQ@QuizIndexEnd} + +% ----------------------------------------------------------------------- +% discussion environment +% ----------------------------------------------------------------------- + +\newcounter{discussion} + +% \begin{dicussion}[short title][title -default-> Discussion] +\def\WQ@DiscussionStart{% + \WQ@Debugging{Starting discussion...}% + \ifWQ@InDiscussion\WQ@Error{discussion environments cannot be nested}\fi% + \ifWQ@InQuestion\WQ@Error{discussion environments cannot be inside a question environment}\fi% + \ifWQ@InQuizIndex\WQ@Error{discussion environments cannot be inside a quizindex environment}\fi% + \global\WQ@InDiscussiontrue% + \refstepcounter{discussion}% +} +\def\WQ@DiscussionEnd{\global\WQ@InDiscussionfalse\WQ@Debugging{Ending discussion...}} +\NewDocumentEnvironment{discussion}{O{Discussion}O{#1}} + {\WQ@DiscussionStart\textbf{#1} (#2)}{\WQ@DiscussionEnd\par\bigskip} + +% --------------------------------------------------------------------------- +% Cross referencing question and discussion environments +% --------------------------------------------------------------------------- + +% \WQ@Ref{+ or -}[optional *][optional text]{mandatory label} +\NewDocumentCommand\WQ@ref{ m s o m }{% +\fbox{\IfBooleanTF{#2}{link}{button} to \IfNoValueTF{#3}{to #1 \ref{#4}}{ to ``#3'' (#1 \ref{#4})}}% +} +\newcommand\dref{\WQ@ref{discussion}} +\newcommand\qref{\WQ@ref{question}} +\newcommand\Qref{\WQ@ref{question number}} + +% ----------------------------------------------------------------------- +% question environment +% ----------------------------------------------------------------------- + +% the question counter keeps track of the quiz question numbers +\newcounter{question} + +\def\WQ@QuestionStart{% + \WQ@Debugging{Starting question...}% + \ifWQ@InDiscussion\WQ@Error{question environments cannot be inside a discussion environment}\fi% + \ifWQ@InQuizIndex\WQ@Error{question environments cannot be inside a quizindex environment}\fi% + \ifWQ@InQuestion\WQ@Error{question environments cannot be nested!}\fi% + \global\WQ@InAnswerfalse% + \global\WQ@InChoicefalse% + \global\WQ@InChoicefalse% + \global\WQ@InItemfalse% + \global\WQ@InQuestiontrue% + \global\WQ@InFeedbackfalse% + \global\WQ@InWhenrightfalse% + \global\WQ@InWhenwrongfalse% + \refstepcounter{question}% +} + +\def\WQ@QuestionEnd{ + \ifWQ@InChoice\else\ifWQ@InAnswer\else% + \WQ@Error{Each question must contain a choice environment or an \noexpand\answer!}% + \fi\fi% + \global\WQ@InQuestionfalse% + \WQ@Debugging{Ending question...}% +} + +\newenvironment{question}{\WQ@QuestionStart\bigskip\textbf{Question \arabic{question}.\newline}} + {\par\bigskip\WQ@QuestionEnd} + +% ----------------------------------------------------------------------- +% choice environment, \correct and \incorrect choices and \feedback +% ----------------------------------------------------------------------- + +% the choice counter keeps track of the choices in a choice environment +\newcounter{choice} +\renewcommand\thechoice{(\alph{choice})} + +\def\WQ@ChoiceStart#1{% + \WQ@Debugging{Starting choice...}% + \ifWQ@InQuestion\relax% Give a warning if we are not inside a question + \else\WQ@Error{Choice environments must be contained in a question}% + \fi% + \ifWQ@InAnswer\WQ@Error{choice environments cannot contain an \noexpand\answer!}\fi% + \ifWQ@InChoice\WQ@Error{choice environments cannot be nested}\fi% + \global\WQ@InChoicetrue% + \global\WQ@InItemfalse% + \pgfkeys{/webquiz checker, #1}% + \setcounter{choice}{0}% reset choice counter +} + +\def\WQ@ChoiceEnd{% + \ifWQ@InItem\else\WQ@Error{Choice environment with no choices!}\fi% + \WQ@InChoicefalse% + \WQ@Debugging{Ending choice...}% +} + +% \begin{choice}[choice type, number of columns] ... \end{choice} The +% allowed choice types are "single" or "multiple". The type and number +% of columns is allowed to appear in either order, so most of the fun +% and games below is sanity checking of the argunments. +\NewDocumentEnvironment{choice}{O{single}}{% + \WQ@ChoiceStart{#1}% + \leavevmode\newline% +% (\textit{The choices will be printed in \pgfkeys{/webquiz checker/columns value} columns in the HTML version of the quiz})% + \par% + \setcounter{choice}{0}% +}{\WQ@ChoiceEnd} + +\def\WQ@ItemStart{% + \WQ@Debugging{Starting item...}% + \ifWQ@InChoice\relax% + \else\WQ@Error{\noexpand\correct and \noexpand\incorrect must be inside a choice environment}% + \fi% + \global\WQ@InItemtrue\global% + \WQ@InFeedbackfalse% + \refstepcounter{choice}% +} + +\def\WQ@Item#1{\WQ@ItemStart\par\bigskip #1\quad\textit{Option} \thequestion\thechoice:\qquad} +\def\correct{\WQ@Item\CheckmarkBold} +\def\incorrect{\WQ@Item\XSolidBrush} + +\def\WQ@FeedbackStart{% + \WQ@Debugging{Starting feedback...}% + \ifWQ@InItem\relax% + \else\WQ@Error{Missing \noexpand\correct or \noexpand\incorrect}% + \fi% + \ifWQ@InFeedback\WQ@Error{Only one feedback per option is allowed!}\fi% + \WQ@InFeedbacktrue% +} + +\def\feedback{\WQ@FeedbackStart\leavevmode\medskip\newline\textit{Feedback:}\space} + +% ----------------------------------------------------------------------- +% The \answer macro and the feedback macros \whenRight, \whenWrong +% ----------------------------------------------------------------------- + +% supported answer comparisons +\def\WQ@AnswerStart#1{% + \WQ@Debugging{Starting answer...}% + \ifWQ@InQuestion\relax% + \else\WQ@Error{\noexpand\answer\ must be contained in a question}% + \fi% + \ifWQ@InChoice\WQ@Error{You cannot have \noexpand\answer inside a choice environment}\fi% + \ifWQ@InAnswer\WQ@Error{Each question can contain only one \noexpand\answer command}\fi% + \pgfkeys{/webquiz checker/comparison/#1}% + \global\WQ@InAnswertrue% + \global\WQ@InWhenrightfalse% + \global\WQ@InWhenwrongfalse% +} + +\NewDocumentCommand\answer{s O{string} m}{% + \WQ@AnswerStart{#2}% + \leavevmode\bigskip\newline% + \IfBooleanTF{#1}{\fbox{\textit{(#2 comparison):}\quad#3}}% + {\fbox{\textit{Answer (#2 comparison):}\quad#3}}% +} + +\def\WQ@WhenStart#1{% + \WQ@Debugging{Starting when#1...}% + \ifWQ@InAnswer\relax\else\WQ@Error{missing \noexpand\answer}\fi% + \ifbool{WQ@InWhen#1}{% + \WQ@Error{Only one \noexpand\when#1 per question is allowed!}% + }{}% + \global\booltrue{WQ@InWhen#1}% +} + +\def\WQ@When#1{\WQ@WhenStart{#1}\leavevmode\medskip\newline\textit{Feedback when #1:}\space} +\def\whenRight{\WQ@When{right}} +\def\whenWrong{\WQ@When{wrong}} + +\endinput +%% End of file `webquiz.cls'. diff --git a/macros/latex/contrib/webquiz/latex/webquiz.ini b/macros/latex/contrib/webquiz/latex/webquiz.ini new file mode 100644 index 0000000000..b4bec75112 --- /dev/null +++ b/macros/latex/contrib/webquiz/latex/webquiz.ini @@ -0,0 +1,14 @@ +author_email = andrew.mathas@sydney.edu.au +authors = Andrew Mathas +copyright = 2004-2019 Andrew Mathas and Donald Taylor, University of Sydney +description = A LaTeX package for writing online quizzes +email = andrew.mathas@sydney.edu.au +keywords = online quizzes, latex, tex4ht, make4ht, python +licence = GNU General Public License, Version 3, 29 June 2007 +name = Andrew Mathas +program = webquiz +release date = 2019/02/08 +repository = github.com/AndrewAtLarge/WebQuiz/issues +requirements = Python3 and \LaTeX, including \TeX 4ht and make4ht +url = www.maths.usyd.edu.au/u/mathas/WebQuiz/doc/webquiz-online-manual.html +version = 5.2 diff --git a/macros/latex/contrib/webquiz/scripts/CHANGES.rst b/macros/latex/contrib/webquiz/scripts/CHANGES.rst new file mode 100644 index 0000000000..4de4c5641c --- /dev/null +++ b/macros/latex/contrib/webquiz/scripts/CHANGES.rst @@ -0,0 +1,96 @@ +=============== +WebQuiz Changes +=============== + +Version 5.2: +------------ + - compatibility with both MikTeX and TeXLive under windows + +Version 5.1: +------------ + - code reorganised n zip file for TeXLive inclusion + - \dref, \qref and \Qref commands + - error and debugging code reorganised + - javascript session history following Hendrik Suess + - unix man page + +Version 5.0: +------------ + - added button for hiding/showing question buttons + - added colour theme support + - added language support + - added support for colour and listings in the quiz files + - added lualatex and xelatex engine support + - added displayasimage + - added more comparison options for inputted answers + - all files converted to utf8 using codecs + - bash script wrapper replaced with python, using argparser, making it more portable and more flexible + - better installation support + - changed name from mathquiz to webquiz + - drop-down menu for quiz index file + - export to ctan in setup.py + - images for buttons etc replaced by css + - implemented a suggestion of Michal Hoftich to workaround tikz/pgf bugs + - implemented a suggestion to Herbert Voss to fix a pstricks issue using pst2pdf + - made compatible with setup tools, together with option to export to ctan + - many more document class options + - new (off-line) manual with automatically generated images via makeimages script + - now using make4ht + - option for pst2pdf preprocessing for quizzes using pstricks/postscript + - option for tikz that fixes a few bugs of pgf/tikz + - program packaged for uploading to ctan and texlive + - programmable breadcrumbs + - python and javascript streamlined and largely rewritten + - randomorder and onepage options added + - replaced Choice environment with smarter choice environment + - rewrote xml parser + - side menu and breadcrumbs automatically disappear on small screens + - system webquizrc configuration file added wiith optional user .webquizrc file + - thechoice controls the labels for multiple choice options + - updated to use html5, mathjax and mathml + - using git and bitbucket for version management control + - using pgfkeys for processing document class and environment options + - using sass to generate css for different themes + - various webquiz defaults can be stored in the rc-file + - windows batch file + +Version 4.6: +------------ + - Updated to use MathML + +Version 4.5: +------------ + - Updated and streamlined many aspects of the code + +Version 4.0: +------------ + - separated allowed default and localised versions for the quiz page payout + with the SMS versiion calling Bob Howlett's update programs to generate + the quiz web pages + +Version 3: +---------- + - code taken over by Andrew Mathas + - latex class file, mathquiz.cls, written and integrated with tex4ht code + - documentation written + - SMS quizzes converted to mathquiz format + +Versions 1 and 2: +----------------- +2001-03-21 Don Taylor - initial prototype by Don Taylor + + +To do +----- +Rather than a to-do list, here are some possible future improvements: + - (?) improve quiz "security" (would be a side-effect of moving to vue...) + - (?) randomise order of questions parts with document-class option randomorder + - (?) allow variables in questions (hardest part is finding a good syntax) + - (?) rewrite javascript to use vue to render and control quiz pages + - (?) allow vertical/horizontal/none customisations of question buttons + - (?) record marks of students...would need a interface for login details etc + - (?) add timer and/or time limits to quiz + - (?) responsive columns to replace columns=? in choice environments + - (?) dynamic themes (easy) + - (?) dynamic languages (harder) + diff --git a/macros/latex/contrib/webquiz/scripts/LICENCE b/macros/latex/contrib/webquiz/scripts/LICENCE new file mode 100644 index 0000000000..b83b60f868 --- /dev/null +++ b/macros/latex/contrib/webquiz/scripts/LICENCE @@ -0,0 +1,226 @@ + +GNU GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/> + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. +Preamble + +The GNU General Public License is a free, copyleft license for software and other kinds of works. + +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. +TERMS AND CONDITIONS +0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on the Program. + +To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. +1. Source Code. + +The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. + +A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. + +The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. +2. Basic Permissions. + +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified it, and giving a relevant date. + b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. + c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: + + a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. + b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. + c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. + d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. + e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. + +A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. +7. Additional Terms. + +“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or + b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or + c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or + d) Limiting the use for publicity purposes of names of licensors or authors of the material; or + e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or + f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. +8. Termination. + +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. +11. Patents. + +A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. + +In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. + +A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>. + +The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/macros/latex/contrib/webquiz/scripts/README-scripts b/macros/latex/contrib/webquiz/scripts/README-scripts new file mode 100644 index 0000000000..8199d0ccc3 --- /dev/null +++ b/macros/latex/contrib/webquiz/scripts/README-scripts @@ -0,0 +1,16 @@ +The WebQuiz executable is webquiz.py. On unix-like systems it is enough to +create a soft link to this file using something like: + ln -s $(pwd)/webquiz.py /usr/local/bin/webquiz + +The batch file webquiz.bat comes from + https://tex.stackexchange.com/questions/40937/how-to-publish-a-package-that-includes-scripts-and-or-executables/40971 + +The files in this directory are: + - webquiz.py* = processes command-line options and settings + - webquiz_layout.py = determines the final layout of the web pages + - webquiz_makequiz.py = converts the XML into HTML + - webquiz_templates.py = template strings for HTML and + - webquiz_util.py = utility functions + - webquiz_xml.py = read and interpret the webquiz XML file + - CHANGES.rst = list of changes to program + - LICENCE = copy of the GPL licence diff --git a/macros/latex/contrib/webquiz/scripts/webquiz b/macros/latex/contrib/webquiz/scripts/webquiz new file mode 120000 index 0000000000..8d8dccbc1d --- /dev/null +++ b/macros/latex/contrib/webquiz/scripts/webquiz @@ -0,0 +1 @@ +webquiz.py
\ No newline at end of file diff --git a/macros/latex/contrib/webquiz/scripts/webquiz.bat b/macros/latex/contrib/webquiz/scripts/webquiz.bat new file mode 100644 index 0000000000..89c05730fa --- /dev/null +++ b/macros/latex/contrib/webquiz/scripts/webquiz.bat @@ -0,0 +1,30 @@ +@echo off +rem WebQuiz batch file to find and launch python executable + +rem Set TEXMF to root TeX directory and look for webquiz.py in scripts/webquiz +setlocal enableextensions +for /F "tokens=*" %%i in ('kpsewhich -var-value TEXMFMAIN') do (SET TEXMF=%%i) + +rem First look for webquiz.py in the current directory +set WebQuiz="webquiz.py" +if not exist %WebQuiz% ( + if exist "%TEXMF%/scripts/webquiz/webquiz.py" ( + set WebQuiz="%TEXMF%/scripts/webquiz/webquiz.py" + ) +) +rem +rem exit with an error if webquiz.py has not been found +if not exist %WebQuiz% ( + echo WebQuiz executable not found. Please check that WebQuiz is properly installed>&2 + exit /b 1 +) + +rem check for the python interpreter in the PATH +for %%I in (python.exe) do set "PYTHONEXE=%%~$PATH:I" +if not defined PYTHONEXE ( + echo %~nx0: Python interpreter not installed or not on the PATH>&2 + exit /b 1 +) + +rem launch webquiz +"%PYTHONEXE%" %WebQuiz% %* diff --git a/macros/latex/contrib/webquiz/scripts/webquiz.py b/macros/latex/contrib/webquiz/scripts/webquiz.py new file mode 100755 index 0000000000..de1e052fb7 --- /dev/null +++ b/macros/latex/contrib/webquiz/scripts/webquiz.py @@ -0,0 +1,1124 @@ +#!/usr/bin/env python3 +r''' +------------------------------------------------------------------------------ + webquiz | Online quizzes generated from LaTeX using python and TeX4ht + | This module mainly deals with command-line options and + | settings and then calls MakeWebQuiz to build the quiz +------------------------------------------------------------------------------ + Copyright (C) Andrew Mathas and Donald Taylor, University of Sydney + + Distributed under the terms of the GNU General Public License (GPL) + http://www.gnu.org/licenses/ + + This file is part of the WebQuiz system. + + <Andrew.Mathas@sydney.edu.au> +------------------------------------------------------------------------------ +''' + +import argparse +import codecs +import errno +import glob +import os +import re +import shutil +import signal +import subprocess +import sys + +# imports of webquiz code +import webquiz_makequiz +import webquiz_templates +import webquiz_util + +################################################################################# +# read in basic meta data such as author, version, ... and set debugging=False +try: + metadata = webquiz_util.MetaData(webquiz_util.kpsewhich('webquiz.ini'), debugging=False) +except subprocess.CalledProcessError: + # check to see if we are running from the zip file + ini_file = os.path.join(webquiz_util.webquiz_file(''), '..', 'latex', 'webquiz.ini') + try: + metadata = webquiz_util.MetaData(ini_file, debugging=False) + except (FileNotFoundError, subprocess.CalledProcessError): + print(webquiz_templates.missing_webquiz_ini.format(ini_file)) + sys.exit(1) + +# --------------------------------------------------------------------------------------- +def graceful_exit(sig, frame): + ''' exit gracefully on SIGINT and SIGTERM''' + if metadata: + webquiz_util.webquiz_error(False, 'program terminated (signal {}\n {})'.format(sig, frame)) + else: + webquiz_util.webquiz_error(False, 'program terminated (signal {})'.format(sig)) + +signal.signal(signal.SIGINT, graceful_exit) +signal.signal(signal.SIGTERM, graceful_exit) + + +################################################################################# +def preprocess_with_pst2pdf(options, quiz_file): + r''' + Preprocess the latex file using pst2pdf. As we are preprocessing the file it + is not enough to have latex pass us a flag that tells us to use pst2pdf. + Instead, we have to extract the class file option from the tex file + + INPUT: quiz_file should be the name of the quiz file, WITHOUT the .tex extension + ''' + options.talk('Preprocessing {} with pst2pdsf'.format(quiz_file)) + try: + # pst2pdf converts pspicture environments to svg images and makes a + # new latex file quiz_file+'-pdf' that includes these + cmd = 'pst2pdf --svg --imgdir={q_file} {q_file}.tex'.format(q_file=quiz_file) + # pst2pdf is missing a #!-header so we need shell=True + options.run(cmd, shell=True) + except OSError as err: + if err.errno == errno.ENOENT: + webquiz_util.webquiz_error(options.debugging, 'pst2pdf not found. You need to install pst2pdf to use the pst2pdf option', err) + else: + webquiz_util.webquiz_error(options.debugging, 'error running pst2pdf on {}'.format(quiz_file), err) + + # match \includegraphics commands + fix_svg = re.compile(r'(\\includegraphics\[scale=1\])\{('+quiz_file+r'-fig-[0-9]*)\}') + # the svg images are in the quiz_file subdirectory but latex can't + # find them so we update the tex file to look in the right place + try: + with codecs.open(quiz_file + '-pdf.tex', 'r', encoding='utf8') as pst_file: + with codecs.open(quiz_file + '-pdf-fixed.tex', 'w', encoding='utf8') as pst_fixed: + for line in pst_file: + pst_fixed.write(fix_svg.sub(r'\1{%s/\2.svg}' % quiz_file, line)) + except OSError as err: + webquiz_util.webquiz_error(options.debugging, + 'there was an problem running pst2pdf for {}'.format(quiz_file), + err + ) + +class WebQuizSettings: + r''' + Class for initialising webquiz. This covers both reading and writing the + webquizrc file and copying files into the web directories during + initialisation. The settings themselves are stored in the attribute + settings, which is a dictionary. The class reads and writes the settings to + the webquizrc file and the values of the settings are available as items: + >>> wq = WebQuizSettings() + >>> wq['webquiz_url'] + ... /WebQuiz + >>> wq['webquiz_url'] = '/new_url' + ''' + + # default of settings for the webquizrc file - a dictionary of dictionaries + # the 'help' field is for printing descriptions of the settings to help the + # user - they are also printed in the webquizrc file + settings = dict( + webquiz_url={ + 'default': '', + 'advanced': False, + 'help': 'Relative URL for the webquiz web directory', + }, + webquiz_www={ + 'default': '', + 'advanced': False, + 'help': 'Full path to WebQuiz web directory', + }, + language={ + 'default': 'english', + 'advanced': False, + 'help': 'Default language used on web pages' + }, + engine = { + 'default': 'latex', + 'advanced': False, + 'help': 'Default TeX engine used to compile web pages', + 'values': dict(latex='', lua='--lua', xelatex='--xetex') + }, + theme={ + 'default': 'default', + 'advanced': False, + 'help': 'Default colour theme used on web pages' + }, + breadcrumbs={ + 'default': '', + 'advanced': False, + 'help': 'Breadcrumbs at the top of quiz page', + }, + department={ + 'default': '', + 'advanced': False, + 'help': 'Name of department', + }, + department_url={ + 'default': '/', + 'advanced': False, + 'help': 'URL for department', + }, + institution={ + 'default': '', + 'advanced': False, + 'help': 'Institution or university', + }, + institution_url={ + 'default': '/', + 'advanced': False, + 'help': 'URL for institution or university', + }, + hide_side_menu={ + 'default': 'false', + 'advanced': False, + 'help': 'Do not display the side menu at start of quiz', + }, + one_page={ + 'default': 'false', + 'advanced': False, + 'help': 'Display questions on one page', + }, + random_order={ + 'default': 'false', + 'advanced': False, + 'help': 'Randomly order the quiz questions', + }, + webquiz_layout={ + 'default': 'webquiz_layout', + 'advanced': True, + 'help': 'Name of python module that formats the quizzes', + }, + make4ht={ + 'default': '', + 'advanced': True, + 'help': 'Build file for make4ht', + }, + mathjax={ + 'default': + 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js', + 'advanced': + True, + 'help': + 'URL for mathjax', + }, + version={ + 'advanced': False, + 'help': 'WebQuiz version number for webquizrc settings', + }) + + # by default we assume we don't need to print a initialisation warning + initialise_warning = '' + + # turn debugging on by default because any error message that we hit before + # we process the command line options really should not happen + debugging = True + + # keep track of whether we have initialised + have_initialised = False + + def __init__(self): + ''' + First read the system webquizrc file and then read the + to use some system settings and to override others. + + By default, there is no webquiz initialisation file. We first + look for webquizrc in the webquiz source directory and then + for .webquizrc file in the users home directory. + ''' + self.settings['version']['default'] = metadata.version + for key in self.settings: + self.settings[key]['value'] = self.settings[key]['default'] + if not 'editable' in self.settings[key]: + self.settings[key]['editable'] = False + + # define user and system rc file and load the ones that exist + + TEXMFLOCAL='' + try: + TEXMFLOCAL = webquiz_util.kpsewhich('-var-value TEXMFLOCAL') + except subprocess.CalledProcessError: + pass + + if TEXMFLOCAL == '': + TEXMFLOCAL = webquiz_util.kpsewhich('-var-value TEXMFMAIN') + + self.system_rcfile = os.path.join(TEXMFLOCAL, 'tex', 'latex', 'webquiz', 'webquizrc') + self.read_webquizrc(self.system_rcfile) + + # the user rc file defaults to: + # ~/.dotfiles/config/webquizrc if .dotfiles/config exists + # ~/.config/webquizrc if .config exists + # and otherwise to ~/.webquizrc + if os.path.isdir(os.path.join(os.path.expanduser('~'), '.dotfiles', 'config')): + self.user_rcfile = os.path.join(os.path.expanduser('~'), '.dotfiles', 'config', 'webquizrc') + elif os.path.isdir(os.path.join(os.path.expanduser('~'), '.config')): + self.user_rcfile = os.path.join(os.path.expanduser('~'), '.config', 'webquizrc') + else: + self.user_rcfile = os.path.join(os.path.expanduser('~'), '.webquizrc') + + self.read_webquizrc(self.user_rcfile) + + def webquiz_debug(self, msg): + r''' + Customised debugging message for the MakeSettings module + ''' + webquiz_util.webquiz_debug(self.debugging, 'main: '+msg) + + def webquiz_error(self, msg, err=None): + r''' + Customised error messages for the Module + ''' + webquiz_util.webquiz_error(self.debugging, 'settings: '+msg, err) + + def __getitem__(self, key): + r''' + Return the value of the corresponding setting. That is, it returns + self.settings[key]['value'] + and an error if the key is unknown. + ''' + if key in self.settings: + return self.settings[key]['value'] + + self.webquiz_error('getitem: unknown setting "{}" in webquizrc.'.format(key)) + + def __setitem__(self, key, value): + r''' + Set the value of the corresponding setting. This is the equivalent of + self.settings[key]['value'] = value + and an error if the key is unknown. + ''' + if key in self.settings: + self.settings[key]['value'] = value + else: + self.webquiz_error('setitem: unknown setting "{}" in webquizrc'.format(key)) + + def read_webquizrc(self, rcfile, must_exist=False): + r''' + Read the settings from the specified webquizrc file - if it exists, in + which case set self.rcfile equal to this directory. If the file does + not exist then return without changing the current settings. + ''' + if os.path.isfile(rcfile): + try: + with codecs.open(rcfile, 'r', encoding='utf8') as webquizrc: + for line in webquizrc: + if '#' in line: # remove comments + line = line[:line.index('#')] + if '=' in line: + key, value = line.split('=') + key = key.strip().lower().replace('-','_') + value = value.strip() + if key in self.settings: + if value != self[key]: + self[key] = value + elif key != '': + self.webquiz_error('unknown setting "{}" in {}'.format(key, rcfile)) + + # record the rcfile for later use + self.rcfile = rcfile + + except OSError as err: + self.webquiz_error('there was a problem reading the rc-file {}'.format(rcfile), err) + + except Exception as err: + self.webquiz_error('there was an error reading the webquizrc file,', err) + + elif must_exist: + # this is only an error if we have been asked to read this file + self.webquiz_error('the rc-file "{}" does not exist'.format(rcfile)) + + def keys(self): + r''' + Return a list of keys for all settings, ordered alphabetically with the + advanced options last/ + ''' + return sorted(self.settings.keys(), key=lambda k: '{}{}'.format(self.settings[k]['advanced'], k)) + + def write_webquizrc(self): + r''' + Write the settings to the webquizrc file, defaulting to the user + rcfile if unable to write to the system rcfile + ''' + if not hasattr(self, 'rcfile'): + # when initialising an rcfile will not exist yet + self.rcfile = self.system_rcfile + + file_not_written = True + while file_not_written: + try: + dire = os.path.dirname(self.rcfile) + if dire != '' and not os.path.isdir(dire): + os.makedirs(dire, exist_ok=True) + with codecs.open(self.rcfile, 'w', encoding='utf8') as rcfile: + for key in self.keys(): + # Only save settings in the rcfile if they have changed + # Note that changed means changed from the last read + # rcfile rather than from the default (of course, the + # defaults serve as the "initial rcfile") + if key == 'version' or self.settings[key]['default']!=self[key]: + rcfile.write('# {}\n{:<17} = {}\n'.format( + self.settings[key]['help'], + key.replace('_','-'), + self[key]) + ) + + print('\nWebQuiz settings saved in {}\n'.format( self.rcfile)) + input('Press RETURN to continue... ') + file_not_written = False + + except (OSError, PermissionError) as err: + # if writing to the system_rcfile then try to write to user_rcfile + alt_rcfile = self.user_rcfile if self.rcfile != self.user_rcfile else self.system_rcfile + response = input( + webquiz_templates.rc_permission_error.format( + error=err, + rcfile=self.rcfile, + alt_rcfile=alt_rcfile)) + if response.startswith('2'): + self.rcfile = alt_rcfile + elif response.startswith('3'): + rcfile = input('WebQuiz rc-file: ') + print('\nTo access this rc-file you will need to use: webquiz --rcfile {} ...'.format(rcfile)) + self.rcfile = os.path.expanduser(rcfile) + elif not response.startswith('1'): + print('exiting...') + sys.exit(1) + + def list_settings(self, setting='all'): + r''' + Print the non-default settings for webquiz from the webquizrc + ''' + if not hasattr(self, 'rcfile'): + print(webquiz_templates.initialise_settings) + sys.exit(1) + + if setting not in ['all', 'verbose', 'help']: + setting = setting.replace('-', '_') + if setting in self.settings: + print(self.settings[setting]['value']) + else: + self.webquiz_error('{} is an invalid setting'.format(setting)) + + elif setting=='all': + dash = '-'*len('WebQuiz rc-file: {}'.format(self.rcfile)) + print('{dash}\nWebQuiz rc-file: {rcfile}\n{dash}'.format(rcfile=self.rcfile, dash=dash)) + for key in self.keys(): + print('{:<17} = {}'.format(key.replace('_', '-'), self[key])) + print('{dash}'.format(dash=dash)) + + elif setting=='help': + for key in self.keys(): + print('{:<17} {}'.format(key.replace('_', '-'), self.settings[key]['help'].lower())) + + else: + print('WebQuiz settings from {}'.format(self.rcfile)) + for key in self.keys(): + print('# {}{}\n{:<17} = {:<17} {}'.format( + self.settings[key]['help'], + ' (advanced)' if self.settings[key]['advanced'] else '', + key.replace('_', '-'), + self[key], + '(default)' if self[key]==self.settings[key]['default'] else '' + ) + ) + + def initialise_webquiz(self, need_to_initialise=False, developer=False): + r''' + Set the root for the WebQuiz web directory and copy the www files into + this directory. Once this is done save the settings to webquizrc. + This method should only be used when WebQuiz is being set up. + + If `need_to_initialise` is `True` then this is a forced initialisation. + ''' + + # keep track of whether we have initialised + self.have_initialised = True + + if need_to_initialise: + self.initialise_warning = webquiz_templates.web_initialise_warning + initialise = input(webquiz_templates.initialise_invite) + if initialise!='' and initialise.strip().lower()[0]!='y': + self['webquiz_url'] = 'http://www.maths.usyd.edu.au/u/mathas/WebQuiz' + return + + if self['webquiz_url']=='': + self['webquiz_url'] = '/WebQuiz' + + # prompt for directory and copy files - are these reasonable defaults + # for each OS? + if sys.platform == 'darwin': + default_root = '/Library/WebServer/Documents/WebQuiz' + platform = 'Mac OSX' + elif sys.platform.startswith('win'): + default_root = 'c:\inetpub\wwwroot\WebQuiz' + platform = 'Windows' + else: + default_root = '/var/www/html/WebQuiz' + platform = sys.platform.capitalize() + + if self['webquiz_www'] != '': + webquiz_root = self['webquiz_www'] + else: + webquiz_root = default_root + + print(webquiz_templates.initialise_introduction) + input('Press RETURN to continue... ') + + print(webquiz_templates.webroot_request.format( + platform=platform, + webquiz_dir = webquiz_root) + ) + input('Press RETURN to continue... ') + + files_copied = False + while not files_copied: + web_dir = input('\nWebQuiz web directory:\n[{}] '.format(webquiz_root)) + if web_dir == '': + web_dir = webquiz_root + else: + web_dir = os.path.expanduser(web_dir) + + print('Web directory set to {}'.format(web_dir)) + if web_dir=='SMS': + # undocumented: allow links to SMS web pages + self['webquiz_www'] = 'SMS' + self['webquiz_url'] = 'http://www.maths.usyd.edu.au/u/mathas/WebQuiz' + + else: + try: + # ...remove the doc directory + web_doc = os.path.join(web_dir, 'doc') + if os.path.isfile(web_doc) or os.path.islink(web_doc): + os.remove(web_doc) + elif os.path.isdir(web_doc): + shutil.rmtree(web_doc) + + # Need to locate the www directory, which should be a subdirectory + # of the webquiz doc directory. First try using texdoc + webquiz_doc = '' + try: + webquiz_pdf = webquiz_util.shell_command('texdoc --list --machine webquiz.pdf').split()[-1] + if webquiz_pdf.endswith('webquiz.pdf'): + webquiz_doc = os.path.dirname(webquiz_pdf) + except subprocess.CalledProcessError: + pass + + # if texdoc failed then try using TEXMFMAIN + if webquiz_doc=='': + try: + webquiz_doc = os.path.join(webquiz_util.kpsewhich('-var-value TEXMFMAIN'), 'doc','latex', 'webquiz') + except subprocess.CalledProcessError: + pass + + # if we still don't have webquiz_doc then try working backwards from webquiz.cls + # unlikely to work if TEXMFMAIN doesn't + if not os.path.isdir(webquiz_doc): + parent = os.path.dirname + try: + texdist_dir = parent(parent(parent(parent(parent(webquiz_util.kpsewhich('webquiz.cls')))))) + except subprocess.CalledProcessError: + print(webquiz_templates.not_installed.format(metadata.repository)) + sys.exit(1) + + webquiz_doc = os.path.join(texdist_dir, 'doc', 'latex', 'webquiz') + + # get the root directory of the source code for developer + # mode and just in case webquiz_www still does not exist + webquiz_src = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + + webquiz_www = os.path.join(webquiz_doc, 'www') + if not os.path.isdir(webquiz_www): + webquiz_www = os.path.join(webquiz_src, 'doc', 'www') + + if developer and os.path.isdir(os.path.join(webquiz_src, 'doc')): + # this is a development version so add links from the + # web directory to the css,doc and js directories + print('\nInstalling files for development version') + print('Linking web files {} -> {} ...\n'.format(web_dir, webquiz_src)) + if not os.path.exists(web_dir): + os.makedirs(web_dir) + + for (src, target) in [('javascript', 'js'), ('css', 'css'), ('doc', 'doc')]: + newlink = os.path.join(web_dir, target) + try: + os.remove(newlink) + except FileNotFoundError: + pass + try: + os.symlink(os.path.join(webquiz_src,src), newlink) + except OSError as err: + print('There was a problem linking {}: {}'.format(newlink, err)) + + else: + # loop until we find some files to install or exit + while not os.path.isdir(webquiz_www) or webquiz_www=='': + print('\nUnable to find the WebQuiz web files') + webquiz_www = input('Please enter the location of the WebQuiz www directory\nor press RETURN to exit: ') + webquiz_www = os.path.expanduser(webquiz_www) + if webquiz_www=='': + sys.exit() + if not (webquiz_www.endswith('www/') or webquiz_www.endswith('www')): + print('\nThe webquiz web directory is called www, so\n {}\ncannot be the right directory.'.format( + webquiz_www) + ) + webquiz_www = False + + + # the www directory exists so we copy it to web_dir + print('\nCopying web files to {} ...'.format(web_dir)) + webquiz_util.copytree(webquiz_www, web_dir) + + self['webquiz_www'] = web_dir + files_copied = True + + except PermissionError: + print(webquiz_templates.permission_error.format(web_dir)) + + except OSError as err: + print(webquiz_templates.oserror_copying.format(web_dir=web_dir, err=err)) + + if self['webquiz_www']!='SMS': + # now prompt for the relative url + webquiz_url = input(webquiz_templates.webquiz_url_message.format(self['webquiz_url'])) + if webquiz_url != '': + # removing trailing slashes from webquiz_url + while webquiz_url[-1] == '/': + webquiz_url = webquiz_url[:len(webquiz_url) - 1] + + if webquiz_url[0] != '/': # force URL to start with / + webquiz_url = '/' + webquiz_url + + if not web_dir.endswith(webquiz_url): + print(webquiz_templates.webquiz_url_warning) + input('Press RETURN to continue... ') + + self['webquiz_url'] = webquiz_url + + # save the settings and exit + self.write_webquizrc() + print(webquiz_templates.initialise_ending.format(web_dir=self['webquiz_www'])) + + def edit_settings(self): + r''' + Change current default values for the WebQuiz settings + ''' + advanced_not_started = True + for key in self.keys(): + if key not in ['webquiz_www', 'version']: + if advanced_not_started and self.settings[key]['advanced']: + print(webquiz_templates.advanced_settings) + advanced_not_started = False + + skey = '{}'.format(self[key]) + setting = input('{}{}[{}]: '.format( + self.settings[key]['help'], + ' ' if len(skey)<40 else '\n', + skey + ) + ).strip() + if setting != '': + if key == 'webquiz_url' and setting[0] != '/': + print(" ** prepending '/' to webquiz_url **") + setting = '/' + setting + + elif key == 'webquiz_layout': + setting = os.path.expanduser(setting) + if setting.endswith('.py'): + print(" ** removing .py extension from webquiz_layout **") + setting = setting[:-3] + + elif key == 'engine' and setting not in self.settings['engine'].values: + print('setting not changed: {} is not a valid TeX engine'.format(setting)) + setting = self['engine'] + + elif key in ['hide_side_menu', 'random_order']: + setting = setting.lower() + if setting not in ['true', 'false']: + print('setting not changed: {} must be True or False'.format(key)) + setting = self[key] + + elif setting=='NONE': + setting = '' + + self[key] = setting + + # save the settings, print them and exit + self.write_webquizrc() + self.list_settings() + + def tex_install(self): + r''' + Install the tex files into the standard locations in TEXMFMAIN: + scripts -> TEXMFMAIN/scripts/webquiz + doc -> TEXMFMAIN/doc/latex/webquiz + latex -> TEXMFMAIN/tex/latex/webquiz + It is assumed that this is run from the zipfile installation. There + is little in the way of error checking or debugging. + + Undocumented feature - useful for debugging initialisation routine + ''' + webquiz_top = os.path.abspath(webquiz_util.webquiz_file('..')) + texmf = webquiz_util.kpsewhich('-var-value TEXMFMAIN') + for (src, target) in [('scripts', 'scripts'), + ('latex', 'tex/latex'), + ('doc', 'doc/latex')]: + try: + webquiz_util.copytree(os.path.join(webquiz_top,src), os.path.join(texmf, target, 'webquiz')) + + except (FileExistsError,FileNotFoundError): + continue + + except PermissionError as err: + print(webquiz_templates.insufficient_permissions.format(err)) + sys.exit(1) + + try: + + # add a link to webquiz.py + texbin = os.path.dirname(shutil.which('pdflatex')) + if sys.platform.startswith('win'): + shutil.copyfile( + os.path.join(texmf,'scripts','webquiz','webquiz.bat'), + os.path.join(texbin, 'webquiz.bat') + ) + else: + os.symlink( + os.path.join(texmf,'scripts','webquiz','webquiz.py'), + os.path.join(texbin, 'webquiz') + ) + subprocess.call('mktexlsr', shell=True) + + except (FileExistsError,FileNotFoundError): + pass + + except PermissionError as err: + print(webquiz_templates.insufficient_permissions.format(err)) + sys.exit(1) + + except subprocess.CalledProcessError as err: + self.webquiz_error('There was a problem running mktexlsr', err) + + def tex_uninstall(self): + r''' + UnInstall the tex files into TEXMFMAIN. It is assumed that the files + are installed in the natural locations in the TEXMFMAIN tree, namely: + scripts -> TEXMFMAIN/scripts/webquiz + doc -> TEXMFMAIN/doc/latex/webquiz + latex -> TEXMFMAIN/tex/latex/webquiz + There is little in the way of error checking or debugging. + + Undocumented feature - useful for debugging initialisation routine + ''' + webquiz_top = os.path.abspath(webquiz_util.webquiz_file('..')) + texmf = webquiz_util.kpsewhich('-var-value TEXMFMAIN') + for target in ['scripts', 'tex/latex', 'doc/latex']: + try: + shutil.rmtree(os.path.join(texmf, target, 'webquiz')) + + except (FileExistsError,FileNotFoundError): + pass + + except PermissionError as err: + print(webquiz_templates.insufficient_permissions.format(err)) + sys.exit(1) + + try: + # remove link from texbin to webquiz.py + texbin = os.path.dirname(shutil.which('pdflatex')) + if sys.platform.startswith('win'): + os.remove(os.path.join(texbin, 'webquiz.bat')) + else: + os.remove(os.path.join(texbin, 'webquiz')) + + except (FileExistsError,FileNotFoundError): + pass + + except PermissionError as err: + print(webquiz_templates.insufficient_permissions.format(err)) + sys.exit(1) + + # remove any rcfiles that exist in obvious places + try: + if os.path.isfile(self.system_rcfile): + os.remove(self.system_rcfile) + if os.path.isfile(self.user_rcfile): + os.remove(self.user_rcfile) + if os.path.isfile(self.rcfile): + os.remove(self.rcfile) + except PermissionError: + print(webquiz_templates.insufficient_permissions.format(err)) + sys.exit(1) + + # remove link to webquiz.py + texbin = os.path.dirname(shutil.which('pdflatex')) + try: + if sys.platform.startswith('win'): + webquiz = os.path.join(texbin, 'webquiz.bat') + os.remove(webquiz) + else: + webquiz = os.path.join(texbin,'webquiz') + target = os.readlink(webquiz) + if target==os.path.join(texmf,'scripts','webquiz','webquiz.py'): + os.remove(webquiz) + + except (FileExistsError,FileNotFoundError): + pass + + except OSError as err: + print('There was a problem removing the link to webquiz: {}'.format(err)) + + def uninstall_webquiz(self): + r''' + Remove all of the webquiz files from the webserver + ''' + + if os.path.isdir(self['webquiz_www']): + remove = input('Do you really want to remove the WebQuiz from your web server [N/yes]? ') + if remove != 'yes': + print('WebQuiz unistall aborted!') + return + + try: + shutil.rmtree(self['webquiz_www']) + print('WebQuiz files successfully removed from {}'.format(self['webquiz_www'])) + + except PermissionError as err: + print(webquiz_templates.insufficient_permissions.format(err)) + sys.exit(1) + + except OSError as err: + self.webquiz_error('There was a problem removing webquiz files from {}'.format(self['webquiz_www']), err) + + # now reset and save the locations of the webquiz files and URL + self['webquiz_url'] = '' + self['webquiz_www'] = '' + self.write_webquizrc() + + else: + self.webquiz_error('uninstall: no webwquiz files are installed on your web server??') + + for rfile in ['system', 'user']: + rcfile = getattr(self, rfile+'_rcfile') + if os.path.isfile(rcfile): + rm = input('Remove {} rcfile {}\n[Y/no] '.format(rfile, rcfile)) + if rm != 'no': + try: + os.remove(rcfile) + except (OSError, PermissionError) as err: + self.webquiz_error('There was a problem deleting {}'.format(rcfile), err) + + +# ===================================================== +if __name__ == '__main__': + try: + settings = WebQuizSettings() + + # parse the command line options + parser = argparse.ArgumentParser(description=metadata.description) + + parser.add_argument( + 'quiz_file', + nargs='*', + type=str, + default=None, + help='latex quiz files') + + parser.add_argument( + '-q', + '--quiet', + action='count', + default=0, + help='Suppress tex4ht messages (also -qq etc)') + + parser.add_argument( + '-d', '--draft', + action='store_true', + default=False, + help='Use make4ht draft mode') + + parser.add_argument( + '-s', + '--shell-escape', + action='store_true', + default=False, + help='Shell escape for tex4ht/make4ht') + + engine = parser.add_mutually_exclusive_group() + engine.add_argument( + '--latex', + action='store_const', + const='latex', + default=settings['engine'], + dest='engine', + help='Use latex to compile document with make4ht (default)') + engine.add_argument( + '-l', + '--lua', + action='store_const', + const='lua', + dest='engine', + help='Use lualatex to compile the quiz') + engine.add_argument( + '-x', + '--xelatex', + action='store_const', + const='xelatex', + dest='engine', + help='Use xelatex to compile the quiz') + + parser.add_argument( + '-r', + '--rcfile', + action='store', + default=None, + help='Specify location of the webquiz rc-file ') + + settings_parser = parser.add_mutually_exclusive_group() + settings_parser.add_argument( + '-i', + '--initialise', + '--initialize', + action='store_true', + default=False, + help='Install web components of webquiz') + settings_parser.add_argument( + '-e', '--edit-settings', + action='store_true', + default=False, + help='Edit default settings for webquiz') + settings_parser.add_argument( + '--settings', + action='store', + const='all', + default='', + nargs='?', + type=str, + help='List default settings for webquiz' + ) + settings_parser.add_argument( + '--developer', + action='store_true', + default=False, + help=argparse.SUPPRESS + ) + + # options suppressed from the help message + parser.add_argument( + '-m', + '--make4ht', + action='store', + type=str, + dest='make4ht_options', + default=settings['make4ht'], + help=argparse.SUPPRESS + ) + + parser.add_argument( + '--webquiz_layout', + action='store', + type=str, + dest='webquiz_layout', + default=settings['webquiz_layout'], + help=argparse.SUPPRESS + ) + + install_parser = parser.add_mutually_exclusive_group() + install_parser.add_argument( + '--tex-install', + action='store_true', + default=False, + help=argparse.SUPPRESS + ) + install_parser.add_argument( + '--tex-uninstall', + action='store_true', + default=False, + help=argparse.SUPPRESS + ) + install_parser.add_argument( + '--uninstall', + action='store_true', + default=False, + help=argparse.SUPPRESS + ) + + parser.add_argument( + '--version', + action='version', + version='%(prog)s version {}'.format(metadata.version), + help=argparse.SUPPRESS) + + parser.add_argument( + '--debugging', + action='store_true', + default=False, + help=argparse.SUPPRESS) + + parser.add_argument( + '--shorthelp', + action='store_true', + default=False, + help=argparse.SUPPRESS + ) + + # parse the options + options = parser.parse_args() + options.prog = parser.prog + + # set debugging mode from options + settings.debugging = options.debugging + + # read the rcfile and throw an error if we are not adjusting the settings + if options.rcfile is not None: + rcfile = os.path.expanduser(options.rcfile) + settings.read_webquizrc(rcfile) + + if options.uninstall: + # uninstall web files and exit + settings.uninstall_webquiz() + sys.exit() + elif options.tex_install: + # install files from zip file into tex distribution and then exit + settings.tex_install() + sys.exit() + elif options.tex_uninstall: + # install files from zip file into tex distribution and then exit + settings.tex_uninstall() + sys.exit() + + # initialise and exit + if options.initialise or options.developer: + settings.initialise_webquiz(developer=options.developer) + + # force initialisation if the url is not set + elif settings['webquiz_url'] == '': + settings.initialise_webquiz(need_to_initialise=True) + + # list settings and exit + if options.settings != '': + settings.list_settings(options.settings) + sys.exit() + + # edit settings and exit + if options.edit_settings: + settings.edit_settings() + sys.exit() + + # print short help and exit + if options.shorthelp: + parser.print_usage() + sys.exit() + + # if no filename then exit + if options.quiz_file==[]: + if settings.have_initialised: + sys.exit() + else: + parser.print_help() + sys.exit(1) + + # import the local page formatter + mod_dir, mod_layout = os.path.split(options.webquiz_layout) + if mod_dir != '': + sys.path.insert(0, mod_dir) + options.write_web_page = __import__(mod_layout).write_web_page + + # run() is a shorthand for executing system commands depending on the quietness + # - we need to use shell=True because otherwise pst2pdf gives an error + # options.talk() is a shorthand for letting the user know what is happening + if options.quiet == 0: + options.run = webquiz_util.run + options.talk = lambda msg: print(msg) + elif options.quiet == 1: + options.run = webquiz_util.quiet_run + options.talk = lambda msg: print(msg) + else: + options.run = webquiz_util.silent_run + options.talk = lambda msg: None + + # run through the list of quizzes and make them + for quiz_file in options.quiz_file: + if len(options.quiz_file) > 1 and options.quiet < 3: + print('Making web page for {}'.format(quiz_file)) + + quiz_name, ext = os.path.splitext(quiz_file) # extract filename and extension + # quiz_file is assumed to be a tex file if no extension is given + if ext=='': + ext = '.tex' + quiz_file += ext + + # windows likes adding a prefix of '.\\'to filename and this causes havoc with latex + if os.path.dirname(quiz_file)=='.': + quiz_file = os.path.basename(quiz_file) + + if ext not in ['.tex', '.xml']: + webquiz_util.webquiz_error(True, 'unrecognised file extension {}'.format(ext)) + + if not os.path.isfile(quiz_file): + webquiz_util.webquiz+error(True, 'WebQuiz error: cannot read file {}'.format(quiz_file)) + + # the quiz name and the quiz_file will be different if pst2pdf is used + quiz_name = quiz_file + if options.quiet < 2: + print('WebQuiz generating web page for {}'.format(quiz_file)) + + options.pst2pdf = False + if ext==".tex": + # If the pst2pdf option is used then we need to preprocess + # the latex file BEFORE passing it to MakeWebQuiz. Set + # options.pst2pdf = True if pst2pdf is given as an option to + # the webquiz documentclass + with codecs.open(quiz_file, 'r', encoding='utf8') as q_file: + doc = q_file.read() + + try: + brac = doc.index(r'\documentclass[') + 15 # start of class options + if 'pst2pdf' in [ + opt.strip() + for opt in doc[brac:brac+doc[brac:].index(']')].split(',') + ]: + preprocess_with_pst2pdf(options, quiz_file[:-4]) + options.pst2pdf = True + # now run webquiz on the modified tex file + quiz_file = quiz_file[:-4] + '-pdf-fixed.tex' + except ValueError: + pass + + # the file exists and is readable so make the quiz + webquiz_makequiz.MakeWebQuiz(quiz_name, quiz_file, options, settings, metadata) + + quiz_name, ext = os.path.splitext(quiz_name) # extract filename and extension + + # move the css file into the directory for the quiz + css_file = os.path.join(quiz_name, quiz_name + '.css') + if os.path.isfile(quiz_name + '.css'): + if os.path.isfile(css_file): + os.remove(css_file) + shutil.move(quiz_name + '.css', css_file) + + # now clean up unless debugging + if not options.debugging: + for ext in ['4ct', '4tc', 'dvi', 'idv', 'lg', 'log', + 'ps', 'pdf', 'tmp', 'xml', 'xref' + ]: + if os.path.isfile(quiz_name + '.' + ext): + os.remove(quiz_name + '.' + ext) + + # files created when using pst2pdf + if options.pst2pdf: + for file in glob.glob(quiz_name + '-pdf.*'): + os.remove(file) + for file in glob.glob(quiz_name + '-pdf-fixed.*'): + os.remove(file) + for extention in ['.preamble', '.plog', '-tmp.tex', + '-pst.tex', '-fig.tex' + ]: + if os.path.isfile(quiz_name + extention): + os.remove(quiz_name + extention) + if os.path.isdir(os.path.join(quiz_name, quiz_name)): + shutil.rmtree(os.path.join(quiz_name, quiz_name)) + + if settings.initialise_warning != '' and not settings.have_initialised: + print(webquiz_templates.text_initialise_warning) + + except Exception as err: + + # there is a small chance that there is an error before the + # settings.debugging flag has been set + webquiz_util.webquiz_error(settings.debugging if 'settings' in globals() else True, + 'unknown problem.\n\nIf you think this is a bug please report it by creating an issue at\n {}\n' + .format(metadata.repository), err) diff --git a/macros/latex/contrib/webquiz/scripts/webquiz_layout.py b/macros/latex/contrib/webquiz/scripts/webquiz_layout.py new file mode 100644 index 0000000000..19130b7afe --- /dev/null +++ b/macros/latex/contrib/webquiz/scripts/webquiz_layout.py @@ -0,0 +1,73 @@ +r''' +----------------------------------------------------------------------------- + webquiz_local | default layout of webquiz quiz pages. +----------------------------------------------------------------------------- + + Copyright (C) Andrew Mathas, University of Sydney + + Distributed under the terms of the GNU General Public License (GPL) + http://www.gnu.org/licenses/ + + This file is part of the WebQuiz system. + + <Andrew.Mathas@sydney.edu.au> +----------------------------------------------------------------------------- +''' + +# -*- encoding: utf-8 -*- + +from webquiz_templates import no_script + +# If you want to create a new version of this file to change the +# quiz web page layout then the following "dictionary" of code variables +# is likely to be useful: +# quiz.breadcrumbs = HTML for breadcrunbs +# quiz.css = css includes for quisz +# quiz.department = department from \UnitDepartment +# quiz.department_url = unit url from \UnitURL +# quiz.header = header links for quiz +# quiz.institution = institution from \Institution +# quiz.institution_url = unit url from \InstitutionURL +# quiz.javascript = javascript includes for quiz +# quiz.quiz_header = HTMK for quiz title and navigation arrows +# quiz.quiz_questions = html for quiz +# quiz.side_menu = HTML for side menu, including navigation buttons +# quiz.title = web page title from \title{...} command +# quiz.unit_code = unit code from \UnitCode +# quiz.unit_name = unit name from \UnitName +# quiz.unit_url = unit url from \UnitURL +# quiz.webquiz_init = javascript for initialising quiz page +# MUST appear towards the end of HTML body + +def write_web_page(quiz): + return quiz_page.format( + title=quiz.quiz.title, # page title + htmlpreamble=quiz.header + quiz.javascript + quiz.css, # header material + breadcrumbs=quiz.breadcrumbs, # bread crumb constructed above + side_menu=quiz.side_menu, # navigation menu for quiz + quiz_header=quiz.quiz_header, # quiz title + navigation arrows + quiz_questions=quiz.quiz_questions, # html for quiz + no_script=no_script, # error when javascript is not enabled + webquiz_init=quiz.webquiz_init # parting javascript callsWebQuizInt + ) + + +quiz_page = r'''<!DOCTYPE HTML> +<html lang="en"> +<head> + <title> {title} </title> + {htmlpreamble} +</head> +<body> + {no_script}{breadcrumbs} + <div class="quiz-page"> + {side_menu} + <div class="quiz-questions"> + {quiz_header} + {quiz_questions} + </div> + </div> + {webquiz_init} +</body> +</html> +''' diff --git a/macros/latex/contrib/webquiz/scripts/webquiz_makequiz.py b/macros/latex/contrib/webquiz/scripts/webquiz_makequiz.py new file mode 100644 index 0000000000..5f9e66f61b --- /dev/null +++ b/macros/latex/contrib/webquiz/scripts/webquiz_makequiz.py @@ -0,0 +1,550 @@ +#!/usr/bin/env python3 +r''' +------------------------------------------------------------------------------ + webquiz_makequiz | build and generate the quiz page using webquiz_xml + | and webquiz_layout +------------------------------------------------------------------------------ + Copyright (C) Andrew Mathas, University of Sydney + + Distributed under the terms of the GNU General Public License (GPL) + http://www.gnu.org/licenses/ + + This file is part of the WebQuiz system. + + <Andrew.Mathas@sydney.edu.au> + <Donald.Taylor@sydney.edu.au> +------------------------------------------------------------------------------ +''' +import subprocess +import codecs +import shutil +import os +import re + +import webquiz_templates +import webquiz_util +import webquiz_xml + +################################################################################# +class MakeWebQuiz(object): + """ + Convert a webquiz latex file to an online quiz. + + There are several steps: + 1. If given a LaTeX file then run htlatex/make4ht on the latex file to generate an + xml file for the quiz that has all LaTeS markup converted to html. + 2. Read in the xml file version of the quiz + 3. Spit out the html version + + The HTMl is constructed using the template strings in webquiz_templates + """ + # attributes that will form part of the generated web page + header = '' # page header: title, meta data, links + css = '' # css specifications + javascript = '' # javascript code + quiz_questions = '' # the main quiz page + side_menu = '' # the left hand quiz menu + + def __init__(self, quiz_name, quiz_file, options, settings, metadata): + self.options = options + self.settings = settings + self.metadata = metadata + self.quiz_file, extension = os.path.splitext(quiz_file) + self.quiz_name = os.path.basename(self.quiz_file) + self.webquiz_url = settings['webquiz_url'] + if self.webquiz_url[-1] == '/': + self.webquiz_url = self.webquiz_url[:len(self.webquiz_url)-1] + + # run htlatex only if quiz_file has a .tex extension + if extension == '.tex': + self.htlatex_quiz_file() + + self.read_xml_file() + + # use kpsewhich to fine the webquiz language file + try: + language_file = webquiz_util.kpsewhich('webquiz-{}.lang'.format(self.quiz.language)) + except subprocess.CalledProcessError: + self.webquiz_error( + 'kpsewhich is unable to find language file for "{}"'.format(self.quiz.language) + ) + # read the language file and store as a dictonary + self.language = webquiz_util.MetaData(language_file) + + # initialise number of quiz and discussion items + self.number_discussions = len(self.quiz.discussion_list) + self.number_questions = len(self.quiz.question_list) + + # build the different components of the quiz web page + self.add_meta_data() + self.add_question_javascript() + self.add_side_menu() + self.add_quiz_header_and_questions() + self.add_breadcrumbs() + + # add the initialisation warning if webquiz has not been initialised + if self.settings.initialise_warning != '': + self.breadcrumbs = self.settings.initialise_warning + self.breadcrumbs + + # now write the quiz to the html file + with codecs.open(self.quiz_name + '.html', 'w', encoding='utf8') as file: + # write the quiz in the specified format + file.write(self.options.write_web_page(self)) + + def webquiz_debug(self, msg): + r''' + Customised debugging message for the makequiz module + ''' + webquiz_util.webquiz_debug(self.settings.debugging, 'makequiz: '+msg) + + def webquiz_error(self, msg, err=None): + r''' + Customised eror message for the makequiz module + ''' + webquiz_util.webquiz_error(self.settings.debugging, 'makequiz: '+msg, err) + + def add_breadcrumbs(self): + r''' + Build the breadcrumbs by appropriately parsing the magic crumbs + ''' + self.breadcrumbs = '' + if self.quiz.breadcrumbs != '': + # build the bread crumbs + crumbs = '\n ' + for crumb in self.quiz.breadcrumbs.split('|'): + crumb = crumb.strip() + + if crumb == 'breadcrumb': + crumbs += self.add_breadcrumb_line(self.quiz.breadcrumb, missing='breadcrumb') + + elif crumb == 'department': + crumbs += self.add_breadcrumb_line( + text=self.quiz.department, + url=self.quiz.department_url, + missing='department') + + elif crumb == 'institution': + crumbs += self.add_breadcrumb_line( + text=self.quiz.institution, + url=self.quiz.institution_url, + missing='institution') + + elif crumb == 'quizindex': + if self.quiz.quiz_index == []: + crumbs += webquiz_templates.breadcrumb_quizindex.format( + quizzes_url=self.quiz.quizzes_url, + **self.language) + else: + crumbs += self.add_breadcrumb_line('Quizzes') + + elif crumb == 'Title': + crumbs += self.add_breadcrumb_line(text = self.quiz.title, missing='title') + + elif crumb == 'title': + title = self.quiz.title + crumbs += self.add_breadcrumb_line( + text = title[:title.index(':')] if ':' in title else title, + missing='title' + ) + + elif crumb == 'unitcode': + crumbs += self.add_breadcrumb_line( + text=self.quiz.unit_code, + url=self.quiz.unit_url, + missing='unit code') + + elif crumb == 'unitname': + crumbs += self.add_breadcrumb_line( + text=self.quiz.unit_name, + url=self.quiz.unit_url, + missing='unit name') + + elif crumb != '': + lastSpace = crumb.rfind(' ') + url = crumb[lastSpace:].strip() + if url[0] == '/' or url.lower()[:4] == 'http': + crumbs += self.add_breadcrumb_line(text=crumb[:lastSpace], url=url) + else: + crumbs += self.add_breadcrumb_line(crumb) + + self.breadcrumbs = webquiz_templates.breadcrumbs.format(crumbs=crumbs) + + def add_breadcrumb_line(self, text, url='', missing='??'): + r''' + Return a line to add the bread crumbs, with errors if necessary + ''' + if url == '': + return webquiz_templates.breadcrumb_line_text.format( + text=text if text != '' else '?? ' + missing) + + return webquiz_templates.breadcrumb_line_url.format( + url=url, text=text if text != '' else '?? ' + missing) + + def htlatex_quiz_file(self): + r''' + Process the file using htlatex/make4ht. This converts the quiz to an xml + with markup specifying the different elements of the quiz page. + ''' + # at the minimum we put a css file into a <quiz_name> subdirectory + if not os.path.exists(self.quiz_name): + os.makedirs(self.quiz_name) + + try: + self.options.talk('Processing {}.tex with TeX4ht'.format(self.quiz_name)) + # there is a slightly torturous process to convert the engine + # settings into a command line option that make4ht understands + cmd = 'make4ht --utf8 --config webquiz.cfg {draft} {engine} {escape} {make4ht_options} {quiz_file}.tex'.format( + draft='--mode draft' if self.options.draft else '', + engine=self.settings.settings['engine']['values'][self.options.engine], + escape='--shell-escape' if self.options.shell_escape else '', + make4ht_options=self.options.make4ht_options, + quiz_file=self.quiz_file + ) + self.options.run(cmd) + + # move the css file into the quiz_file subdirectory + if os.path.exists(self.quiz_file + '.css'): + shutil.move( + self.quiz_file + '.css', + os.path.join(self.quiz_name, self.quiz_name + '.css')) + + # Now move any images that were created into the quiz_name + # subdirectory and update the links in the html file As htlatex + # generates an html file, we rename this as an xml file at the same + # time - in the cfg file, \Preamable{ext=xml} should lead to an xml + # file being created but this doesn't seem to work ?? + try: + fix_img = re.compile(r'^(|.* )\b(data|src)="([-0-9a-zA-Z]*\.(?:png|svg))" (.*)$') + with codecs.open(self.quiz_file + '.html', 'r', encoding='utf8') as make4ht_file: + with codecs.open(self.quiz_name + '.xml', 'w', encoding='utf8') as xml_file: + for line in make4ht_file: + match = fix_img.match(line) + if match is None: + xml_file.write(line) + else: + # update html link and move file + start, src, image, rest_of_line = match.groups() + xml_file.write(r'{}{}="{}/{}" {}'.format( + start, src, self.quiz_name, image, rest_of_line)) + shutil.move(image, os.path.join(self.quiz_name, image)) + + except OSError as err: + self.webquiz_error( + 'there was a problem moving the image files for {}'.format( + self.quiz_name), err) + + except Exception as err: + self.webquiz_error( 'something went wrong when running htlatex on {}'.format(self.quiz_file), err) + + def read_xml_file(self): + r''' + Read in the webquiz xml file for the quiz and store the xml document + tree in ``self.quiz``. + ''' + try: + # read in the xml version of the quiz + if not os.path.isfile(self.quiz_name + '.xml'): + self.webquiz_error('{}.xml does not exist!?'.format(self.quiz_name)) + self.quiz = webquiz_xml.ReadWebQuizXmlFile(self.quiz_name + '.xml', self.settings) + except Exception as err: + self.webquiz_error('error reading the xml generated for {}. Please check your latex source.' + .format(self.quiz_name), err) + + def add_meta_data(self): + """ add the meta data for the web page to self.header """ + # meta tags` + self.header += webquiz_templates.html_meta.format( + version=self.metadata.version, + authors=self.metadata.authors, + webquiz_url=self.webquiz_url, + description=self.metadata.description, + copyright=self.metadata.copyright, + department=self.quiz.department, + institution=self.quiz.institution, + quiz_file=self.quiz_name, + theme=self.quiz.theme) + if self.quiz.mathjs: + self.header += webquiz_templates.mathjs + + def add_side_menu(self): + """ construct the left hand quiz menu """ + if self.quiz.discussion_list != []: # links for discussion items + discussion_list = '\n <ul>\n {}\n </ul>'.format( + '\n '.join( + webquiz_templates.discuss.format(b=q + 1, title=d.short_heading) + for (q, d) in enumerate(self.quiz.discussion_list))) + else: + discussion_list = '' + + # department and institution links + department = '''<a href="{0.department_url}">{0.department}</a>'''.format(self.quiz) + institution = '''<a href="{0.institution_url}">{0.institution}</a>'''.format(self.quiz) + + # question buttons + if self.number_questions == 0: + question_buttons = '' + else: + buttons = '\n' + '\n'.join( + webquiz_templates.button.format(b=q, + cls='button-selected' if self.quiz.discussion_list==[] and q==1 else 'blank' + ) + for q in range(1, self.number_questions + 1)) + question_buttons=webquiz_templates.question_buttons.format( + buttons=buttons, **self.language + ) + + # the full side menu + self.side_menu = webquiz_templates.side_menu.format( + discussion_list=discussion_list, + version=self.metadata.version, + department=department, + institution=institution, + side_questions=self.language['questions'] if self.number_questions>0 else '', + question_buttons=question_buttons, + copyright_years=self.metadata.copyright[:self.metadata.copyright.index(' ')], + **self.language) + + def add_question_javascript(self): + """ + Add the javascript for the questions to self and write the javascript + initialisation file, <quiz>/quiz_specs.js, for the quiz. When the quiz + page is loaded, WebQuizInit reads the quiz_specs initialisation file to + load the answers to the questions, and the headers for the discussion + items. We don't explicitly list quiz_specs.js in the meta data for the + quiz page because we want to hide this information from the student, + although they can easily get this if they open by the javascript + console and know what to look for. + """ + + try: + os.makedirs(self.quiz_name, exist_ok=True) + os.chmod(self.quiz_name, mode=0o755) + with codecs.open(os.path.join(self.quiz_name, 'wq-' + self.quiz_name + '.js'), 'w', + encoding='utf8') as quiz_specs: + if self.number_discussions > 0: + for (i, d) in enumerate(self.quiz.discussion_list): + quiz_specs.write('Discussion[{}]="{}";\n'.format(i+1, d.heading)) + if self.number_questions > 0: + for (i, question) in enumerate(self.quiz.question_list): + # QuizSpecifications is a 0-based array + quiz_specs.write('QuizSpecifications[{}]=[];\n'.format(i+1)) + quiz_specs.write('QuizSpecifications[{}].type="{}";\n'.format(i+1, question.type)) + if question.type == 'input': + quiz_specs.write('QuizSpecifications[{}].value="{}";\n'.format(i+1, + question.answer.lower() if question.comparison=='lowercase' + else question.answer + ) + ) + quiz_specs.write('QuizSpecifications[{}].comparison="{}";\n'.format(i+1, question.comparison)) + else: + quiz_specs.write(''.join( + 'QuizSpecifications[{}][{}]={};\n'.format(i+1, j, s.correct) + for (j, s) in enumerate(question.items) + ) + ) + + if self.quiz.hide_side_menu: + quiz_specs.write('toggle_side_menu();\n') + if self.quiz.one_page: + quiz_specs.write('onePage = true;\n') + if self.quiz.random_order: + quiz_specs.write('shuffleQuestions();\n') + quiz_specs.write('initSession();\n') + if self.number_discussions+self.number_questions>0: + quiz_specs.write('gotoQuestion({});'.format( + -1 if self.number_discussions>0 else 1) + ) + + except Exception as err: + self.webquiz_error('error writing quiz specifications', err) + + self.javascript = webquiz_templates.questions_javascript.format( + webquiz_url=self.webquiz_url, + mathjax=self.settings['mathjax'] + ) + self.webquiz_init = webquiz_templates.webquiz_init.format( + number_questions=self.number_questions, + number_discussions=self.number_discussions, + quiz_file=self.quiz_name, + ) + + def add_quiz_header_and_questions(self): + r''' + Write the quiz head and the main body of the quiz. + ''' + if self.quiz.one_page: + arrows = '' + else: + arrows = webquiz_templates.navigation_arrows.format( + question_number=self.quiz.discussion_list[0].heading + if self.quiz.discussion_list != [] + else '1' if self.quiz.question_list > [] + else '', + **self.language + ) + + # specify the quiz header - this will be wrapped in <div class="question-header>...</div> + self.quiz_header = webquiz_templates.quiz_header.format( + title=self.quiz.title, + arrows=arrows, + **self.language + ) + + # index for quiz + if self.quiz.quiz_index != []: + # add index to the web page + self.quiz_questions += webquiz_templates.quiz_index_div.format( + title=self.quiz.title if self.quiz.title!='' else self.quiz.unit_name, + quiz_index='\n '.join( + webquiz_templates.index_item.format( + url=q.url, + title='{} {}. {}'.format(self.language['quiz'],num+1,q.title) + if q.prompt else q.title, + ) for (num, q) in enumerate(self.quiz.quiz_index)), + **self.language) + # write a javascript file for displaying the menu + # quizmenu = the index file for the quizzes in this directory + with codecs.open('quizindex.js', 'w', encoding='utf8') as quizmenu: + quizmenu.write('var QuizTitles = [\n{titles}\n];\n'.format( + titles=',\n'.join(" ['{}', '{}']".format( + '{} {}. {}'.format(self.language['quiz'],num+1,q.title) + if q.prompt else q.title, + q.url) + for (num,q) in enumerate(self.quiz.quiz_index)) + ) + ) + quizmenu.write(webquiz_templates.create_quizindex_menu) + + # now comes the main page text + # discussion(s) masquerade as negative questions + if self.quiz.discussion_list != []: + dnum = 0 + for d in self.quiz.discussion_list: + dnum += 1 + self.quiz_questions += webquiz_templates.discussion.format( + dnum=dnum, + discussion=d, + display='inline' if self.quiz.one_page else 'none', + heading=webquiz_templates.discussion_heading.format(d.heading) + if self.quiz.one_page else '' + ) + + # finally we print the questions + if self.quiz.question_list != []: + self.quiz_questions += ''.join( + webquiz_templates.question_wrapper.format( + qnum=qnum + 1, + question_number='{} {}. '.format(self.language.question, qnum+1) + if self.quiz.one_page else '', + display='inline' if self.quiz.one_page else 'none', + question=self.print_question(quiz_question, qnum + 1), + feedback=self.print_feedback(quiz_question, qnum + 1) + ) + for (qnum, quiz_question) in enumerate(self.quiz.question_list)) + + def print_question(self, question, qnum): + r'''Here: + - question is the question + - qnum is the number of the question + ''' + if question.type == 'input': + self.webquiz_debug('Q{}: after_text={}.'.format(qnum, question.after_text)) + question_options = webquiz_templates.input_answer.format( + size=5+len('{}'.format(question.answer)), + after_text=question.after_text, + qnum=qnum, + answer=self.language['answer']+':' if question.prompt else '' + ) + elif question.type in ['single', 'multiple']: + question_options = webquiz_templates.choice_answer.format( + after_text=question.after_text, + choices='\n'.join(self.print_choices(qnum, question, choice) + for choice in range(len(question.items))) + ) + else: + self.webquiz_error('Unknown question type "{}" in question {}'.format(question.type, qnum)) + return webquiz_templates.question_text.format( + qnum=qnum, + question_text=question.text, + nextquestion='' if self.quiz.one_page else webquiz_templates.nextquestion.format(**self.language), + question_options=question_options, + **self.language) + + def print_choices(self, qnum, question, part): + r''' + Here: + - qnum = question number + - question = current question + - part = number of the option we need to process. + We put the parts into question.columns multicolumn format, so we have + to add '<tr>' and '</tr>' tags depending on part. + ''' + choice = question.items[part] + item = '<tr>' if question.columns == 1 or (part % question.columns) == 0 else '<td> </td>' + if question.type == 'single': + item += webquiz_templates.single_item.format(choice=choice.symbol, qnum=qnum, text=choice.text) + elif question.type == 'multiple': + item += webquiz_templates.multiple_item.format( + choice=choice.symbol, + qnum=qnum, + optnum=part, + text=choice.text + ) + else: + item += '<!-- internal error: %s -->\n' % question.type + self.webquiz_error('Unknown question type "{}" in question {}'.format(question.type, qnum)) + + if question.columns == 1 or (part+1) % question.columns == 0 or part == len(question.items) - 1: + item += ' </tr><!-- part={}, cols={}, # answers = {} -->\n'.format( + part, question.columns, len(question.items)) + return item + + def print_feedback(self, question, qnum): + r''' + Generate the HTML for displaying the feedback help text when the user + answers a question. + ''' + if question.type == 'input': + feedback = webquiz_templates.tf_feedback_text.format( + choice=qnum, + feedback='true', + correct_answer=self.language.correct, + answer2='', + text=question.feedback_right) + feedback += webquiz_templates.tf_feedback_text.format( + choice=qnum, + feedback='false', + correct_answer=self.language.incorrect, + answer2=self.language.try_again, + text=question.feedback_wrong) + elif question.type == "single": + feedback = '\n' + '\n'.join( + webquiz_templates.single_feedback.format( + qnum=qnum, + part=snum + 1, + correct_answer=self.language.correct if s.correct == 'true' else self.language.incorrect, + alpha_choice=self.language.choice.format(s.symbol), + feedback=s.feedback, + **self.language) + for (snum, s) in enumerate(question.items)) + elif question.type == "multiple": + feedback = '\n' + '\n'.join(webquiz_templates.multiple_feedback.format( + qnum=qnum, + part=snum + 1, + correct_answer=getattr(self.language, s.correct).capitalize(), + feedback=s.feedback, + multiple_choice_opener=self.language.multiple_incorrect. + format(s.symbol), + **self.language) + for (snum, s) in enumerate(question.items) + ) + feedback += webquiz_templates.multiple_feedback_correct.format( + qnum=qnum, + feedback='\n'.join(webquiz_templates.multiple_feedback_answer.format( + correct_answer=getattr(self.language, s.correct).capitalize(), + reason=s.feedback) for s in question.items), + **self.language) + else: + self.webquiz_error('Unknown question type "{}" in question {}'.format(question.type, qnum)) + + return '<div class="answer">' + feedback + '</div>' diff --git a/macros/latex/contrib/webquiz/scripts/webquiz_templates.py b/macros/latex/contrib/webquiz/scripts/webquiz_templates.py new file mode 100644 index 0000000000..ea86df2039 --- /dev/null +++ b/macros/latex/contrib/webquiz/scripts/webquiz_templates.py @@ -0,0 +1,408 @@ +r''' +----------------------------------------------------------------------- + webquiz_templates | html template file +----------------------------------------------------------------------- + + Copyright (C) Andrew Mathas, University of Sydney + + Distributed under the terms of the GNU General Public License (GPL) + http://www.gnu.org/licenses/ + + This file is part of the WebQuiz system. + + <Andrew.Mathas@sydney.edu.au> +---------------------------------------------------------------------- +''' + +# -*- encoding: utf-8 -*- + +## The quiz web pages are built using the following "template" strings + +# html meta statements +html_meta = r'''<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta name="viewport" content="width=device-width,initial-scale=1.0"> + <meta name="generator" content="WebQuiz {version} (http://www.maths.usyd.edu.au/u/mathas/WebQuiz/webquiz-online-manual.html)"> + <meta name="description" content="{description}"> + <meta name="authors" content="WebQuiz: {authors}"> + <meta name="organization" content="{department}, {institution}"> + <meta name="Copyright" content="WebQuiz: {copyright}"> + <meta name="keywords" content="WebQuiz, TeX4ht, make4ht, latex, python, quiz, mathematics"> + <link href="{webquiz_url}/css/webquiz-{theme}.css" type="text/css" rel="stylesheet"> + <link href="{quiz_file}/{quiz_file}.css" type="text/css" rel="stylesheet"> +''' + +# javascript for setting up the questions +questions_javascript = r''' <script src="{webquiz_url}/js/webquiz.js"></script> + <script defer src="{mathjax}?config=MML_CHTML"></script>''' + +mathjs=r' <script defer src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/5.4.0/math.min.js"></script>' + +webquiz_init = r'''<div style="display: none;"> + <script src="quizindex.js"></script> + <script>WebQuizInit({number_questions}, {number_discussions}, '{quiz_file}');</script> + </div>''' + +# Bread crumbs including a drop down menu for all of the quizzes for the unit. +# The drop-down-menu is added by create_quizindex_menu() in webquiz.js +breadcrumb_line_text = ' <li>{text}</li>\n' +breadcrumb_line_url = ' <li><a href="{url}">{text}</a></li>\n' +breadcrumb_quizindex = r''' <li><a href="{quizzes_url}">{quizzes}</a> + <span onclick="toggle_quizindex_menu();" id="quizzes-menu-icon"></span> + <ul id="quizindex-menu" onclick="toggle_quizindex_menu();"></ul> + </li> +''' +create_quizindex_menu = r'''// construct the drop down menu if QuizTitles has some entries +if (QuizTitles.length > 0 && quizindex_menu) { + create_quizindex_menu(); +} +''' +breadcrumbs = r'''<div class="breadcrumbs"> + <nav> + <div class="navleft"> + <ul>{crumbs} </ul> + </div> + </nav> + </div> +''' + +# Should we add a menu to change the theme dynamically? If so then the code +# below should be added to the breadcrumbs and then fixed a little. Perhaps the +# trickiest bit is finding the current list of supported themes. +theme_menu=r''' + <div class="navright" > + <span onclick="toggle_theme_menu();">Theme ⚙</span> + <ul><li> + <ul id="theme-menu" onclick="toggle_theme_menu();"> + <li>one</li><li>two</li> + </ul> + </li> + </ul> + </div> +''' + +# Add a drop-down menu to the navigation to dynamically change the theme? + +# question buttons +button = r' <div id="button{b}" class="button {cls}" content=" " onClick="gotoQuestion({b})">{b}</div>' +discuss = r' <li id="button-{b}" class="discussion" onClick="gotoQuestion(-{b})">{title}</li>' +side_menu = r'''<div id="menu-icon"> + <span id="sidelabelclosed" class="question-label" onclick="toggle_side_menu();">❖</span> + <span id="sidelabelopen" class="question-label" onclick="toggle_side_menu();">✖ {side_questions} + </span> + </div> + <div id="sidemenu" class="side-menu">{discussion_list}{question_buttons} + <div class="school"> + {department}<p> + {institution} + </div> + <div class="copyright"> + <a href="http://www.maths.usyd.edu.au/u/mathas/WebQuiz/credits.html"> + <span class="webquizlogo">WebQuiz</span><span class="TEX">T<span class="E">E</span>X</span> + </a> + <br>© Copyright<br><span style="overflow: visible;">{copyright_years}</span> + </div> + </div>''' + +question_buttons = r''' + <div class="buttons"> + <br>{buttons} + </div> + <table class="marking-key"> + <tr><td class="star">★</td><td style="width: 14ex;">{side_menu_star}</td></tr> + <tr><td class="tick">✓</td><td>{side_menu_tick}</td></tr> + <tr><td class="cross">✗</td><td>{side_menu_cross}</td></tr> + </table>''' + +# quiz title and navigation arrows +quiz_header = r'''<div class="quiz-header"> + <div class="quiz-title">{title}</div><div></div>{arrows} + </div>''' +navigation_arrows = r''' + <span id="question-label" class="question-label">{question}</span> + <span id="question-number" class="question-label">{question_number}</span> + <span class="arrows"> + <a onClick="nextQuestion(-1);" title="{previous_question}">◄</a> + <span class="question-label">{questions}</span> + <a onClick="nextQuestion(1);" title="{next_question}">►</a> + </span>''' + +# discussion item +discussion = r'''<div id="question-{dnum}" class="question" style="display:{display};"> + {heading}{discussion.text} + </div> +''' +discussion_heading = r'''<div class="question-label">{}</div> + ''' + +#quiz index +quiz_index_div = r''' <div class="quiz-index"> + <ul> + {quiz_index} + </ul> + </div>''' +index_item = r'''<li><a href={url}>{title}</a></li>''' + +# now we come to the question wrappers +question_wrapper = r'''<div id="question{qnum}" class="question" style="display:{display};"> + <span class="question-label">{question_number}</span>{question} + {feedback} + </div> +''' + +question_text = r''' {question_text} + <form id="Q{qnum}Form" onSubmit="return false;"> + {question_options} + <p> + <input type="button" value="{check_answer}" name="answer" class="input-button" onClick="checkAnswer({qnum});"/> + {nextquestion} + </p> + </form> +''' +nextquestion='<input type="button" value="{next_question}" class="input-button" title="{next_question}" name="next" onClick="nextQuestion(1);"/>' + +# Questions and feedback: +input_answer = '{answer} <input type="text" onChange="checkAnswer({qnum});" size="{size}"/>{after_text}' +choice_answer = '<table class="question-choices">{choices}</table>{after_text}' +input_single = '\n<input type="hidden" name="Q{qnum}hidden"/>' + +single_item = '''<td><input type="radio" name="Q{qnum}option"/></td> +<td class="brown" >{choice}</td><td><div class="question-choices">{text}</div></td> +''' +multiple_item = '''<td><input type="checkbox" name="Q{qnum}option{optnum}"/></td> +<td class="brown" >{choice}</td><td><div class="question-choices">{text}</div></td> +''' + +tf_feedback_text = r''' + <div id="q{choice}{feedback}" class="feedback"><em class="dazzle">{correct_answer}</em> <em>{answer2}</em> + <div>{text}</div> + </div>''' +single_feedback = r''' + <div id="q{qnum}feedback{part}" class="feedback"> + <em>{alpha_choice} <span class="dazzle">{correct_answer}</span></em> + <div>{feedback}</div> + </div>''' + +multiple_feedback = r''' + <div id="q{qnum}feedback{part}" class="feedback"> + <em>{one_mistake}</em><br>{multiple_choice_opener} <span class="dazzle">{correct_answer}</span>. + <div>{feedback}</div> + </div>''' +multiple_feedback_correct = r''' + <div id="q{qnum}feedback0" class="feedback"><em class="dazzle">{correct}</em> + <ol> +{feedback} + </ol> + </div>''' +multiple_feedback_answer = ' <li><em>{correct_answer}</em> {reason}</li>' + +# no script error when javascript is not enabled +no_script = r'''<noscript> + <div class="warning"> + If you are reading this message either your browser does not support + JavaScript or because JavaScript is not enabled. You will need to enable + JavaScript and then reload this page in order to use this quiz. + </div> + </noscript>''' + +###################################################################### +# missing webquiz.ini file +###################################################################### + +missing_webquiz_ini = r''' +webquiz installation error: unable to find webquiz.ini -> {} + +If you believe that WebQuiz has been installed correctly then please try +rebuilding the TeX filename database. On TeXLive systems this can be done +using the command mktexlsl, or using the TeXLive gui. On MiKTEX you can +rebuild the database from the Tasks menu on the MiKTeX console. You may +need to run this command using an administrator account or sudo, on unix +systems. + +''' + +###################################################################### +# the remaining templates prompt the user when initialising webquiz +###################################################################### + +initialise_invite = r'''WebQuiz needs to be initialised. + +Before WebQuiz can display quiz web pages on your system it first needs to +copy some css and javascript files into a directory that is accessible from +your webserver. + +Do you want to initialise WebQuiz now [Y/n]? ''' + +initialise_before_settings = r''' +Before you can view the webquiz settings you need to initialise WebQuiz +using the command: + webquiz --initialise +''' + +initialise_introduction = r''' +WebQuiz Initialisation +====================== +If you want to install the web components of WebQuiz files into a "system" +directory then you should quit this program (use control-C on unix-like +systems) and then run + webquiz --initialise +from an administrators account or, on unix-like systems, use: + sudo webquiz --initialise + +If you want to continue then WebQuiz will guide you through the +initialisation process. For more information about the steps involved +see Section 3.2 of the WebQuiz manual On many systems, you can open +the webquiz manual using the command: texdoc webquiz +''' + +webroot_request = r'''---- +To make files accessible from your web server WebQuiz needs: + o A directory, or folder, on your server that is visible from your + web server. This directory MUST be accessible from the web. It can + either be a "system" directory or in your personal web directories. + o The relative URL for accessing these files from the web. This is + the part of the URL that you have to add to your "root" URL to + access the files. For example, if the URL for your department is + http://www.maths.usyd.edu.au/ + and the WebQuiz files can be accessed as + http://www.maths.usyd.edu.au/teaching/WebQuiz + then the relative URL for the WebQuiz files is /teaching/WebQuiz + +It is recommended that you create a separate directory for WebQuiz on your +web server. The location of the files on your web server will depend on +your operating system and system configuration. A common sysem location +for the WebQuiz web directory on a {platform} system is + {webquiz_dir} +''' + +not_installed = r''' +According to kpsewhich, the TeX components of WebQuiz are not installed +on your system. If you have downloaded the WebQuiz zip file from ctan +then try using: + > webquiz --tex-install +If the TeX components are already installed then something has gone +horribly wrong. If you think this is a bug please report it by creating +an issue at {} +''' + +oserror_copying = r'''There was a problem copying files to {web_dir} +Error: {err} + +Please give a different directory +''' + +webquiz_url_message = r''' +Please give the relative URL for the WebQuiz web directory. For example, +if the base of your web server's directory is /var/www/html/ and the +WebQuiz web directory is /var/www/html/courses/WebQuiz then the +relative URL for the WebQuiz directory would be /courses/WebQuiz. + +WebQuiz relative URL [{}]: ''' + +initialise_ending = r''' +You should now be able to build web pages using webquiz! As an initial +test you can try to build the example files from the webquiz manual +by going to the directory + {web_dir}/doc/examples +If pstricks and dvisgvm are properly configured (see Section 3.3 of +the manual), then you can also try building the online manual, by +going to the directory + {web_dir}/doc/examples +and typing: + webquiz webquiz-online-manual + +If you want to change the default webquiz settings please use: + webquiz --edit-settings +''' + +text_initialise_warning = r''' +WebQuiz has not yet been initialised. To remove this warning please use + webquiz --initialise +to install the WebQuiz web files onto your system. +''' + +web_initialise_warning = r''' + <div id="initialisewarning" class="warning"> + WebQuiz has not yet been initialised. To remove this warning box please use + <blockquote> + webquiz --initialise + </blockquote> + to install the WebQuiz web files on your system. + <button style="float: right" onclick="document.getElementById('initialisewarning').style.display='none'">OK</button> + </div> +''' + +rc_permission_error = r''' +Attempting to write the rcfile to {rcfile} +resulted in the error: + {error} + +To write the WebQuiz rcfile into this directory you may need to quit +and run webquiz again, either using an administrator account, or using +sudo on linux/macosx. + +Press the key 1-3, followed by RETURN, to: + 1. Try to save to {rcfile} again + 2. Save to the user rcfile {alt_rcfile} + 3. Give a different location for the rcfile +Press any other key to exit without saving. +''' + +permission_error = r''' +You do not have permission to write to {}. + +To install WebQuiz files into this directory you may need to quit and +run webquiz using either an administrator account, or using sudo on +linux/macosx. + +Alternatively, please give a different directory. +''' + +insufficient_permissions = r''' +Insufficient permissions. Try using sudo or using an admisitrator account. +{} +''' + +webquiz_url_warning = r''' +WARNING: most of the time, but not always, the relative URL will be a +suffix of the web directory name, which is not the case with your +settings. Your URL may well be correct, however, if you have made a +mistake then you can change this at any time using the command: + webquiz --initialise +''' + +edit_settings = r'''---- +In the webquizrc file you can set global defaults for the following: + breadrumbs + colour theme + department + department_url + engine + institution + institution + language +Leave these blank if you do not want default values. There are three +additional "advanced: options: + mathjax + webquiz_layout + webquiz_mk4 +Please only change these settings if you know what you are doing +because incorrect values for these settings will break WebQuiz. + +With each setting the default value is printed inside square brackets. +For example, as [default]. Press RETURN to accept the default value. +Except for the location of the WebQuiz web directory all of these +settings are easy to change at any time using the command: + webquiz --edit-settings +''' + +advanced_settings = r''' +** The remaining settings are advanced settings that you probably ** +** do not want to change at this time. Incorrect values for these ** +** settings will break WebQuiz so accept the defaults unless you ** +** know what you are doing. ** +''' + +# and now for the webquiz help message +webquiz_help_message = r''' +WebQuiz allows you to write interactive online quizzes using latex +''' diff --git a/macros/latex/contrib/webquiz/scripts/webquiz_util.py b/macros/latex/contrib/webquiz/scripts/webquiz_util.py new file mode 100644 index 0000000000..ea2e6e7b17 --- /dev/null +++ b/macros/latex/contrib/webquiz/scripts/webquiz_util.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python3 +r''' +------------------------------------------------------------------------------ + webquiz_util | utilty functions +------------------------------------------------------------------------------ + Copyright (C) Andrew Mathas, University of Sydney + + Distributed under the terms of the GNU General Public License (GPL) + http://www.gnu.org/licenses/ + + This file is part of the WebQuiz system. + + <Andrew.Mathas@sydney.edu.au> +------------------------------------------------------------------------------ +''' + +import os +import subprocess +import shutil +import stat +import sys +import traceback + +# --------------------------------------------------------------------------------------- +# Return the full path for a file in the webquiz directory +webquiz_file = lambda file: os.path.join(os.path.dirname(os.path.realpath(__file__)), file) + +def shell_command(cmd): + r''' + Short-cut for shell commands + ''' + return subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).decode('ascii').strip() + +def kpsewhich(search): + r''' + Short-cut to access kpsewhich output. + + usage: kpsewhich('-var-value=TEXMFLOCAL') + ''' + return subprocess.check_output('kpsewhich ' + search, shell=True).decode('ascii').strip() + +# --------------------------------------------------------------------------------------- +class MetaData(dict): + r""" + A dummy class for reading, accessing and storing key-value pairs from + a file. Any internal spaces in the key name are replaced with underscores + and lines without a key-value pair are ignored. + + The key-value pairs are available as both attributes and items + + Usage: MetaData(filename) or MetaData(filename, key-value pairs) + """ + + def __init__(self, filename, **args): + dict.__init__(self) + # add attributes from **args + for key in args: + setattr(self, key, args[key]) + with open(filename, 'r') as meta: + for line in meta: + if '=' in line: + key, val = line.strip().split('=') + if key.strip() != '': + self.__setitem__(key.strip().lower().replace(' ', '_'), + val.strip()) + setattr(self, + key.strip().lower().replace(' ', '_'), + val.strip()) + + +################################################################################# +def webquiz_debug(debugging, *arg): + if debugging: + sys.stderr.write(' '.join('{}'.format(a) for a in arg)+'\n') + + +################################################################################# +def webquiz_error(debugging, msg, err=None): + r''' + Consistent handling of errors in magthquiz: print the message `msg` and + exist with error code `err.errno` if it is available.abs + ''' + print('{dash}WebQuiz error:\n {msg}\n{dash}'.format( + msg=msg, dash='-'*40+'\n') + ) + + if err is not None: + trace = traceback.extract_tb(sys.exc_info()[2]) + filename, lineno, fn, text = trace[-1] + print('File: {}, line number: {}\nError {} in {}: {}'.format( + filename, lineno, err, fn, text)) + + if debugging and err is not None: + raise + + if hasattr(err, 'errno'): + sys.exit(err.errno) + + sys.exit(1) + + +############################################################################### +def copytree(src, dst, symlinks=False, ignore=None): + r''' Recursively copy directory tree, fixing shutil.copytree + from https://stackoverflow.com/questions/1868714 + ''' + if not os.path.exists(dst): + os.makedirs(dst) + shutil.copystat(src, dst) + lst = os.listdir(src) + if ignore: + excl = ignore(src, lst) + lst = [x for x in lst if x not in excl] + for item in lst: + s = os.path.join(src, item) + d = os.path.join(dst, item) + if symlinks and os.path.islink(s): + if os.path.lexists(d): + os.remove(d) + os.symlink(os.readlink(s), d) + try: + st = os.lstat(s) + mode = stat.S_IMODE(st.st_mode) + os.lchmod(d, mode) + except OSError: + pass # lchmod not available + elif os.path.isdir(s): + copytree(s, d, symlinks, ignore) + else: + shutil.copy2(s, d) + +############################################################################### +## shortcuts for running commands +environ = os.environ.copy() + +def run(cmd, shell=False): + r''' + Run commands with output to stdout and errors to stderr + ''' + if shell: + subprocess.call(cmd, env=environ, shell=True) + else: + subprocess.call(cmd.split(), env=environ) + +def quiet_run(cmd, shell=False): + r''' + Run commands with ignoring and sending errors to stderr + ''' + if shell: + subprocess.call(cmd, env=environ, stdout=open(os.devnull, 'wb'), shell=True) + else: + subprocess.call(cmd.split(), env=environ, stdout=open(os.devnull, 'wb')) + +def silent_run(cmd, shell=False): + r''' + Run commands ignoring all output and errors + ''' + if shell: + subprocess.call(cmd, env=environ, stdout=open(os.devnull, 'wb'), stderr=open(os.devnull, 'wb'), shell=True) + else: + subprocess.call(cmd.split(), env=environ, stdout=open(os.devnull, 'wb'), stderr=open(os.devnull, 'wb')) diff --git a/macros/latex/contrib/webquiz/scripts/webquiz_xml.py b/macros/latex/contrib/webquiz/scripts/webquiz_xml.py new file mode 100644 index 0000000000..b1db71a2da --- /dev/null +++ b/macros/latex/contrib/webquiz/scripts/webquiz_xml.py @@ -0,0 +1,386 @@ +r''' +----------------------------------------------------------------------------- + webquiz_xml | xml reader for reading the xml file generated by tex4ht +----------------------------------------------------------------------------- + + Copyright (C) Andrew Mathas and Donald Taylor, University of Sydney + + Distributed under the terms of the GNU General Public License (GPL) + http://www.gnu.org/licenses/ + + This file is part of the Math_quiz system. + + <Andrew.Mathas@sydney.edu.au> + <Donald.Taylor@sydney.edu.au> +----------------------------------------------------------------------------- +''' + +# -*- encoding: utf-8 -*- + +import xml.sax + +# imports of webquiz code +import webquiz_util + +# --------------------------------------------------------------------------------------- +def ReadWebQuizXmlFile(quizfile, defaults): + r''' + Set up, call and then return the xml parser + for the quiz web page + ''' + parser = xml.sax.make_parser() + quiz = QuizHandler(defaults) + parser.setContentHandler(quiz) + parser.setErrorHandler(quiz) + parser.setDTDHandler(quiz) # as far as I can see this does nothing... + parser.parse(quizfile) + parser.close() + return quiz + + +# --------------------------------------------------------------------------------------- +class Data(object): + r''' + A wrapper object class that holds the data for the different + components of the quiz. + ''' + def __init__(self, **args): + ''' + Accepts key-value pairs, each of which is stored as an attribute + ''' + self._items = args.items() + for key, val in args.items(): + setattr(self, key, val) + + +class QuizHandler(xml.sax.ContentHandler): + """ + The content handler gives the xml tags to `startElement`, which + initialises the webquiz tags, and then `endElement` attaches the + content of each webquiz tag tothe appropriate part of `self`. Any end + tag that is ot special to webquiz has its contents appended to + `self.text`. Any tag that contains `DeFaUlT` is set to the system + default using the `defaults` dictionary. + """ + + def __init__(self, defaults): + self.defaults = defaults + + # arrays for the different quiz components + self.discussion_list = [] + self.question_list = [] + self.quiz_index = [] + + # these will contain the link and meta elements from the xml file but they + # are ignored by webquiz.py + self.link_list = [] + self.meta_list = [] + + # to add mathjs when an eval comparison is used + self.mathjs = False + + # the following tags have defaults set by `defaults` + self.setting_tags = [ + 'department', + 'department_url', + 'institution', + 'institution_url', + 'language', + 'theme', + ] + # quiz data + for tag in self.setting_tags: + setattr(self, tag, defaults[tag]) + self.breadcrumb = '' + self.text = '' + self.after_text = '' + self.title = '' + self.unit_code = '' + self.unit_name = '' + + # keep track of current tags for debugging... + self.current_tags=[] + + def webquiz_debug(self, msg): + r''' + Customised debugging message for the xml module + ''' + webquiz_util.webquiz_debug(self.defaults.debugging, 'xml: '+msg) + + def webquiz_error(self, msg, err=None): + r''' + Customised error message for the xml module + ''' + webquiz_util.webquiz_error(self.defaults.debugging, 'xml: '+msg, err) + + def set_default_attribute(self, key, value): + ''' Set the attribute `key` of self, using the default value if + `value=='DeFaUlT'`. + ''' + if value.strip() == 'DeFaUlT': + setattr(self, key, self.defaults[key]) + else: + setattr(self, key, value) + self.webquiz_debug('Just set "{}" equal to "{}" from "{}"'.format(key, getattr(self, key), value)) + + #---- start of start elements -------------------------------------------- + def startElement(self, tag, attributes): + ''' + At the start of each webquiz xml tag we need to pull out the + attributes and place + ''' + self.webquiz_debug('Starting tag for '+tag) + self.current_tags.append(tag) + + if hasattr(self, 'start_'+tag): + getattr(self, 'start_'+tag)(attributes) + + elif tag in ['department', 'institution', 'uni']: + for key in attributes.keys(): + self.set_default_attribute(tag, attributes.get(key)) + + def start_webquiz(self, attributes): + r''' + Start element for tag="webquiz". Initialise the quix and extract + and process the list of attributes. + ''' + for key in attributes.keys(): + self.set_default_attribute(key, attributes.get(key)) + + # convert the following attibutes to booleans + for key in ['debugging', 'hide_side_menu', 'one_page', 'pst2pdf', 'random_order']: + setattr(self, key, getattr(self, key)=='true') + + setattr(self, 'language', self.language.lower()) + setattr(self, 'theme', self.theme.lower()) + + # set debugging mode from the latex file...from this point on + self.defaults.debugging = self.defaults.debugging or self.debugging + + def start_link(self, attributes): + r''' + Start element for tag="link" + ''' + self.link_list.append({key: attributes.get(key) for key in attributes.keys()}) + + def start_meta(self, attributes): + r''' + Start element for tag="meta" + ''' + self.meta_list.append({key: attributes.get(key) for key in attributes.keys()}) + + def start_breadcrumb(self, attributes): + r''' + Start element for tag="breadcrumb" + ''' + self.set_default_attribute('breadcrumbs', attributes.get('breadcrumbs')) + + def start_unit_name(self, attributes): + r''' + Start element for tag="unit_name" + ''' + self.set_default_attribute('unit_url', attributes.get('url')) + self.quizzes_url = attributes.get('quizzes_url') + if self.quizzes_url == 'DeFaUlT': + self.quizzes_url = self.unit_url + '/Quizzes' + + def start_discussion(self, attributes): + r''' + Start element for tag="discussion" + ''' + discussion = Data(heading = '', + short_heading = '', + text = '' # The text of the discussion + ) + self.discussion_list.append(discussion) + + def start_question(self, attributes): + r''' + Start element for tag="question" + ''' + self.question_list.append( + Data(text = '', # The text of the question + type = None, # input, or single or multiple choice + after_text = '' # text at end of question + ) + ) + + def start_answer(self, attributes): + r''' + Process the different question types, items choice and feedback + ''' + if self.question_list[-1].type != None: + self.webquiz_error('question {} has too many question types: {} and input'.format( + len(self.question_list)+1, self.question_list[-1].type) + ) + self.question_list[-1].type = 'input' + self.question_list[-1].answer = '' + self.question_list[-1].feedback_right = '' + self.question_list[-1].feedback_wrong = '' + self.question_list[-1].text += self.text + self.text = '' + + self.question_list[-1].comparison = attributes.get('comparison') + self.question_list[-1].prompt = attributes.get('prompt')=='true' + if self.question_list[-1].comparison in ['complex', 'number']: + self.mathjs = True + + def start_choice(self, attributes): + r''' + Start element for tag="choice" + ''' + if self.question_list[-1].type != None: + self.webquiz_error('question {} has too many question types: {} and choice'.format( + len(self.question_list)+1, self.question_list[-1].type) + ) + self.question_list[-1].type = attributes.get('type') + self.question_list[-1].columns = int(attributes.get('columns')) + self.question_list[-1].items = [] + self.question_list[-1].correct = 0 + self.question_list[-1].text += self.text + self.text = '' + + def start_item(self, attributes): + r''' + Start element for tag="item" + ''' + self.question_list[-1].items.append( + Data(correct= attributes.get('correct'), + symbol=attributes.get('symbol'), + feedback='', + text='' + ) + ) + if attributes.get('correct')=='true': + self.question_list[-1].correct += 1 + + def start_index_item(self, attributes): + r''' + Finally look after the index file + ''' + self.quiz_index.append(Data( + prompt=attributes.get('prompt')=='true', + url=attributes.get('url'), + title='' + ) + ) + + def start_when(self, attributes): + r''' + start element for tag="when" + ''' + if self.text.strip() != '': + self.question_list[-1].after_text += ' '+self.text.strip() + self.webquiz_debug('After_text is now {}'.format(self.question_list[-1].after_text)) + self.text = '' + self.current_tags[-1] = 'feedback_'+attributes.get('type') + + #---- end of start elements --------------------------------------------- + + def endElement(self, tag): + self.webquiz_debug('ending tag for {} (should be {})'.format(tag, self.current_tags[-1])) + + reset_text = True + if hasattr(self, 'end_'+tag): + getattr(self, 'end_'+tag)() + self.text = '' + + elif tag in self.setting_tags: + self.set_default_attribute(tag, self.text) + self.text = '' + + elif tag in ['heading', 'short_heading']: + setattr(self.discussion_list[-1], tag, self.text.strip()) + + elif tag in ['breadcrumb', 'title', 'unit_code', 'unit_name']: + setattr(self, tag, self.text.strip()) + + else: + # self.text lives to be used another day + reset_text = False + + if reset_text: + self.text = '' + + # remove the last tag from the tag list + self.current_tags.pop() + + #---- start of the end elements ------------------------------------------ + + def end_answer(self): + r''' + Process end tag when tag="answer" + ''' + self.question_list[-1].answer = self.text.strip() + + def end_discussion(self): + r''' + Process end tag when tag="discussion" + ''' + self.discussion_list[-1].text = self.text.strip() + + def end_item(self): + r''' + Process end tag when tag="item" + ''' + self.question_list[-1].items[-1].text = self.text.strip() + + def end_feedback(self): + r''' + Process end tag when tag="feedback" + ''' + self.question_list[-1].items[-1].feedback = self.text.strip() + + def end_question(self): + r''' + Process end tag when tag="question" + ''' + # first some error checking + if self.question_list[-1].type == None: + self.webquiz_error('Question {} does not have an \\answer or choice environment'.format( + len(self.question_list)+1)) + + elif hasattr(self.question_list[-1], 'items'): + if len(self.question_list[-1].items)==0: + self.webquiz_error('question {} has no multiple choice items'.format( + len(self.question_list)+1)) + + if self.question_list[-1].type=='single' and self.question_list[-1].correct!=1: + self.webquiz_error('question {} is single-choice but has {} correct answers'.format( + len(self.question_list)+1, + self.question_list[-1].correct + ) + ) + elif not hasattr(self.question_list[-1], 'answer') or self.question_list[-1].answer=='': + self.webquiz_error('question {} does have not an \answer or multiple choice'.format( + len(self.question_list)+1)) + + if self.text.strip() != '': + self.question_list[-1].after_text += ' '+self.text.strip() + + def end_index_item(self): + r''' + Process end tag when tag="index_item" + ''' + self.quiz_index[-1].title = self.text.strip().replace('\n',' ').replace('\r',' ') + + def end_when(self): + r''' + Process end tag when tag="index_item" + ''' + self.webquiz_debug('WHEN: Adding text to '+self.current_tags[-1]) + setattr(self.question_list[-1], self.current_tags[-1], self.text.strip()) + + #---- end of end elements ----------------------------------------------- + + def characters(self, text): #data,start,length): + r''' + Append everything to `self.text` + ''' + self.text += text + + def error(self, e): + self.webquiz_error('unknown error', e) + + def fatalError(self, e): + self.webquiz_error('unknown fatal error', e) |