# Help for reproducing a complex table in latex

Here is the table that i want to reproduce in latex, could someone help me.

• What exactly about this table do you need to reproduce? The font itself (some kind of sans-serif -- does it matter which one?), the font size, or something else? Please advise. It would be very helpful if you showed what you've tried so far, by the way.
– Mico
Nov 16 '14 at 20:36
• In fact i am not so good with tables in latex, and i only need the skeleton of this table. Nov 16 '14 at 20:45
• Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. You can improve your question by adding a minimal working example (MWE) that more users can copy/paste onto their systems to work on. If no hero takes the challenge we might have to close your question.
– cfr
Nov 16 '14 at 20:51
• How many tables would you like @Mico to code for you based just on an image? You should at least be able to use one of the answers you received earlier to begin this table, even if you are not sure how to get things exactly right.
– cfr
Nov 16 '14 at 20:54
• if this table cames from a spreadsheet, it exists converter like Calc2latexorexcel2latex wich produces the LaTeX code. Nov 16 '14 at 21:20

Here is a solution. It uses tabularx, makecell (to allow for line breaks inside centred cells) and cellspace to have a less tight vertical spacing. On one has to use footnotesize inside the table to avoid overflowing the right margin:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{array, tabularx, caption,}
\renewcommand{\tabularxcolumn}[1]{>{\centering\arraybackslash}m{#1}}

\usepackage{makecell}

\usepackage{cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}

\begin{document}

\begin{table}
\sffamily\centering\footnotesize
\begin{tabularx}{\linewidth}{|Sc|S{X}|*{5}{X|}}
\cline{2-7}
\multicolumn{1}{c|}{ }& \multicolumn{3}{Sc|}{omega 1} & \multicolumn{3}{c|}{omega 2} \\
\cline{2-7}
\multicolumn{1}{c|}{} & Q4 & Q4 &QEPH & Q4 & Q4 &QEPH \\
\cline{2-7}
\multicolumn{1}{c|}{} & \multicolumn{2}{Sc|} {Hourglass type1} & & \multicolumn{2}{c|} {Hourglass type1} & \\
\cline{2-7}
\multicolumn{1}{c|}{} & \multicolumn{3}{Sc|}{Iterative projection} & \multicolumn{3}{c|}{Iterative projection} \\
\cline{2-7}
\multicolumn{1}{c|}{} & Constant thickness & \multicolumn{2}{c|}{Variable thickness} & Constant thickness & \multicolumn{2}{c|}{Variable thickness} \\
\cline{2-7}
\multicolumn{1}{c|}{} & NIP = 0 & \multicolumn{2}{c|}{NIP = 5} & NIP = 0 & \multicolumn{2}{c|}{NIP = 5} \\
\cline{2-7}
\multicolumn{1}{c|}{ }& \multicolumn{3}{Sc|}{Avec /DT/NODA} & \multicolumn{3}{c|}{Avec /DT/NODA} \\
\hline
Nb de cycles & 4432 & 4454 & 5413 & 13234 & 13293 & 16109 \\
\hline
\makecell{Énergie de Hourglass\\ à t = 10\,ms} & 327.76 & 339.52 & 0 & 45.09 & 45.93 & 0 \\
\hline
\makecell{Erreur sur l’énergie\\ à t = 10\,ms} & --13.3\,\% & --13.5\,\% & 0 & --4.00\,\% & --4.00\,\% & 0 \\
\hline
\makecell{Force normale\\ sur le «~Rigid wall~»} & 77.57 & 60.92 & 59.95 & 51.94 & 52.16 & 52.25 \\
\hline
\end{tabularx}
\end{table}

\end{document}


See Philippe's answer from How can I draw a horizontal line spanning only some of the table cells?

and

http://en.wikibooks.org/wiki/LaTeX/Tables#Partial_Vertical_Lines

and

Alan Munn's answer in tabular and array.

I know, though, that LaTeX can sometimes be a little confusing. So check out the code below.

Best of luck.

\documentclass[11pt,letterpaper]{article}
\usepackage[latin1]{inputenc}
\begin{document}
\begin{tabular}{ c|c|c|c|c|c|c|}
\cline{2-7}  & \multicolumn{3}{c| }{omega 1} & \multicolumn{3}{c| }{omega 2}\\
\cline{2-7}  & Q4 & Q4 & QEPH & Q4 & Q4 & QEPH \\
\cline{2-7}  & \multicolumn{2}{c| }{Hourglass 1}  &  & \multicolumn{2}{c| }{Hourglass 1}  &  \\
\cline{2-7}  & \multicolumn{3}{c| }{Iterative projec} & \multicolumn{3}{c| }{Iterative projec}\\
\cline{2-7}  & Con & \multicolumn{2}{c| }{Var} & con & \multicolumn{2}{c| }{var} \\
\cline{2-7}  & nip=0 & \multicolumn{2}{c| }{nip=5} & nip=0 & \multicolumn{2}{c| }{nip=5}\\
\cline{2-7}  & \multicolumn{3}{c| }{avec} & \multicolumn{3}{c| }{avec}\\
\hline \multicolumn{1}{|c|}{no of cycles} & 1 & 2 & 3 & 4 & 5 & 6 \\
\hline \multicolumn{1}{|c|}{energy of hourglass} & 1 & 2 & 3 & 4 & 5 & 6 \\
\hline \multicolumn{1}{|c| }{error on energy} & 1 & 2 & 3 & 4 & 5 & 6 \\
\hline \multicolumn{1}{|c| }{normal force} & 1 & 2 & 3 & 4 & 5 & 6 \\
\hline
\end{tabular}
\end{document}