TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am brand new to LaTeX, and I am trying to create a LaTeX string to create a report with a known format. I will be inserting my LaTeX string into an A4 page in a scribus document.

Accoring to the Scribus documentation on using LaTex:

Just type your LaTeX code, but remember: The preamble and the end is added automatically during processing. So only add the parts between




Since I am new to this, I will be very grateful if one of the experts in here can help me get started with creating the LaTeX string to generate a report of the nested table structure shown below.

What I am struggling with in particular are:

  • the nesting of the columns (e.g. Main table -> Gender -> weight/height -> stats
  • The shading of the column header cells
  • Drawing lines with different shades of grey to separate between birthday, weight and height.

I will be very grateful for a LaTeX snippet that shows me how to generate such a report.

enter image description here

share|improve this question
I'm confused with why you're using LaTeX to make this table. Complex table layouts are one of LaTeX's weakest points. Do you want to do this in LaTeX just so you can generate the data using Sweave? – rdhs Mar 25 '12 at 15:47
Hi Homunculus, welcome to tex exchange! It's usually better to show what you have first- The Indian TUG page has some excellent examples that might get you started- perhaps you could try that, and then edit your question :) – cmhughes Mar 25 '12 at 15:55
@rdhs: What are the alternatives for creating a table? (like I said, I'm new to this - so this may indeed, not be the best approach, although my preliminary research seems to indicate otherwise). I need to dynamically generate this table for a publication. I saw Sweave some time back, but it was not intuitive. I am working with Python mostly (as far as scripting languages go), and I wanted to dynamically generate the LaTeX string for the document (populated with the data). It will be a lot faster for me to do this than to learn Sweave. – Homunculus Reticulli Mar 25 '12 at 15:56
Check back on your related question for part of a solution. If you have the data in Python, you should be able to replace my dummy values with the real ones. – Mike Renfro Mar 25 '12 at 16:21
Thanks Mike, I'm on it ... – Homunculus Reticulli Mar 25 '12 at 16:28

should also work with longtable

\def\Vrule{\vrule width 1pt}

                |*4{C!{\color{black!50}\vrule}} C |
                 *4{C!{\color{black!50}\vrule}} C
                 !{\Vrule} c !{\Vrule}
                 *4{C!{\color{black!50}\vrule}} C |
                 *4{C!{\color{black!50}\vrule}} C |}
 & \multicolumn{10}{c}{\bfseries Male} & 
   \multicolumn{1}{c}{\rule{1.5cm}{0pt}} & 
   \multicolumn{10}{c}{\bfseries Male}\\\cline{2-22}

 & \multicolumn{5}{|c}{weight} & \multicolumn{5}{|c}{height} & 
   \multicolumn{1}{!{\Vrule}c}{} &
   \multicolumn{5}{|c}{weight} & \multicolumn{5}{|c|}{height} \\\cline{2-11}\cline{13-22}
\textbf{Birthday} &
\textbf{min} & \textbf{q1} & \textbf{med} & \textbf{q3} & \textbf{max} & 
\textbf{min} & \textbf{q1} & \textbf{med} & \textbf{q3} & \textbf{max} &
  \cellcolor{white}\raisebox{1.5ex}{\textbf{Power}} &
\textbf{min} & \textbf{q1} & \textbf{med} & \textbf{q3} & \textbf{max} &
\textbf{min} & \textbf{q1} & \textbf{med} & \textbf{q3} & \textbf{max} \\\cline{2-22}

\textbf{Jan 2012} & & & & & & & & & & & 100 & & & & & & & & & & \\\cline{2-22}
                  & & & & & & & & & & & 110 & & & & & & & & & & \\\cline{2-22}

enter image description here

share|improve this answer

It seems that Excel2LaTeX will be able to reproduce most of the layout your asking for, and even more. (Are you fine with double lines instead of thick lines?) It runs on Windows and MacOS (using a beta version, see bug report), and you will need it only for translating the Excel sheet into LaTeX. (That is, the LaTeX document doesn't have to be compiled in Windows.)

Simply insert what this tool produces into Scribus, be sure to leave out the figure environment, though. The layout you ask for requires extra packages such as multirow, not sure if Scribus allows for this.

See also the Comprehensive list of tools that simplify the generation of LaTeX tables (work in progress).

On that note: I wouldn't actually call your table a "nested table". Perhaps "merged columns" would be more appropriate.

share|improve this answer

Your Answer


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.