30 在tabular以及multirow宏包在涉及makecell共同作用时的纵向对齐问题?

发布于 2025-09-06 13:29:12

该问题的tabularray方案可见这个链接

本提问只希望局限在tabular的框架内,不希望用例如tabularray宏包的方案...

希望实现合并单元格内的纵向对齐

MWE如下:

\documentclass[fontset=fandol]{ctexart}
\usepackage{array}
\usepackage{multirow}
\usepackage{amsmath,amsfonts}
\usepackage{makecell}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}

\begin{tabular}{|M{5cm}|M{5cm}|M{5cm}|}
\hline
\textbf{条件} & \textbf{方程} & \textbf{说明} \\ \hline
\multirow{2}{*}{圆心在原点} & $x^2+y^2=r^2$ & $a=b=0$ \\ \cline{2-3}
 & $x^2+y^2+F=0$ & $D=E=0$ \\ \hline
\multirow{2}{*}{圆过原点} & $(x-a)^2+(y-b)^2=a^2+b^2$ & $a^2+b^2=r^2$ \\ \cline{2-3}
 & $x^2+y^2+Dx+Ey=0$ & $F=0$ \\ \hline
\multirow{2}{*}{圆心在$x$轴上} & $(x-a)^2+y^2=r^2$ & $b=0$ \\ \cline{2-3}
 & $x^2+y^2+Dx+F=0$ & $E=0$ \\ \hline
\multirow{2}{*}{圆心在$y$轴上} & $x^2+(y-b)^2=r^2$ & $a=0$ \\ \cline{2-3}
 & $x^2+y^2+Ey+F=0$ & $D=0$ \\ \hline
\multirow{2}{*}{圆与$x$轴相切} & $(x-a)^2+(y-b)^2=b^2$ & $|b|=r$ \\ \cline{2-3}
 & \makecell{$x^2+y^2+Dx+Ey+F=0$\\$(E\neq 0,D^2-4F=0)$} & $E\neq 0,D^2-4F=0$ \\ \hline
\multirow{2}{*}{圆与$y$轴相切} & $(x-a)^2+(y-b)^2=a^2$ & $|a|=r$ \\ \cline{2-3}
 & \makecell{$x^2+y^2+Dx+Ey+F=0$\\$(D\neq 0,E^2-4F=0)$} & $D\neq 0,E^2-4F=0$ \\ \hline
 \multirow{2}{*}{圆心在$x$轴上且圆过原点} & $(x-a)^2+y^2=a^2$ & $|a|=r,b=0$ \\ \cline{2-3}
 & $x^2+y^2+Dx=0$ & $E=F=0,D\neq 0$ \\ \hline
\multirow{2}{*}{圆心在$y$轴上且圆过原点} & $x^2+(y-b)^2=b^2$ & $a=0,|b|=r$ \\ \cline{2-3}
 & $x^2+y^2+Ey=0$ & $D=F=0,E\neq 0$ \\ \hline
\multirow{2}{*}{圆与$x,y$轴都相切} & \makecell{$(x-a)^2+(y-b)^2=a^2$\\$(|a|=|b|\neq 0)$} & $|a|=|b|=r$ \\ \cline{2-3}
 & \makecell{$x^2+y^2+Dx+Ey+F=0$\\$(|D|=|E|\neq 0)$} & $D^2=E^2=4F$ \\ \hline
\end{tabular}

\end{document}

即使使用了array提供的m{<width>}格式这也并不令人满意....

image.png

本回答重点在于,希望在不改变目前代码的大框架下(i.e.必须使用原生的tabular环境)权衡好multirowmakecell的功能,试图找到tabular框架下纵向对齐的最佳实践。

查看更多

关注者
0
被浏览
71
1 个回答
Sagittarius Rover
Sagittarius Rover 3小时前
这家伙很懒,什么也没写!

感谢@u101077 老师提供的方案,调整\multirow的行数即可。

\documentclass[fontset=fandol]{ctexart}
\usepackage{array}
\usepackage{multirow}
\usepackage{amsmath,amsfonts}
\usepackage{makecell}

\begin{document}
\begin{tabular}{|c|c|c|}
\hline
\textbf{条件} & \textbf{方程} & \textbf{说明} \\ \hline
\multirow{2}{*}{圆心在原点} & $x^2+y^2=r^2$ & $a=b=0$ \\ \cline{2-3}
 & $x^2+y^2+F=0$ & $D=E=0$ \\ \hline
\multirow{2}{*}{圆过原点} & $(x-a)^2+(y-b)^2=a^2+b^2$ & $a^2+b^2=r^2$ \\ \cline{2-3}
 & $x^2+y^2+Dx+Ey=0$ & $F=0$ \\ \hline
