-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnmd-grades.cls
79 lines (68 loc) · 2.2 KB
/
nmd-grades.cls
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
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{nmd/nmd-grades}[2014/12/16 - Semester end edition]
\RequirePackage{nmd/nmd-common}
\ProcessOptions
\LoadClassWithOptions{article}
\RequirePackage[tikz]{nmd/nmd-graphics}
\RequirePackage[margin=0.5in]{geometry}
\RequirePackage[utopia]{nmd/nmd-fonts}
\setlength{\parindent}{0cm}
\addtolength{\parskip}{4pt}
% Drawing grade plots
\definecolor{nmd@Agrade}{gray}{0.9}
\definecolor{nmd@Bgrade}{gray}{1.0}
\definecolor{nmd@Cgrade}{gray}{0.9}
\definecolor{nmd@Dgrade}{gray}{1.0}
\definecolor{nmd@Fgrade}{gray}{0.9}
\pgfkeys{/tikz/plot height/.initial=3}
\pgfkeys{/tikz/grade label below/.initial=0.2}
% Grade boxes. Args are: xmin, xmax, grade, proportion
\newcommand{\gradebox}[4]{%
\def\nmd@plotheight{\pgfkeysvalueof{/tikz/plot height}}
\coordinate (A) at (#1, 0);
\coordinate (B) at (#2, 0);
\coordinate (C) at (#2, \nmd@plotheight + 1.0);
\coordinate (D) at (#1, \nmd@plotheight + 1.0);
\fill[color=nmd@#3grade] (A) rectangle (C);
\draw[color=nmd@#3grade] (D) -- (C) node
[midway, below=\pgfkeysvalueof{/tikz/grade label below}, color=black] {\large \emph{#3}};
\node[below left=0.07] at (C) {#4\%};
}
% ticks: xmin, xmax, ticks.
\newcommand{\axisandticks}[3]{%
\begin{scope}[color=black, ultra thick]
\draw (#1, 0) -- (#2,0);
\foreach \x in {#3}
{
\draw (\x, -0.5) node {$\x$};
\draw (\x, -0.2) -- (\x, 0);
}
\end{scope}
}
% vertical bars each representing one student
\newcommand{\drawbars}[1]{%
\foreach \x in {#1}
{
\draw[color=darkgray, fill=darkgray, line width=1pt]
(\x, 0) -- (\x, \pgfkeysvalueof{/tikz/plot height});
};
}
% histogram bar
\pgfkeys{/tikz/histogram bar width/.initial=1}
\newcommand{\onehistbar}[2]{
\def\nmd@histbarw{\pgfkeysvalueof{/tikz/histogram bar width}}
\coordinate (A) at (#1 - 0.5*\nmd@histbarw, 0);
\coordinate (C) at (#1 + 0.5*\nmd@histbarw, #2*\pgfkeysvalueof{/tikz/plot height});
\filldraw[color=black!35] (A) rectangle (C);
}
% histogram
\newcommand{\histogrambars}[1]{
\foreach \x / \y in {#1} {
\onehistbar{\x}{\y}
}
}
% student bar
\newcommand{\studentbar}[1]{%
\ifnotthen{\equal{#1}{EX}}{
\draw[color=black, line width=4pt] (#1, 0) -- (#1, 1.15*\nmd@plotheight);
}}