blob: ff61d4dbbfff81ef7d93e1189bb8eac170f2b2db (
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
|
% This file is public domain.
\documentclass[captions=tableheading]{scrartcl}
\usepackage{datatool}
\usepackage{longtable}
\DTLloaddb{scores}{sample-student-records.csv}
\begin{document}
Sort by surname, then first name:
\DTLsort{Surname,First Name}{scores}
% omit Address column
\DTLdisplaydb[Address]{scores}
Sort by assignment 1 score in descending order:
\DTLsort{Assignment 1=descending}{scores}
% omit Address column
\DTLdisplaydb[Address]{scores}
Average score:
\DTLmeanforcolumn{scores}{Assignment 1}{\averagescore}%
\averagescore\%.
Rounded to two decimal places: \DTLround{\averagescore}{\averagescore}{2}%
\averagescore\%.
A long list will require the longtable environment (supplied by
longtable.sty). Example in Table~\ref{tab:records}.
% Omit RegNum and Address columns
\DTLdisplaylongdb[caption={Student Scores},label={tab:records},omit={RegNum,Address}]{scores}
\end{document}
|