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. Using Python within LaTeX and accessing its variables (not yet tried, not sure whether relevant) outlining
  • 1
    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}. Nov 22, 2011 at 23:14

1 Answer 1


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;

  • 3
    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, 2011 at 23:12
  • @egreg: what would you suggest with massive db or scalable db (not to get any memory probs)?
    – hhh
    Nov 23, 2011 at 22:56
  • 1
    @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, 2011 at 23:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .