diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-13 00:04:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-13 00:04:50 +0000 |
commit | 399ee5e736a5e0d2a923705db055da613a6b7987 (patch) | |
tree | d0dac0432fa89b46d3dd12466a6ab0258d538a2d /Master/texmf-dist/tex/latex/qcm | |
parent | e5a771568b41e8213c075c082fa9edd6c7e6f87a (diff) |
qcm
git-svn-id: svn://tug.org/texlive/trunk@1260 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/qcm')
-rw-r--r-- | Master/texmf-dist/tex/latex/qcm/qcm.cls | 180 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/qcm/qcm.sty | 186 |
2 files changed, 366 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/qcm/qcm.cls b/Master/texmf-dist/tex/latex/qcm/qcm.cls new file mode 100644 index 00000000000..b03315d33d3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/qcm/qcm.cls @@ -0,0 +1,180 @@ +%% +%% This is file `qcm.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% qcm.dtx (with options: `qcmclass') +%% + + +%% Copyright (C) 2004 Didier Verna + +%% 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 the file `README'. + +%% \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 \~} +\NeedsTeXFormat{LaTeX2e} + +\ProvidesClass{qcm}[2004/11/27 v2.1 + Multiple Choice Questionnaire class for LaTeX2e] + +\RequirePackage{qcm}[2004/11/09] + +\def\@titlefont{\LARGE\bfseries} +\newcommand\titlefont[1]{\gdef\@titlefont{#1}} +\@onlypreamble\titlefont + +\newlength\titlespace +\setlength\titlespace{20pt} + +\@onlypreamble\title + +\def\@make@title{% + \begin{center} + \@titlefont\@title + \end{center} + \vspace\titlespace} +\let\@maketitle\empty +\newcommand\maketitle{% + \@make@title% + \let\@maketitle\@make@title} + +\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} + +\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} +\gdef\@questionsepspace{0pt} + +\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}} + +\DeclareOption{english}{% + \questiontitle{Question N.\thequestion:}} +\DeclareOption{french}{% + \questiontitle{Question N$^{o}$~\thequestion~:}} +\DeclareOption{francais}{% + \ExecuteOptions{french}} + +\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 +} + +\endinput +%% +%% End of file `qcm.cls'. diff --git a/Master/texmf-dist/tex/latex/qcm/qcm.sty b/Master/texmf-dist/tex/latex/qcm/qcm.sty new file mode 100644 index 00000000000..fc72d145bf1 --- /dev/null +++ b/Master/texmf-dist/tex/latex/qcm/qcm.sty @@ -0,0 +1,186 @@ +%% +%% This is file `qcm.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% qcm.dtx (with options: `qcmstyle') +%% + + +%% Copyright (C) 2004 Didier Verna + +%% 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 the file `README'. + +%% \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 \~} +\NeedsTeXFormat{LaTeX2e} + +\ProvidesPackage{qcm}[2004/11/27 v2.1 + Multiple Choice Questionnaire style for LaTeX2e] + +\RequirePackage{ifthen} +\RequirePackage{calc} +\RequirePackage{verbatim} +\RequirePackage{tabularx} + +\def\@headerfont{\bfseries} +\newcommand\headerfont[1]{\gdef\@headerfont{#1}} + +\def\@X{X} +\newcommand\X[1]{\gdef\@X{#1}} + +\def\pbs#1{\let\tmp=\\#1\let\\=\tmp} +\newcolumntype{D}{>{\pbs\centering}X} +\newcolumntype{Q}{>{\@headerfont}X} + +\renewcommand\tabularxcolumn[1]{m{#1}} + +\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}}} + +\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}} + +\newcounter{question}\stepcounter{question} +\newcounter{@choice} + +\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.}}}} + +\newenvironment{question}[1]{% + %% \begin{question} + \begin{minipage}{\textwidth} + \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% + \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}% + +\def\@correctionstyle{\itshape} +\newcommand\correctionstyle[1]{\gdef\@correctionstyle{#1}} + +\newenvironment{@correction}{\@correctionstyle}{} + +\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}} + +\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 + +\endinput +%% +%% End of file `qcm.sty'. |