![행 끝에 \\[...]를 추가하면 정렬이 엉망이 되는 이유는 무엇입니까?](https://rvso.com/image/353160/%ED%96%89%20%EB%81%9D%EC%97%90%20%5C%5C%5B...%5D%EB%A5%BC%20%EC%B6%94%EA%B0%80%ED%95%98%EB%A9%B4%20%EC%A0%95%EB%A0%AC%EC%9D%B4%20%EC%97%89%EB%A7%9D%EC%9D%B4%20%EB%90%98%EB%8A%94%20%EC%9D%B4%EC%9C%A0%EB%8A%94%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F.png)
OP의 의견에 답변하려고했습니다.내 이 대답[...]
하지만 행의 끝에 넣으면 가로 정렬이 엉망이 된다는 것을 알았습니다 .
\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}