# Problem with table

I'm trying to create a table for my thesis. I'm quite noob in LaTeX so I will request some charity help

I already done the table in but in other format. See the attachment.

Regards

 \documentclass{article}
\usepackage{booktabs,multirow}
\begin{document}

\begin{table}[htbp]
\centering

\begin{tabular}{ccccccccc}
\toprule
\multirow{2}[4]{*}{\textbf{Nível na albufeira (m)}} & \multirow{2}[4]{*}{\textbf{QM.FÍSICO (m3/s)}} & \multirow{2}[4]{*}{\textbf{QDIM. (m3/s)}} & \multicolumn{3}{c}{\textbf{1st order Mom. Adv}} & \multicolumn{3}{c}{\textbf{2nd order Mom. Adv}} \\
\midrule
&       &       & \textbf{QCFD (m3/s)} & \multicolumn{2}{c}{\textbf{Erro (\%)}} & \textbf{QCFD (m3/s)} & \multicolumn{2}{c}{\textbf{Erro (\%)}} \\
\textbf{260,4} & \textbf{100} & \textbf{88,3} & \textbf{81,9} & \textbf{-18.1} & \textbf{-7.3} & \textbf{83,3} & \textbf{-16.7} & \textbf{-5.7} \\
\textbf{262,5} & \textbf{250} & \textbf{233,1} & \textbf{223,1} & \textbf{-10.8} & \textbf{-4.3} & \textbf{224,9} & \textbf{-10} & \textbf{-3.5} \\
\textbf{267,0} & \textbf{750,0} & \textbf{708,9} & \textbf{690,3} & \textbf{-8} & \textbf{-2.6} & \textbf{696,9} & \textbf{-7.1} & \textbf{-1.7} \\
\bottomrule
\end{tabular}%
\label{tab:niveis}
\end{table}%
\end{document}


Im not getting the same output like the image attached. Any ideas?

• Welcome to TeX.SX! Please add a MWE (Minimal Working Example) of the code you already have. Otherwise, it is very hard to guess the actual problem you are having in creating a table. – barghest Mar 26 '13 at 13:17
• You can adapt Mico's solution with minimal effort. – jub0bs Mar 26 '13 at 13:30
• How can I make Q_{M.FISICO} in tabular environment with the same aspect as other words, not math aspect? – Ibau Mar 26 '13 at 13:56
• If by "aspect" you mean the font (i.e. use the font of the surrounding text instead of the "math font"), you can do \usepackage{amsmath} in the preamble and use $\text{Q}_{\text{M.FISICO}}$ – barghest Mar 26 '13 at 14:12

I think here is what you need. Improvements:

• fixltex2e package for \textsubscript command.
• \cmidrule{4-9} for rule.
• 2cm for \multirow parameter.
• \renewcommand\multirowsetup{\centering} for \centering of \multirow cells.

Code:

\documentclass{article}

\usepackage[top=1cm,bottom=1cm,left=1cm,right=1cm]{geometry}
\usepackage{booktabs,multirow}
\usepackage{fixltx2e}

\begin{document}
\begin{table}[htbp]
\renewcommand\multirowsetup{\centering}
\centering

