[OS X TeX] Tables

Hamner, Jesse Harrison jhamner at emory.edu
Mon Aug 20 14:54:15 EDT 2007

Hi Nathan,

On 8/20/07 2:26 PM, "Nathan Paxton" <napaxton at fas.harvard.edu> wrote:

>         I'm about to make some statistical tables to include in a conference
> article, and I wonder if there is a convenient way to do this.  I
> know about the Tables panel in TeXShop, but I've never quite figured
> out how to get it to the following.
>         Say I set up a table (headers and such) but don't put the values for
> each cell in. Then I want to fill in those values over the course of
> a couple of days. And perhaps I need a column added later on. Etc. I
> don't see any way to save the contents of the table so that I can re-
> edit it with ease (and also not screw it up if I edit it by hand,
> which inevitably seems to happen). I guess what I'd like is something
> more spreadsheet-like, where I can enter, edit, and format the table,
> but I can then generate at least some sort of LaTeX code to insert
> into my document.

I ended up writing 500 lines of Perl to make some tables (a ``real'' Perl
programmer would have done it in 150), *but* I also use LaTeX's \newcommand
(and \renewcommand) to make line templates for my summary tables. For

\newcommand{\monadline}[6]{\multirow{8}{0.75in}{#1} &
\multirow{2}{1.05in}{#2} & {\monad} & #3 & \multirow{#4}{1.5in}{#5} & #6
\tabularnewline\cline{3-4}\cline{6-6} }

\newcommand{\dyadline}[2]{\multirow{4}{0.75in}{~} &  & {\dyad} & #1 &  & #2
\tabularnewline[\sep]\cline{2-4}\cline{6-6} }

So the usage would look like:

\monadline{}{necktie usage}{increase, $p<0.01$}{4}{}{More Windows use leads
to more neckties}
\dyadline{decrease, $p<0.01$}{Open source use associated with fewer

In this example, you've got a template with 6 or 2 variables for a given
type of line (here, \monadline{}{}{}{}{}{} or \dyadline{}{}) So that helps
reduce the amount of potential errors from hand-coding.

You could edit your Excel tables to include the \commandname, \{ and \}
braces in columns to either side of your numbers, and then copy & paste them
in to the LaTeX document.

Depending on how many tables you have, this approach might be useful. Not
exactly elegant, but APSA is right around the corner...

My two cents, but there may be easier answers out there.


Jesse Hamner
Coordinator, Social Sciences Computing Center
Emory University

------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/

More information about the MacOSX-TeX mailing list