TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have quite a large index. I am planning to create a full-blown DB for it and later export the information to LaTeX. I am comfortable with R and Python so I would like to work with them but I feel there must be something already built. I mean to save info INDEX_KEY|CATEGORY|TITLE|DESCRIPTION|TIME in DB, rather than type that into latex directly - I feel DB could help with searching and indexing later. Do some DBs already have Latex converting possibility?


  1. Postgress, Python and LaTeX -question (unsolved)
  2. Automating Adding Tables Fast to LateX from R? (maybe relevant)
  3. Python and LaTeX (not yet tried, not sure whether relevant) outlining
share|improve this question
IMHO you could use Python to read data from your DB and generate mydata.tex file with the entries already formated the way you want, e.g., using longtable, etc. Then in a main tex file, you just use \input{mydata}. – Paulo Cereda Nov 22 '11 at 23:14

I thik datatool package is exactly whant you need. From the package documentation:

databases may be created using LaTeX commands or by importing external files; they may be sorted numerically or alphabetically; repetitive operations (such as mail merging) may be performed on each row of a database, subject to conditions to exclude particular rows; commands are provided to examine database elements, and to convert formats (for example, to convert a numeric element to a format compatible with the fp package;

share|improve this answer
It should be noted that datatool loads the entire database in memory, so it may not be the right tool to use if the DB is large. – egreg Nov 22 '11 at 23:12
@egreg: what would you suggest with massive db or scalable db (not to get any memory probs)? – hhh Nov 23 '11 at 22:56
@hhh Probably to get from the DB a suitably formatted file. TeX is able to read an entire file (\input) or to scan it line by line. datatool loads the file in the second way and transforms each line in a suitable way all inside LaTeX, which is memory consuming. Conversely, if the file is already conveniently formatted, it can be \input. – egreg Nov 23 '11 at 23:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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