I've been spending hours to get this table working, but without luck. Perhaps I don't fully understand the concept of \multicolumn.
I would like to have a 5 column table. The first column contains long text and therefore is set to variable width. The other columns have very short text (one character) and should all have the same width.
I want three multicolumns defined, the first one spans the first column with variable width, the second spans column 2-3 and the last spans column 4-5. The labels of the last two multicolumn should be equally sized (as they span 4 equally sized columns)
Anyway, here is my minimal working example...
MWE:
Code: Select all
\documentclass[11pt]{article}
\title{Table testing}
\author{Tim}
\date{oktober 2010}
\usepackage{setspace} %setting interline spacing
\onehalfspacing
\usepackage{geometry}
\geometry{a4paper}
\usepackage{booktabs}
\usepackage{ctable} %provides good options for footnotes
\usepackage{paralist}
\usepackage{floatrow}
\floatsetup[table]{style=plaintop, captionskip = 4pt,footnoterule =none, footskip=-10pt}
\usepackage{tabularx}
\begin{document}
\begin{table}[htbp]
\begin{tabularx}{\textwidth}{ lXXXX }
\multicolumn{1}{c}{labelcolumn1}\multicolumn{2}{c}{label column 2-3}\multicolumn{2}{c}{label column 3-4}\\
\hline
longtextlongtextlongtextlxt & item 1 & item 2 & item 3 & item 4 \\
strain 2 & item 1 & item 2 & item 3 & item 4 \\
strain 2 & item 1 & item 2 & item 3 & item 4 \\
strain 2 & item 1 & item 2 & item 3 & item 4 \\
strain 2 & item 1 & item 2 & item 3 & item 4 \\
strain 2 & item 1 & item 2 & item 3 & item 4 \\
\hline
\end{tabularx}
\end{table}
\end{document}