% Turn off special handling of vertical bars by lgrind, so tabular % works properly. %|- % The order of sections in a class package: % Identification Part % Initial Code Part % Declaration of Options % Execution of Options % Package Loading % Main Code % Identification Part: \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ictexam}[2002/02/01 For IVE ICT exams] % Initial Code Part: empty % Declaration of Options \DeclareOption{supplementary}{% \AtEndOfClass% {% \renewcommand*{\examtype}{Supplementary Exam}% }% } \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} % Execution of options \ProcessOptions % Special class file commands \LoadClass[% a4paper,% 12pt% ]{article} \RequirePackage{% geometry,% prog,% acro,% lastpage,% booktabs,% nbox,% varioref,% multicol,% multirow,% fancyhdr,% float,% amssymb,% psfrag,% amsmath,% graphicx,% amstext,% hhline,% cols,% key,% ifthen,% mdwlist,% calc,% fancybox,% verbatim,% moreverb,% nick% } % \RequirePackage[pdfpagemode=None, % pdfauthor={Nick Urbanik}, % pdfstartview=FitH, % pdfpagemode=FitWidth, % pdfkeywords={Operating Systems, Systems Integration}, % pdftitle={Final Examination, June 2002, Operating Systems % and Systems Integration}, % pdfsubject={Operating Systems and Systems Integration} % ]{hyperref} %\RequirePackage[nooneline,hang,bf]{caption2} \RequirePackage[bf]{caption2} \geometry{compat2, left = 30mm, top = 15mm, right = 30mm, bottom = 14mm, headheight = 19pt, headsep = 8mm, footskip = 11mm} \newlength{\ttWid} \settowidth{\ttWid}{\texttt{\small{}m}} \newcommand*{\threespace}{\underline{\hspace*{3\ttWid}}} \newcommand*{\twospace}{\underline{\hspace*{2\ttWid}}} \newenvironment{explanation}% {% \begin{list}{}% {% \setlength{\parskip}{0.8em plus .2em minus .2em} \rightmargin \leftmargin \topsep 0pt% }% \small\item[]% }% {\end{list}} % p. 74 of LaTeX Companion: \newcommand{\marginlabel}[1] {\mbox{}\marginpar{\raggedright\hspace{0pt}#1}} \DeclareRobustCommand{\marksFont}[1]{{\small#1}} \DeclareRobustCommand{\marks}[1]{% \ifthenelse{\equal{#1}{1} \or \equal{#1}{0.5}}% {\mbox{}\marginpar{\raggedright\hspace{0pt}{\marksFont{(#1 mark)}}}}% %{\marginpar{\small\textmedium{#1 mark}}}% % else %{\marginpar{\small\textmedium{#1 marks}}}% {\mbox{}\marginpar{\raggedright\hspace{0pt}{\marksFont{(#1 marks)}}}}% } % Stolen from exam.dtx: %@- %\providecommand\leftnote[1][-\baselineskip]{\@rlnote l{#1}} %\providecommand\rightnote[1][-\baselineskip]{\@rlnote r{#1}} %\providecommand\leftnote[1][-1.5\baslineskip]{\@rlnote l{#1}} %\providecommand\rightnote[1][-1.5\baselineskip]{\@rlnote r{#1}} \providecommand\leftnote[1][-0.75\baslineskip]{\@rlnote l{#1}} \providecommand\rightnote[1][-0.75\baselineskip]{\@rlnote r{#1}} %\providecommand\@rlnote[3]% %{% % \noindent\vadjust% % {% % \vbox to\z@% % {% % \vskip#2\leftskip\z@skip\rightskip\z@skip\noindent % \if#1l% % \llap{#3\hskip\marginparsep}% % \else% % \hfill\rlap{\hskip\marginparsep#3}% % \fi% % \vss\vskip\z@skip% % }% % }% %} \providecommand\@rlnote[3]% {% \noindent\vadjust% {% \vtop to\z@% {% \vskip-\baselineskip\leftskip\z@skip\rightskip\z@skip\noindent \if#1l% \llap{#3\hskip\marginparsep}% \else% \hfill\rlap{\hskip\marginparsep#3}% \fi% \vss\vskip\z@skip% }% }% } % Now try after looking at page 316 of the TeXbook: %\def\strutdepth{\dp\strutbox} %\providecommand\@rlnote[3]% %{% % \noindent\vadjust% % {% % \vtop to\z@% % {% % \vskip#2\leftskip\z@skip\rightskip\z@skip\noindent % \if#1l% % \llap{#3\hskip\marginparsep}% % \else% % \hfill\rlap{\hskip\marginparsep#3}% % \fi% % \vss\vskip\z@skip% % }% % }% %} % This comes nowhere near working: %\providecommand\@rlnote[3]% %{% % \if#1l% % \llap{#3\hskip\marginparsep}% % \else% % \hfill\rlap{\hskip\marginparsep#3}% % \fi% %} %@+ %\DeclareRobustCommand{\marks}[1]{% % \ifthenelse{\equal{#1}{1}}% % {\mbox{}\rightnote{\raggedright\hspace{0pt}{\marksFont{#1 mark}}}}% %% else % {\mbox{}\rightnote{\raggedright\hspace{0pt}{\marksFont{#1 marks}}}}% %} % Note that \topsep, \parsep, etc are set in size12.clo. \newenvironment{question}{% \enumerate % \parskip 12pt plus 2pt minus 2pt% % \itemsep 15pt plus 7.5pt minus 3pt% % \topsep 30pt plus 12pt minus 12pt% % \parsep 12pt plus 2pt minus 2pt% % \partopsep 12pt plus 4pt minus 4pt\relax% }{\endenumerate} \newenvironment{subQuestion}{% \enumerate % \parskip 3pt plus 1pt minus 1pt% % \itemsep 5pt plus 2.5pt minus 1pt% % \topsep 7pt plus 2.5pt minus 1pt% % \parsep 3pt plus 1pt minus 1pt% % \partopsep 3pt plus 2pt minus 2pt\relax% }{\endenumerate} %@- %% \def\@listi{\leftmargin\leftmargini %% \partopsep 12pt plus 4pt minus 4pt% %% \parskip 12pt plus 2pt minus 2pt% %% \itemsep 15pt plus 7.5pt minus 3pt% %% \topsep 30pt plus 12pt minus 12pt% %% \parsep 12pt plus 2pt minus 2pt% %% % \parsep 5\p@ \@plus2.5\p@ \@minus\p@ %% % \topsep 10\p@ \@plus4\p@ \@minus6\p@ %% % \itemsep5\p@ \@plus2.5\p@ \@minus\p@% %% } %% \let\@listI\@listi %% \@listi % From size12.clo, 25 March 2002: %% \def\@listi{\leftmargin\leftmargini %% \parsep 5\p@ \@plus2.5\p@ \@minus\p@ %% \topsep 10\p@ \@plus4\p@ \@minus6\p@ %% \itemsep5\p@ \@plus2.5\p@ \@minus\p@} %% \let\@listI\@listi %% \@listi %% \def\@listii {\leftmargin\leftmarginii %% \labelwidth\leftmarginii %% \advance\labelwidth-\labelsep %% \topsep 5\p@ \@plus2.5\p@ \@minus\p@ %% \parsep 2.5\p@ \@plus\p@ \@minus\p@ %% \itemsep \parsep} %% \def\@listiii{\leftmargin\leftmarginiii %% \labelwidth\leftmarginiii %% \advance\labelwidth-\labelsep %% \topsep 2.5\p@\@plus\p@\@minus\p@ %% \parsep \z@ %% \partopsep \p@ \@plus\z@ \@minus\p@ %% \itemsep \topsep} %% \def\@listiv {\leftmargin\leftmarginiv %% \labelwidth\leftmarginiv %% \advance\labelwidth-\labelsep] % My modifications to the above, to increase spacing between questions: \def\@listi{\leftmargin\leftmargini \parsep 5\p@ \@plus2.5\p@ \@minus\p@ \topsep 10\p@ \@plus4\p@ \@minus6\p@ \itemsep35\p@ \@plus10\p@ \@minus5\p@} \let\@listI\@listi \@listi \def\@listii {\leftmargin\leftmarginii \labelwidth\leftmarginii \advance\labelwidth-\labelsep \topsep 5\p@ \@plus2.5\p@ \@minus\p@ \parsep 2.5\p@ \@plus\p@ \@minus\p@ \itemsep 20\p@ \@plus6\p@ \@minus2\p@} \def\@listiii{\leftmargin\leftmarginiii \labelwidth\leftmarginiii \advance\labelwidth-\labelsep \topsep 2.5\p@\@plus\p@\@minus\p@ \parsep \z@ \partopsep \p@ \@plus\z@ \@minus\p@ \itemsep 15\p@ \@plus5\p@ \@minus2\p@} \def\@listiv {\leftmargin\leftmarginiv \labelwidth\leftmarginiv \advance\labelwidth-\labelsep \itemsep 8\p@\@plus4\p@\@minus\p@} \renewcommand\theenumii{\@roman\c@enumii} \renewcommand\theenumiii{\@alph\c@enumiii} \renewcommand\theenumiv{\@Alph\c@enumiv} %\newcommand\labelenumi{\theenumi.} \renewcommand{\labelenumi}{\textbf{Q\theenumi.}} \renewcommand\labelenumii{\textbf{\theenumii)}} \renewcommand\labelenumiii{\textbf{(\theenumiii)}} \renewcommand\labelenumiv{\textbf{\theenumiv.}} \renewcommand\p@enumii{\theenumi} \renewcommand\p@enumiii{\theenumi(\theenumii)} \renewcommand\p@enumiv{\p@enumiii\theenumiii} %% \renewcommand\theenumii{\@alph\c@enumii} %% \renewcommand\theenumiii{\@roman\c@enumiii} %% \renewcommand\theenumiv{\@Alph\c@enumiv} %% \newcommand\labelenumi{\theenumi.} %% \newcommand\labelenumii{(\theenumii)} %% \newcommand\labelenumiii{\theenumiii.} %% \newcommand\labelenumiv{\theenumiv.} %% \renewcommand\p@enumii{\theenumi} %% \renewcommand\p@enumiii{\theenumi(\theenumii)} %% \renewcommand\p@enumiv{\p@enumiii\theenumiii} %% \renewcommand{\theenumii}{\roman{enumii}} %% \renewcommand{\labelenumii}{\textbf{\theenumii)}} %% \renewcommand{\theenumiii'}{\alph{enumiii}} %% \renewcommand{\labelenumiii}{\textbf{(\theenumiii)}} % The following was the result of a major grepping and source viewing % session. I found the most helpful source to be ltxref.dtx, part of % LaTeX2e. The packages caption.dtx and caption2.dtx didn't help % much. % This works rather well; it could now be put into a package. % Perhaps it would be appropriate to make it part of \caption, so that % there is no special word required for each float type. % Update: Donald told me how to do it right, bless him: %% From: Donald Arseneau %% Newsgroups: comp.text.tex %% Subject: Re: References: my macros are broken; please help %% Date: 19 Mar 2002 18:12:55 -0800 %% Organization: TRIUMF: Canada's national meson facility %% Lines: 44 %% Sender: asnd@mutant %% Message-ID: %% References: <3C94ECA4.81946117@vtc.edu.hk> <3C96924D.BDC45404@vtc.edu.hk> <3C97C91F.F2C93D8A@vtc.edu.hk> %% Mime-Version: 1.0 %% Content-Type: text/plain; charset=us-ascii %% X-Trace: nntp.itservices.ubc.ca 1016590085 6793 142.90.112.22 (20 Mar 2002 02:08:05 GMT) %% X-Complaints-To: abuse@interchange.ubc.ca %% User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7 %% Xref: dragon.vtc.edu.hk comp.text.tex:122897 %% Nick Urbanik writes: %% > Donald Arseneau wrote: %% > %% > > Nick Urbanik writes: %% > > %% > > > > > \newFigTag{QB\ref{que:paging}} %% > > > > or...). Note that you are %% > > > > using \ref in a label. %% > > > %% > > > Sorry to be so slow, but what would be a good idea to do instead? %% > > %% > > Think about what you really want. I expect you don't want %% > > a hyper-link to be part of the fig-tag. (It can't work %% > > even if you DID want that!) Maybe you want to use %% > > \@currentreference? %% > %% > That doesn't seem to work. %% You noticed it was really \@currentlabel, and it does work. %% > What I'm aiming for is a label for each %% > figure that matches the question number, %% Why don't you make a new class of float, which is cleaner, rather %% than calling them figures. %% > Here is an example document that works as reuired, except that it does %% > not work with hyperref, %% But it still doesn't explain WHAT labelling you want. What is "match"? %% Using \ref is neither feasible nor elegant. %% Using \@currentlabel does work. %% \newcommand*{\newFigTag}{ %% \protected@edef\thefigure{Q\@currentlabel}% %% \def\@currentlabel{\thefigure}% %% \def\refstepcounter##1{}% %% } \newcommand*{\newQTag}{ \protected@edef\thefigure{Q\@currentlabel}% \protected@edef\thetable{Q\@currentlabel}% \protected@edef\theprogram{Q\@currentlabel}% } %% \newcommand*{\newFigTag}[1]{% %% \def\fnum@figure{Figure #1}% %% \def\@currentlabel{#1}% %% \def\refstepcounter##1{}% %% } %% \newcommand*{\newTabTag}[1]{% %% \def\fnum@table{Table #1}% %% \def\@currentlabel{#1}% %% \def\refstepcounter##1{}% %% } %% %\newcommand{\newTabTag}[1]{% %% % \def\fnum@table{Table #1}% %% %} %% \newcommand*{\newProgTag}[1]{% %% \def\fnum@program{Program listing #1}% %% % \def\fnum@program{Figure #1}% %% \def\@currentlabel{#1}% %% \def\refstepcounter##1{}% %% } \setlength{\marginparsep}{6mm} \setlength{\marginparwidth}{20mm} \newcommand*{\pinNumSize}{\scriptsize} % Nick: % This is what may override in the document: % \newcommand*{\department}{Department of Information and Communications % Technology}% \newcommand*{\subject}{Operating Systems and Systems Integration}% %\newcommand*{\dateofexam}{June sometime} \newcommand*{\dateofexam}{11 June 2002}% \newcommand*{\subjectnumber}{CMT3321}% \newcommand*{\department}{Department of Information and Communications Technology (Tsing Yi)} \newcommand*{\courseName}{FT Higher Diploma in Computer Systems Administration} \newcommand*{\courseCode}{41300} \newcommand*{\headerfontsize}{\footnotesize}% \newcommand*{\footerfontsize}{\scriptsize} \newcommand{\examtype}{Main Examination} \newcounter{year} \setcounter{year}{2001} \newcounter{nextyear} \setcounter{nextyear}{\value{year}} \addtocounter{nextyear}{1} \newcommand*{\thisyear}{\arabic{year}} \newcommand*{\nextyear}{\arabic{nextyear}} \newsavebox{\fminibox}% \newlength{\fminilength}% \setlength{\fminilength}{\textwidth-2\fboxsep-2\fboxrule}% \pagestyle{fancy} \lhead{\headerfontsize\textbf{\upshape \department\\ \courseName{} (\courseCode)}} \rhead{\headerfontsize\textbf{\upshape page \thepage{} of \pageref{LastPage}}} % \pageref{pag:lastpage}}} \lfoot{\noindent\fbox{% \begin{minipage}{\fminilength}% \headerfontsize\upshape\subject{} (\subjectnumber)\hfill \examtype{} \thisyear/\nextyear \end{minipage}% }} \cfoot{} \renewcommand{\floatpagefraction}{0.75} % default is .5, to increase % density. \renewcommand*{\bottomfraction}{0.6} % default is 0.3 \renewcommand*{\topfraction}{0.85} % default is 0.7 \renewcommand*{\textfraction}{0.1} % default is 0.2 \setlength{\extrarowheight}{1pt} \floatstyle{ruled} \floatname{program}{Figure} \newfloat{program}{tbh}{lop} \providecommand*{\dc}{\textsf{\relsize{-1}X}\xspace} % dc = Don't care. %\renewcommand{\captionfont}{\raggedright} \newlength{\SA} \newlength{\SB} \newlength{\SC} \newlength{\SD} \newlength{\Se} \newlength{\amount} \settoheight{\SA}{\scriptsize $\star$} \settoheight{\SB}{\footnotesize $\star$} \settoheight{\SC}{\small $\star$} \settoheight{\SD}{\normalsize $\star$} \settoheight{\Se}{\large $\star$} \setlength{\amount}{0.5\Se} % [1][end of questions]{ \DeclareRobustCommand{\endOfExam}[1][end of questions]{% \hfill% \raisebox{\amount-0.5\SA}[0pt][0pt]{\makebox{\scriptsize $\star$}} \raisebox{\amount-0.5\SB}[0pt][0pt]{\makebox{\footnotesize $\star$}} \raisebox{\amount-0.5\SC}[0pt][0pt]{\makebox{\small $\star$}} \raisebox{\amount-0.5\SD}[0pt][0pt]{\makebox{\normalsize $\star$}} \raisebox{\amount-0.5\Se}[0pt][0pt]{\makebox{\large $\star$}} \hspace{1em} \textbf{#1} \hspace{1em} \raisebox{\amount-0.5\Se}[0pt][0pt]{\makebox{\large $\star$}} \raisebox{\amount-0.5\SD}[0pt][0pt]{\makebox{\normalsize $\star$}} \raisebox{\amount-0.5\SC}[0pt][0pt]{\makebox{\small $\star$}} \raisebox{\amount-0.5\SB}[0pt][0pt]{\makebox{\footnotesize $\star$}} \raisebox{\amount-0.5\SA}[0pt][0pt]{\makebox{\scriptsize $\star$}} \hfill } \AtBeginDocument% {% \raggedright } % end of ictexam.cls