![Vertikale Ausrichtung in Tabelle mithilfe von Array funktioniert nicht](https://rvso.com/image/391709/Vertikale%20Ausrichtung%20in%20Tabelle%20mithilfe%20von%20Array%20funktioniert%20nicht.png)
Unten finden Sie meinen Code. Ich habe nichts am Code geändert, sondern nur mein LaTeX-Dokument neu kompiliert und die vertikale Zentrierung funktioniert nicht mehr.
Wie kann ich die vertikale Zentrierung (wie im Vorher-Screenshot zu sehen) wiederherstellen?
Code:
\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}
Vor:
Nach:
Antwort1
Bei mir funktioniert es auch nicht. Ich schlage vor, die Definition Ihrer Spaltentypen zu ändern, um den S
Vorspezifizierer (Sie können einen anderen Buchstaben verwenden, wenn Sie laden siunitx
) von einzubinden cellspace
. Dies stellt in den entsprechenden Spalten einen minimalen vertikalen Abstand oben und unten in den Zellen sicher:
\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}