LaTeX forum ⇒ Graphics, Figures & Tables\multicolumn stretches last column on row below

Information and discussion about graphics, figures & tables in LaTeX documents.
crobar
Posts: 12
Joined: Mon Nov 16, 2009 4:41 pm

\multicolumn stretches last column on row below

Postby crobar » Fri Apr 22, 2011 3:46 pm

Hello,

I want to make a table with a heading row which has two cells, one spanning one column, and the other spanning another four rows. The code for the table is shown below:

  1. \documentclass{report}
  2.  
  3. \usepackage{booktabs}
  4.  
  5. \begin{document}
  6.  
  7.  
  8. \begin{table}
  9. %\begin{minipage}[b]{0.5\linewidth}%\centering
  10. %\centering
  11. \renewcommand\arraystretch{1.4}
  12. %\scalebox{1.0}{
  13. \begin{tabular}{l c c c c}
  14. \toprule
  15. \textbf {Group} & \multicolumn{4}{c}{\textbf {No. rabbits required for each implantation period}} \\
  16. & 12 & 26 & 52 & 78 \\ \midrule
  17. Test sample in bone & 12 & 12 & 12 & 12 \\
  18. Control sample in bone & 12 & 12 & 12 & 12 \\
  19. Test sample in muscle & 12 & 12 & 12 & 12 \\
  20. Control sample in muscle & 12 & 12 & 12 & 12 \\\bottomrule
  21. \end{tabular}
  22. %}
  23. \caption{insert caption}
  24. \label{tab:examiner2assessment2}
  25. \end{table}
  26.  
  27. \end{document}


How do I get the four columns spanned by the multicolumn to be of equal width?

Thanks!

User avatar
Stefan Kottwitz
Site Admin
Posts: 9522
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Apr 22, 2011 6:22 pm

Hi crobar,

you could use the tabularx package:

  1. \usepackage{tabularx}
  2. \newcolumntype{C}{>{\centering\arraybackslash}X}
  3. ...
  4. \begin{tabularx}{\textwidth}{lCCCC}
  5. ...
  6. \end{tabularx}


Here are also \multicolumn-Examples: Creating tables with LaTeX.

Viele Grüße,

Stefan
Site admin

crobar
Posts: 12
Joined: Mon Nov 16, 2009 4:41 pm

Postby crobar » Fri Apr 22, 2011 6:36 pm

That works perfectly, thanks!


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 5 guests