![Вертикальное выравнивание в таблице с использованием массива не работает](https://rvso.com/image/391709/%D0%92%D0%B5%D1%80%D1%82%D0%B8%D0%BA%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE%D0%B5%20%D0%B2%D1%8B%D1%80%D0%B0%D0%B2%D0%BD%D0%B8%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5%20%D0%B2%20%D1%82%D0%B0%D0%B1%D0%BB%D0%B8%D1%86%D0%B5%20%D1%81%20%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5%D0%BC%20%D0%BC%D0%B0%D1%81%D1%81%D0%B8%D0%B2%D0%B0%20%D0%BD%D0%B5%20%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%B0%D0%B5%D1%82.png)
Ниже приведен мой код. Я ничего не менял в коде, а просто перекомпилировал свой документ LaTeX, и вертикальное выравнивание по центру больше не работает.
Как вернуть вертикальное выравнивание по центру (как на снимке экрана «до»)?
Код:
\documentclass[10pt]{exam}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\begin{document}
\begin{table}
\centering
\begin{tabular}{| L{3cm} | L{8cm} | L{1.7cm} | L{1.7cm} |}
\hline
\textbf{Section} & \textbf{Description} & \textbf{Available Points} & \textbf{Earned Points}\\
\hline
\textbf{Cover Page} & Includes the title of the report, team name, and all of the team member names. & 1 & ~\\[1cm]
\hline
\textbf{Introduction} & Explains the project functionality and features. & 2 & ~\\[1cm]
\hline
\end{tabular}
\end{table}
\end{document}
До:
После:
решение1
У меня тоже не работает. Предлагаю изменить определение типов столбцов, включив в него S
предварительный спецификатор (можно использовать другую букву, если загружаете siunitx
) из cellspace
. Это гарантирует в соответствующих столбцах минимальный вертикальный интервал сверху и снизу ячеек:
\documentclass[10pt]{exam}
\usepackage{array, cellspace}
\setlength{\cellspacetoplimit}{2ex}
\setlength{\cellspacebottomlimit}{2ex}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}S{m{#1}}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}S{m{#1}}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}S{m{#1}}}
\begin{document}
\begin{table}
\centering
\begin{tabular}{| L{3cm} |L{8cm} | L{1.7cm} | L{1.7cm} |}
\hline
\textbf{Section} & \textbf{Description} & \textbf{Available Points} & \textbf{Earned Points}\\
\hline
\textbf{Cover Page} & Includes the title of the report, team name, and all of the team member names. & 1 & ~\\
\hline
\textbf{Introduction} & Explains the project functionality and features. & 2 & ~\\
\hline
\end{tabular}
\end{table}
\end{document}