Suppose I have a really long, really boring list of data in - let's say CSV, but converting to other formats is an option, when this can be done automatically - and I want to prepare a section in my LaTeX document using it as a data source.

csvautotabular isn't quite what I'm after, I'd like to be able to do it in a custom way - something like:


for input and getting in the output (aka: in the .dvi) something that would look like:

\command1{foo} \command2{bar} \command3{baz}
\somecommand % end record 1 
\command1{zip} \command2{boom} \command3{bang}
\somecommand % end record 2

\someenvironment may or may not be a tabular environment and command1 are commands and aliases that I or others have already been defined.

I'd like to avoid preparing a script in some language that reads my data and outputs the above (admittedly, easy), because I'm working with others and I would rather not have them running the script on the data every time they need to compile their LaTeX file.

Any hint, however small, is appreciated.


  • Any hint, however small? → datatool and/or pgfplotstable
    – user11232
    Aug 22, 2014 at 6:08
  • Thanks, Harish, I'm having a look at both - however, they seem to be mainly converned about tables and plotting, according to e.g. ctan.mackichan.com/macros/latex/contrib/datatool/…, while a table is exactly what I'm not after. Aug 22, 2014 at 6:11
  • datatool can be used outside table also.
    – user11232
    Aug 22, 2014 at 6:19

1 Answer 1


Please, use csvsimple version 1.12 (2014/07/14) (or newer).

In my code, I made a helper macro \commandThreeX which is used to get rid of the semicolon at the end of the input lines. The rest is quite straigtforward using \csvreader:



%%%% Your Macros %%%%
\newenvironment{someenvironment}{BEGINENV\par}{\par ENDENV}


%%%% Auxiliary %%%%


\csvreader[no head]{example.csv}{}


The result is:

enter image description here


You must log in to answer this question.

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