在LaTex表格环境中,如何在表格单元格中垂直居中文本?

在LaTex表格环境中,如何在表格单元格中垂直居中文本?,latex,tabular,Latex,Tabular,我想将每个单元格中的文本水平和垂直居中。使用下面的代码,文本水平居中,而不是垂直居中,并显示在单元格顶部。提前谢谢 \documentclass[jou]{apa7} \usepackage{tabularx,colortbl} \begin{document} \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1

我想将每个单元格中的文本水平和垂直居中。使用下面的代码,文本水平居中,而不是垂直居中,并显示在单元格顶部。提前谢谢

\documentclass[jou]{apa7}
\usepackage{tabularx,colortbl}

\begin{document}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}

\begin{tabular}{| L{1cm} | C{5cm} | C{5cm} | C{5cm} |} \hline
\rowcolor[gray]{.4}& \color{white}Cell 1 & \color{white}Cell 2 & \color{white}Cell 3 \\[30pt] \hline
\cellcolor[gray]{.4}\color{white}Cell 4 & Cell 5 & Cell 6 & Cell 7 \\[100pt] \hline


\end{tabular}

\end{document}

请,请,请,看看如何创建美观的表格,例如。将数据放入数据监狱是不好的。做斑马线桌子更糟糕。同时做这两件事太可怕了

\documentclass[jou]{apa7}
\usepackage{tabularx,colortbl}

\begin{document}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}}

{
\setlength{\extrarowheight}{30pt}
\begin{tabular}{| L{1cm} | C{5cm} | C{5cm} | C{5cm} |} \hline
\rowcolor[gray]{.4}& \color{white}Cell 1 & \color{white}Cell 2 & \color{white}Cell 3 \\[30pt] \hline
\cellcolor[gray]{.4}\color{white}Cell 4 & Cell 5 & Cell 6 & Cell 7 \\[30pt] \hline
\end{tabular}
}

\end{document}

感谢您的帮助和反馈。我对乳胶很陌生。“将数据放入数据监狱是什么意思?”玛丽·数据监狱描述了在所有四个站点上都有规则的单元格。最好不要在表格中使用任何垂直线。