\begin{tabular}{ccccccccc}
\toprule
\multirow{2}[4]{2cm}{\textbf{N\'ivel na albufeira (m)}} & \multirow{2}[4]{2cm}{\textbf{Q\textsubscript{M.F\'ISICO} (m3/s)}} & \multirow{2}[4]{2cm}{\textbf{Q\textsubscript{DIM.} (m3/s)}} & \multicolumn{3}{c}{\textbf{1st order Mom. Adv}} & \multicolumn{3}{c}{\textbf{2nd order Mom. Adv}} \\
\cmidrule{4-9}
&       &       & \textbf{Q\textsubscript{CFD} (m3/s)} & \multicolumn{2}{c}{\textbf{Erro (\%)}} & \textbf{Q\textsubscript{CFD} (m3/s)} & \multicolumn{2}{c}{\textbf{Erro (\%)}} \\
\midrule
\textbf{260,4} & \textbf{100} & \textbf{88,3} & \textbf{81,9} & \textbf{-18.1} & \textbf{-7.3} & \textbf{83,3} & \textbf{-16.7} & \textbf{-5.7} \\
\textbf{262,5} & \textbf{250} & \textbf{233,1} & \textbf{223,1} & \textbf{-10.8} & \textbf{-4.3} & \textbf{224,9} & \textbf{-10} & \textbf{-3.5} \\
\textbf{267,0} & \textbf{750,0} & \textbf{708,9} & \textbf{690,3} & \textbf{-8} & \textbf{-2.6} & \textbf{696,9} & \textbf{-7.1} & \textbf{-1.7} \\
\bottomrule
\end{tabular}
\label{tab:niveis}
\end{table}
\end{document}


Image:

• While this reproduces the OP's picture, I think the numbers should align vertically at their decimal points. I also think that setting all content bold is a bad idea. – mafp Mar 26 '13 at 14:32
• @mafp: I'll left this here: Aligning numbers by decimal points in table columns. – m0nhawk Mar 26 '13 at 14:36
• Thanks very much mOnhawk! Yeah its right I will try to align numbers vertically at their decimal points. – Ibau Mar 26 '13 at 14:41

Shamelessly stealing moonhawk's solution to add some spice with bold and sans-serif fonts. Also the units are now parsed via siunitx

\documentclass{article}

\usepackage[top=1cm,bottom=1cm,left=1cm,right=1cm]{geometry}
\usepackage{booktabs,multirow,siunitx}
\usepackage{fixltx2e}

\sisetup{per-mode=symbol,detect-inline-weight=text,text-rm=\bfseries\sffamily,mode=text}
\newcolumntype{B}{>{\bfseries\sffamily}S<{}}

\begin{document}
\begin{table}
\renewcommand\multirowsetup{\centering}
\centering

\begin{tabular}{BBBBBBBBB}
\toprule
\multirow{2}[4]{2cm}{\bfseries\sffamily N\'{i}vel na albufeira (\si{\meter})}
&\multirow{2}[4]{2cm}{\bfseries\sffamily Q\textsubscript{M.F\'ISICO} (\si{\meter\cubed\per\second})}
&\multirow{2}[4]{2cm}{\bfseries\sffamily Q\textsubscript{DIM.} (\si{\meter\cubed\per\second})}
&\multicolumn{3}{c}{\bfseries\sffamily 2nd order Mom. Adv} \\
\cmidrule{4-9}
&%
&%
&\multicolumn{1}{c}{\bfseries\sffamily Q\textsubscript{CFD}(\si{\meter\cubed\per\second})}%
&\multicolumn{2}{c}{\bfseries\sffamily Error (\si{\percent})} %
&\multicolumn{1}{c}{\bfseries\sffamily Q\textsubscript{CFD}(\si{\meter\cubed\per\second})}%
&\multicolumn{2}{c}{\bfseries\sffamily Error (\si{\percent})} \\
\midrule
260,4 & 100   &  88,3 &  81,9 & -18.1 & -7.3 &  83,3 & -16.7 & -5.7 \\
262,5 & 250   & 233,1 & 223,1 & -10.8 & -4.3 & 224,9 & -10   & -3.5 \\
267,0 & 750,0 & 708,9 & 690,3 &  -8   & -2.6 & 696,9 &  -7.1 & -1.7 \\
\bottomrule
\end{tabular}
\label{tab:niveis}
\end{table}
\end{document}


• I can't see any advantage in having a different typeface in the body of the table than in the main text. Also the numbers aren't aligned properly. (Of course you should make sure the figures are tabular figures.) – user10274 Mar 26 '13 at 15:43
• @MarcvanDongen They are aligned with respect to the decimal point. – percusse Mar 26 '13 at 15:54
• No, they're not (yet:-). The dot in the -7.1 is partially underneath the 0 of the -10 in the second last column. I think this is caused by the fact that your sans serif doesn't have tabular figures. (You can also see this in other columns.) – user10274 Mar 26 '13 at 19:46
• @MarcvanDongen -10 is actually taken as -10.0 so 7.1 is aligned to the hypothetical dot. – percusse Mar 26 '13 at 19:47
• You have to be kidding. The 7 is partially underneath the 1 of the -10.. The dots in the last column, to me, don't seem to be in the same column. – user10274 Mar 26 '13 at 19:49