Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

I simply want to align the decimal points in columns. I know this has been answered already but I can not figure out how to apply it in my table. Forgive me, I am very new to LaTeX. This is the code that I have:

\begin{table}[h]
\begin{center}
\begin{tabular}{ccc|cc|cc|c}
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&$D$&$E$&$D$&$E$&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\end{tabular}
\end{center}
\end{table}

One more thing. If my table was too long, and I wanted to cut it so that the other half is in the other page, is that possible? And if it is not too much to ask, can you show me how?

share|improve this question

marked as duplicate by zeroth, lockstep, mafp, Marco Daniel, Stefan Kottwitz Mar 9 '13 at 9:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you. –  Claudio Fiandrino Mar 9 '13 at 9:26

1 Answer 1

For the aligning see the duplicated bug in the first comment. For page breaking you can use longtable environment from the longtable package. See its documentation for more details. I converted your example to longtable and siunitx (for the aliging) and made it longer to show the page breaking:

\documentclass{article}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{siunitx}
\begin{document}
\begin{longtable}[c]{ccc|SS|SS|S}
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&{$D$}&{$E$}&{$D$}&{$E$}&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&{$D$}&{$E$}&{$D$}&{$E$}&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&{$D$}&{$E$}&{$D$}&{$E$}&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&{$D$}&{$E$}&{$D$}&{$E$}&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&{$D$}&{$E$}&{$D$}&{$E$}&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&{$D$}&{$E$}&{$D$}&{$E$}&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&{$D$}&{$E$}&{$D$}&{$E$}&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&{$D$}&{$E$}&{$D$}&{$E$}&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&{$D$}&{$E$}&{$D$}&{$E$}&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&{$D$}&{$E$}&{$D$}&{$E$}&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&{$D$}&{$E$}&{$D$}&{$E$}&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\hline\hline 
\multirow{2}{*}{$A$}  & \multirow{2}{*}{$B$}  & \multirow{2}{*}{$C$} & \multicolumn{2}{c|}{1} & \multicolumn{2}{c|}{2} & 
\multirow{2}{*}{$F$}\\\cline{4-7}
&&&{$D$}&{$E$}&{$D$}&{$E$}&\\\hline\hline
\multirow{3}{*}{2} &    \multirow{3}{*}{5} &    12  &   2.146   &   9.144   &   6.311   &   9.566   &   7.134   \\  \cline{3-8}
&&  14  &   3.245   &   10.255  &   6.978   &   19.274  &   18.245  \\  \cline{3-8}
&&  16  &   7.176   &   11.968  &   10.852  &   47.485  &   25.282  \\  \hline\hline
\end{longtable}

\end{document}
share|improve this answer
    
Are the longtable and siunitx packages already in LaTeX or do I have to dowmload and install something else? I'm afraid, the code didn't work. –  Ian Mar 9 '13 at 12:55
    
longtable and siunitx are packages, as you said yourself. That means, they're not part of the LaTeX kernel. You'll have to load them via \usepackage{siunitx} and \usepackage{longtable}, just as you did with \multirow. If your question aims at tex-distributions, I'm not sure. Both are available in TeXlive and probably MiKTeX but possibly not in their minimal configurations. –  Toscho Mar 9 '13 at 15:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.