Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have had a quick look for similar questions but I couldn't find anything, so apologies if this is a duplicate.

Firstly, I am looking for a way to grab information from external source files (i.e. query1.sql) which will then be formatted with language-specific highlighting (SQL in this case).

Secondly, I would like to grab information from an external csv file and have it formatted into a table.

I am using external files so that they can be updated automatically by an Automated Build process so that we have documentation that is always up to date.

As an example, I am looking for something like this:

Using the below script:

select *
from table;

We receive the output:

1 | 2 | 3
_________
a | b | c
d | e | f
share|improve this question
add comment

1 Answer

up vote 12 down vote accepted
  1. The listings package can input external files and format them. It already has language definitions for SQL source.
  2. The datatool package can read CSV files so that they can be used in tables.
share|improve this answer
    
Awesome, thanks Alan, that is just what I was after. –  josh-fuggle Apr 21 '11 at 4:18
    
Sorry, it looks like I can't vote up on this account. :( –  josh-fuggle Apr 21 '11 at 4:19
    
Besides datatool, there're also pgfplotstable and csvsimple. –  Leo Liu Apr 21 '11 at 4:41
    
@Leo Liu Thanks Leo, I'll take a look into those as well :) –  josh-fuggle Apr 21 '11 at 4:44
    
@Leo It's a shame that the documentation for csvsimple is only in German. (Although one can probably figure most things out from the examples.) –  Alan Munn May 7 '11 at 18:13
add comment

Your Answer

 
discard

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.