# How to make table creation in TeX easier?

In my work I need to describe several database tables (~20) - each table has six columns - field name, field type, key, null / not null setting, default value and description.

Is there some way how to create in TeX some kind of template / macro so I don't need to create each table manually?

-
Do you want to read in the table and typeset automatically? For instance pgfplotstable could be a viable solution? – zeroth Feb 28 '13 at 14:08
Along the lines of pgfplotstable: importing csv table. – Mike Renfro Feb 28 '13 at 14:09

You can use RStudio to type your LaTeX document with knitr, R and the xtable package, in that way:

\documentclass{article}

\begin{document}
<<echo=FALSE,results='asis'>>=
library("xtable")
tab=xtable(my_tab)
print(tab)
@
\end{document}


with many possible output options. You can use a for loop if you want to write it for 20 tables.

-

If you already have tables in Excel, you could use the plugin Excel2LaTeX to convert everything immediately to LaTeX.

-
While your idea is nice, we prefer the answers to be "self-contained", i.e. to explain in more detail how such a conversion is done. Could you please add a small example? – yo' Feb 28 '13 at 15:09