Importing data from files
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.
How to do it...
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} ...
Get LaTeX Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.