# Creating table with multirow option fixed width and wrapped text

I am trying to create a table using multirow option. I am using the following code:

\documentclass[10pt]{article}
%\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{microtype}
\usepackage{graphicx}
\usepackage{multirow}

\begin{document}
\begin{table}[h]
\newcommand{\lambdabar}{{\mkern0.75mu\mathchar '26\mkern -9.75mu\lambda}}
\centering
\begin{tabular}{r@{=}ll}
\hline
\hline
$a_0$ & $\frac{\hbar^2}{m e^2}$
& \multirow{2}{7cm}{Bohr (radius of electron orbit in Bohr's model of Hydrogen)} \\
& $5.29\times10^{-9}$ & \\
$\lambdabar_c$ & $\alpha a_0 = \frac{\hbar}{m c}$
& \multirow{2}{7cm}{Reduced Compton wavelength ($\lambda_c = \lambda_c/2$). $\lambda_c$ is change of wavelength of photon scattered at 90\textdegree by a stationary electron due to recoil of electron.} \\
& $3.86159\times10^{-11}$cm & \\
$r_0$ & $\alpha^2 a_0 = \alpha \lambdabar_c = \frac{d^2}{m c^2}$
&  \multirow{2}{7cm}{Classical radius of electron (size for which electrostatic self energy equals rest mass energy)} \\
& $2.81794\times10^{-13}$cm  & \\
\hline
\hline
\end{tabular}
\end{table}
\end{document}


And I am getting the following output:

Here we can see the last two row coming on the third and fourth row. Why is that happening and how to make it proper?

multirow doesn't serve to have more lines in one table cell. for this you should use appropriate type of column, for example p{<column width>} or use tabularx (as i use in example below), tabulary etc. for math stuff is better to declare table column in a way >{$}c<{$} (or other type of column). i hope that example below will some how help you.

\documentclass[10pt]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{tabularx}

\begin{document}
\begin{table}[h]
\newcommand{\lambdabar}{{\mkern0.75mu\mathchar '26\mkern -9.75mu\lambda}}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\renewcommand{\arraystretch}{1.4}
\centering
\begin{tabularx}{\hsize}{>{$}m{4cm}<{$}X}
\hline
\hline
a_0=\dfrac{\hbar^2}{m e^2}=5.29\times10^{-9}
& Bohr (radius of electron orbit in Bohr's model of Hydrogen)   \\
\begin{aligned}
\lambdabar_c  & =\alpha a_0 = \dfrac{\hbar}{m c}\newline\\
& = 3.86159\times10^{-11}\ \text{cm}
\end{aligned}
&   Reduced Compton wavelength ($\lambda_c=\lambda_c/2$). $\lambda_c$ is change of wavelength of photon scattered at 90\textdegree by a stationary electron due to recoil of electron.                             \\
\begin{aligned}
r_0 & = \alpha^2 a_0 = \alpha\lambdabar_c = \dfrac{d^2}{m c^2}\\
& = 2.81794\times10^{-13}\ \text{cm}
\end{aligned}
&  Classical radius of electron (size for which electrostatic self energy equals rest mass energy)                                        \\
\hline
\hline
\end{tabularx}
\end{table}
\end{document}


Here is a TABstacked alternative.

\documentclass[10pt]{article}
%\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{microtype}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{tabstackengine}
\TABstackMath
\begin{document}
\begin{table}[ht]
\renewcommand\arraystretch{1.4}
\setstackgap{L}{1.3\normalbaselineskip}
\newcommand{\lambdabar}{{\mkern0.75mu\mathchar '26\mkern -9.75mu\lambda}}
\centering
\begin{tabular}{lp{2.65in}}
\hline
\hline
{\alignLongunderstack{a_0 =&\frac{\hbar^2}{m e^2}\\
=&5.29\times10^{-9}}}
& Bohr (radius of electron orbit in Bohr's model of Hydrogen) \\
{\alignLongunderstack{\lambdabar_c =& \alpha a_0 = \frac{\hbar}{m c}\\
=&3.86159\times10^{-11} \text{cm}}}
& Reduced Compton wavelength ($\lambda_c = \lambda_c/2$).
$\lambda_c$ is change of wavelength of photon scattered
at 90\textdegree by a stationary electron due to recoil
of electron. \\
{\alignLongunderstack{ r_0  =& \alpha^2 a_0 = \alpha \lambdabar_c
= \frac{d^2}{m c^2}\\=&2.81794\times10^{-13} \text{ cm}}}
&  Classical radius of electron (size for which electrostatic
self energy equals rest mass energy) \\
\hline
\hline
\end{tabular}
\end{table}

\end{document}


The text of the 3rd row (Reduced ...) take 4 lines; not 2. To fix it you can put '\multirow{2}... and them leave 2 empty lines.

\documentclass[10pt]{article}
%\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{microtype}
\usepackage{graphicx}
\usepackage{multirow}

\begin{document}
\begin{table}[h]
\newcommand{\lambdabar}{{\mkern0.75mu\mathchar '26\mkern -9.75mu\lambda}}
\centering
\begin{tabular}{r@{=}ll}
\hline
\hline
$a_0$ & $\frac{\hbar^2}{m e^2}$
& \multirow{2}{7cm}{Bohr (radius of electron orbit in Bohr's model of Hydrogen)} \\
& $5.29\times10^{-9}$ & \\
$\lambdabar_c$ & $\alpha a_0 = \frac{\hbar}{m c}$
& \multirow{4}{7cm}{Reduced Compton wavelength ($\lambda_c = \lambda_c/2$). $\lambda_c$ is change of wavelength of photon scattered at 90\textdegree by a stationary electron due to recoil of electron.} \\
& $3.86159\times10^{-11}$cm & \\
\\
\\
$r_0$ & $\alpha^2 a_0 = \alpha \lambdabar_c = \frac{d^2}{m c^2}$
&  \multirow{2}{7cm}{Classical radius of electron (size for which electrostatic self energy equals rest mass energy)} \\
& $2.81794\times10^{-13}$cm  & \\
\hline
\hline
\end{tabular}
\end{table}
\end{document}


This has the side-effect of having = sign in some rows. I will take them otu from the column specification and put column 1 and 2 in the same.

• Problem with this is that I will not have much freedom to change things. Like if I change the table size I have to change no of columns and also if I add extra text I have change the no of columns. Anyway thanks for quick reply. – Apurba Nov 19 '13 at 15:43
• I have found some other solution, I can use perbox to break the lines instead of multirow`. – Apurba Nov 21 '13 at 11:51