diff options
author | Karl Berry <karl@freefriends.org> | 2016-12-20 22:54:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-12-20 22:54:48 +0000 |
commit | f84e6a7cb7a889c2a8c7297f9d5ca4894eab7687 (patch) | |
tree | c549ecf37486b8cadd59b3b82d3bac295c3e7596 /Master/texmf-dist/tex/latex/exam-n | |
parent | 5a634cef0f8bbb07d7982cb2bbcb38037a233686 (diff) |
exam-n (20dec16)
git-svn-id: svn://tug.org/texlive/trunk@42755 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/exam-n')
-rw-r--r-- | Master/texmf-dist/tex/latex/exam-n/exam-n.cls | 195 |
1 files changed, 133 insertions, 62 deletions
diff --git a/Master/texmf-dist/tex/latex/exam-n/exam-n.cls b/Master/texmf-dist/tex/latex/exam-n/exam-n.cls index 68a03b55c61..fb7e2ce8345 100644 --- a/Master/texmf-dist/tex/latex/exam-n/exam-n.cls +++ b/Master/texmf-dist/tex/latex/exam-n/exam-n.cls @@ -6,10 +6,10 @@ %% %% exam-n.dtx (with options: `package') %% exam-n: format exam questions -%% Release version 1.1, 2014 May 03. +%% Release version 1.1.4, 2016 December 19. %% %%%% File: exam-n.dtx -%%%% Copyright 2005--2014, Norman Gray +%%%% Copyright 2005--2016, Norman Gray %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -27,12 +27,12 @@ %% the derived file exam-n.cls, %% and the associated *.clo files. -%%%% Source: Mercurial revision 6f818b549982, 2014-05-03 13:42 +0100, tag 1.1 + 0 +%%%% Source: Mercurial revision e8a612cb25f4, 2016-12-19 16:49 +0000, tag exam-n-1.1.4 + 0 %% \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{exam-n}[2014/05/03 1.1] -\typeout{Class: `exam-n 1.1 <2014/05/03>} +\ProvidesClass{exam-n}[2016/12/19 1.1.4] +\typeout{Class: `exam-n 1.1.4 <2016/12/19>} @@ -94,9 +94,15 @@ \def\examn@header@shoutformat#1{{\Huge\bfseries #1}} } \DeclareOption{colour}{} +\newcount\examn@fontvariant + \examn@fontvariant=0 % the default \newif\ifbigfont -\bigfontfalse -\DeclareOption{bigfont}{\bigfonttrue} + \bigfontfalse +\DeclareOption{largefont}{\examn@fontvariant=1 \bigfontfalse} +\DeclareOption{bigfont}{% + \ClassWarning{exam-n}{OPTION [bigfont] HAS BEEN DEPRECATED; use [hugefont] instead} + \examn@fontvariant=2 \bigfonttrue} +\DeclareOption{hugefont}{\examn@fontvariant=2 \bigfonttrue} \PassOptionsToClass{a4paper}{article} \newtoks\@styleoverrides \@styleoverrides={} @@ -228,7 +234,25 @@ \DeclareRobustCommand\normalfont {\usefont\encodingdefault\sfdefault\seriesdefault\shapedefault \relax} \fi -\ifbigfont +\ifcase\examn@fontvariant + % default: do nothing +\or + % font variant 1: 18pt + \def\examn@bodyfontchange{ + \renewcommand\normalsize{% + \@setfontsize\normalsize{18}{24}% + \abovedisplayskip 18\p@ \@plus3.5\p@ \@minus9\p@ + \abovedisplayshortskip \z@ \@plus5\p@ + \belowdisplayshortskip 10\p@ \@plus5\p@ \@minus5\p@ + \belowdisplayskip \abovedisplayskip + \let\@listi\@listI} + \parindent=24pt + \parskip=18pt + % Redefine \FormatPartMarks so that it doesn't push the text off the paper + \let\FormatPartMarks\examn@variantFormatPartMarks + } +\or + % font variant 2: 36pt \def\examn@bodyfontchange{ \renewcommand\normalsize{% \@setfontsize\normalsize{36}{42}% @@ -240,16 +264,23 @@ \parindent=48pt \parskip=36pt % Redefine \FormatPartMarks so that it doesn't push the text off the paper - \def\FormatPartMarks##1{ - \setbox0=\hbox{\hskip 1em \textbf{[##1]}} - \@tempdima=0.8\marginsize - \ifdim\wd0>\@tempdima - \advance\@tempdima -\wd0 - \hbox to 0pt{\hskip\@tempdima \box0\hss}% - \else - \hbox to 0pt{\box0\hss} - \fi}} + \let\FormatPartMarks\examn@variantFormatPartMarks + } +\else + % Bad font variant + \ClassError{exam-n} + {Bad font variant \examn@fontvariant} + {I didn't expect to see that number (broken style file re largefont/hugefont?)} \fi +\def\examn@variantFormatPartMarks#1{% + \setbox0=\hbox{\hskip 1em \textbf{[#1]}}% + \@tempdima=0.8\marginsize + \ifdim\wd0>\@tempdima + \advance\@tempdima -\wd0 + \hbox to 0pt{\hskip\@tempdima \box0\hss}% + \else + \hbox to 0pt{\box0\hss}% + \fi} \def\@exambanner{} \def\exambanner{\def\@exambanner} @@ -303,12 +334,12 @@ images may not be used in examinations without prior arrangement. \def\CheckTotalQuestions{% \ifnum\@draftstatus < 2 \ifx\@numquestions\@empty \else - \ifnum\questionnumber=\@numquestions \else + \ifnum\c@questionnumber=\@numquestions \else \ClassWarning{exam-n} - {Expected \@numquestions\space questions, got \the\questionnumber!} + {Expected \@numquestions\space questions, got \thequestionnumber!} \ifnum\@draftstatus > 0 % draft mode \begin{center} - \textbf{\highlighted{Expected \@numquestions\space questions, got \the\questionnumber}} + \textbf{\highlighted{Expected \@numquestions\space questions, got \thequestionnumber}} \end{center} \fi \fi @@ -365,16 +396,28 @@ images may not be used in examinations without prior arrangement. } \setlength{\parindent}{2em} \setlength{\parskip}{\bigskipamount} +\def\examn@flushfloats{\par + \begingroup + \edef\@tempa{\@deferlist\@dbldeferlist} + \ifx\@tempa\@empty \else + \clearpage + \fi + \endgroup +} \ifcase\@draftstatus % Final version \def\ClosingText{ + \examn@flushfloats \begin{center}\textbf{End of Paper}\\\end{center} \mark{END}} \or % Draft version \def\ClosingText{ + \examn@flushfloats \begin{center}\textbf{End of Draft Paper}\\\end{center} \mark{END}} \else % Compose version (nothing, because this would be on a page by itself) - \def\ClosingText{\mark{END}} + \def\ClosingText{ + \examn@flushfloats + \mark{END}} \fi \RequirePackage{fancyhdr} \pagestyle{fancy} @@ -390,7 +433,7 @@ images may not be used in examinations without prior arrangement. \def\@tempa{END} \xdef\examn@topmark{\botmark} \ifx\examn@topmark\@empty - \formatcontinuations{Paper continued over}% + \formatcontinuations{Paper continued over\dots}% \else\ifx\examn@topmark\@tempa \formatcontinuations{END} \else @@ -552,15 +595,16 @@ images may not be used in examinations without prior arrangement. \vskip 2\baselineskip plus 0.3fil \parindent=0pt \parskip=0.5\baselineskip - \ifbigfont + \ifnum\examn@fontvariant > 0 % Don't put the rubric here (see below) + {\LARGE Rubric: see overleaf} \else \ifx\@rubric\@empty\else \ifx\@rubric\@nnil\else - % if there's a rubric, separate from the base rubric, then + % If there's a rubric, separate from the base rubric, then % separate the two with an hrule (the per-exam rubric % presumably represents special instructions for this exam, - % so should be highlighted + % so should be highlighted) \vbox{\let\emph\textbf \@rubric \par} @@ -569,10 +613,10 @@ images may not be used in examinations without prior arrangement. \vskip1.5\baselineskip \fi \fi - \ifx\@baserubric\@empty \else - \@baserubric \par - \fi - \fi % end \ifbigfont\else + \ifx\@baserubric\@empty \else + \@baserubric \par + \fi + \fi % end \ifbigfont \else ... \end{center} \vskip 2\baselineskip plus 0.6fil % \newpage is {\vfil\penalty-\@M} \vbox to 0pt{\hbox to \textwidth{% @@ -606,7 +650,7 @@ images may not be used in examinations without prior arrangement. % \examn@bodyfontchange \normalfont\normalsize - \ifbigfont + \ifnum\examn@fontvariant>0 % Put the rubric on a second page, in the 'huge' size. \begin{center} \parskip=18pt @@ -654,11 +698,13 @@ images may not be used in examinations without prior arrangement. \def\subsubsection{\@badsection{subsubsection}} \def\paragraph{\@badsection{paragraph}} \def\subparagraph{\@badsection{subparagraph}} +\renewcommand\tableofcontents{\bigskip + \hbox to \textwidth{\hfil\textbf{\Large Contents}\hfil}% + \@starttoc{toc}} \newcount\marktotal % number of marks accumulated so far \newcount\markgoal % number of marks we should have in the end - -\newcount\questionnumber -\questionnumber=0 +\newcounter{questionnumber} +\setcounter{questionnumber}0 \newcounter{partnumber} \renewcommand\part{% \if@nobreak \else @@ -672,7 +718,8 @@ images may not be used in examinations without prior arrangement. \stepcounter{partnumber}% \noindent\FormatPartNumber } -\newcommand\FormatPartNumber{\hbox to \parindent{(\alph{partnumber})\hss}} +\newcommand\FormatPartNumber{\hbox to \parindent{(\StylePartNumber{partnumber})\hss}} +\let\StylePartNumber\alph \newif\if@newpagebeforequestion \if@pageperquestion \@newpagebeforequestiontrue @@ -713,7 +760,7 @@ images may not be used in examinations without prior arrangement. % visual display only -- doesn't count towards mark total \setbox0=\vbox to 0pt{\vss \hbox to \textwidth{\hfil\hbox to 0pt{\quad\small[\dots #1]\hss}} - \vskip0.25ex } + \vskip0.25ex }% % the next line is probably unnecessary, but guarantees that box0 % has zero depth, so no extra vertical space appears because of % this new box @@ -726,13 +773,24 @@ images may not be used in examinations without prior arrangement. \else \global\advance\marktotal #1 \if@tempswa - \setbox0=\vbox to 0pt{\vss - \hbox to \textwidth{\strut\hfill\FormatPartMarks{#1}}% - \vskip 1\baselineskip} % vskip means box has zero depth - \ifvmode - \box0 + \ifdim\displaywidth>0pt + \if@eqnsw + \ClassError{exam-n}{\string\partmarks* may not be used + within numbered equations}{Replace \string\partmarks* + with a \string\partmarks\ after the equation} + \global\advance\marktotal -#1 % to cause the mark total to be wrong + \else + \eqno \hbox to 1sp{\FormatPartMarks{#1}\hfil}% + \fi \else - \vadjust{\box0}% + \setbox0=\vbox to 0pt{\vss + \hbox to \textwidth{\strut\hfill\FormatPartMarks{#1}}% + \vskip 1\baselineskip}% vskip means box has zero depth + \ifvmode + \box0 + \else + \vadjust{\box0}% + \fi \fi \else \ifdim\@partmarksspace > 0pt @@ -770,8 +828,8 @@ images may not be used in examinations without prior arrangement. {Missing mark goal for question (using 0 instead)} {Missing mark goal for question (using 0 instead)} \def\@tempa{0} - \fi - \ifx\@includequestionoverridenumber\@empty + \fi + \ifx\@includequestionoverridenumber\@empty \do@question{#1}{\@tempa}% \else \ClassWarning{exam-n}{Forcing question number @@ -802,16 +860,16 @@ images may not be used in examinations without prior arrangement. \fi} {\par \ifnum\ex@mcqi<\ex@nmcq - \ClassWarning{exam-n}{Too few potential answers in MCQ \the\questionnumber} - \@shout{Too few potential answers in MCQ \the\questionnumber} + \ClassWarning{exam-n}{Too few potential answers in MCQ \thequestionnumber} + \@shout{Too few potential answers in MCQ \thequestionnumber} \ifnum\@draftstatus > 0 \highlighted{TOO FEW ANSWERS}\par \fi \fi \ifcase\ex@mcqnanswer \ClassWarning{exam-n} - {No correct MCQ answer provided in question \the\questionnumber} - \@shout{No correct MCQ answer provided in question \the\questionnumber} + {No correct MCQ answer provided in question \thequestionnumber} + \@shout{No correct MCQ answer provided in question \thequestionnumber} \ifnum\@draftstatus > 0 \highlighted{NO CORRECT ANSWER PROVIDED}\par \fi @@ -819,8 +877,8 @@ images may not be used in examinations without prior arrangement. % ex@mcqanswer=1: correct -- do nothing \else \ClassWarning{exam-n} - {Too many correct MCQ answers provided in question \the\questionnumber} - \@shout{Too many correct MCQ answers provided in question \the\questionnumber} + {Too many correct MCQ answers provided in question \thequestionnumber} + \@shout{Too many correct MCQ answers provided in question \thequestionnumber} \ifnum\@draftstatus > 0 \highlighted{TOO MANY CORRECT ANSWERS}\par \fi @@ -862,7 +920,12 @@ images may not be used in examinations without prior arrangement. \questionpreamble{} \fi \setcounter{partnumber}{0} - \global\advance\questionnumber 1 + \setcounter{answerpartnumber}{0} + \refstepcounter{questionnumber} + \def\@tempa{#1} + \ifx\@tempa\@empty \else + \edef\@currentlabel{#1} + \fi \examn@prequestionspace{% \if@nobreak % after a heading (or something like that) @@ -876,7 +939,7 @@ images may not be used in examinations without prior arrangement. \def\@tempa{#1}% intended question number \ifx\@tempa\@empty % no optional argument -- easy - \def\@currentquestion{\the\questionnumber} + \def\@currentquestion{\thequestionnumber} \else \setbox0=\hbox{\@tempcnta=#1} \ifdim\wd0>0pt @@ -889,21 +952,21 @@ images may not be used in examinations without prior arrangement. \ifcase\@draftstatus % Final version \@tempcnta=#1 - \ifnum\questionnumber=\@tempcnta + \ifnum\c@questionnumber=\@tempcnta \def\@currentquestion{#1} \else \ifx\@includequestionoverridenumber\@empty \ClassError{exam-n} - {\string\question[#1] is actually question \the\questionnumber!} + {\string\question[#1] is actually question \thequestionnumber!} {The question in {question} environment number - \the\questionnumber\space is specified as + \thequestionnumber\space is specified as \string\question[#1].\MessageBreak This is an error in 'final' mode.\MessageBreak Perhaps you need \string\QuestionNumberChecksOff?} \def\@currentquestion{???} \else \ClassWarning{exam-n}{Forcing question number \@includequestionoverridenumber, - in {question} environment number \the\questionnumber} + in {question} environment number \thequestionnumber} \edef\@currentquestion{\@includequestionoverridenumber}% this doesn't seem to expand in fact! \message{current question=\@currentquestion, override \@includequestionoverridenumber} \fi @@ -912,9 +975,9 @@ images may not be used in examinations without prior arrangement. % Draft version -- let the given number override % \the\questionnumber, but warn if there's a difference. \@tempcnta=#1 - \ifnum\questionnumber=\@tempcnta \else + \ifnum\c@questionnumber=\@tempcnta \else \ClassWarning{exam-n} - {\string\question[#1] is actually question \the\questionnumber!} + {\string\question[#1] is actually question \thequestionnumber!} \fi \def\@currentquestion{#1} \else @@ -929,16 +992,16 @@ images may not be used in examinations without prior arrangement. % no optional argument -- this is possibly an error, so warn \ClassWarning{exam-n}{\string\QuestionNumberChecksOff\ is in force, but this question has no [number]} - \def\@currentquestion{\the\questionnumber} + \def\@currentquestion{\thequestionnumber} \else - \typeout{Forcing question \the\questionnumber\space to be #1} + \typeout{Forcing question \thequestionnumber\space to be #1} \def\@currentquestion{#1} \fi \fi \everypar{\setbox0=\lastbox % discard \box0 \FormatQuestionNumber \mark{\@currentquestion}% - \everypar{}} + \global\everypar{}} } \newcommand\FormatQuestionNumber {\hbox to 0pt{\hss \textbf{\@currentquestion}\hskip1em}} @@ -987,6 +1050,7 @@ images may not be used in examinations without prior arrangement. } } \newenvironment{questiondata}{% + \par \penalty50 % poor break \vbox\bgroup \slshape @@ -1002,7 +1066,7 @@ images may not be used in examinations without prior arrangement. \medskip \hrule width \textwidth \par - \egroup + \egroup % end of \vbox } \newcommand\questionpreamble[1]{\gdef\examn@questionpreamble{#1}} \let\examn@questionpreamble\@empty @@ -1080,6 +1144,11 @@ images may not be used in examinations without prior arrangement. \let\@includequestionoverridenumber\@empty \newif\if@insolution \@insolutionfalse +\newcounter{answerpartnumber} +\newcommand{\examn@solutionpart}{% + \par + \stepcounter{answerpartnumber} + \noindent\hbox to \parindent{(\StylePartNumber{answerpartnumber})\hss}} \def\@formatsolution{\par \if@insolution \ClassError{exam-n}{Misplaced solution}{You can't have a solution within a solution} @@ -1088,12 +1157,13 @@ images may not be used in examinations without prior arrangement. \fi \examn@dummycaptions % dummy captions within solutions \typeout{SHOWING SOLUTIONS} + \let\part\examn@solutionpart \vskip 1ex plus 2\bigskipamount % add stretchable space... \penalty-\@lowpenalty % ...and encouragement to break here \parskip 0.5\baselineskip \raggedright \color{solutiontext}%\slshape - \ifbigfont\else + \ifbigfont \else \small \fi \hrule @@ -1102,6 +1172,7 @@ images may not be used in examinations without prior arrangement. \vskip -\parskip % cancel out the following parskip \textbf{\highlighted{Solution:}}\hskip2em \ignorespaces + \parindent=2em } \def\end@formatsolution{% \par |