I primarily a Word user, but use LaTeX now and then. One thing I don't like working with in LaTeX is tables. My data might come from Excel (usually), Word, or the output of some custom program.

If my data source is Excel, I use some xls2Latex macro (that I downloaded somewhere) to do the job for me.

However, I am wondering, is there any good, general workflow for easily getting your data in a LaTeX tables? Do you modify your programs to directly output to LaTeX format, or do you e.g. output to csv first and then use a csv to latex script?

And how do you update it? By hand directly in LaTex, or do you rerun your whatever-to-LaTeX script?

  • 1
    Have you tried datatool package?
    – user11232
    Mar 2, 2012 at 11:10
  • @Dr Harish Kumar: No :-) Mar 2, 2012 at 11:40
  • This question may be of some help.
    – user11232
    Mar 2, 2012 at 14:45
  • As far as editing a pre-existing table, I like LyX for getting all of the cell borders right. But LyX does not have great tools for pasting a table in yet.
    – scottkosty
    Mar 3, 2012 at 6:19

1 Answer 1


I teach statistics and have used R with Sweave to create a LaTeX file for a Standard Normal Cumulative Distribution table. This works very well for computed tables. The package datatool package is superior for preexisting tabular information. (Although you could input the data into R and reformat with some additional work. Here is Rnw file for creating a standard normal cumulative distribution table.

%%% Adapted from a file written by Ross Ihaka (One of the Original R Developers)
%%% --- Customisation of Sweave layout
\DefineVerbatimEnvironment{Sinput}{Verbatim} {xleftmargin=2em}
% These definitions eliminate the space between the input and
% output in the man-machine dialog.
%%% --- End of customisation

\title{\textbf{Computing the Normal \\ Distribution Function}}
%%% --- Customisation of R printing and graphical layout
options(continue=" ")
        par(mar=c(4.1, 4.1, .1, 2.1))))
ntableb =
    function(cols = 1:length(y)) {
        x = seq(0, 3.4, by = .1)
        y = seq(0, .09, by = .01)
        p = round(outer(x, y, function(x, y) pnorm(x+y)), 4)
            length(cols)-1,"}{@{\\quad}c}|}\n", sep = "")
        cat(paste("\\rule{0pt}{12pt}z & ",
                  paste(sprintf("%.2f", y[cols]), collapse = " & "),
                  sep = ""), "\\\\\n")
        for(i in 1:length(x)) {
            if (i == 1) cat("\\rule{0pt}{14pt}")
            cat(paste(sprintf("%.1f & ", x[i]),
                      paste(sprintf("%.4f", p[i,cols]),
                            collapse = " & "),
                      sep = ""), "\\\\")
            if (i %% 5 == 0 || i == length(x)) cat("[5pt]\n") else cat("\n")

\parbox[b]{3in}{Standard Normal Curve Areas $P(X\le x)$ \par\vspace{.25in}}\par


I use TeXmaker and the command loaded in one of the user commands is

R.exe CMD Sweave %.Rnw

Now just compile the resulting *.tex file with pdfatex

You must log in to answer this question.

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