我试图回复原帖的评论我的这个答案但我发现当我把它放在[...]
一行末尾时它会弄乱水平对齐。
\documentclass{book}
\usepackage{array}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{arydshln}
\begin{document}
\renewcommand{\arraystretch}{2.2}
Without space added:
\begin{tabular}{|M{.7cm}|}
\hline
$y$ \\
\hdashline
$a$ \\
\hdashline
$b$ \\
\hline
\end{tabular}
\vspace{10pt} with space added:
\begin{tabular}{|M{.7cm}|}
\hline
$y$ \\[2ex]
\hdashline
$a$ \\
\hdashline
$b$ \\
\hline
\end{tabular}
\end{document}
查看的位置y
:
我究竟做错了什么?
答案1
问题在于数学后面的空格。arydshln
重新定义内部命令(在本例中\@xargarraycr
)并忘记了\unskip
原始定义:
\documentclass{book}
\usepackage{array}
\newcolumntype{M}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{arydshln}
\usepackage{etoolbox}
\begin{document}
\renewcommand{\arraystretch}{2.2}
\begin{tabular}{|M{.7cm}|}
\hline
$y$ \\[2ex]
\hdashline
$a$ \\
\hline
\end{tabular}
\begin{tabular}{|M{.7cm}|}
\hline
$y$\\[2ex] %no problem without the space
\hdashline
$a$ \\
\hline
\end{tabular}
\makeatletter
\pretocmd\@xargarraycr{\unskip}{}{\fail} %patch to add \unskip
\begin{tabular}{|M{.7cm}|}
\hline
$y$ \\[2ex]
\hdashline
$a$ \\
\hline
\end{tabular}
\end{document}