# Help in creating tables, errors in code

I am beginner of LaTeX. I am using MiKTeX 2.9 and TeXnicCenter as editor. I tried following code to create merged table but I got 101 errors! I want to create PDF file and not able to understand what went wrong. Probably, am I not using correct package? Please help, following is the code:

\documentclass[a4paper,12pt]{article}
\usepackage{tabls}
\usepackage{ctable}
\usepackage{booktabs}
\usepackage{longtable}

\begin{document}
\section{Table 1}

\begin{tabular}{ccc}

cmidrule[2pt](lr){1-2} \cmidrule[1pt](r){3}

30 & 50 & 80\\

10 & 20 & 30\\

1 & 5 & 6\\

\bottomrule[1.5pt]

\end{tabular}
\end{document}


The editor is showing error at first \multicolumn line. It is showing

pdflatex-> !undefined control sequence.

-
1. The second \multicolumn is not needed. It does not affect the output. 2. In the actual log, directly following ! Undefined control sequence, you can see that \head is the problem as it gets an own line. –  Qrrbrbirlbel Jan 7 '13 at 4:23

I am not sure what \head is, so I have defined it below as \textbf.

The only package required for the table below is the booktabs package.

The \cmidrule macro requires a range of columns, so instead of {3} you need to specify {3-3}. You were also missing a \ prior to the first \cmidrule.

## Code:

\documentclass[a4paper,12pt]{article}
%\usepackage{tabls}
%\usepackage{ctable}
\usepackage{booktabs}
%\usepackage{longtable}

\begin{document} \section{Table 1}

\begin{tabular}{ccc}

\cmidrule[2pt](lr{0.75em}){1-2} \cmidrule[1pt](r){3-3}
30 & 50 & 80\\
10 & 20 & 30\\
1 &  5 &  6\\
\bottomrule[1.5pt]
\end{tabular}
\end{document}

-
Thanks! Your suggestions worked! Thanks again!! –  user24057 Jan 7 '13 at 4:58

For beginners, I believe it is useful to see the minimum code necessary to accomplish the spirit of your task. Take a look at this:

\documentclass[a4paper,12pt]{article}

\begin{document}

\begin{tabular}{|cc|c|}
\hline
\multicolumn{2}{|c|}{Input} & \multicolumn{1}{|c|}{Output}\\
\hline
Group A & Group B & Group C \\
\hline
30 & 50 & 80\\
10 & 20 & 30\\
1 & 5 & 6\\
\hline
\end{tabular}
\end{document}


The other packages in your header expand the capabilities of LaTeX's tabular environment. Add them as you reach tabular's limitations (like multiple page tables).

-