summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mathexam/mathexam.sty
blob: a5a05ce4f9dfd90753ab87d1724d302cb984ffc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
%%
%% This is file `mathexam.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% mathexam.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2007 by Jan Hlavacek
%% 
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.2 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.2 or later is part of all distributions of LaTeX version
%% 1999/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mathexam}
        [2007/07/30 v1.00 Package for typesetting exams]
\newif\ifExamHdr
\ExamHdrtrue
\DeclareOption{nohdr}{\ExamHdrfalse}
\ProcessOptions
\ifExamHdr
\RequirePackage{fancyhdr}
\RequirePackage{lastpage}
\RequirePackage{ifthen}
\fi
\newcommand{\ExamName}[1]{\def\@xamname{#1}}
\newcommand{\ExamClass}[1]{\def\@xamclass{#1}}
\newcommand{\ExamHead}[1]{\def\@xamrighthdr{#1}}
\def\@xamname{\relax}
\def\@xamclass{\relax}
\def\@xamrighthdr{\relax}
\ifExamHdr
\pagestyle{fancy}

\lhead{\@xamclass}
\chead{\@xamname}
\rhead{Page \thepage\ of \pageref{LastPage}}

\rfoot{\ifthenelse{\value{page}=\pageref{LastPage}}{The End.}{Cont.}}
\cfoot{}
\AtBeginDocument{
\begin{center}
   \large\scshape \@xamclass \hfill \@xamname \hfill \@xamrighthdr
\end{center}}

\thispagestyle{empty}
\fi
\newcommand{\answ@r}[1][\fill]{%
   \nopagebreak\vspace{#1}\par\nopagebreak\hfill\hbox to
   .5\columnwidth{Answer:\hrulefill}\vspace{\baselineskip}}

\newcommand{\addansw@r}[1][\baselineskip]{%
   \nopagebreak\vspace{#1}\par\nopagebreak\hfill\hbox to
   .5\columnwidth{Answer:\hrulefill}\vspace{\baselineskip}}
\newcommand{\answ@rstar}[2][\fill]{%
   \nopagebreak\vspace{#1}\par\nopagebreak\hfill\hbox to
   .5\columnwidth{#2\hrulefill}\vspace{\baselineskip}}

\newcommand{\addansw@rstar}[2][\baselineskip]{%
   \nopagebreak\vspace{#1}\par\nopagebreak\hfill\hbox to
   .5\columnwidth{#2\hrulefill}\vspace{\baselineskip}}
\def\answer{%
   \def\e@t*{}%
   \def\n@xt{\if\noexpand\myn@@xt*%
      \expandafter\expandafter\expandafter\answ@rstar\expandafter\e@t\else%
      \expandafter\answ@r\fi}%
   \futurelet\myn@@xt\n@xt}

\def\addanswer{%
   \def\e@t*{}%
   \def\n@xt{\if\noexpand\myn@@xt*%
      \expandafter\expandafter\expandafter\addansw@rstar\expandafter\e@t\else%
      \expandafter\addansw@r\fi}%
   \futurelet\myn@@xt\n@xt}
\newcommand{\noanswer}[1][\fill]{\nopagebreak\vspace{#1}\par}
\newcommand{\ExamNameLine}{%
\par
\vspace{\baselineskip}
Name:\hrulefill\relax
\par}
\newcommand{\ExamInstrBox}[1]{\begin{center}\vspace{\baselineskip}%
   \fbox{\fbox{\parbox{.8\hsize}{#1}}}\end{center}}

\endinput
%%
%% End of file `mathexam.sty'.