# build a table in latex

This is my new code but i have a new pb:

\begin{table}[!h]
\begin{center}
\begin{tabular}{l|p{0.9cm}|p{0.9cm}|p{0.9cm}|p{0.9cm}|p{0.9cm}|p{0.9cm}|p{0.9cm}|p{0.9cm}|p{0.9cm}|p{0.9cm}|}
\cline{2-11}
&\multicolumn{2}{|p{2.5cm}|} {\bf 100 Pages }& \multicolumn{2}{|p{2.5cm}|} {\bf 250 Pages }& \multicolumn{2}{|p{2.5cm}|} {\bf 500 Pages }& \multicolumn{2}{|p{2.5cm}|} {\bf 750 Pages }& \multicolumn{2}{|p{2.5cm}|} {\bf 1000 Pages }\\
\cline{2-11}
&\bf R1& \bf R2& \bf R3& \bf R4& \bf R5& \bf R6& \bf R7& \bf R8& \bf R9& \bf R10\\
\hline
Nb Pages Publiques &\bf R1& \bf R2& \bf R3& \bf R4& \bf R5& \bf R6& \bf R7& \bf R8& \bf R9& \bf R10\\
\hline
Nb Pages Amis \\et leurs Amis &\bf R1& \bf R2& \bf R3& \bf R4& \bf R5& \bf R6& \bf R7& \bf R8& \bf R9& \bf R10\\
\hline
Text&\bf R1& \bf R2& \bf R3& \bf R4& \bf R5& \bf R6& \bf R7& \bf R8& \bf R9& \bf R10\\
\hline

\end{tabular}
\end{center}

\bf{\caption{Caractéristiques du Réseau 1}}
\end{table}


When I put Nb pages Amis\\ et leurs Amis a line empty is inserted and I want to eliminate this please

-
No what I want is besides the 2 lines of data I would like to add 3 new lines for puting the data. I will try to explain again after this 2 lines that contains 10 colonne I want to put 3 lines that contain 13 columns. – boutheina May 7 '12 at 15:17
Maybe it would be best if you could draw and upload a mock-up of what table layout you want. – Jake May 7 '12 at 15:20
I think one problem might be the width of the table. You have specified each column to 1.3cm, well with 10 columns that is already 13cm. How wide is your page that you are targeting? – Peter Grill May 7 '12 at 15:21
How about making all the rows with 13 columns and then \multicolumn{3} for the first two rows? Is that what you want? – Håkon Malmedal May 7 '12 at 15:53
Please do use \centering not \center inside table: Should I use center or centering for figures/tables?, but you seem to like to use a non-floating table anyway: How to influence the position of float environments like figure and table in LaTeX?. Finally don't use \bf but \bfseries: Does it matter if I use \textit or \it (also counts for \bf). – Martin Scharrer May 7 '12 at 15:54

To center text vertically in the spanning top left corner use multirow.

\usepackage{multirow}


Saves some work that you are not using both multirow and multicolumn in on cell. To reproduce the table you have outlined you could use this sample code. I changed the sizes somewhat to make it fit in my sample document, so you would have to adapt it a bit for your use.

multirow: the first argument is how many rows to span, the second for specifying the width, * for autoadjust to content length, and the third is the content of the cell.

cline: the argument is from which column to which column the line should be drawn.

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

\begin{table}[!h]
\centering
\begin{tabular}{|p{0.65cm}|p{0.65cm}|p{0.65cm}|p{0.65cm}|p{0.65cm}|p{0.65cm}|p{0.65cm}|p{0.65cm}|p{0.65cm}|p{0.65cm}|p{0.65cm}|}\hline
\multirow{2}{*}{ct} & \multicolumn{2}{|c|}{ct} & \multicolumn{2}{|c|}{ct} & \multicolumn{2}{|c|}{ct} & \multicolumn{2}{|c|}{ct}& \multicolumn{2}{|c|}{ct}     \\ \cline{2-11}
& sub& sub& sub& sub& sub& sub& sub& sub& sub& sub\\ \hline
row & fill& fill& fill& fill& fill& fill& fill& fill& fill& fill\\\hline
row & fill& fill& fill& fill& fill& fill& fill& fill& fill& fill\\\hline
row & fill& fill& fill& fill& fill& fill& fill& fill& fill& fill\\\hline
\end{tabular}
\end{table}

-
the answer of user14316 is right but the same pb when I put the text in the place of row it is disorganized I want to put Nbre Pages Publique Nbre pages Amis et leurs Amis Nbre Pages Amis Seulement – boutheina May 7 '12 at 17:06
That might be because I specified the length of the column, you would maybe want to change the column specifier to l or c for it to autoadjust. In that sample a long line will be broken into smaller ones. – cybrhuman May 8 '12 at 16:39

Perhaps something like this?

\documentclass[landscape]{scrartcl}
\usepackage{geometry}
\begin{document}
\begin{table}[!h]
\begin{center}
\begin{tabular}{p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|}
\cline{2-11}
&\multicolumn{2}{|p{2.5cm}|} {\bf 100 Pages }& \multicolumn{2}{|p{2.5cm}|} {\bf 250 Pages }& \multicolumn{2}{|p{2.5cm}|} {\bf 500 Pages }& \multicolumn{2}{|p{2.5cm}|} {\bf 750 Pages }& \multicolumn{2}{|p{2.5cm}|} {\bf 1000 Pages }\\
\cline{2-11}
&\bf R1& \bf R2& \bf R3& \bf R4& \bf R5& \bf R6& \bf R7& \bf R8& \bf R9& \bf R10\\
\hline
Text&\bf R1& \bf R2& \bf R3& \bf R4& \bf R5& \bf R6& \bf R7& \bf R8& \bf R9& \bf R10\\
\hline
Text&\bf R1& \bf R2& \bf R3& \bf R4& \bf R5& \bf R6& \bf R7& \bf R8& \bf R9& \bf R10\\
\hline
Text&\bf R1& \bf R2& \bf R3& \bf R4& \bf R5& \bf R6& \bf R7& \bf R8& \bf R9& \bf R10\\
\hline

\end{tabular}
\end{center}

\bf{\caption{Caractéristiques du Réseau 1}}
\end{table}

\end{document}

-
Malmedal: thank you for your answer but I would like to replace the title of the lines that you put R1 R2 R3 with a text but when I put that it is disorganized – boutheina May 7 '12 at 16:41
Perhaps what you actually want is 11 columns? The first column should be extra wide? – Håkon Malmedal May 7 '12 at 16:48
yes this is right – boutheina May 7 '12 at 16:49
Replace the first p{1.3cm} with l. – Håkon Malmedal May 7 '12 at 17:26
Add ten ampersands (&) before the double backslash. – Håkon Malmedal May 7 '12 at 18:07