横向表格不居中且过于紧凑

横向表格不居中且过于紧凑

我目前正在使用表格,我想为特定页面制作一个横向表格,但表格太小、太紧凑,而且不居中。我该如何放大它?

\documentclass[12pt, a4paper]{article}
\usepackage[margin=1.9cm, left=2.1cm, right=1.8cm]{geometry}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage{afterpage}
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\begin{document}
\afterpage{
\begin{landscape}
\section{Time Frame}
\centering
\begin{table}[ht]
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
                      &                                   & \multicolumn{13}{c|}{Week}                                                                                                                                                                                                                                                                                                                                   \\ \cline{3-15} 
\multirow{-2}{*}{No.} & \multirow{-2}{*}{Activities}      & 1                        & 2                        & 3                        & 4                        & 5                        & 6                        & 7                        & 8                        & 9                        & 10                       & 11                       & 12                       & 13                       \\ \hline
1                     & Course Briefing                   & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          \\ \hline
2                     & Committee Selection               &                          & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          \\ \hline
3                     & Topic Selection                   &                          & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          \\ \hline
4                     & Budget Estimation                 &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          &                          &                          &                          \\ \hline
6                     & Teaser Design                     &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
7                     & Attracting Sponsors               &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
8                     & T-Shirt Design                    &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
9                     & Mural Design                      &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
10                    & Certificate Design                &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
11                    & Proposal Preparation              &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
12                    & Planning Approval                 &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
13                    & Video Filming/ Taking Photography &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          \\ \hline
14                    & Event Promotion                   &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          \\ \hline
15                    & Event Preparation                 &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          \\ \hline
16                    & Mural-painting                    &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          & \cellcolor[HTML]{009901} &                          &                          \\ \hline
17                    & Video Editing                     &                          &                          &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          \\ \hline
18                    & Final Report Preparation          &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} \\ \hline
\end{tabular}
\end{table}
\end{landscape}}
\end{document}

在此处输入图片描述

答案1

像这样?

在此处输入图片描述

\documentclass{article}
\usepackage[margin=1.9cm, left=2.1cm, right=1.8cm]{geometry}
\usepackage{graphicx}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{cellspace,
            multirow}
\setlength\cellspacetoplimit{5pt}    % <----
\setlength\cellspacebottomlimit{5pt} % <---- 

\usepackage[table,xcdraw]{xcolor}
\newcommand\CCG{\cellcolor[HTML]{009901}}
\newcommand\CCY{\cellcolor[HTML]{FFC702}}

\begin{document}
\afterpage{
\begin{landscape}
\section{Time Frame}
\begin{table}[ht]
\centering
\Large      % <----
\begin{tabular}{|Sc|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
    &   & \multicolumn{13}{c|}{Week}                                        \\ \cline{3-15}
\multirow{-2}{*}{No.}
    & \multirow{-2}{*}{Activities}
        & 1 & 2 & 3 &  4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13    \\ \hline
1   & Course Briefing
        & \CCG  &   &   &   &   &   &   &   &   &   &   &   &       \\ \hline
2   & Committee Selection
        &   & \CCG  &   &   &   &   &   &   &   &   &   &   &       \\ \hline
3   & Topic Selection
        &   & \CCG  &   &   &   &   &   &   &   &   &   &   &       \\ \hline
4   & Budget Estimation
        &   & \CCY & \CCY & \CCG &  &   &   &   &   &   &   &   &   \\ \hline
6   & Teaser Design                     &                          & \CCY & \CCY & \CCY & \CCY & \CCY & \CCG &                          &                          &                          &                          &                          &                          \\ \hline
7   & Attracting Sponsors               &                          & \CCY & \CCY & \CCY & \CCY & \CCY & \CCG &                          &                          &                          &                          &                          &                          \\ \hline
8   & T-Shirt Design                    &                          & \CCY & \CCY & \CCY & \CCY & \CCY & \CCG &                          &                          &                          &                          &                          &                          \\ \hline
9   & Mural Design                      &                          & \CCY & \CCY & \CCY & \CCY & \CCY & \CCG &                          &                          &                          &                          &                          &                          \\ \hline
10  & Certificate Design                &                          & \CCY & \CCY & \CCY & \CCY & \CCY & \CCG &                          &                          &                          &                          &                          &                          \\ \hline
11  & Proposal Preparation              &                          & \CCY & \CCY & \CCY & \CCY & \CCY & \CCG &                          &                          &                          &                          &                          &                          \\ \hline
12  & Planning Approval                 &                          & \CCY & \CCY & \CCY & \CCY & \CCY & \CCG &                          &                          &                          &                          &                          &                          \\ \hline
13  & Video Filming/ Taking Photography
        &   & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCG &   &   \\ \hline
14  & Event Promotion
        &   & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCG &   &   \\ \hline
15  & Event Preparation
        &   & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCG &   &   \\ \hline
16  & Mural-painting      &   &   &   &   &   &   &   &   &   &   & \CCG &    &           \\ \hline
17  & Video Editing       &   &   &   & \CCY  & \CCY & \CCY & \CCY & \CCY & \CCY
                                      & \CCY & \CCY & \CCG &                              \\ \hline
18  & Final Report Preparation
        & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY & \CCY
        & \CCY & \CCG &                                                                    \\ \hline
\end{tabular}
\end{table}
\end{landscape}}

答案2

正如@Zarko提到的,您应该将其放置\center在表格环境中。您可以使用以下内容调整大小你的桌子:

{
\renewcommand{\arraystretch}{1.3} % row height
\setlength{\tabcolsep}{12pt} % column width
your table...
}

输出

\documentclass[12pt, a4paper]{article}
\usepackage[margin=1.9cm, left=2.1cm, right=1.8cm]{geometry}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage{afterpage}
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\begin{document}

\afterpage{
\begin{landscape}
\section{Time Frame}
{
\renewcommand{\arraystretch}{1.3} % row height
\setlength{\tabcolsep}{12pt} % column width

\begin{table}[ht]
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
                      &                                   & \multicolumn{13}{c|}{Week}                                                                                                                                                                                                                                                                                                                                   \\ \cline{3-15} 
\multirow{-2}{*}{No.} & \multirow{-2}{*}{Activities}      & 1                        & 2                        & 3                        & 4                        & 5                        & 6                        & 7                        & 8                        & 9                        & 10                       & 11                       & 12                       & 13                       \\ \hline
1                     & Course Briefing                   & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          \\ \hline
2                     & Committee Selection               &                          & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          \\ \hline
3                     & Topic Selection                   &                          & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          \\ \hline
4                     & Budget Estimation                 &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          &                          &                          &                          \\ \hline
6                     & Teaser Design                     &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
7                     & Attracting Sponsors               &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
8                     & T-Shirt Design                    &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
9                     & Mural Design                      &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
10                    & Certificate Design                &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
11                    & Proposal Preparation              &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
12                    & Planning Approval                 &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          &                          &                          &                          &                          \\ \hline
13                    & Video Filming/ Taking Photography &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          \\ \hline
14                    & Event Promotion                   &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          \\ \hline
15                    & Event Preparation                 &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          &                          \\ \hline
16                    & Mural-painting                    &                          &                          &                          &                          &                          &                          &                          &                          &                          &                          & \cellcolor[HTML]{009901} &                          &                          \\ \hline
17                    & Video Editing                     &                          &                          &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} &                          \\ \hline
18                    & Final Report Preparation          &                          & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{FFC702} & \cellcolor[HTML]{009901} \\ \hline
\end{tabular}
\end{table}
}
\end{landscape}}
\end{document}

相关内容