\multirow{2}{*}{圆心在$x$轴上} & $(x-a)^2+y^2=r^2$ & $b=0$ \\ \cline{2-3}
 & $x^2+y^2+Dx+F=0$ & $E=0$ \\ \hline
\multirow{2}{*}{圆心在$y$轴上} & $x^2+(y-b)^2=r^2$ & $a=0$ \\ \cline{2-3}
 & $x^2+y^2+Ey+F=0$ & $D=0$ \\ \hline
\multirow{3}{*}{圆与$x$轴相切} & $(x-a)^2+(y-b)^2=b^2$ & $|b|=r$ \\ \cline{2-3}
 & \makecell{$x^2+y^2+Dx+Ey+F=0$\\$(E\neq 0,D^2-4F=0)$} & $E\neq 0,D^2-4F=0$ \\ \hline
\multirow{3}{*}{圆与$y$轴相切} & $(x-a)^2+(y-b)^2=a^2$ & $|a|=r$ \\ \cline{2-3}
 & \makecell{$x^2+y^2+Dx+Ey+F=0$\\$(D\neq 0,E^2-4F=0)$} & $D\neq 0,E^2-4F=0$ \\ \hline
 \multirow{2}{*}{圆心在$x$轴上且圆过原点} & $(x-a)^2+y^2=a^2$ & $|a|=r,b=0$ \\ \cline{2-3}
 & $x^2+y^2+Dx=0$ & $E=F=0,D\neq 0$ \\ \hline
\multirow{2}{*}{圆心在$y$轴上且圆过原点} & $x^2+(y-b)^2=b^2$ & $a=0,|b|=r$ \\ \cline{2-3}
 & $x^2+y^2+Ey=0$ & $D=F=0,E\neq 0$ \\ \hline
\multirow{3}{*}{圆与$x,y$轴都相切} & \makecell{$(x-a)^2+(y-b)^2=a^2$\\$(|a|=|b|\neq 0)$} & $|a|=|b|=r$ \\ \cline{2-3}
 & \makecell{$x^2+y^2+Dx+Ey+F=0$\\$(|D|=|E|\neq 0)$} & $D^2=E^2=4F$ \\ \hline
\end{tabular}

\end{document}

image.png

不过我不确定若右侧内容中存在\dfrac,或者插入图片等「高度不是行数的整数倍」的情况是否都具有良好的可拓展性...是不是总是能找到这个合适的\multirow{<nrow>}...

\documentclass[fontset=fandol]{ctexart}
\usepackage{array}
\usepackage{multirow}
\usepackage{amsmath,amsfonts}
\usepackage{makecell}
\usepackage{graphicx}
\begin{document}
\begin{tabular}{|c|c|c|}
\hline
\textbf{条件} & \textbf{方程} & \textbf{说明} \\ \hline
\multirow{2}{*}{圆心在原点} & $x^2+y^2=r^2$ & $a=b=0$ \\ \cline{2-3}
 & $x^2+y^2+F=0$ & $D=E=0$ \\ \hline
\multirow{3}{*}{圆与$x,y$轴都相切} & \makecell{$(x-a)^2+(y-b)^2=a^2$\\$(|a|=|b|\neq 0)$} & $|a|=|b|=r$ \\ \cline{2-3}
 & \makecell{$x^2+y^2+Dx+Ey+F=0$\\$(|D|=|E|\neq 0)$} & $D^2=E^2=4F$ \\ \hline
\multirow{3}{*}{圆与$x,y$轴都相切} & \makecell{$\dfrac{1}{2}(x-a)^2+(y-b)^2=a^2$\\$(|a|=|b|\neq \dfrac{1}{2})$} & $|a|=|b|=r$ \\ \cline{2-3}
 & \makecell{$x^2+y^2+\dfrac{4}{5}Dx+Ey+F=0$\\$(|D|=|E|\neq 0)$} & $D^2=E^2=F$ \\ \hline
\multirow{7}{*}{圆与$x,y$轴都相切} & \makecell{$\dfrac{1}{2}(x-a)^2+(y-b)^2=a^2$\\$(|a|=|b|\neq \dfrac{1}{2})$} & $|a|=|b|=r$ \\ \cline{2-3}
 & \makecell{$x^2+y^2+\dfrac{4}{5}Dx+Ey+F=0$\\$(|D|=|E|\neq 0)$} &\includegraphics[width=4cm]{example-image}\\\hline
\end{tabular}
\end{document}

image.png

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览