How to vertically center an equation in a joined row?

I have an equation in a cell with several rows (also called a merged cell) that needs to be vertically centered. I am using the following code snippet:

\documentclass{article} \usepackage { multirow, longtable, array } \begin{document} \begin{tabular}{|*{2}{c|}}\hline \parbox[c][1cm]{5cm}{Description} & \parbox[c][1cm]{5cm}{Formula}\\\hline \multirow{3}* { \parbox[c][1cm]{5cm} { \centering$\displaystyle \int_a^bf(x)\, \textrm{d}x=F(b)-F(a)$ } } &\parbox[c][1cm]{5cm}{ A } \\\cline{2-2} &\parbox[c][1cm]{5cm}{ B } \\\cline{2-2} &\parbox[c][1cm]{5cm}{ C } \\\hline \parbox[c][1cm]{5cm}{D} & \parbox[c][1cm]{5cm}{E}\\\hline \end{tabular} \end{document} 

alt text

Is there a way to make it vertically centered without trial and error?

+4
source share
2 answers

Instead of using \ multirow for the first cell by placing three rows in a table inside the second cell, you can solve the problem. This gives you the freedom to ignore the height of the second cell.

 \documentclass{article} \usepackage{multirow,longtable,array} \begin{document} \begin{tabular}{|*{2}{ c@ {}|@{}}} \hline \parbox[c][1cm]{5cm}{Description} & \parbox[c][1cm]{5cm}{~~~Formula}\\\hline $\displaystyle \int_a^bf(x)\, \textrm{d}x=F(b)-F(a)$ &\begin{tabular}{@{} l@ {}} \parbox[c][1cm]{5cm}{~~ A } \\\hline \parbox[c][1cm]{5cm}{~~ B } \\\hline \parbox[c][1cm]{5cm}{~~ C } \\ \end{tabular}\\\hline \parbox[c][1cm]{5cm}{D} & \parbox[c][1cm]{5cm}{~~~E}\\\hline \end{tabular} \end{document} 
+1
source

I spent some time with him without solving it. You could, of course, increase the second argument to parbox from 1 cm to 3 cm, since each cell is 1 cm high (give or take a few mm). But how to expand parbox to fill the cell exactly, I cannot understand. Not even sure if this is possible.

Perhaps you could use

 \newlength{\threecells} \settoheight{\threecells}{a tabular of three cells} 

and then use \threecells in the second argument.

+2
source

All Articles