I want to create an overview table of some data. More specifically, I have some named objects and for each of these I have some properties.

Example data and schematic of output:

+ -------+--------+-------+--------+
| Object | Edible | Color | Size   |
+ -------+--------+-------+--------+
| Apple  | yes    | green | small  |
| Cat    | no     | brown | medium |
+ -------+--------+-------+--------+

Instead of entering the table manually, I'd like to create something like a database and then generate the table based on a format description.

I thought this could maybe be done with BibTex.

I would create a bib file with content like this:


And then create a (very) custom bibliography style to turn this into a table.

I could create some external script to transform the bib file into a table (JSON would probably be a better data format then) but I'd like to use TeX tools.

How can I get from this (or similar) bib to a table instead of a list (like usually with references)?

1 Answer 1


Unless you know how to write in bibtex's stack-based language, I wouldn't recommend doing it that way. If you just want to use TeX tools without relying on external scripts, you can use datatool. Here's an example:





% Define a command to access a field in `mydata' in the row identified by a
% given object:

% Syntax: \field{object}{column label} 

% Syntax: \boolfield{object}{column label}{true part}{false part}


List the data in a tabular environment:


Sort on `Object' column.

List sorted data in a tabular environment:


Access data: an apple is \field{Apple}{Size} and \field{Apple}{Color}.
It \boolfield{Apple}{Edible}{is}{isn't} edible.

Access data: a cat is \field{Cat}{Size} and \field{Apple}{Color}.
It \boolfield{Cat}{Edible}{is}{isn't} edible.


The above example produces:

Image of result

(I suggest putting \DTLdisplaydb inside a table or use \DTLdisplaylongdb if it's longer than a page.)

  • 1
    Where is datatooltk-gui? ;-) Jun 29, 2013 at 20:01
  • @MarcoDaniel I thought about mentioning it, but that would've contradicted my "without relying on external scripts" statement ;-) Jun 29, 2013 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.