diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/datatool/samples')
-rw-r--r-- | Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.pdf | bin | 0 -> 35087 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.tex | 57 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.pdf | bin | 0 -> 19543 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.tex | 21 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.pdf | bin | 0 -> 33969 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.tex | 36 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/datatool/samples/sample-student-records.csv | 7 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.pdf | bin | 0 -> 34628 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.tex | 34 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.pdf | bin | 0 -> 31764 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.tex | 55 |
11 files changed, 210 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.pdf Binary files differnew file mode 100644 index 00000000000..89ea8bf27c2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.pdf diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.tex b/Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.tex new file mode 100644 index 00000000000..142f1eeb810 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.tex @@ -0,0 +1,57 @@ + % This file is public domain. +\documentclass[captions=tableheading]{scrartcl} + +\usepackage{tikz} +\usetikzlibrary{snakes} + +\usepackage{databar} + +\DTLloaddb{marks}{sample-student-records.csv} + +\begin{document} + +% Compute average mark for each student: +\DTLforeach{marks}{% +\assignI=Assignment 1,% +\assignII=Assignment 2,% +\assignIII=Assignment 3}{% +\DTLmeanforall{\theMean}{\assignI,\assignII,\assignIII}% +\DTLround{\theMean}{\theMean}{0}\DTLclip{\theMean}{\theMean}% +\DTLappendtorow{Average}{\theMean}} + +\begin{table} +\caption{Student Marks} + \centering +\DTLdisplaydb[Address,RegNum,Title]{marks} +\end{table} + +\begin{figure}[htbp] + \centering + % compute the overall mean + \DTLmeanforkeys{marks}{Average}{\overallmean} + % round it to 2 decimal places + \DTLround{\overallmean}{\overallmean}{2} + % draw a grey dotted line indicating the overall mean + % covering the entire width of the bar chart + \renewcommand*{\DTLbaratendtikz}{% + \draw[lightgray,loosely dotted] (0,\overallmean) -- + (\DTLbarchartwidth,\overallmean) + node[right,black]{Average (\overallmean)};} + % Set the lower bar labels to draw a brace across the current + % group, along with the student's name and average score + \renewcommand*{\DTLdisplaylowerbarlabel}[1]{% + \tikz[baseline=(current bounding box.center)]{ + \draw[snake=brace,rotate=-90](0,0) -- (\DTLbargroupwidth,0);} + \DTLround{\theMean}{\theMean}{2}% + \shortstack{#1\\(Average: \theMean)}} + % draw the bar chart + \DTLmultibarchart{variables={\assignI,\assignII,\assignIII}, + barwidth=10pt,uppermultibarlabels={\assignI,\assignII,\assignIII}, + barlabel={\firstname\ \surname}}{marks} + {\surname=Surname,\firstname=First Name,\assignI=Assignment 1,% + \assignII=Assignment 2,\assignIII=Assignment 3,\theMean=Average} + \caption{Student marks} +\end{figure} + + +\end{document} diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.pdf Binary files differnew file mode 100644 index 00000000000..73fb2f1c83e --- /dev/null +++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.pdf diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.tex b/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.tex new file mode 100644 index 00000000000..384584e540e --- /dev/null +++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.tex @@ -0,0 +1,21 @@ + % This file is public domain. +\documentclass{scrlttr2} + +\usepackage{datatool} + +\DTLloaddb{data}{sample-student-records.csv} + +\begin{document} +\begin{DTLenvforeach*}{data}{\Title=Title,\FirstName=First Name,\Surname=Surname,\AssignmentI=Assignment 1,\AssignmentII=Assignment 2,\AssignmentIII=Assignment 3,\Address=Address} +\begin{letter}{\Title\space\FirstName\space\Surname\\\Address} +\opening{Dear \Title~\Surname} + +\DTLmeanforall{\Score}{\AssignmentI,\AssignmentII,\AssignmentIII} +\DTLround{\Score}{\Score}{0}\DTLclip{\Score}{\Score}% +You were awarded a mark of \Score\%. + +\closing{Yours Sincerely} +\end{letter} + +\end{DTLenvforeach*} +\end{document} diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.pdf Binary files differnew file mode 100644 index 00000000000..43d1a30f341 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.pdf diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.tex b/Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.tex new file mode 100644 index 00000000000..2bcd49dcf61 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.tex @@ -0,0 +1,36 @@ + % This file is public domain. +\documentclass[captions=tableheading]{scrartcl} + +\usepackage{datapie} + +\DTLloaddb{marks}{sample-student-records.csv} + +\begin{document} + +% Compute average mark for each student: +\DTLforeach{marks}{% +\assignI=Assignment 1,% +\assignII=Assignment 2,% +\assignIII=Assignment 3}{% +\DTLmeanforall{\theMean}{\assignI,\assignII,\assignIII}% +\DTLround{\theMean}{\theMean}{0}\DTLclip{\theMean}{\theMean}% +\DTLappendtorow{Average}{\theMean}} + +% Sort according to average mark +\DTLsort{Average=descending}{marks} + +\begin{table} +\caption{Student Marks} +\centering +\DTLdisplaydb[Address,RegNum,Title]{marks} +\end{table} + +\begin{figure} +\caption{Pie Chart} +\centering +\DTLpiechart{variable=\Average,outerlabel={\Surname, \FirstName},rotateouter}{marks}% + {\Average=Average,\Surname=Surname,\FirstName=First +Name} +\end{figure} + +\end{document} diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-student-records.csv b/Master/texmf-dist/doc/latex/datatool/samples/sample-student-records.csv new file mode 100644 index 00000000000..b8d212d4885 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-student-records.csv @@ -0,0 +1,7 @@ +"Title","First Name","Surname","RegNum","Assignment 1","Assignment 2","Assignment 3","Address" +"Miss","Jane","Brown",1234567891,75,84,80,"Flat 1a\\The Street\\The Town" +"Mr","John","Smith, Jr",1234567892,68,57,72,"Flat 1b\\The Street\\The Town" +"Mr","Zack","Watts",1234567893,32,43,49,"Flat 1c\\The Street\\The Town" +"Mrs","Hillary","Rix",1234567894,87,88,86,"Flat 1d\\The Street\\The Town" +"Miss","Z\""oe","Adams",1234567895,52,48,57,"Flat 1e\\The Street\\The Town" +"Mr","Andy","Brown",1234567896,42,52,54,"Flat 1f\\The Street\\The Town" diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.pdf Binary files differnew file mode 100644 index 00000000000..1abee68d126 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.pdf diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.tex b/Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.tex new file mode 100644 index 00000000000..ff61d4dbbff --- /dev/null +++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.tex @@ -0,0 +1,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} diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.pdf Binary files differnew file mode 100644 index 00000000000..17676a1093f --- /dev/null +++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.pdf diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.tex b/Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.tex new file mode 100644 index 00000000000..c8f266d739a --- /dev/null +++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.tex @@ -0,0 +1,55 @@ + % This file is public domain. +\documentclass[captions=tableheading]{scrartcl} + +\usepackage{datatool} + +\DTLloaddb{scores}{sample-student-records.csv} +% Sort by surname then first name +\DTLsort{Surname,First Name}{scores} + +\begin{document} + +\begin{table}[htbp] + \caption{Two database rows per tabular row} + \centering + \begin{tabular}{llcllc} + \bfseries First Name & + \bfseries Surname & + \bfseries Assignment 1 (\%) & + \bfseries First Name & + \bfseries Surname & + \bfseries Assignment 1 (\%)% + \DTLforeach*{scores}{\firstname=First Name,\surname=Surname,\score=Assignment 1}{% + \DTLifoddrow{\\}{&}% + \firstname & \surname & \score}% + \end{tabular} +\end{table} + +\begin{table}[htbp] + \caption{Two database rows per tabular row (column-wise)} + \centering + % store half number of rows + \edef\maxrows{\DTLrowcount{scores}}% + \DTLdiv{\halfrowidx}{\maxrows}{2} + \begin{tabular}{llcllc} + \bfseries First Name & + \bfseries Surname & + \bfseries Assignment 1 (\%) & + \bfseries First Name & + \bfseries Surname & + \bfseries Assignment 1 (\%)% + \DTLforeach*[\value{DTLrowi}<\halfrowidx]{scores}% + {\firstname=First Name,\surname=Surname,\score=Assignment 1}% + {% + \\% + \firstname & \surname & \score + & + \edef\currentrowidx{\arabic{DTLrowi}}% + \DTLadd{\rowidxII}{\halfrowidx}{\currentrowidx}% + \DTLassign{scores}{\rowidxII}{\firstnameII=First Name,\surnameII=Surname,\scoreII=Assignment 1}% + \firstnameII & \surnameII & \scoreII + }% + \end{tabular} +\end{table} + +\end{document} |