将文本垂直对齐到表格单元格的左上角

将文本垂直对齐到表格单元格的左上角

我对乳胶还很陌生,已经遇到这个问题好几天了。我的目标是为即将到来的高中董事会考试编写一个日历/待办事项列表。代码非常简单,因为我现在还不知道乳胶的潜力。这是我目前构建的图像:当前日历

如您所见,文本向左对齐,但不是垂直对齐。如果我的代码可以修改为将单词与左上角对齐,我将不胜感激。这是我的代码:

\documentclass[10pt, letterpaper]{article}
\usepackage[margin=0.5cm, landscape]{geometry}
\usepackage{array}

\begin{document}

\begin{table}\center
\renewcommand{\arraystretch}{6}

\begin{tabular}{|p{3.4cm}|p{3.4cm}|p{3.4cm}|p{3.4cm}|p{3.4cm}|p{3.4cm}|p{3.4cm}|}
\hline
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
\hline
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
\hline
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
\hline
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
\hline
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
\hline
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
\hline
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
\hline
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
\hline
\end{tabular}
\end{table}

\end{document}

答案1

使用该tabularray软件包可以轻松获得您想要的东西:

\documentclass[letterpaper]{article}
\usepackage[margin=0.5cm, landscape]{geometry}
\usepackage{tabularray}

\begin{document}
    \begin{table}
\begin{tblr}{hlines, vlines,
             colspec = {*{7}{X[l, h]}}, % left, top (header)
             rows = {ht=1cm}            % height of rows
             }
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
Monday & Tuesday & Wednesday & Thursday & Friday & Saturday & Sunday \\
\end{tblr}
    \end{table}
\end{document}

在此处输入图片描述

相关内容