更改 tabularray 中的单元格高度

更改 tabularray 中的单元格高度

我正在尝试使用 tabularray 制定时间表。以下是我的代码和图片。

\documentclass[12pt,a4paper]{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[left=0mm,top=0mm,right=0mm,bottom=0mm]{geometry}
\usepackage{amsmath}
\usepackage{pdflscape}
\usepackage{lscape}
\usepackage{array}
\usepackage{tabularray}

\newcommand{\columnTitle}[1]{\LARGE\textbf{#1}\normalsize}

\begin{document}
    \begin{landscape}
        \begin{center}
            \large
            \begin{tblr}{
                    hlines, vlines,
                    columns = {40mm, c},
                    column {1} = {25mm, l},
                    row {1} = {abovesep=2mm, belowsep=2mm},
                    rows = {6mm, c},
                    cell {5}{1,2,4,6,7} = {r=2}{m},
                    cell {3}{3} = {r=3}{m}, % item1
                    cell {6}{5} = {r=4}{m}  % item2
                }
                \columnTitle{\Large Time} & \columnTitle{Monday} & \columnTitle{Tuesday} & \columnTitle{Wednesday} & \columnTitle{Thursday} & \columnTitle{Friday} & \columnTitle{Saturday} \\
                9:00  & & & & & & \\
                9:30  & & item1 & & & & \\
                10:00 & & & & & & \\
                10:30 & & & & & & \\
                      & & & & item2 & & \\
                11:00 & & & & & & \\
                11:30 & & & & & & \\
                12:00 & & & & & & \\
                12:30 & & & & & &
            \end{tblr}
        \end{center}
    \end{landscape}
\end{document}

日程

我的问题是 10:30 那一行。它有两行,但看起来像一行,我希望它与其他行的高度相同。我尝试调整上述两行的大小,但无法正确调整它们的大小。项目 1 在 10:15 结束,项目 2 在 10:15 开始。

答案1

像这样?我只需创建额外的行来覆盖这 15 分钟的时间段。

\documentclass[margin=5mm]{standalone}
\usepackage{tabularray}

\begin{document}
\begin{tblr}{
    hline{1}, hline{even}, hline{Z},
    vlines,
    cells = {font=\large},
    columns = {40mm, c},
    rows = {rowsep=0mm, c},
    column {1} = {25mm, l},
    row{1} = {abovesep=2mm, belowsep=2mm, font=\LARGE\bfseries},
    cell{even[2]}{1} = {r=2}{},
    %%% Items
    cell{4}{3} = {r=5}{}, hline{9}={3-3}{},  % Item 1
    cell{9}{5} = {r=4}{}, hline{9}={5-5}{},  % Item 2
  }
  \Large\bfseries Time & Monday & Tuesday & Wednesday & Thursday & Friday & Saturday \\
  9:00  & & & & & & \\
        & & & & & & \\
  9:30  & & Item 1 & & & & \\
        & & & & & & \\
  10:00 & & & & & & \\
        & & & & & & \\
  10:30 & & & & & & \\
        & & & & Item 2 & & \\
  11:00 & & & & & & \\
        & & & & & & \\
  11:30 & & & & & & \\
        & & & & & & \\
  12:00 & & & & & & \\
        & & & & & & \\
  12:30 & & & & & & \\
        & & & & & &
\end{tblr}
\end{document}

在此处输入图片描述

答案2

我明白了,我错过了stretch=0

\begin{tblr}{
    hlines, vlines,
    columns = {40mm, c},
    column {1} = {25mm, l},
    row {1} = {abovesep=2mm, belowsep=2mm},
    rows = {6mm, c},
    cell {5}{1,2,4,6,7} = {r=2}{m},
    cell {3}{3} = {r=3}{m}, % item1
    cell {6}{5} = {r=4}{m}, % item2
    row {5} = {3mm, c},
    row {6} = {3mm, c},
    stretch=0
}

相关内容