如何在合并行中垂直居中方程?
我在多行单元格(也称为合并单元格)中有一个方程,应该垂直居中。我使用以下代码片段:
\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^b f(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}
有没有办法使其垂直居中而不进行试验和错误调整?
I have an equation in a multi row cell (aka a merged cell) that should be vertically centered. I do 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^b f(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}
Is there a way to make it vertically centered without doing trial and error adjustments?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我花了一些时间处理它,但没有真正解决它。当然,您可以将
parbox
的第二个参数从 1cm 增加到 3cm,因为每个单元格高 1cm(相差几毫米)。但是如何扩展 parbox 以精确填充单元格我无法弄清楚。甚至不确定这是否可能。也许您可以
在第二个参数中使用然后使用
\thirdcells
。I've spent some time with it without really solving it. You could of course increase the second argument to
parbox
from 1cm to 3cm since each cell is 1cm high (give or take a few mm). But how to expand the parbox to exactly fill the cell I can't figure out. Not even sure it's possible.Perhaps you could use
and then use
\threecells
in your second argument.不要对第一个单元格使用 \multirow,而是将三行放在第二个单元格内的表格中可以解决问题。这使您可以自由地忽略第二个单元格的高度。
Instead of using \multirow for first cell, putting the three rows in a tabular inside second cell can solve the problem. That gives you the freedom of ignoring the height of second cell.