# Fix sized centered multirow and multicolumn tables

I'm using TeXLive 2011, and one of my friends has a problem with creating tables, which use fix sized centered \multirow and \multicolumn cells. This is his thesis, so there is a lot of ignorable code in the following minimal working example, but I'm not sure.

\documentclass[11pt,titlepage,oneside,fleqn]{report}
\usepackage[a4paper,right=1.0in,left=1.0in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[magyar]{babel}
\usepackage{ifthen}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{amssymb}
\usepackage{indentfirst}
\usepackage{setspace}
\usepackage{changepage}
\usepackage{textcomp}
\usepackage[version=3]{mhchem}
\usepackage{tipa}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{chemfig}
\usepackage{longtable}
\usepackage{xtab}
\usepackage{subfig}
\usepackage{multirow}
\usepackage{fmtcount}
\interfootnotelinepenalty=10000
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}

\hyphenation{ImageJ}

\frenchspacing
\sloppy

\newcommand\setpolymerdelim[2]{\def\delimleft{#1}\def\delimright{#2}}
\def\makebraces[#1,#2]#3#4#5{%
\edef\delimhalfdim{\the\dimexpr(#1+#2)/2}%
\edef\delimvshift{\the\dimexpr(#1-#2)/2}%
\chemmove{%
\node[at=(#4),yshift=(\delimvshift)]
{$\left\delimleft\vrule height\delimhalfdim depth\delimhalfdim width0pt\right.$};%
\node[at=(#5),yshift=(\delimvshift)]
{$\left.\vrule height\delimhalfdim depth\delimhalfdim width0pt\right\delimright_{\rlap{$\scriptstyle#3$}}$};}}

\newcommand{\superscript}[1]{\ensuremath{^{\textrm{#1}}}}
\newcommand{\subscript}[1]{\ensuremath{_{\textrm{#1}}}}

\begin{document}

\makeatletter
\vspace*{50 pt}%
{\setlength{\parindent}{0pt} \raggedright \normalfont
\bfseries\Huge\thechapter.\ #1
\par\nobreak\vspace{40 pt}}}
\makeatother

\begin{table}[h]
\hspace{-1,25cm}
\begin{tabular}{>{\centering\arraybackslash}m{2cm} >{\centering\arraybackslash}m{3cm} >{\centering\arraybackslash}m{2cm} >{\centering\arraybackslash}m{4cm} >{\centering\arraybackslash}m{4cm}}
\hline
\noalign{\smallskip}
\multirow{3}{*}{A brmfe juiodondf} & \multicolumn{2}{c}{Az előkezelt otijgfni} & \multirow{3}{*}{A oighderinir, iufbdgkfddf and zxdbviid7ud uibuofvdt water dfubu} & \multirow{3}{*}{Absorbance 550~nm (liquid shit)}\\\noalign{\smallskip}
\cline{2-3} \noalign{\smallskip}
& what & whatever &  &\\\noalign{\smallskip}
\cline{2-3} \noalign{\smallskip}
& \multicolumn{2}{c}{something}\\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
x & 0,71g & 0,0360g & 15ml & 0,4\\\noalign{\smallskip}
y & 0,11g & 0,0146g & 15ml & 0,26\\\noalign{\smallskip}
z & 0,47g & 0,0527g & 16ml & 0,5\\\noalign{\smallskip}
\multicolumn{4}{l}{again some} & 0,537\\\noalign{\smallskip}
\multicolumn{4}{l}{bullshit} & 0,456\\
\noalign{\smallskip}
\hline
\end{tabular}
\caption{Beautiful table}
\end{table}

\end{document}


-
Welcome to TeX.sx! What is the problem exactly? This compiles fine here, there are a couple of overfull hboxes, but that is due to the massive amount of text you are trying to place into the header. –  Roelof Spijker Oct 25 '11 at 10:12
Had not seen the image you included. If the problem is with the wrapping, that is due to the fact that you provide the * argument to the multirow command. That tells it to use the natural width of the text. However, you use a limited width for the columns, if you set that width instead of the * you will see that the text wraps inside of the column. –  Roelof Spijker Oct 25 '11 at 10:19
Thank you, @wh1t3! This is a perfect answer. I only had to add \centering to these rows. \multirow{3}{2cm}{\centering A brmfe juiodondf} –  szantaii Oct 25 '11 at 11:53
I've added it as an answer so the question can be shown as answered. –  Roelof Spijker Oct 25 '11 at 12:04

If the problem is with the wrapping, that is due to the fact that you provide the * argument to the multirow command. That tells it to use the natural width of the text. However, you use a limited width for the columns, if you set that width instead of the * you will see that the text wraps inside of the column.