It can be very handy to get the data for the row entries from an external file. Actually, this can be done in a few lines.
We will load the datatool
package, let it import data from a comma separated data file, sort it, and print it:
Store your data in the same folder as your main
tex
document. Here, we will use the data from the last recipes, unsorted within a text file:Distribution,Hits Zorin,85 Debian,1582 CentOS,1171 elementary,899 Arch,1040 Mint,2364 openSUSE,1334 Ubuntu,1838 Mageia,1219 Fedora,1262
Start with a document class, such as
article
, and load thebooktabs
package for improvedtabular
layout, and thedatatool
package for data handling:\documentclass{article} \usepackage{booktabs} \usepackage{datatool}
With these
datatool
commands, load the data from the file and sort it:\DTLloaddb{Linux}{linux.csv} \DTLsort{Hits=descending}{Linux}
Start the document and set up a
tabular
environment:\begin{document} \begin{tabular}{rlr} & Distribution...