diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-11 23:56:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-11 23:56:54 +0000 |
commit | ba8215a2f0a6d5317e7df528d49dd5e87ec87707 (patch) | |
tree | 32070d1c14bdfaebcc7694da59920e774f4795c2 | |
parent | 3f0248b934b6bfe5522a8e79300e278da6fa2530 (diff) |
trunk/Master/texmf-dist/source/latex/qcm
git-svn-id: svn://tug.org/texlive/trunk@478 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/source/latex/qcm/qcm.dtx | 773 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/qcm/qcm.ins | 75 |
2 files changed, 848 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/qcm/qcm.dtx b/Master/texmf-dist/source/latex/qcm/qcm.dtx new file mode 100644 index 00000000000..5a0f89f1edc --- /dev/null +++ b/Master/texmf-dist/source/latex/qcm/qcm.dtx @@ -0,0 +1,773 @@ +% \iffalse -*- mode: LaTeX -*- +% +% qcm.dtx --- Doc file for QCM (code and documentation) +% +% Copyright (C) 2004 Didier Verna. +% +% PRCS: $Id: qcm.dtx 1.10.1.15 Sat, 27 Nov 2004 17:03:01 +0100 didier $ +% +% Author: Didier Verna <didier@lrde.epita.fr> +% Maintainer: Didier Verna <didier@lrde.epita.fr> +% Created: Mon Dec 18 10:18:50 2000 +% Last Revision: Tue Nov 9 17:47:21 2004 +% +% This file is part of QCM. +% +% QCM may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.1 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.1 or later is part of all distributions of LaTeX +% version 1999/06/01 or later. +% +% QCM consists of the files listed in `README'. +% +% +% Commentary: +% +% Contents management by FCM version 0.1-b2. +% +% +% Code: +% +%<*driver> +\documentclass[a4paper]{ltxdoc} +% \OnlyDescription +% \CodelineIndex +% \RecordChanges +\begin{document} +\DocInput{qcm.dtx} +\end{document} +%</driver> +% +% \fi +% +% \catcode`\¡=14 +% \CheckSum{557} +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +% +% ^^A $Format: "% \\newcommand{\\version}{v$Version$}"$ +% \newcommand{\version}{v2.1} +% ^^A $Format: "% \\newcommand{\\classreleasedate}{$ClassReleaseDate$}"$ +% \newcommand{\classreleasedate}{2004/11/27} +% ^^A $Format: "% \\newcommand{\\stylereleasedate}{$StyleReleaseDate$}"$ +% \newcommand{\stylereleasedate}{2004/11/27} +% ^^A $Format: "% \\newcommand{\\packagecopyright}{$LaTeXCopyright$}"$ +% \newcommand{\packagecopyright}{Copyright \copyright{} 2004 Didier Verna} +% \newcommand{\qcm}{\textsf{QCM}} +% \newcommand{\auctex}{AUC-\TeX} +% \date{\today} +% \title{\qcm{} -- A \LaTeXe{} package for making \textbf{M}ultiple +% \textbf{C}hoices \textbf{Q}uestionnaires\thanks{This document +% describes \qcm{} \version, class release date \classreleasedate, +% style release date \stylereleasedate.}} +% \author{Didier Verna\\ +% \texttt{mailto:didier@lrde.epita.fr}\\ +% \texttt{http://www.lrde.epita.fr/\~{}didier}} +% \maketitle +% +% \begin{abstract} +% \qcm{} is a package for making multiple choices questionnaires +% (``\textsc{QCM}'' is the corresponding French acronym) under \LaTeXe. A +% special environment allows you to define questions and possible answers. You +% can specify which answers are correct and which are not. \qcm{} not only +% formats the questions for you, but also generates a ``form'' (a grid that +% your students will have to fill in), and a ``mask'' (the same grid, only +% with correct answers properly checked in). You can then print the mask on a +% slide and correct the questionnaires more easily by superimposing the mask +% on top of students' forms.\par +% The \qcm{} package is \packagecopyright{}, and distributed under the terms +% of the LPPL license. +% \end{abstract} +% +% \section{Using \qcm{} (attention users of version 1)} +% As of version 2.0, \qcm{} comes both in style and class form. The style +% provides all the basic features: making questions, generating the form and +% the mask\ldots You can use it with any class you want, which is useful when +% you want to incorporate multiple choice questions in a larger document (a +% full exam for instance).\par +% If you want to make simple multiple choice questionnaires, with just a list +% of questions, you can alternately use the class which provides some basic +% formatting on top of the style itself. +% +% \section{The \qcm{} Style} +% First of all, please note that \qcm{} requires the packages \texttt{ifthen}, +% \texttt{calc} and \texttt{tabularx}. As of version 2.1, the +% \texttt{verbatim} package is also required. You don't have to require these +% packages explicitly though. As long as \LaTeXe{} is able to locate them, +% they will be used automatically.\par +% In order to use the \qcm{} style, say |\usepackage[|\meta{options}|]{qcm}| +% in the preamble of your document. The available options are described along +% the text, where appropriate. +% +% \subsection{Creating Questions} +% Here's a simple example demonstrating how to produce a new question: +% \begin{verbatim} +% \begin{question}{What is the color of Henri the Fourth's white horse?} +% \false black, +% \true white, +% \false yellow, +% \false red. +% \end{question} +% \begin{correction} +% The correct answer is white, because it's in the question. +% \end{correction} +% \end{verbatim} +% +% \subsubsection{The \texttt{question} environment} +% \DescribeEnv{question} +% The |question| environment allows you to insert questions into your +% document. It takes one mandatory argument which specifies the actual +% question's text. The question will be displayed in a frame box, the size of +% the line.\par +% \DescribeMacro{\true}\DescribeMacro{\false} +% The proposed answers are displayed below the question in a list fashion (the +% |question| environment is a list-based one). Instead of using |\item| +% however, use either |\true| or |\false| to insert a possible answer.\par +% +% \subsubsection{Question Numbers} +% The |question| environment is associated with a \LaTeX{} counter named +% |question|. This counter stores the number of the next (or current) +% question. It is initialized to 1, and automatically incremented at the end +% of |question| environments. You might want to use it to format question +% titles. For instance, you could decide that each question belongs to a +% subsection in the |article| class, and use something like this before each +% question: |\subsection*{Question \thequestion}| +% +% \subsection{The Form and the Mask} +% Based on the questions appearing in your document, \qcm{} has the ability to +% generate a ``form'' (a grid that your students will have to fill in), and a +% ``mask'' (the same grid, only with correct answers properly checked in). +% This can make the correction process easier.\par +% \DescribeMacro{\makeform} +% \DescribeMacro{\makemask} +% To generate a form and a mask, use the macros |\makeform| and |\makemask|. +% \qcm{} uses two auxiliary files to build them. These files have respectively +% an extension of \texttt{frm} and \texttt{msk}. If you use these macros, you +% will need two passes of \LaTeXe{} in order to get a correctly formatted +% document.\par +% +% \subsection{Typesetting corrections} +% \DescribeEnv{correction} +% As of version 2.1, \qcm{} comes with a ``correction'' mode which allows you +% to automatically typeset and distribute corrections to your students. These +% corrections are slightly modified versions of your questionnaire: each +% possible answer is prefixed with a small symbol (a visual clue) indicating +% whether the answer was correct or wrong. In addition, you can typeset +% explanations below each question.\par +% To activate the correction mode, use the |correction| option. It is off by +% default.\par +% To typeset explanations below the questions, use the |correction| +% environment (no argument). The contents of this environment is displayed +% only in |correction| mode. In normal mode, it is simply discarded.\par +% In addition, note that \qcm{} cancels the actions performed by |\makeform| +% and |\makemask| in |correction| mode. This is to avoid further edition of +% the source when typesetting a correction. +% +% \subsection{Important Note} +% Currently, \qcm{} requires that you provide a constant number of proposed +% answers across all questions in your \textsc{QCM}. This is something natural +% when you want to build forms, but this might me too restrictive otherwise, +% I'm not sure, so it is possible that this restriction will be removed in +% future versions.\par +% Currently, there is a built-in mechanism for checking that the number of +% proposed answers remains constant: when \qcm{} encounters the first +% occurrence of the |question| environment, it remembers the number of proposed +% answers from there. Afterwards, any noticed difference in subsequent +% occurrences will generate an error. As a consequence, you never have to tell +% \qcm{} explicitly what that number is. +% +% \subsection{Customizing the \qcm{} style} +% \subsubsection{The question environment} +% \DescribeMacro{\questionspace} +% |\questionspace| is the amount of extra vertical space to put under the +% question, before the list of proposed answers. This is a \LaTeX{} length +% that defaults to \texttt{0pt}.\par +% \DescribeMacro{\answerstitlefont} +% Before the list of possible answers, a short title is displayed (for +% English, it reads ``Possible answers:''). The |\answerstitlefont| macro +% takes one mandatory argument which redefines the font to use for the answers +% title. By default, |\bfseries| is used.\par +% \DescribeMacro{\answernumberfont} +% Each proposed answer in the list is numbered automatically (and +% alphabetically). The |\answernumberfont| macro takes one mandatory argument +% which redefines the font to use for displaying the answer number. By +% default, |\bfseries| is used.\par +% +% \subsubsection{The Form and the Mask} +% \DescribeMacro{\headerfont} +% The |\headerfont| macro takes one mandatory argument which redefines +% the font to use for the headers (first line and first column) of the form +% and mask arrays. By default, |\bfseries| is used.\par +% \DescribeMacro{\X} +% In the mask, correct answers are checked in by filling the corresponding +% cell with an ``X'' character. If you want to change this, call the |\X| +% macro with one (mandatory) argument. +% +% \subsubsection{The correction} +% \DescribeMacro{\truesymbol} +% \DescribeMacro{\falsesymbol} +% In correction mode, labels in front of answers are modified to give a visual +% clue about whether the answer was correct or wrong. By default, a cross and +% a small arrow are used. You can change these symbols by using the +% |\truesymbol| and |\falsesymbol| macros. For instance, you could give a +% fancier look to your correction by using the |pifont| package and issuing: +% \begin{verbatim} +% \truesymbol{\ding{'063}~} +% \truesymbol{\ding{'067}~} +% \end{verbatim} +% \DescribeMacro{\correctionstyle} +% The appearance of the contents of the |correction| environment can be +% adjusted by using the |\correctionstyle| macro. By default, |\itshape| is +% used. +% \subsubsection{Internationalization} +% \DescribeEnv{english} +% \DescribeEnv{french, francais} +% \qcm{} currently supports English, and French. You can select the language +% you want to use by using the corresponding option. The \texttt{french} and +% \texttt{francais} options are synonyms. If you want a finer grain on the +% language-dependent parts of \qcm, the following macros are provided.\par +% \DescribeMacro{\answerstitle} +% This macro takes one mandatory argument which lets you redefine the +% answers'titles. For English, the answers title defaults to +% ``Possible answers:''.\par +% +% +% \section{The \qcm{} Class} +% The \qcm{} class provides a wrapper around the style to allow you to format +% simple multiple choice questionnaires, with just a list of questions.\par +% In order to use the \qcm{} class, say +% |\documentclass[|\meta{options}|]{qcm}| at the beginning of your document. +% The available options are described along the text, where appropriate. Note +% that the underlying \qcm{} style is loaded automatically. +% +% \subsection{Standard Class Features} +% +% \subsection{Page Size and layout} +% \DescribeEnv{a4paper} +% \DescribeEnv{a5paper} +% \DescribeEnv{b4paper} +% \DescribeEnv{letterpaper} +% \DescribeEnv{legalpaper} +% \DescribeEnv{executivepaper} +% \DescribeEnv{landscape} +% The \texttt{a4}, \texttt{a5}, \texttt{b4}, \texttt{letter}, \texttt{legal} +% and \texttt{executive} ``paper'' options allow you to select the type of +% page format you want. By default, \texttt{letterpaper} is used. The +% \texttt{landscape} options switches the horizontal and vertical settings. +% I'm not sure why I propose this option. Nobody wants to write a \textsc{QCM} +% in landscape mode, right?\par +% +% \DescribeEnv{oneside} +% \DescribeEnv{twoside} +% \qcm{} also supports the standard \texttt{oneside} and \texttt{twoside} +% class options. By default, \texttt{oneside} is used. In \texttt{twoside} +% mode, odd and even pages have a different geometry and headings layout. +% +% \subsection{Font Size} +% \DescribeEnv{10pt} +% \DescribeEnv{11pt} +% \DescribeEnv{12pt} +% The \texttt{10pt}, \texttt{11pt} and \texttt{12pt} options let you choose +% the size of the default font you want to use. By default, \texttt{10pt} is +% used. +% +% \subsection{Output Mode} +% \DescribeEnv{final} +% \DescribeEnv{draft} +% In \texttt{draft} mode, a black rule will be drawn at the end of overfull +% lines (as done by standard classes). +% +% \subsection{Page styles} +% \qcm{} supports the standard \LaTeX{} page style mechanism. Available styles +% are \texttt{empty}, \texttt{plain}, \texttt{headings} and +% \texttt{myheadings}. These styles have their usual meaning, except that +% there are no sectioning commands in the \qcm{} class. By default, the page +% style is \texttt{plain}. Also, note that the form and the mask have an empty +% page style, whatever the setting for the rest of the document. +% +% \subsection{Title} +% \DescribeMacro{\title} +% The |\title| macro takes one mandatory argument which defines a title for +% your questionnaire (repeated on the form and the mask). It can be used in +% the document's preamble only. The title will be centered on the page.\par +% \DescribeMacro{\titlefont} +% The |\titlefont| macro takes one mandatory argument which redefines the +% font to use for the title. By default, |\LARGE\bfseries| is used.\par +% \DescribeMacro{\titlespace} +% |\titlespace| is the amount of extra vertical space to put after the title. +% This is a \LaTeX{} length that defaults to \texttt{20pt}.\par +% \DescribeMacro{\maketitle} +% If you have defined a title, make it appear by calling |\maketitle| after +% the beginning of your document. If you call |\maketitle| without having +% defined a title, an error will be generated. +% +% \subsection{Modifications to the question environment} +% The \qcm{} class modifies the |question| environment so as to display a +% title before each question (something that you would probably do with a +% sectioning command in other classes). This title is displayed in a frame +% box, the size of a quarter of the line. For English, the default reads +% ``Question n.\meta{X}:''.\par +% +% \subsection{Modifications to \cs{makeform} and \cs{makemask}} +% The \qcm{} class modifies |\makeform| and |\makemask| along the following +% lines: each grid is printed on a page of its own, and the document's title +% is repeated on top of each. Also, the page style is set to |empty|. +% +% \subsection{Customizing the \qcm{} class} +% \subsubsection{The question titles} +% \DescribeMacro{\questiontitlefont} +% The |\questiontitlefont| macro takes one mandatory argument which redefines +% the font to use for each question title. By default, |\bfseries| is +% used.\par +% \DescribeMacro{\questiontitlespace} +% |\questiontitlespace| is the amount of extra vertical space to put after the +% question title (and before the questions' text). This is a \LaTeX{} length +% that defaults to \texttt{5pt}.\par +% \DescribeMacro{\questionsepspace} +% In addition, questions are separated from each other by some vertical space. +% |\questionsepspace| is the amount of extra vertical space to put between +% each question block. This is a \LaTeX{} length that defaults to +% \texttt{20pt}. +% +% \subsubsection{Internationalization} +% \DescribeEnv{english} +% \DescribeEnv{french, francais} +% \qcm{} currently supports English, and French. You can select the language +% you want to use by using the corresponding option. The \texttt{french} and +% \texttt{francais} options are synonyms. If you want a finer grain on the +% language-dependent parts of \qcm, the following macros are provided.\par +% \DescribeMacro{\questiontitle} +% This macro takes one mandatory argument which lets you redefine the +% questions'titles. For English, the question title defaults to +% ``|Question N.\thequestion:|''.\par +% +% +% \section{\auctex{} support} +% \auctex{} is a powerful major mode for editing \TeX{} documents in +% \textsf{Emacs} or \textsf{XEmacs}. In particular, it provides automatic +% completion of macro names once they are known. \qcm{} supports \auctex{} +% by providing a style file named \texttt{qcm.el} which contains \auctex{} +% definitions for the relevant macros. This file should be installed to a +% location where \auctex{} can find it (usually in a subdirectory of your +% \LaTeX{} styles directory). Please refer to the \auctex{} documentation for +% more information on this.\par +% For people already knowing \auctex: note that the \auctex{} command +% \texttt{LaTeX-insert-item} (usually bound to \texttt{M-Ret}) inserts +% |\false| by default in a \textsc{QCM}, since it replaces |\item|. If you +% want to insert a |\true|, use a prefix. +% +% \StopEventually{\par Well, I think that's it. Enjoy using \qcm{}! +% \vfill\hfill\small\packagecopyright{}.} +% +% \iffalse +%<*qcmstyle> +% \fi +% \section{Style Code} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +¡ $Format: "\\ProvidesPackage{qcm}[$StyleReleaseDate:$ v$Version$"$ +\ProvidesPackage{qcm}[2004/11/27 v2.1 + Multiple Choice Questionnaire style for LaTeX2e] + +\RequirePackage{ifthen} +\RequirePackage{calc} +\RequirePackage{verbatim} +\RequirePackage{tabularx} + +% \end{macrocode} +% \subsection{The Form and Mask} +% Here are the customization parameters: +% \begin{macrocode} +\def\@headerfont{\bfseries} +\newcommand\headerfont[1]{\gdef\@headerfont{#1}} + +\def\@X{X} +\newcommand\X[1]{\gdef\@X{#1}} + +% \end{macrocode} +% We use two new column types in the form and mask arrays: |Q| for header +% cells and |D| for data cells. We also use centered cells for the X +% specification. Note that this might clash with a user setting one day, but +% let's not anticipate problems. +% \begin{macrocode} +\def\pbs#1{\let\tmp=\\#1\let\\=\tmp} +\newcolumntype{D}{>{\pbs\centering}X} +\newcolumntype{Q}{>{\@headerfont}X} + +\renewcommand\tabularxcolumn[1]{m{#1}} + +% \end{macrocode} +% \begin{macrocode} +\newcommand\makeform@nocorrection{% + \addtocontents{frm}{\protect\end{tabularx}} + \@starttoc{frm}} +\newcommand\makeform@correction{% + \addtocontents{frm}{\protect\end{tabularx}}} + +\newcommand\makemask@nocorrection{% + \addtocontents{msk}{\protect\end{tabularx}} + \@starttoc{msk}} +\newcommand\makemask@correction{% + \addtocontents{msk}{\protect\end{tabularx}}} + +% \end{macrocode} +% \subsection{The \texttt{question} Environment} +% Here are the customization parameters: +% \begin{macrocode} +\newlength\questionspace +\setlength\questionspace{0pt} + +\newcommand\answerstitle[1]{\gdef\@answerstitle{#1}} + +\def\@answerstitlefont{\bfseries} +\newcommand\answerstitlefont[1]{\gdef\@answerstitlefont{#1}} + +\def\@answernumberfont{\bfseries} +\newcommand\answernumberfont[1]{\gdef\@answernumberfont{#1}} + +% \end{macrocode} +% The |question| counter starts at one, and is incremented at the end of each +% question. +% \begin{macrocode} +\newcounter{question}\stepcounter{question} +\newcounter{@choice} + +% \end{macrocode} +% The macro |\@initorcheck| is called at the end of each question. After the +% first one, it initializes the number of proposed answers (this must be +% constant across all questions). This is used to build the form and mask +% arrays description lines, and initialize the auxiliary files. Afterwards, it +% redefines itself so that subsequent calls will just check that the number of +% answers remains the same across all questions. +% \begin{macrocode} +\def\@initorcheck{% + \xdef\@choices{\the@choice}% + \setcounter{@choice}{1}% + \gdef\@arraydesc{|Q||}% + \gdef\@headerline{}% + \whiledo{\not{\value{@choice}>\@choices}}{ + \xdef\@arraydesc{\@arraydesc D|} + \def\@appendheader{\g@addto@macro\@headerline} + \@appendheader{&\protect\@headerfont} + \edef\@the@choice{{\alph{@choice}}} + \expandafter\@appendheader\@the@choice + \stepcounter{@choice}}% + \addtocontents{frm}{% + \protect\begin{tabularx}{\protect\linewidth}{\@arraydesc} + \protect\hline + \@headerline\protect\\\protect\hline\protect\hline}% + \addtocontents{msk}{% + \protect\begin{tabularx}{\protect\linewidth}{\@arraydesc} + \protect\hline + \@headerline\protect\\\protect\hline\protect\hline}% + \gdef\@initorcheck{% + \ifthenelse{\value{@choice} = \@choices}{}{% + \ClassError{QCM}{Question \thequestion: wrong number of choices + (\the@choice\space instead of \@choices)}{% + Questions must all have the same number of proposed answers.% + \MessageBreak + Type X <return> to quit, fix your QCM and rerun LaTeX.}}}} + +% \end{macrocode} +% A minipage environment is used in order to prevent page breaks in the middle +% of a question. +% \begin{macrocode} +\newenvironment{question}[1]{% + %% \begin{question} + \begin{minipage}{\textwidth} +% \end{macrocode} +% Each line in the form and mask arrays is stored in the macros +% |\@formanswerline| and |\@maskanswerline|. They are initialized here, +% updated progressively by each call to |\true| or |\false|, \ldots +% \begin{macrocode} + \xdef\@formanswerline{\@questionheader}% + \xdef\@maskanswerline{\@questionheader}% + \fbox{\parbox[c]{\linewidth}{#1}} + \vspace\questionspace\par + {\@answerstitlefont\@answerstitle} + \begin{list}{\@answernumberfont\alph{@choice}.~}{\usecounter{@choice}}}{% + %% \end{question} + \end{list} + \@initorcheck% +% \end{macrocode} +% \ldots and added to the form and mask auxiliary files here: +% \begin{macrocode} + \addtocontents{frm}{\@formanswerline\protect\\\protect\hline}% + \addtocontents{msk}{\@maskanswerline\protect\\\protect\hline}% + \end{minipage} + \stepcounter{question}} + +\def\@truesymbol{$\rightarrow$~} +\def\@falsesymbol{$\times$~} +\newcommand\truesymbol[1]{\gdef\@truesymbol{#1}} +\newcommand\falsesymbol[1]{\gdef\@falsesymbol{#1}} + +\def\@true@nocorrection{\item} +\def\@false@nocorrection{\item} +\def\@true@correction{\item[\@truesymbol\refstepcounter{@choice}]} +\def\@false@correction{\item[\@falsesymbol\refstepcounter{@choice}]} + +\newcommand\true{% + \xdef\@formanswerline{\@formanswerline&}% + \xdef\@maskanswerline{\@maskanswerline&\@X}% + \@true}% +\newcommand\false{% + \xdef\@formanswerline{\@formanswerline&}% + \xdef\@maskanswerline{\@maskanswerline&}% + \@false}% + +% \end{macrocode} +% \subsection{The correction environment} +% Here, we only define the visible version of the |correction| environment. +% The other one is provided by |verbatim|'s comment environment. +% \begin{macrocode} +\def\@correctionstyle{\itshape} +\newcommand\correctionstyle[1]{\gdef\@correctionstyle{#1}} + +\newenvironment{@correction}{\@correctionstyle}{} + +% \end{macrocode} +% \subsection{Internationalization} +% \begin{macrocode} +\DeclareOption{english}{% + \def\@questionheader{Question n.\thequestion} + \answerstitle{Possible answers:}} +\DeclareOption{french}{% + \def\@questionheader{Question n$^o$~\thequestion} + \answerstitle{R\'eponses possibles~:}} +\DeclareOption{francais}{% + \ExecuteOptions{french}} + +% \end{macrocode} +% \subsection{Options Processing} +% Note that we don't use |\let| but |\def| to implement the correct behavior +% of |\makeform| and |\makemask|. This is because when using the class, the +% underlying macros might be redefined, so we want to use their latest +% definition. +% \begin{macrocode} +\DeclareOption{nocorrection}{% + \let\@true\@true@nocorrection + \let\@false\@false@nocorrection + \let\correction\comment + \let\endcorrection\endcomment + \def\makeform{\makeform@nocorrection} + \def\makemask{\makemask@nocorrection}} +\DeclareOption{correction}{% + \let\@true\@true@correction + \let\@false\@false@correction + \let\correction\@correction + \let\endcorrection\end@correction + \def\makeform{\makeform@correction} + \def\makemask{\makemask@correction}} + +\ExecuteOptions{english,nocorrection} +\ProcessOptions + +% \end{macrocode} +% \iffalse +%</qcmstyle> +% \fi +% +% \iffalse +%<*qcmclass> +% \fi +% \section{Class Code} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +¡ $Format: "\\ProvidesClass{qcm}[$ClassReleaseDate$ v$Version$"$ +\ProvidesClass{qcm}[2004/11/27 v2.1 + Multiple Choice Questionnaire class for LaTeX2e] + +\RequirePackage{qcm}[2004/11/09] + +% \end{macrocode} +% \subsection{The Title} +% \begin{macrocode} +\def\@titlefont{\LARGE\bfseries} +\newcommand\titlefont[1]{\gdef\@titlefont{#1}} +\@onlypreamble\titlefont + +\newlength\titlespace +\setlength\titlespace{20pt} + +\@onlypreamble\title + +% \end{macrocode} +% |\maketitle| informs \qcm{} that the title should be repeated on the form +% and mask pages by defining |\@maketitle|. +% \begin{macrocode} +\def\@make@title{% + \begin{center} + \@titlefont\@title + \end{center} + \vspace\titlespace} +\let\@maketitle\empty +\newcommand\maketitle{% + \@make@title% + \let\@maketitle\@make@title} + +% \end{macrocode} +% \subsection{The Form and Mask} +% The qcm{} style |\makeform| and |\makemask| macros are saved and wrapped +% into new ones that first repeat the document's title on a new page. The page +% style is also set to |empty|.\par +% For a reason I don't recall anymore, |\addtocontents| fails to write +% anything in the auxiliary files when nothing has been written on the page +% yet. To cope with this problem, we restate the title first. +% \begin{macrocode} +\let\old@makeform@nocorrection\makeform@nocorrection +\def\makeform@nocorrection{% + \newpage + \@maketitle + \thispagestyle{empty} + \old@makeform@nocorrection} + +\let\old@makemask@nocorrection\makemask@nocorrection +\def\makemask@nocorrection{% + \newpage + \@maketitle + \thispagestyle{empty} + \old@makemask@nocorrection} + +% \end{macrocode} +% \subsection{The \texttt{question} Environment} +% \begin{macrocode} +\newcommand\questiontitle[1]{\gdef\@questiontitle{#1}} + +\def\@questiontitlefont{\bfseries} +\newcommand\questiontitlefont[1]{\gdef\@questiontitlefont{#1}} + +\newlength\questiontitlespace +\setlength\questiontitlespace{5pt} + +\newlength\questionsepspace +\setlength\questionsepspace{20pt} +% \end{macrocode} +% The real space used is |\@questionsepspace|. It is initialy set to 0 to +% prevent extra space from appearing before the first question. It is +% redefined to the real value at the end of the |question| environment. +% \begin{macrocode} +\gdef\@questionsepspace{0pt} + +% \end{macrocode} +% The qcm{} style |question| environment is saved and wrapped into a new one +% that outputs a question title. +% \begin{macrocode} +\let\old@question\question +\let\old@endquestion\endquestion +\renewenvironment{question}[1]{% + %% \begin{question} + \vspace\@questionsepspace + \fbox{\parbox[c]{0.25\linewidth}{\@questiontitlefont\@questiontitle}} + \nopagebreak\vspace\questiontitlespace\par + \old@question{#1}}{% + %% \end{question} + \old@endquestion + \gdef\@questionsepspace{\questionsepspace}} + +% \end{macrocode} +% \subsection{Language Processing} +% \begin{macrocode} +\DeclareOption{english}{% + \questiontitle{Question N.\thequestion:}} +\DeclareOption{french}{% + \questiontitle{Question N$^{o}$~\thequestion~:}} +\DeclareOption{francais}{% + \ExecuteOptions{french}} + +% \end{macrocode} +% \subsection{Standard Class Processing} +% \begin{macrocode} +\DeclareOption{a4paper}{ + \setlength\paperheight{297mm} + \setlength\paperwidth{210mm}} +\DeclareOption{a5paper}{ + \setlength\paperheight{210mm} + \setlength\paperwidth{148mm}} +\DeclareOption{b5paper}{ + \setlength\paperheight{250mm} + \setlength\paperwidth{176mm}} +\DeclareOption{letterpaper}{ + \setlength\paperheight{11in} + \setlength\paperwidth{8.5in}} +\DeclareOption{legalpaper}{ + \setlength\paperheight{14in} + \setlength\paperwidth{8.5in}} +\DeclareOption{executivepaper}{ + \setlength\paperheight{10.5in} + \setlength\paperwidth{7.25in}} +\DeclareOption{landscape}{ + \setlength\@tempdima{\paperheight} + \setlength\paperheight{\paperwidth} + \setlength\paperwidth{\@tempdima}} + +\DeclareOption{10pt}{\def\@ptsize{0}} +\DeclareOption{11pt}{\def\@ptsize{1}} +\DeclareOption{12pt}{\def\@ptsize{2}} + +\DeclareOption{oneside}{\@twosidefalse\@mparswitchfalse} +\DeclareOption{twoside}{\@twosidetrue\@mparswitchtrue} + +\DeclareOption{draft}{\setlength\overfullrule{5pt}} +\DeclareOption{final}{\setlength\overfullrule{0pt}} + +\ExecuteOptions{english,letterpaper,10pt,oneside,final} +\ProcessOptions + +\input{size1\@ptsize.clo} +\setlength\parindent{0pt} +\setlength\parskip{0pt} +\setlength\tabcolsep{6pt} +\setlength\arrayrulewidth{0.4pt} +\raggedbottom +\onecolumn +\pagestyle{plain} +\pagenumbering{arabic} + +\if@twoside + \def\ps@headings{% + \let\@oddfoot\@empty\let\@evenfoot\@empty + \def\@evenhead{\thepage\hfil\slshape\leftmark}% + \def\@oddhead{{\slshape\rightmark}\hfil\thepage}% + \let\@mkboth\markboth + } +\else + \def\ps@headings{% + \let\@oddfoot\@empty + \def\@oddhead{{\slshape\rightmark}\hfil\thepage}% + \let\@mkboth\markboth + } +\fi +\def\ps@myheadings{% + \let\@oddfoot\@empty\let\@evenfoot\@empty + \def\@evenhead{\thepage\hfil\slshape\leftmark}% + \def\@oddhead{{\slshape\rightmark}\hfil\thepage}% + \let\@mkboth\@gobbletwo +} + +% \end{macrocode} +% \iffalse +%</qcmclass> +% \fi +% +% ^^A \PrintChanges +% ^^A \PrintIndex +% \Finale +% +% ^^A qcm.dtx ends here. diff --git a/Master/texmf-dist/source/latex/qcm/qcm.ins b/Master/texmf-dist/source/latex/qcm/qcm.ins new file mode 100644 index 00000000000..bb266a1b7aa --- /dev/null +++ b/Master/texmf-dist/source/latex/qcm/qcm.ins @@ -0,0 +1,75 @@ +%%% qcm.ins --- Installation file for QCM. -*- mode: LaTeX -*- + +%% Copyright (C) 2004 Didier Verna. + +%% PRCS: $Id: qcm.ins 1.8 Tue, 09 Nov 2004 17:50:00 +0100 didier $ + +%% Author: Didier Verna <didier@lrde.epita.fr> +%% Maintainer: Didier Verna <didier@lrde.epita.fr> +%% Created: Mon Dec 18 10:32:29 2000 +%% Last Revision: Tue Nov 9 17:46:56 2004 + +%% This file is part of QCM. + +%% QCM may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.1 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.1 or later is part of all distributions of LaTeX +%% version 1999/06/01 or later. + +%% QCM consists of the files listed in `README'. + + +%%% Commentary: + +%% Contents management by FCM version 0.1-b2. + + +%%% Code: + +\NeedsTeXFormat{LaTeX2e} +\input docstrip.tex +\keepsilent +\askforoverwritefalse + +\preamble +^^J^^J +%% $Format: "$TextCopyright$^^J"$ +Copyright (C) 2004 Didier Verna^^J +This file is part of QCM.^^J +QCM may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.1 +of this license or (at your option) any later version. +The latest version of this license is in +http://www.latex-project.org/lppl.txt +and version 1.1 or later is part of all distributions of LaTeX +version 1999/06/01 or later.^^J +QCM consists of the files listed in the file `README'.^^J +\endpreamble + +\catcode`\¡=14 +\generate{ + \file{qcm.cls}{\from{qcm.dtx}{qcmclass}} + \file{qcm.sty}{\from{qcm.dtx}{qcmstyle}}} + +\Msg{} +\Msg{,----------} +\Msg{|} +\Msg{| You have two more things to do to finish the installation:} +\Msg{|} +\Msg{| * Typeset the documentation by running LaTeX on the file `qcm.dtx'.} +\Msg{| * Install `qcm.cls', `qcm.sty' and `qcm.dvi' anywhere you see fit.} +\Msg{|} +\Msg{| If you're an AUC-TeX user, you can also install the file `qcm.el' in} +\Msg{| a suitable AUC-TeX style directory.} +\Msg{|} +\Msg{| Have fun!} +\Msg{|} +\Msg{`----------} +\Msg{} + +\endbatchfile + +%%% qcm.ins ends here |