Exercise 1: Loading and Displaying Data (Solution)

This is a solution to Exercise 1. You need the sample files booklist.csv and country-codes.csv. Alternatively, if you want to use data from the samples SQL database, remember to use datatooltk to import the data to a .dbtex file and load it using \DTLloaddbtex as described in Loading Data From a .dbtex File.

Note that two LaTeX runs are required for the longtable to correctly align the table columns. This is a feature of the longtable package. (Two LaTeX runs are also required to get the cross-references up-to-date.)

% arara: pdflatex
% arara: pdflatex



% Load data from booklist.csv:
% Load data from country-codes.csv:

% Add rules from booktabs package:

The book titles are shown in Table~\ref{tab:books}.


The country codes are shown in Table~\ref{tab:countries}.

% Make sure you load at least v2.21 of datatool
% for the rules to show correctly as earlier versions
% had a bug.
    caption={Country Codes},% main caption
    contcaption={Country Codes (Continued)},% continuation caption
    label={tab:countries},% label
    foot={\bottomrule\multicolumn{2}{r}{\emph{Continued on next page}}},% table footer
    lastfoot={}% final table footer


Download dtldisplay.tex or dtldisplay.pdf.

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs