使用陣列在表中垂直對齊不起作用

使用陣列在表中垂直對齊不起作用

請參閱下面的我的程式碼。我沒有對程式碼進行任何更改,只是重新編譯了我的 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預說明符(如果加載,則可以使用另一個字母siunitxcellspace。這確保了相應列中單元格頂部和底部的最小垂直間距:

\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} 

在此輸入影像描述

相關內容